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


Java OIdentifiable类代码示例

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


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

示例1: convertToCatalogLinkIfAble

import com.orientechnologies.orient.core.db.record.OIdentifiable; //导入依赖的package包/类
private Object convertToCatalogLinkIfAble(Object value,OProperty fieldProperty,ODocument mainDoc){
	String catalogsLinkNameAttribute = getOrientDBEndpoint().getCatalogsLinkAttr();//
	String catalogsLinkName = getOrientDBEndpoint().getCatalogsLinkName();//
	String catalogNameField = fieldProperty.getLinkedClass().getCustom(catalogsLinkNameAttribute); 
	if (catalogNameField==null){
		catalogNameField = catalogsLinkName;
	}
	List<OIdentifiable> catalogLinks = curDb.query(new OSQLSynchQuery<OIdentifiable>(
			"select from "+fieldProperty.getLinkedClass().getName()+" where "+catalogNameField+"=?"), value);
	if (catalogLinks.size()>0){
		value = catalogLinks.get(0).getIdentity();
	}else{
		boolean updateCatalogs = getOrientDBEndpoint().isCatalogsUpdate();//
		if (updateCatalogs){
			ODocument catalogRecord = new ODocument(fieldProperty.getLinkedClass());
			catalogRecord.field(catalogNameField,value);
			catalogRecord.save(true);
			value = catalogRecord.getIdentity();
		}
	}
	return value;
}
 
开发者ID:OrienteerBAP,项目名称:camel-orientdb,代码行数:23,代码来源:OrientDBProducer.java

示例2: execute

