org.locationtech.geogig.model.Ref.append()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(159)

本文整理了Java中org.locationtech.geogig.model.Ref.append方法的一些代码示例,展示了Ref.append的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ref.append方法的具体详情如下:
包路径:org.locationtech.geogig.model.Ref
类名称:Ref
方法名:append

Ref.append介绍

暂无

代码示例

代码示例来源:origin: locationtech/geogig

private String toOrigInternal(String name) {
  String origName = append(txOrigNamespace, name);
  return origName;
}

代码示例来源:origin: org.locationtech.geogig/geogig-core

private String toOrigInternal(String name) {
  String origName = append(txOrigNamespace, name);
  return origName;
}

代码示例来源:origin: locationtech/geogig

private String toChangedInternal(String name) {
  return append(txChangedNamespace, name);
}

代码示例来源:origin: org.locationtech.geogig/geogig-core

private String toInternal(String name) {
  return append(txChangedNamespace, name);
}

代码示例来源:origin: locationtech/geogig

public static String buildTransactionNamespace(final UUID transactionId) {
  return append(TRANSACTIONS_PREFIX, transactionId.toString());
}

代码示例来源:origin: org.locationtech.geogig/geogig-core

public static String buildTransactionNamespace(final UUID transactionId) {
  return append(TRANSACTIONS_PREFIX, transactionId.toString());
}

代码示例来源:origin: locationtech/geogig

public TransactionRefDatabase(final RefDatabase refDb, final UUID transactionId) {
  this.refDb = refDb;
  this.txNamespace = buildTransactionNamespace(transactionId);
  this.txChangedNamespace = append(txNamespace, "changed");
  this.txOrigNamespace = append(txNamespace, "orig");
}

代码示例来源:origin: org.locationtech.geogig/geogig-core

public TransactionRefDatabase(final RefDatabase refDb, final UUID transactionId) {
  this.refDb = refDb;
  this.txNamespace = buildTransactionNamespace(transactionId);
  this.txChangedNamespace = append(txNamespace, "changed");
  this.txOrigNamespace = append(txNamespace, "orig");
}

代码示例来源:origin: locationtech/geogig

public Optional<String> mapToLocal(final String remoteRef) {
  Preconditions.checkNotNull(remoteRef);
  String localRef = null;
  if (isAllChildren()) {
    if (Ref.isChild(this.remoteRef, remoteRef)) {
      final String remoteRefName = remoteRef.substring(this.remoteRef.length());
      localRef = Ref.append(this.localRef, remoteRefName);
    }
  } else {
    if (remoteRef.equals(this.remoteRef)) {
      localRef = this.localRef;
    }
  }
  return Optional.ofNullable(localRef);
}

代码示例来源:origin: org.locationtech.geogig/geogig-core

@Override
public Map<String, String> getAll(final String prefix) {
  Map<String, String> originals = refDb.getAll(append(this.txOrigNamespace, prefix));
  Map<String, String> changed = refDb.getAll(append(this.txChangedNamespace, prefix));
  Map<String, String> externalOriginals = toExternal(originals);
  Map<String, String> externalChanged = toExternal(changed);
  Map<String, String> composite = Maps.newHashMap(externalOriginals);
  // Overwrite originals
  composite.putAll(externalChanged);
  return composite;
}

代码示例来源:origin: locationtech/geogig

@Override
public Map<String, String> getAll(final String prefix) {
  Map<String, String> changed = refDb.getAll(append(this.txChangedNamespace, prefix));
  return toExternal(changed);
}

代码示例来源:origin: locationtech/geogig

@Override
public String getSymRef(final String name) {
  String internalName;
  String value;
  if (name.startsWith("changed") || name.startsWith("orig")) {
    internalName = append(txNamespace, name);
    value = refDb.getSymRef(internalName);
  } else {
    internalName = toChangedInternal(name);
    value = refDb.getSymRef(internalName);
  }
  return value;
}

代码示例来源:origin: locationtech/geogig

/**
 * Gets the requested ref value from {@code transactions/<tx id>/<name>}
 */
@Override
public String getRef(final String name) {
  String internalName;
  String value;
  if (name.startsWith("changed") || name.startsWith("orig")) {
    internalName = append(txNamespace, name);
    value = refDb.getRef(internalName);
  } else {
    internalName = toChangedInternal(name);
    value = refDb.getRef(internalName);
  }
  return value;
}

代码示例来源:origin: locationtech/geogig

