Search in sources :

Example 1 with RevPersonImpl

use of org.locationtech.geogig.api.RevPersonImpl in project GeoGig by boundlessgeo.

the class HashObjectTest method testHashTags.

@Test
public void testHashTags() throws Exception {
    RevPerson tagger = new RevPersonImpl("volaya", "volaya@boundlessgeo.com", -1000, -1);
    RevPerson tagger2 = new RevPersonImpl("groldan", "groldan@boundlessgeo.com", 10000, 0);
    RevTag tag = new RevTagImpl(null, "tag1", ObjectId.forString("fake commit id"), "message", tagger);
    RevTag tag2 = new RevTagImpl(null, "tag2", ObjectId.forString("another fake commit id"), "another message", tagger2);
    ObjectId tagId = hashCommand.setObject(tag).call();
    ObjectId tagId2 = hashCommand.setObject(tag2).call();
    assertNotNull(tagId);
    assertNotNull(tagId2);
    assertNotSame(tagId, tagId2);
}
Also used : RevPersonImpl(org.locationtech.geogig.api.RevPersonImpl) RevPerson(org.locationtech.geogig.api.RevPerson) RevTag(org.locationtech.geogig.api.RevTag) ObjectId(org.locationtech.geogig.api.ObjectId) RevTagImpl(org.locationtech.geogig.api.RevTagImpl) Test(org.junit.Test)

Example 2 with RevPersonImpl

use of org.locationtech.geogig.api.RevPersonImpl in project GeoGig by boundlessgeo.

the class TagCreateOp method resolveTagger.

private RevPerson resolveTagger() {
    final String nameKey = "user.name";
    final String emailKey = "user.email";
    Optional<String> name = command(ConfigGet.class).setName(nameKey).call();
    Optional<String> email = command(ConfigGet.class).setName(emailKey).call();
    checkState(name.isPresent(), "%s not found in config. Use geogig config [--global] %s <your name> to configure it.", nameKey, nameKey);
    checkState(email.isPresent(), "%s not found in config. Use geogig config [--global] %s <your email> to configure it.", emailKey, emailKey);
    String taggerName = name.get();
    String taggerEmail = email.get();
    Platform platform = platform();
    long taggerTimeStamp = platform.currentTimeMillis();
    int taggerTimeZoneOffset = platform.timeZoneOffset(taggerTimeStamp);
    return new RevPersonImpl(taggerName, taggerEmail, taggerTimeStamp, taggerTimeZoneOffset);
}
Also used : RevPersonImpl(org.locationtech.geogig.api.RevPersonImpl) Platform(org.locationtech.geogig.api.Platform)

Example 3 with RevPersonImpl

use of org.locationtech.geogig.api.RevPersonImpl in project GeoGig by boundlessgeo.

the class FormatCommonV2 method readRevPerson.

public static final RevPerson readRevPerson(DataInput in) throws IOException {
    final String name = in.readUTF();
    final String email = in.readUTF();
    final long timestamp = readUnsignedVarLong(in);
    final int tzOffset = readUnsignedVarInt(in);
    return new RevPersonImpl(name.length() == 0 ? null : name, email.length() == 0 ? null : email, timestamp, tzOffset);
}
Also used : RevPersonImpl(org.locationtech.geogig.api.RevPersonImpl) Integer.toBinaryString(java.lang.Integer.toBinaryString)

Aggregations

RevPersonImpl (org.locationtech.geogig.api.RevPersonImpl)3 Integer.toBinaryString (java.lang.Integer.toBinaryString)1 Test (org.junit.Test)1 ObjectId (org.locationtech.geogig.api.ObjectId)1 Platform (org.locationtech.geogig.api.Platform)1 RevPerson (org.locationtech.geogig.api.RevPerson)1 RevTag (org.locationtech.geogig.api.RevTag)1 RevTagImpl (org.locationtech.geogig.api.RevTagImpl)1