Example usage for org.eclipse.jgit.lib PersonIdent getTimeZoneOffset

List of usage examples for org.eclipse.jgit.lib PersonIdent getTimeZoneOffset

Introduction

In this page you can find the example usage for org.eclipse.jgit.lib PersonIdent getTimeZoneOffset.

Prototype

public int getTimeZoneOffset() 

Source Link

Document

Get this person's declared time zone as minutes east of UTC.

Usage

From source file:com.google.gerrit.server.CommonConverters.java

License:Apache License

public static GitPerson toGitPerson(PersonIdent ident) {
    GitPerson result = new GitPerson();
    result.name = ident.getName();/* ww  w.j  av  a 2 s  .  c  o  m*/
    result.email = ident.getEmailAddress();
    result.date = new Timestamp(ident.getWhen().getTime());
    result.tz = ident.getTimeZoneOffset();
    return result;
}

From source file:com.google.gerrit.server.patch.PatchSetInfoFactory.java

License:Apache License

private UserIdentity toUserIdentity(final PersonIdent who) {
    final UserIdentity u = new UserIdentity();
    u.setName(who.getName());// w  w  w .  j a  v  a  2 s .c  om
    u.setEmail(who.getEmailAddress());
    u.setDate(new Timestamp(who.getWhen().getTime()));
    u.setTimeZone(who.getTimeZoneOffset());

    // If only one account has access to this email address, select it
    // as the identity of the user.
    //
    final Set<Account.Id> a = byEmailCache.get(u.getEmail());
    if (a.size() == 1) {
        u.setAccount(a.iterator().next());
    }

    return u;
}

From source file:org.commonjava.freeki.store.GitManagerTest.java

License:Open Source License

@Test
public void getLogForValidFile() throws Exception {
    final PlotCommit<PlotLane> log = git.getHeadCommit(new File(dir, "mygroup/page-id.md"));
    assertThat(log, notNullValue());/*from   www. ja  v a2s. c o m*/
    final PersonIdent ident = log.getAuthorIdent();
    assertThat(ident, notNullValue());
    assertThat(ident.getName(), notNullValue());
    assertThat(ident.getEmailAddress(), notNullValue());
    assertThat(ident.getWhen(), notNullValue());

    final String message = log.getFullMessage();
    assertThat(message, notNullValue());

    System.out.printf("%s %s %s %s %s\n\n%s\n", ident.getName(), ident.getEmailAddress(), ident.getWhen(),
            ident.getTimeZone().getID(), ident.getTimeZoneOffset(), message);
}