@Test
public void testAppendAndChild() {
  assertEquals("refs/heads/ref1", Ref.append(Ref.HEADS_PREFIX, "ref1"));
  assertEquals("ref1", Ref.child(Ref.HEADS_PREFIX, "refs/heads/ref1"));
  assertEquals("ref1", Ref.append("", "ref1"));
  assertEquals("refs/heads/ref1", Ref.append(Ref.HEADS_PREFIX, "ref1/"));
  assertEquals("ref1", Ref.child("refs/heads", "refs/heads/ref1"));
  assertEquals("refs/heads/ref1", Ref.append(Ref.HEADS_PREFIX, "/ref1"));
  assertEquals("refs/heads/ref1", Ref.append("refs/heads/ref1", ""));
}

代码示例来源:origin: locationtech/geogig

@Test
public void testGetAllNamespace() {
  final String txNamespace1 = Ref.append(Ref.TRANSACTIONS_PREFIX, "txnamespace1");
  final String txNamespace2 = Ref.append(Ref.TRANSACTIONS_PREFIX, "txnamespace2");
  Map<String, String> allrefs = createTestRefs();
  Map<String, String> allOnNamespace;
  allOnNamespace = refDb.getAll(txNamespace1);
  assertNamespace(txNamespace1, allrefs, allOnNamespace);
  allOnNamespace = refDb.getAll(txNamespace2);
  assertNamespace(txNamespace2, allrefs, allOnNamespace);
}

代码示例来源:origin: org.locationtech.geogig/geogig-core

@Test
public void testGetAllNamespace() {
  final String txNamespace1 = Ref.append(Ref.TRANSACTIONS_PREFIX, "txnamespace1");
  final String txNamespace2 = Ref.append(Ref.TRANSACTIONS_PREFIX, "txnamespace2");
  Map<String, String> allrefs = createTestRefs();
  Map<String, String> allOnNamespace;
  allOnNamespace = refDb.getAll(txNamespace1);
  assertNamespace(txNamespace1, allrefs, allOnNamespace);
  allOnNamespace = refDb.getAll(txNamespace2);
  assertNamespace(txNamespace2, allrefs, allOnNamespace);
}

代码示例来源:origin: locationtech/geogig

@Test
public void testGetAllNonExistentNamespace() {
  Map<String, String> all;
  all = refDb.getAll(Ref.append(Ref.TRANSACTIONS_PREFIX, "nonexistentns"));
  assertNotNull(all);
  assertTrue(all.isEmpty());
}

代码示例来源:origin: org.locationtech.geogig/geogig-core

@Test
public void testGetAllNonExistentNamespace() {
  Map<String, String> all;
  all = refDb.getAll(Ref.append(Ref.TRANSACTIONS_PREFIX, "nonexistentns"));
  assertNotNull(all);
  assertTrue(all.isEmpty());
}

代码示例来源:origin: locationtech/geogig

@Test
public void testRemove() {
  final String origin = Ref.append(Ref.ORIGIN, "master");
  refDb.putRef(origin, sampleId.toString());
  refDb.putSymRef(Ref.HEAD, origin);
  assertEquals(sampleId.toString(), refDb.getRef(origin));
  assertEquals(origin, refDb.getSymRef(Ref.HEAD));
  assertEquals(sampleId.toString(), refDb.remove(origin));
  assertNull(refDb.getRef(origin));
  assertNull(refDb.getSymRef(origin));
  assertEquals(origin, refDb.remove(Ref.HEAD));
  assertNull(refDb.getSymRef(Ref.HEAD));
  assertNull(refDb.getRef(Ref.HEAD));
}

代码示例来源:origin: org.locationtech.geogig/geogig-core

@Test
public void testRemove() {
  final String origin = Ref.append(Ref.ORIGIN, "master");
  refDb.putRef(origin, sampleId.toString());
  refDb.putSymRef(Ref.HEAD, origin);
  assertEquals(sampleId.toString(), refDb.getRef(origin));
  assertEquals(origin, refDb.getSymRef(Ref.HEAD));
  assertEquals(sampleId.toString(), refDb.remove(origin));
  assertNull(refDb.getRef(origin));
  assertNull(refDb.getSymRef(origin));
  assertEquals(origin, refDb.remove(Ref.HEAD));
  assertNull(refDb.getSymRef(Ref.HEAD));
  assertNull(refDb.getRef(Ref.HEAD));
}

相关文章