import com.orientechnologies.orient.core.db.record.OIdentifiable; //导入依赖的package包/类
@Override
public Object execute(final Object iThis,
                      final OIdentifiable iCurrentRecord,
                      final Object iCurrentResult,
                      final Object[] iParams,
                      final OCommandContext iContext)
{
  checkArgument(iParams.length == 1);

  final Object param = iParams[0];

  if (param == null) {
    return null;
  }

  checkArgument(param instanceof String, "lower() parameter must be a string");

  return ((String) param).toLowerCase(Locale.ENGLISH);
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:20,代码来源:Lower.java

示例3: execute

import com.orientechnologies.orient.core.db.record.OIdentifiable; //导入依赖的package包/类
@Override
public Object execute(final Object iThis,
                      final OIdentifiable iCurrentRecord,
                      final Object iCurrentResult,
                      final Object[] iParams,
                      final OCommandContext iContext)
{
  OIdentifiable identifiable = (OIdentifiable) iParams[0];
  ODocument document = identifiable.getRecord();
  String browsedRepositoryName = (String) iParams[1];
  boolean jexlOnly = iParams.length > 2 && (boolean) iParams[2];

  switch (document.getClassName()) {
    case "asset":
      return checkAssetPermissions(document, browsedRepositoryName, jexlOnly);
    case "component":
      return checkComponentAssetPermissions(document, browsedRepositoryName, jexlOnly);
    default:
      return false;
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:22,代码来源:ContentAuth.java

示例4: getNextPage

import com.orientechnologies.orient.core.db.record.OIdentifiable; //导入依赖的package包/类
@Override
@Guarded(by = STARTED)
public <T> List<Entry<T, EntityId>> getNextPage(final OIndexCursor cursor, final int limit) {
  List<Entry<T, EntityId>> page = new ArrayList<>(limit);

  // For reasons unknown Orient needs the connection despite the code not using it
  try (ODatabaseDocumentTx db = databaseInstance.get().acquire()) {
    cursor.setPrefetchSize(limit);
    while (page.size() < limit) {
      Entry<Object, OIdentifiable> entry = cursor.nextEntry();
      if (entry == null) {
        break;
      }

      @SuppressWarnings("unchecked")
      T key = (T) entry.getKey();
      EntityId value = new AttachedEntityId(entityAdapter, entry.getValue().getIdentity());
      page.add(new SimpleEntry<>(key, value));
    }
  }

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

示例5: setup

import com.orientechnologies.orient.core.db.record.OIdentifiable; //导入依赖的package包/类
@Before
public void setup() {
  when(bucketDocument.getRecord()).thenReturn(bucketDocument);
  when(bucketDocument.field("repository_name", String.class)).thenReturn(REPOSITORY_NAME);
  when(bucketDocument.getIdentity()).thenReturn(mock(ORID.class));

  when(assetDocument.getClassName()).thenReturn("asset");
  when(assetDocument.getRecord()).thenReturn(assetDocument);
  when(assetDocument.field("bucket", OIdentifiable.class)).thenReturn(bucketDocument);
  when(assetDocument.field("name", String.class)).thenReturn(PATH);
  when(assetDocument.field("format", String.class)).thenReturn(FORMAT);

  when(componentDocument.getClassName()).thenReturn("component");
  when(componentDocument.getRecord()).thenReturn(componentDocument);
  when(componentDocument.field("bucket", OIdentifiable.class)).thenReturn(bucketDocument);
  when(componentDocument.getDatabase()).thenReturn(database);
  when(componentDocument.getIdentity()).thenReturn(mock(ORID.class));

  when(commandRequest.execute(any(Map.class))).thenReturn(Collections.singletonList(assetDocument));
  when(database.command(any(OCommandRequest.class))).thenReturn(commandRequest);

  underTest = new ContentAuth(contentAuthHelper);
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:24,代码来源:ContentAuthTest.java

示例6: setup

import com.orientechnologies.orient.core.db.record.OIdentifiable; //导入依赖的package包/类
@Before
public void setup() {
  when(variableResolverAdapterManager.get(FORMAT)).thenReturn(variableResolverAdapter);
  when(variableResolverAdapter.fromDocument(assetDocument)).thenReturn(variableSource);

  when(bucketDocument.getRecord()).thenReturn(bucketDocument);
  when(bucketDocument.field("repository_name", String.class)).thenReturn(REPOSITORY_NAME);
  when(bucketDocument.getIdentity()).thenReturn(mock(ORID.class));

  when(assetDocument.getClassName()).thenReturn("asset");
  when(assetDocument.getRecord()).thenReturn(assetDocument);
  when(assetDocument.field("bucket", OIdentifiable.class)).thenReturn(bucketDocument);
  when(assetDocument.field("name", String.class)).thenReturn(PATH);
  when(assetDocument.field("format", String.class)).thenReturn(FORMAT);

  when(commandRequest.execute(any(Map.class))).thenReturn(Collections.singletonList(assetDocument));
  when(database.command(any(OCommandRequest.class))).thenReturn(commandRequest);

  underTest = new ContentExpressionFunction(variableResolverAdapterManager, selectorManager, contentAuthHelper);
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:21,代码来源:ContentExpressionFunctionTest.java

示例7: getIndexedElements

import com.orientechnologies.orient.core.db.record.OIdentifiable; //导入依赖的package包/类
private <ElementType extends OrientElement> Stream<ElementType> getIndexedElements(
        OIndex<Object> index,
        Iterator<Object> valuesIter,
        BiFunction<OrientGraph, OIdentifiable, ElementType> newElement) {
    return executeWithConnectionCheck(() -> {
        makeActive();

        if (index == null) {
            return Collections.<ElementType> emptyList().stream();
        } else {
            if (!valuesIter.hasNext()) {
                return index.cursor().toValues().stream().map(id -> newElement.apply(this, id));
            } else {
                Stream<Object> convertedValues = StreamUtils.asStream(valuesIter).map(value -> convertValue(index, value));
                Stream<OIdentifiable> ids = convertedValues.flatMap(v -> lookupInIndex(index, v)).filter(r -> r != null);
                Stream<ORecord> records = ids.map(id -> id.getRecord());
                return records.map(r -> newElement.apply(this, getRawDocument(r)));
            }
        }
    });
}
 
开发者ID:orientechnologies,项目名称:orientdb-gremlin,代码行数:22,代码来源:OrientGraph.java

示例8: executeIndexQuery

import com.orientechnologies.orient.core.db.record.OIdentifiable; //导入依赖的package包/类
@Override
public OIndexCursor executeIndexQuery(OCommandContext iContext, OIndex<?> index, List<Object> keyParams, boolean ascSortOrder) {
  OIndexCursor cursor;
  Object key;
  key = keyParams.get(0);

  Map<String, Object> queryParams = new HashMap<String, Object>();
  queryParams.put(SpatialQueryBuilderAbstract.GEO_FILTER, SpatialQueryBuilderOverlap.NAME);
  queryParams.put(SpatialQueryBuilderAbstract.SHAPE, key);

  long start = System.currentTimeMillis();
  OLuceneAbstractResultSet indexResult = (OLuceneAbstractResultSet) index.get(queryParams);
  if (indexResult == null || indexResult instanceof OIdentifiable)
    cursor = new OIndexCursorSingleValue((OIdentifiable) indexResult, new OSpatialCompositeKey(keyParams));
  else
    cursor = new OIndexCursorCollectionValue(((Collection<OIdentifiable>) indexResult), new OSpatialCompositeKey(
        keyParams));

  if (indexResult != null)
    indexResult.sendLookupTime(iContext, start);
  return cursor;
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:23,代码来源:OLuceneOverlapOperator.java

示例9: evaluateRecord

import com.orientechnologies.orient.core.db.record.OIdentifiable; //导入依赖的package包/类
@Override
public Object evaluateRecord(OIdentifiable iRecord, ODocument iCurrentResult, OSQLFilterCondition iCondition, Object iLeft,
    Object iRight, OCommandContext iContext) {
  Shape shape = factory.fromDoc((ODocument) iLeft);

  // TODO { 'shape' : { 'type' : 'LineString' , 'coordinates' : [[1,2],[4,6]]} }
  // TODO is not translated in map but in array[ { 'type' : 'LineString' , 'coordinates' : [[1,2],[4,6]]} ]
  Object filter;
  if (iRight instanceof Collection) {
    filter = ((Collection) iRight).iterator().next();
  } else {
    filter = iRight;
  }
  Shape shape1 = factory.fromObject(filter);

  return SpatialOperation.BBoxIntersects.evaluate(shape, shape1.getBoundingBox());
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:18,代码来源:OLuceneOverlapOperator.java

示例10: newGeoDocument

import com.orientechnologies.orient.core.db.record.OIdentifiable; //导入依赖的package包/类
protected Document newGeoDocument(OIdentifiable oIdentifiable, Shape shape) {

    FieldType ft = new FieldType();
    ft.setIndexOptions(IndexOptions.DOCS);
    ft.setStored(true);

    Document doc = new Document();

    doc.add(OLuceneIndexType
        .createField(RID, oIdentifiable.getIdentity().toString(), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
    for (IndexableField f : strategy.createIndexableFields(shape)) {
      doc.add(f);
    }

    doc.add(new StoredField(strategy.getFieldName(), ctx.toString(shape)));
    return doc;
  }
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:18,代码来源:OLuceneSpatialIndexEngineAbstract.java

示例11: findSystemsWithinNFrameshiftJumpsOfDistance

import com.orientechnologies.orient.core.db.record.OIdentifiable; //导入依赖的package包/类
public Set<Vertex> findSystemsWithinNFrameshiftJumpsOfDistance(OrientGraph graph, Vertex system, float jumpDistance, int jumps) {

        // "traverse in_Frameshift, out_Frameshift, Frameshift.in, Frameshift.out from #11:4 while $depth <= 4"
        // select from (traverse in_Frameshift, out_Frameshift, Frameshift.in,
        // Frameshift.out from #11:4 while $depth <= 4 and (@class = 'System' or
        // (@class = 'Frameshift' and ly < 10.0))) where @class = 'System'
        Set<Vertex> systemsWithinNJumpOfDistance = new HashSet<>();
        OrientVertex o = (OrientVertex) system;

        for (OIdentifiable id : o.traverse().fields("in_Frameshift", "out_Frameshift", "Frameshift.in", "Frameshift.out")
                .predicate(new OSQLPredicate("$depth <= " + jumps * 2 + " and (@class = 'System' or (@class = 'Frameshift' and ly < " + jumpDistance + "))"))) {

            OrientElement element = graph.getElement(id);
            if (element.getRecord().getClassName().equals("System")) {
                systemsWithinNJumpOfDistance.add((Vertex) element);
            }
        }

        return systemsWithinNJumpOfDistance;
    }
 
开发者ID:jrosocha,项目名称:jarvisCli,代码行数:21,代码来源:StarSystemService.java

示例12: iterator

import com.orientechnologies.orient.core.db.record.OIdentifiable; //导入依赖的package包/类
@Override
public Iterator<T> iterator() {
	if (resultSet == null || resultSet.isEmpty()) {
		return Collections.emptyListIterator();
	} else {
		final Iterator<OIdentifiable> itIdentifiable = resultSet.iterator();
		return new Iterator<T>() {
			@Override
			public boolean hasNext() {
				return itIdentifiable.hasNext();
			}

			@Override
			public T next() {
				return db.getElementById(itIdentifiable.next().getIdentity(), klass);
			}

			@Override
			public void remove() {
				itIdentifiable.remove();
			}
		};
	}
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:25,代码来源:ResultSetIterable.java

示例13: remove

import com.orientechnologies.orient.core.db.record.OIdentifiable; //导入依赖的package包/类
@Override
public void remove(IGraphNode n) {
	final OrientNode oNode = (OrientNode)n;

	final OIdentifiable toRemove = oNode.getId().isPersistent() ? oNode.getId() : oNode.getDocument();
	List<Entry<String, Map<String, List<Object>>>> indices = oNode.removeIndexFields(escapedName);
	for (Entry<String, Map<String, List<Object>>> index : indices) {
		final String indexName = index.getKey();
		OIndex<?> oIndex = getIndexManager().getIndex(indexName);
		for (Entry<String, List<Object>> idxEntry : index.getValue().entrySet()) {
			final String field = idxEntry.getKey();
			for (Object key : idxEntry.getValue()) {
				oIndex.remove(new OCompositeKey(field, key), toRemove);
			}
		}
	}
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:18,代码来源:OrientNodeIndex.java

示例14: hasNext

import com.orientechnologies.orient.core.db.record.OIdentifiable; //导入依赖的package包/类
@Override
public boolean hasNext() {
	if (next != null) return true;

	Entry<Object, OIdentifiable> entry = cursor.nextEntry();
	outer:
	while (entry != null) {
		final String s = entry.getKey().toString();
		int currentPosition = 0;
		for (String fragment : fragments) {
			final int matchPos = s.indexOf(fragment, currentPosition);
			if (matchPos < 0) {
				entry = cursor.nextEntry();
				continue outer;
			} else {
				currentPosition = matchPos + fragment.length();
			}
		}
		next = entry.getValue();
		return true;
	}

	return false;
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:25,代码来源:FragmentFilteredIndexCursor.java

示例15: removeFromList

import com.orientechnologies.orient.core.db.record.OIdentifiable; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void removeFromList(ODocument orientEdge, final String fldName) {
	changedVertex = getDocument();
	if (changedVertex != null) {
		Object out = changedVertex.field(fldName);

		changedVertex.setTrackingChanges(false);
		if (out instanceof Collection) {
			((Collection<OIdentifiable>) out).remove(orientEdge);
		} else if (out instanceof OCollection) {
			((OCollection<OIdentifiable>) out).remove(orientEdge);
		}
		changedVertex.field(fldName, out);
		changedVertex.setTrackingChanges(true);
	}
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:17,代码来源:OrientNode.java


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