当前位置: 首页>>代码示例>>Java>>正文


Java ORecordDuplicatedException类代码示例

本文整理汇总了Java中com.orientechnologies.orient.core.storage.ORecordDuplicatedException的典型用法代码示例。如果您正苦于以下问题:Java ORecordDuplicatedException类的具体用法?Java ORecordDuplicatedException怎么用?Java ORecordDuplicatedException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ORecordDuplicatedException类属于com.orientechnologies.orient.core.storage包,在下文中一共展示了ORecordDuplicatedException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testIndex_EnforceUniqueName

import com.orientechnologies.orient.core.storage.ORecordDuplicatedException; //导入依赖的package包/类
@Test(expected = ORecordDuplicatedException.class)
public void testIndex_EnforceUniqueName() {
  try (ODatabaseDocumentTx db = database.getInstance().connect()) {
    entityAdapter.register(db);

    KeyStoreData entity = new KeyStoreData();
    entity.setName(KEY_STORE_NAME);
    entity.setBytes(KEY_STORE_DATA);
    entityAdapter.save(db, entity);

    entity = new KeyStoreData();
    entity.setName(KEY_STORE_NAME);
    entity.setBytes(KEY_STORE_DATA);
    entityAdapter.addEntity(db, entity);
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:17,代码来源:KeyStoreDataEntityAdapterTest.java

示例2: createApiKey

import com.orientechnologies.orient.core.storage.ORecordDuplicatedException; //导入依赖的package包/类
@Override
@Guarded(by = STARTED)
public char[] createApiKey(final String domain, final PrincipalCollection principals) {
  checkNotNull(domain);
  checkNotNull(principals);
  try {
    final char[] apiKeyCharArray = makeApiKey(domain, principals);
    persistApiKey(domain, principals, apiKeyCharArray);
    return apiKeyCharArray;
  }
  catch (ORecordDuplicatedException e) { // NOSONAR
    // There is a chance here that if multiple threads enter this method for the same principal that create can be
    // called multiple times resulting in a ORecordDuplicatedException. In that case we know the record must already
    // exist and can call getApiKey again. This avoids locking and gives us eventual-consistency.
    return getApiKey(domain, principals);
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:18,代码来源:ApiKeyStoreImpl.java

示例3: vertexUniqueConstraint

import com.orientechnologies.orient.core.storage.ORecordDuplicatedException; //导入依赖的package包/类
@Test
public void vertexUniqueConstraint() {
    OrientGraph graph = newGraph();
    createVertexIndexLabel(graph, vertexLabel1);
    String value = "value1";

    graph.addVertex(label, vertexLabel1, key, value);
    graph.addVertex(label, vertexLabel2, key, value);

    // no duplicates allowed for vertex with label1
    try {
        graph.addVertex(label, vertexLabel1, key, value);
        Assert.fail("must throw duplicate key here!");
    } catch (ORecordDuplicatedException e) {
        // ok
    }

    // allow duplicate for vertex with label2
    graph.addVertex(label, vertexLabel2, key, value);
}
 
开发者ID:orientechnologies,项目名称:orientdb-gremlin,代码行数:21,代码来源:OrientGraphIndexTest.java

示例4: edgeUniqueConstraint

import com.orientechnologies.orient.core.storage.ORecordDuplicatedException; //导入依赖的package包/类
@Test
public void edgeUniqueConstraint() {
    OrientGraph graph = newGraph();
    createUniqueEdgeIndex(graph, edgeLabel1);
    String value = "value1";

    Vertex v1 = graph.addVertex(label, vertexLabel1);
    Vertex v2 = graph.addVertex(label, vertexLabel1);
    v1.addEdge(edgeLabel1, v2, key, value);

    // no duplicates allowed for edge with label1
    try {
        v1.addEdge(edgeLabel1, v2, key, value);
        Assert.fail("must throw duplicate key here!");
    } catch (ORecordDuplicatedException e) {
        // ok
    }

    // allow duplicate for vertex with label2
    v2.addEdge(edgeLabel2, v1, key, value);
}
 
开发者ID:orientechnologies,项目名称:orientdb-gremlin,代码行数:22,代码来源:OrientGraphIndexTest.java

示例5: executeTransform

import com.orientechnologies.orient.core.storage.ORecordDuplicatedException; //导入依赖的package包/类
@Override
public Object executeTransform(final Object input) {
  vertexClass = (String) resolve(vertexClass);
  if (vertexClass != null) {
    final OClass cls = pipeline.getGraphDatabase().getVertexType(vertexClass);
    if (cls == null)
      pipeline.getGraphDatabase().createVertexType(vertexClass);
  }

  final OrientVertex v = pipeline.getGraphDatabase().getVertex(input);
  if (v == null)
    return null;

  if (vertexClass != null && !vertexClass.equals(v.getRecord().getClassName()))
    try {
      v.setProperty("@class", vertexClass);
    } catch (ORecordDuplicatedException e) {
      if (skipDuplicates) {
        return null;
      } else {
        throw e;
      }
    }
  return v;
}
 
开发者ID:orientechnologies,项目名称:orientdb-etl,代码行数:26,代码来源:OVertexTransformer.java

示例6: testConflictingWebRootPath

import com.orientechnologies.orient.core.storage.ORecordDuplicatedException; //导入依赖的package包/类
@Test(expected = ORecordDuplicatedException.class)
public void testConflictingWebRootPath() {
	try (Tx tx = tx()) {
		NodeGraphFieldContainer containerA = tx.getGraph().addFramedVertex(NodeGraphFieldContainerImpl.class);
		NodeGraphFieldContainer containerB = tx.getGraph().addFramedVertex(NodeGraphFieldContainerImpl.class);
		containerA.getElement().setProperty(NodeGraphFieldContainerImpl.WEBROOT_PROPERTY_KEY, "test");
		containerB.getElement().setProperty(NodeGraphFieldContainerImpl.WEBROOT_PROPERTY_KEY, "test");
		tx.success();
	}
}
 
开发者ID:gentics,项目名称:mesh,代码行数:11,代码来源:NodeGraphFieldContainerTest.java

示例7: testConflictingPublishWebRootPath

import com.orientechnologies.orient.core.storage.ORecordDuplicatedException; //导入依赖的package包/类
@Test(expected = ORecordDuplicatedException.class)
public void testConflictingPublishWebRootPath() {
	try (Tx tx = tx()) {
		NodeGraphFieldContainer containerA = tx.getGraph().addFramedVertex(NodeGraphFieldContainerImpl.class);
		NodeGraphFieldContainer containerB = tx.getGraph().addFramedVertex(NodeGraphFieldContainerImpl.class);
		containerA.getElement().setProperty(NodeGraphFieldContainerImpl.PUBLISHED_WEBROOT_PROPERTY_KEY, "test");
		containerB.getElement().setProperty(NodeGraphFieldContainerImpl.PUBLISHED_WEBROOT_PROPERTY_KEY, "test");
		tx.success();
	}
}
 
开发者ID:gentics,项目名称:mesh,代码行数:11,代码来源:NodeGraphFieldContainerTest.java

示例8: store

import com.orientechnologies.orient.core.storage.ORecordDuplicatedException; //导入依赖的package包/类
@Override
public Role store(Role role) {
    metrics.meter(ROLE_STORE_METRIC).mark();
    try (OObjectDatabaseTx db = db()) {
        try {
            return db.detachAll(db.save(role), true);
        } catch (ORecordDuplicatedException e) {
            throw new NotUniqueException(e.getMessage());
        }
    }
}
 
开发者ID:dmart28,项目名称:gcplot,代码行数:12,代码来源:RolesOrientDbRepository.java

示例9: saveTrigger

import com.orientechnologies.orient.core.storage.ORecordDuplicatedException; //导入依赖的package包/类
@Override
public <T extends Trigger> T saveTrigger(T trigger) {
    metrics.meter(SAVE_TRIGGER_METRIC).mark();
    try (OObjectDatabaseTx db = db()) {
        try {
            if (db.getMetadata().getSchema().getClass(trigger.getClass()) == null) {
                register(db, db.getMetadata().getSchema(), trigger.getClass());
            }
            return db.detachAll(db.save(trigger), true);
        } catch (ORecordDuplicatedException e) {
            throw new NotUniqueException(e.getMessage());
        }
    }
}
 
开发者ID:dmart28,项目名称:gcplot,代码行数:15,代码来源:TriggerOrientDbRepository.java

示例10: insert

import com.orientechnologies.orient.core.storage.ORecordDuplicatedException; //导入依赖的package包/类
@Override
public Account insert(Account account) {
    metrics.meter(ACCOUNT_INSERT_METRIC).mark();
    try (OObjectDatabaseTx db = db()) {
        try {
            return db.detachAll(db.save(account), true);
        } catch (ORecordDuplicatedException e) {
            throw new NotUniqueException(e.getMessage());
        }
    }
}
 
开发者ID:dmart28,项目名称:gcplot,代码行数:12,代码来源:AccountOrientDbRepository.java

示例11: createComponentNode

import com.orientechnologies.orient.core.storage.ORecordDuplicatedException; //导入依赖的package包/类
@Override
@Guarded(by = STARTED)
public void createComponentNode(final String repositoryName, final List<String> path, final Component component) {
  inTxRetry(databaseInstance)
      // handle case where assets try to create the exact same component-level path at once
      .retryOn(ONeedRetryException.class, ORecordDuplicatedException.class)
      .run(db -> entityAdapter.createComponentNode(db, repositoryName, path, component));
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:9,代码来源:BrowseNodeStoreImpl.java

示例12: createAssetNode

import com.orientechnologies.orient.core.storage.ORecordDuplicatedException; //导入依赖的package包/类
@Override
@Guarded(by = STARTED)
public void createAssetNode(final String repositoryName, final List<String> path, final Asset asset) {
  inTxRetry(databaseInstance)
      // handle case where an asset and its component try to create the exact same path at once
      .retryOn(ONeedRetryException.class, ORecordDuplicatedException.class)
      .run(db -> entityAdapter.createAssetNode(db, repositoryName, path, asset));
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:9,代码来源:BrowseNodeStoreImpl.java

示例13: duplicateComponentName

import com.orientechnologies.orient.core.storage.ORecordDuplicatedException; //导入依赖的package包/类
@Test(expected = ORecordDuplicatedException.class)
public void duplicateComponentName() throws Exception {
  createComponent(null, "name", null);
  createComponent(null, "name", null);
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:6,代码来源:StorageFacetImplIT.java

示例14: duplicateComponentGroupName

import com.orientechnologies.orient.core.storage.ORecordDuplicatedException; //导入依赖的package包/类
@Test(expected = ORecordDuplicatedException.class)
public void duplicateComponentGroupName() throws Exception {
  createComponent("group", "name", null);
  createComponent("group", "name", null);
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:6,代码来源:StorageFacetImplIT.java

示例15: duplicateComponentNameVersion

import com.orientechnologies.orient.core.storage.ORecordDuplicatedException; //导入依赖的package包/类
@Test(expected = ORecordDuplicatedException.class)
public void duplicateComponentNameVersion() throws Exception {
  createComponent(null, "name", "1");
  createComponent(null, "name", "1");
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:6,代码来源:StorageFacetImplIT.java


注:本文中的com.orientechnologies.orient.core.storage.ORecordDuplicatedException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。