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


Java ORecordId类代码示例

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


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

示例1: newComponentDoc

import com.orientechnologies.orient.core.id.ORecordId; //导入依赖的package包/类
private ODocument newComponentDoc(final TestData testData) {
  ORID id = new ORecordId(1, clusterPosition++);
  ODocument componentDoc = new ODocument(id);
  componentDoc.field(P_NAME, testData.artifactId);
  componentDoc.field(P_BUCKET, bucketEntityAdapter.recordIdentity(bucket));
  componentDoc.field(P_FORMAT, "maven2");

  Map<String, Object> mavenAttributes = new HashMap<>();
  mavenAttributes.put(P_GROUP_ID, testData.groupId);
  mavenAttributes.put(P_ARTIFACT_ID, testData.artifactId);
  mavenAttributes.put(P_BASE_VERSION, testData.baseVersion);

  Map<String, Object> map = new HashMap<>();
  map.put("maven2", mavenAttributes);
  componentDoc.field(P_ATTRIBUTES, map);

  return componentDoc;
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:19,代码来源:PurgeUnusedSnapshotsFacetImplTest.java

示例2: recordIdEncoding

import com.orientechnologies.orient.core.id.ORecordId; //导入依赖的package包/类
@Test
public void recordIdEncoding() throws Exception {
  try (ODatabaseDocumentTx db = createDatabase()) {
    ODocument doc = createPerson(db);
    log("New Document: {}", doc);

    ORID rid = doc.getIdentity();
    log("RID: {}", rid);

    String encoded = Hex.encode(rid.toStream());
    log("Hex Encoded: {}", encoded);

    ORID decoded = new ORecordId().fromStream(Hex.decode(encoded));
    log("Decoded RID: {}", decoded);

    assertThat(decoded, is(rid));

    doc = db.getRecord(decoded);
    log("Fetched Document: {}", doc);
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:22,代码来源:OrientDbDocumentTrial.java

示例3: verifyIdTypeMismatchFails

import com.orientechnologies.orient.core.id.ORecordId; //导入依赖的package包/类
@Test
public void verifyIdTypeMismatchFails() {
  ORID rid = new ORecordId("#9:1");
  OClass type = mock(OClass.class);
  when(type.getClusterIds()).thenReturn(new int[] { 1 });
  String encoded = underTest.encode(type, rid);

  // this should fail since the cluster-id of the RID is not a member of the given type
  try {
    underTest.decode(type, encoded);
    fail();
  }
  catch (IllegalArgumentException e) {
    // expected
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:17,代码来源:RecordIdObfuscatorTestSupport.java

示例4: updateAssetBlobStoreRefs

import com.orientechnologies.orient.core.id.ORecordId; //导入依赖的package包/类
@VisibleForTesting
void updateAssetBlobStoreRefs(final Map<String, String> renamedBlobStores) {
  try (ODatabaseDocumentTx db = componentDatabaseInstance.get().connect()) {
    renamedBlobStores.forEach((originalName, newName) -> {
      log.debug("Searching for BlobStoreRefs, original name: {}, new name: {} ", originalName, newName);

      OSQLSynchQuery query = new OSQLSynchQuery<>("select from asset where blob_ref like ? and @rid > ? limit 100");
      String nameTestValue = originalName + "@%";

      List<ODocument> results = db.query(query, nameTestValue, new ORecordId());

      while (!results.isEmpty()) {
        log.debug("Updating set of {} Refs", results.size());
        ORID last = results.get(results.size() - 1).getIdentity();

        results.forEach(doc -> updateDocWithNewName(originalName, newName, doc));

        results = db.query(query, nameTestValue, last);
      }
    });
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:23,代码来源:ConfigDatabaseUpgrade_1_2.java

示例5: deleteViewDefinition

import com.orientechnologies.orient.core.id.ORecordId; //导入依赖的package包/类
public void deleteViewDefinition(Object id, boolean notify) throws RuntimeException {
    ViewDefinition vd = null;
    String viewUrl = null;
    try (OObjectDatabaseTx database = getOObjectDatabaseTx()) {
        vd = database.load(new ORecordId(id.toString()));
        if (vd != null) {
            viewUrl = vd.getUrl();
            List<TabDefinition> tabs = database.query(new OSQLSynchQuery<TabDefinition>("SELECT * FROM TabDefinition WHERE viewId = ?"), id);
            for (TabDefinition td : tabs) {
                database.command(new OCommandSQL("DELETE VERTEX PanelDefinition WHERE tabId = " + td.getId())).execute();
            }
            database.command(new OCommandSQL("DELETE VERTEX TabDefinition WHERE viewId = " + id)).execute();
        }
        database.delete(new ORecordId(id.toString()));
        database.commit();
    }
    if (notify && vd != null && vd instanceof ViewDefinition) {
        HazelcastServer.getDashboardEventTopic().publish(DashboardEvent.createViewDeleteEvent(sessionId, viewUrl));
    }
}
 
开发者ID:hybridbpm,项目名称:hybridbpm,代码行数:21,代码来源:DashboardAPI.java

示例6: deleteTabDefinition

import com.orientechnologies.orient.core.id.ORecordId; //导入依赖的package包/类
public void deleteTabDefinition(Object id, boolean notify) throws RuntimeException {
    TabDefinition tab = null;
    String viewUrl = null;
    try (OObjectDatabaseTx database = getOObjectDatabaseTx()) {
        tab = database.load(new ORecordId(id.toString()));
        if (tab != null) {
            ViewDefinition view = database.load(new ORecordId(tab.getViewId().getId().toString()));
            viewUrl = view.getUrl();
            database.command(new OCommandSQL("DELETE VERTEX PanelDefinition WHERE tabId = " + id)).execute();
        }
        database.delete(new ORecordId(id.toString()));
        database.commit();
    }
    if (notify && tab != null && tab instanceof TabDefinition) {
        HazelcastServer.getDashboardEventTopic().publish(DashboardEvent.createViewChangeEvent(sessionId, viewUrl));
    }
}
 
开发者ID:hybridbpm,项目名称:hybridbpm,代码行数:18,代码来源:DashboardAPI.java

示例7: savePanelDefinitions

import com.orientechnologies.orient.core.id.ORecordId; //导入依赖的package包/类
public void savePanelDefinitions(List<PanelDefinition> panelDefinitions) {
    try (ODatabaseDocumentTx database = getODatabaseDocumentTx()) {
        if (panelDefinitions != null && !panelDefinitions.isEmpty()) {
            for (PanelDefinition panelDefinition : panelDefinitions) {
                savePanelDefinitionInternal(panelDefinition, database);
            }
            TabDefinition tabDefinition = panelDefinitions.get(0).getTabId();
            ODocument tab = database.getRecord(new ORecordId(tabDefinition.getId().toString()).getRecord());
            switch (tabDefinition.getLayout()) {
                case HORIZONTAL:
                    tab.field("columns", panelDefinitions.size());
                    tab.field("rows", 0);
                    database.save(tab);
                    break;
                case VERTICAL:
                    tab.field("columns", 0);
                    tab.field("rows", panelDefinitions.size());
                    database.save(tab);
                    break;
                case GRID:
                    break;
            }
            database.commit();
        }
    }
}
 
开发者ID:hybridbpm,项目名称:hybridbpm,代码行数:27,代码来源:DashboardAPI.java

示例8: deletePanelDefinition

import com.orientechnologies.orient.core.id.ORecordId; //导入依赖的package包/类
public void deletePanelDefinition(Object id, boolean notify) throws RuntimeException {
    PanelDefinition panel = null;
    String viewUrl = null;
    try (OObjectDatabaseTx database = getOObjectDatabaseTx()) {
        panel = database.load(new ORecordId(id.toString()));
        if (panel != null) {
            TabDefinition tab = detach(database.load(new ORecordId(panel.getTabId().getId().toString())));
            ViewDefinition view = database.load(new ORecordId(tab.getViewId().getId().toString()));
            viewUrl = view.getUrl();
            if (Objects.equals(tab.getLayout(), TabDefinition.LAYOUT_TYPE.VERTICAL) || Objects.equals(tab.getLayout(), TabDefinition.LAYOUT_TYPE.HORIZONTAL)){
                database.command(new OCommandSQL("UPDATE PanelDefinition INCREMENT order = -1 WHERE tabId = " + tab.getId() + " AND order > " + panel.getOrder())).execute();
            }
        }
        database.delete(new ORecordId(id.toString()));
        database.commit();
    }
    if (notify && viewUrl != null) {
        HazelcastServer.getDashboardEventTopic().publish(DashboardEvent.createViewChangeEvent(sessionId, viewUrl));
    }
}
 
开发者ID:hybridbpm,项目名称:hybridbpm,代码行数:21,代码来源:DashboardAPI.java

示例9: addRowToGridTabDefinition

import com.orientechnologies.orient.core.id.ORecordId; //导入依赖的package包/类
public TabDefinition addRowToGridTabDefinition(TabDefinition tabDefinition, int row) throws RuntimeException {
    try (ODatabaseDocumentTx database = getODatabaseDocumentTx()) {
        database.command(new OCommandSQL("UPDATE TabDefinition INCREMENT rows = 1 WHERE @rid = " + tabDefinition.getId())).execute();
        database.command(new OCommandSQL("UPDATE PanelDefinition INCREMENT row = 1 WHERE tabId = " + tabDefinition.getId() + " AND row >= " + row)).execute();

        for (int i = 0; i < tabDefinition.getColumns(); i++) {
            PanelDefinition newPanelDef = PanelDefinition.createDefault();
            newPanelDef.setTabId(tabDefinition);
            newPanelDef.setRow(row);
            newPanelDef.setColumn(i);
            savePanelDefinitionInternal(newPanelDef, database);
        }
        database.commit();
        tabDefinition = getOObjectDatabaseTx().load(new ORecordId(tabDefinition.getId().toString()));
        return detach(tabDefinition);
    }
}
 
开发者ID:hybridbpm,项目名称:hybridbpm,代码行数:18,代码来源:DashboardAPI.java

示例10: addColumnToGridTabDefinition

import com.orientechnologies.orient.core.id.ORecordId; //导入依赖的package包/类
public TabDefinition addColumnToGridTabDefinition(TabDefinition tabDefinition, int column) throws RuntimeException {
    try (ODatabaseDocumentTx database = getODatabaseDocumentTx()) {
        database.command(new OCommandSQL("UPDATE TabDefinition INCREMENT columns = 1 WHERE @rid = " + tabDefinition.getId())).execute();
        database.command(new OCommandSQL("UPDATE PanelDefinition INCREMENT column = 1 WHERE tabId = " + tabDefinition.getId() + " AND column >= " + column)).execute();

        for (int i = 0; i < tabDefinition.getRows(); i++) {
            PanelDefinition newPanelDef = PanelDefinition.createDefault();
            newPanelDef.setTabId(tabDefinition);
            newPanelDef.setColumn(column);
            newPanelDef.setRow(i);
            savePanelDefinitionInternal(newPanelDef, database);
        }
        database.commit();
        tabDefinition = getOObjectDatabaseTx().load(new ORecordId(tabDefinition.getId().toString()));
        return detach(tabDefinition);
    }
}
 
开发者ID:hybridbpm,项目名称:hybridbpm,代码行数:18,代码来源:DashboardAPI.java

示例11: getMyDocuments

import com.orientechnologies.orient.core.id.ORecordId; //导入依赖的package包/类
public Map<Document, List<Permission.PERMISSION>> getMyDocuments(String parentId) {
    String documentRequest = parentId != null
            ? "SELECT FROM Document WHERE @rid IN "
            + "(SELECT in FROM PERMISSION WHERE [email protected] = 'Document' AND permissions IN ('VIEW') "
            + "AND out in (SELECT FROM Role WHERE @rid IN (SELECT out('UserGroup').in('RoleGroup') FROM User WHERE @rid = " + user.getId() + "))) "
            + " AND parent = " + parentId
            : "SELECT FROM Document WHERE @rid IN "
            + "(SELECT in FROM PERMISSION WHERE [email protected] = 'Document' AND permissions IN ('VIEW') "
            + "AND out in (SELECT FROM Role WHERE @rid IN (SELECT out('UserGroup').in('RoleGroup') FROM User WHERE @rid = " + user.getId() + ")))"
             + " AND parent IS NULL ";
    try (OObjectDatabaseTx database = getOObjectDatabaseTx()) {
        List<Document> documents = database.query(new OSQLSynchQuery<Document>(documentRequest));
        documents = detachList(documents);
        Map<Document, List<Permission.PERMISSION>> result = new HashMap<>(documents.size());
        for (Document doc : documents) {
            Edge edge = getOrientGraph().getVertex(doc.getId()).getEdges(Direction.IN, "Permission").iterator().next();
            Permission p = getOObjectDatabaseTx().load(new ORecordId(edge.getId().toString()));
            result.put(doc, p.getPermissions());
        }
        return result;
    }
}
 
开发者ID:hybridbpm,项目名称:hybridbpm,代码行数:23,代码来源:DocumentAPI.java

示例12: OrientIoRegistry

import com.orientechnologies.orient.core.id.ORecordId; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
private OrientIoRegistry() {
    register(GryoIo.class, ORecordId.class, new ORecordIdKyroSerializer());
    register(GryoIo.class, ORidBag.class, new ORidBagKyroSerializer());
    SimpleModule serializer = new SimpleModule();
    serializer.addSerializer(ORecordId.class, new ORecordIdJacksonSerializer());
    serializer.addDeserializer(ORecordId.class, (JsonDeserializer) new ORecordIdDeserializer());
    serializer.addSerializer(ORidBag.class, new ORidBagJacksonSerializer());
    serializer.addDeserializer(ORidBag.class, (JsonDeserializer) new ORidBagDeserializer());
    serializer.addDeserializer(Object.class, new OObjectJacksonDeserializer());

    serializer.addDeserializer(Edge.class, new EdgeJacksonDeserializer());
    serializer.addDeserializer(Vertex.class, new VertexJacksonDeserializer());
    serializer.addDeserializer(Map.class, (JsonDeserializer) new ORecordIdDeserializer());

    register(GraphSONIo.class, ORecordId.class, serializer);
    register(GraphSONIo.class, Map.class, serializer);
}
 
开发者ID:orientechnologies,项目名称:orientdb-gremlin,代码行数:19,代码来源:OrientIoRegistry.java

示例13: getNode

import com.orientechnologies.orient.core.id.ORecordId; //导入依赖的package包/类
private OrientNode getNode(final String property) {
	final ODocument tmpEdge = getDocument();

	// We don't modify edge documents - we just create or delete them.
	// Disabling tracking speeds up warm queries noticeably.
	tmpEdge.setTrackingChanges(false);
	final Object value = tmpEdge.field(property);
	tmpEdge.setTrackingChanges(true);
	if (value instanceof ODocument) {
		ODocument doc = (ODocument) value;
		return db.getNodeById(doc);
	} else if (value != null) {
		ORecordId id = (ORecordId) value;
		return db.getNodeById(id);
	} else {
		return null;
	}
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:19,代码来源:OrientEdge.java

示例14: apply

import com.orientechnologies.orient.core.id.ORecordId; //导入依赖的package包/类
@Override
public ODocument apply(F input) {
	if(input==null)
	{
		return null;
	}
	else if(input instanceof ODocument)
	{
		return (ODocument)input;
	}
	else if(input instanceof ORID)
	{
		return ((ORID)input).getRecord();
	}
	else if(input instanceof CharSequence)
	{
		return new ORecordId(input.toString()).getRecord();
	}
	else
	{
		throw new WicketRuntimeException("Object '"+input+"' of type '"+input.getClass()+"' can't be converted to ODocument");
	}
}
 
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:24,代码来源:ConvertToODocumentFunction.java

示例15: convertLinks

import com.orientechnologies.orient.core.id.ORecordId; //导入依赖的package包/类
private void convertLinks(List<Object> input){
	for (int i = 0; i < input.size(); i++) {
		if (input.get(i).toString().matches("^#[\\d]+:[\\d]+$")){
			input.set(i, new ORecordId(input.get(i).toString()));
		}
	}
}
 
开发者ID:OrienteerBAP,项目名称:camel-orientdb,代码行数:8,代码来源:OrientDBProducer.java


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