• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java OCommandContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: execute

import com.orientechnologies.orient.core.command.OCommandContext; //导入依赖的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


示例2: execute

import com.orientechnologies.orient.core.command.OCommandContext; //导入依赖的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


示例3: executeIndexQuery

import com.orientechnologies.orient.core.command.OCommandContext; //导入依赖的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


示例4: evaluateRecord

import com.orientechnologies.orient.core.command.OCommandContext; //导入依赖的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


示例5: searchIntersect

import com.orientechnologies.orient.core.command.OCommandContext; //导入依赖的package包/类
public Object searchIntersect(OCompositeKey key, double distance, OCommandContext context) throws IOException {

    double lat = ((Double) OType.convert(((OCompositeKey) key).getKeys().get(0), Double.class)).doubleValue();
    double lng = ((Double) OType.convert(((OCompositeKey) key).getKeys().get(1), Double.class)).doubleValue();
    SpatialOperation operation = SpatialOperation.Intersects;

    Point p = ctx.makePoint(lng, lat);
    SpatialArgs args = new SpatialArgs(operation, ctx.makeCircle(lng, lat,
        DistanceUtils.dist2Degrees(distance, DistanceUtils.EARTH_MEAN_RADIUS_KM)));
    Filter filter = strategy.makeFilter(args);
    IndexSearcher searcher = searcher();
    ValueSource valueSource = strategy.makeDistanceValueSource(p);
    Sort distSort = new Sort(valueSource.getSortField(false)).rewrite(searcher);

    return new LuceneResultSet(this,
        new SpatialQueryContext(context, searcher, new MatchAllDocsQuery(), filter, distSort).setSpatialArgs(args));
  }
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:18,代码来源:OLuceneLegacySpatialIndexEngine.java


示例6: results

import com.orientechnologies.orient.core.command.OCommandContext; //导入依赖的package包/类
protected LuceneResultSet results(OFromClause target, OExpression[] args, OCommandContext ctx) {
  OIndex oIndex = searchForIndex(target, args);
  if (oIndex != null) {
    Map<String, Object> queryParams = new HashMap<String, Object>();
    queryParams.put(SpatialQueryBuilderAbstract.GEO_FILTER, operator());
    Object shape;
    if (args[1].getValue() instanceof OJson) {
      OJson json = (OJson) args[1].getValue();
      ODocument doc = new ODocument().fromJSON(json.toString());
      shape = doc.toMap();
    } else {
      shape = args[1].execute(null, ctx);
    }
    queryParams.put(SpatialQueryBuilderAbstract.SHAPE, shape);
    return (LuceneResultSet) oIndex.get(queryParams);
  }
  return null;
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:19,代码来源:OSpatialFunctionAbstract.java


示例7: executeEvent

import com.orientechnologies.orient.core.command.OCommandContext; //导入依赖的package包/类
private Object executeEvent(final ODatabaseDocumentTx db, final String iEventName, final OCommandContext iContext) {
  if (events == null)
    return null;

  OCommandScript script = scripts.get(iEventName);

  if (script == null) {
    final String code = events.get(iEventName);
    if (code != null) {
      // CACHE IT
      script = new OCommandScript(code).setLanguage("Javascript");
      scripts.put(iEventName, script);
    }
  }

  if (script != null) {
    final Map<String, Object> pars = new HashMap<String, Object>();
    pars.put("task", iContext);
    pars.put("importer", this);

    return db.command(script).execute(pars);
  }
  return null;
}
 
开发者ID:orientechnologies,项目名称:orientdb-etl,代码行数:25,代码来源:OScriptImporterListener.java


示例8: configure

import com.orientechnologies.orient.core.command.OCommandContext; //导入依赖的package包/类
@Override
public void configure(OETLProcessor iProcessor, final ODocument iConfiguration, OCommandContext iContext) {
  super.configure(iProcessor, iConfiguration, iContext);
  fieldName = (String) resolve(iConfiguration.field("fieldName"));
  fieldNames = (List<String>) resolve(iConfiguration.field("fieldNames"));

  if (fieldNames == null && fieldName == null)
    throw new IllegalArgumentException("Field transformer must specify 'fieldName' or 'fieldNames'");

  expression = iConfiguration.field("expression");
  value = iConfiguration.field("value");

  if (expression != null && value != null)
    throw new IllegalArgumentException("Field transformer cannot specify both 'expression' and 'value'");

  if (iConfiguration.containsField("save"))
    save = (Boolean) iConfiguration.field("save");

  if (iConfiguration.containsField("operation"))
    setOperation = "set".equalsIgnoreCase((String) iConfiguration.field("operation"));
}
 
开发者ID:orientechnologies,项目名称:orientdb-etl,代码行数:22,代码来源:OFieldTransformer.java


示例9: configure

import com.orientechnologies.orient.core.command.OCommandContext; //导入依赖的package包/类
@Override
public void configure(OETLProcessor iProcessor, final ODocument iConfiguration, final OCommandContext iContext) {
  super.configure(iProcessor, iConfiguration, iContext);
  edgeClass = iConfiguration.field("class");
  if (iConfiguration.containsField("direction")) {
    final String direction = iConfiguration.field("direction");
    if ("out".equalsIgnoreCase(direction))
      directionOut = true;
    else if ("in".equalsIgnoreCase(direction))
      directionOut = false;
    else
      throw new OConfigurationException("Direction can be 'in' or 'out', but found: " + direction);
  }

  if (iConfiguration.containsField("targetVertexFields"))
    targetVertexFields = (ODocument) iConfiguration.field("targetVertexFields");
  if (iConfiguration.containsField("edgeFields"))
    edgeFields = (ODocument) iConfiguration.field("edgeFields");
  if (iConfiguration.containsField("skipDuplicates"))
    skipDuplicates = (Boolean) resolve(iConfiguration.field("skipDuplicates"));
}
 
开发者ID:orientechnologies,项目名称:orientdb-etl,代码行数:22,代码来源:OEdgeTransformer.java


示例10: sendLookupTime

import com.orientechnologies.orient.core.command.OCommandContext; //导入依赖的package包/类
public void sendLookupTime(OCommandContext context, final TopDocs docs, final Integer limit, long startFetching) {
  if (context != null) {

    final long finalTime = System.currentTimeMillis() - startFetching;
    context.setVariable((indexName + ".lookupTime").replace(".", "_"), new HashMap<String, Object>() {
      {
        put("limit", limit);
        put("totalTime", finalTime);
        put("totalHits", docs.totalHits);
        put("returnedHits", docs.scoreDocs.length);
        put("maxScore", docs.getMaxScore());

      }
    });
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-lucene,代码行数:17,代码来源:OLuceneIndexManagerAbstract.java


示例11: searchIntersect

import com.orientechnologies.orient.core.command.OCommandContext; //导入依赖的package包/类
public Object searchIntersect(OCompositeKey key, double distance, OCommandContext context) throws IOException {

    double lat = ((Double) OType.convert(((OCompositeKey) key).getKeys().get(0), Double.class)).doubleValue();
    double lng = ((Double) OType.convert(((OCompositeKey) key).getKeys().get(1), Double.class)).doubleValue();
    SpatialOperation operation = SpatialOperation.Intersects;

    Point p = ctx.makePoint(lng, lat);
    SpatialArgs args = new SpatialArgs(operation, ctx.makeCircle(lng, lat,
        DistanceUtils.dist2Degrees(distance, DistanceUtils.EARTH_MEAN_RADIUS_KM)));
    Filter filter = strategy.makeFilter(args);
    IndexSearcher searcher = getSearcher();
    ValueSource valueSource = strategy.makeDistanceValueSource(p);
    Sort distSort = new Sort(valueSource.getSortField(false)).rewrite(searcher);

    return new LuceneResultSet(this,
        new SpatialQueryContext(context, searcher, new MatchAllDocsQuery(), filter, distSort).setSpatialArgs(args));
  }
 
开发者ID:orientechnologies,项目名称:orientdb-lucene,代码行数:18,代码来源:OLuceneSpatialIndexManager.java


示例12: executeIndexQuery

import com.orientechnologies.orient.core.command.OCommandContext; //导入依赖的package包/类
@Override
public OIndexCursor executeIndexQuery(OCommandContext iContext, OIndex<?> index, List<Object> keyParams, boolean ascSortOrder) {
  OIndexDefinition definition = index.getDefinition();
  int idxSize = definition.getFields().size();
  int paramsSize = keyParams.size();
  OIndexCursor cursor;
  Object indexResult = index.get(new OSpatialCompositeKey(keyParams).setOperation(SpatialOperation.IsWithin));
  if (indexResult == null || indexResult instanceof OIdentifiable)
    cursor = new OIndexCursorSingleValue((OIdentifiable) indexResult, new OSpatialCompositeKey(keyParams));
  else
    cursor = new OIndexCursorCollectionValue(((Collection<OIdentifiable>) indexResult).iterator(), new OSpatialCompositeKey(
        keyParams));

  iContext.setVariable("$luceneIndex", true);
  return cursor;
}
 
开发者ID:orientechnologies,项目名称:orientdb-lucene,代码行数:17,代码来源:OLuceneWithinOperator.java


示例13: execute

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

  String clazz = (String) iParams[0];
  String latField = (String) iParams[1];
  String lngField = (String) iParams[2];
  ODatabaseDocument databaseRecord = ODatabaseRecordThreadLocal.INSTANCE.get();
  Set<OIndex<?>> indexes = databaseRecord.getMetadata().getSchema().getClass(clazz).getInvolvedIndexes(latField, lngField);
  for (OIndex i : indexes) {
    if (OClass.INDEX_TYPE.SPATIAL.toString().equals(i.getInternal().getType())) {
      List<Object> params = new ArrayList<Object>();
      params.add(iParams[3]);
      params.add(iParams[4]);
      double distance = iParams.length > 5 ? ((Number) iParams[5]).doubleValue() : 0;
      Object ret = i.get(new OSpatialCompositeKey(params).setMaxDistance(distance));
      if (ret instanceof Collection) {
        if (context == null)
          context = new HashSet<Object>();
        context.addAll((Collection<?>) ret);
      }
      return ret;
    }
  }
  return null;
}
 
开发者ID:orientechnologies,项目名称:orientdb-lucene,代码行数:27,代码来源:OLuceneNearFunction.java


示例14: execute

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

  for (Object param : iParams) {
    b.append(param);
  }

  return b.toString();
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:16,代码来源:Concat.java


示例15: evaluateRecord

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

  List<Number> left = (List<Number>) iLeft;

  double lat = left.get(0).doubleValue();
  double lon = left.get(1).doubleValue();

  Shape shape = factory.context().makePoint(lon, lat);
  List<Number> right = (List<Number>) iRight;

  double lat1 = right.get(0).doubleValue();
  double lon1 = right.get(1).doubleValue();
  Shape shape1 = factory.context().makePoint(lon1, lat1);

  Map map = (Map) right.get(2);
  double distance = 0;

  Number n = (Number) map.get("maxDistance");
  if (n != null) {
    distance = n.doubleValue();
  }
  Point p = (Point) shape1;
  Circle circle = factory.context().makeCircle(p.getX(), p.getY(),
      DistanceUtils.dist2Degrees(distance, DistanceUtils.EARTH_MEAN_RADIUS_KM));
  double docDistDEG = factory.context().getDistCalc().distance((Point) shape, p);
  final double docDistInKM = DistanceUtils.degrees2Dist(docDistDEG, DistanceUtils.EARTH_EQUATORIAL_RADIUS_KM);
  iContext.setVariable("distance", docDistInKM);
  return shape.relate(circle) == SpatialRelation.WITHIN;
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:32,代码来源:OLuceneNearOperator.java


示例16: executeIndexQuery

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

  OIndexCursor cursor;
  OIndexDefinition definition = index.getDefinition();
  int idxSize = definition.getFields().size();
  int paramsSize = keyParams.size();

  double distance = 0;
  Object spatial = iContext.getVariable("spatial");
  if (spatial != null) {
    if (spatial instanceof Number) {
      distance = ((Double) OType.convert(spatial, Double.class)).doubleValue();
    } else if (spatial instanceof Map) {
      Map<String, Object> params = (Map<String, Object>) spatial;

      Object dst = params.get("maxDistance");
      if (dst != null && dst instanceof Number) {
        distance = ((Double) OType.convert(dst, Double.class)).doubleValue();
      }
    }
  }
  Object indexResult = index.get(new OSpatialCompositeKey(keyParams).setMaxDistance(distance).setContext(iContext));
  if (indexResult == null || indexResult instanceof OIdentifiable)
    cursor = new OIndexCursorSingleValue((OIdentifiable) indexResult, new OSpatialCompositeKey(keyParams));
  else
    cursor = new OIndexCursorCollectionValue(((Collection<OIdentifiable>) indexResult), new OSpatialCompositeKey(
        keyParams));

  iContext.setVariable("$luceneIndex", true);
  return cursor;
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:33,代码来源:OLuceneNearOperator.java


示例17: evaluateRecord

import com.orientechnologies.orient.core.command.OCommandContext; //导入依赖的package包/类
@Override
public Object evaluateRecord(OIdentifiable iRecord, ODocument iCurrentResult, OSQLFilterCondition iCondition, Object iLeft,
    Object iRight, OCommandContext iContext) {
  List<Number> left = (List<Number>) iLeft;

  double lat = left.get(0).doubleValue();
  double lon = left.get(1).doubleValue();

  Shape shape = SpatialContext.GEO.makePoint(lon, lat);

  Shape shape1 = shapeFactory.makeShape(new OSpatialCompositeKey((List<?>) iRight), SpatialContext.GEO);

  return shape.relate(shape1) == SpatialRelation.WITHIN;
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:15,代码来源:OLuceneWithinOperator.java


示例18: executeIndexQuery

import com.orientechnologies.orient.core.command.OCommandContext; //导入依赖的package包/类
@Override
public OIndexCursor executeIndexQuery(OCommandContext iContext, OIndex<?> index, List<Object> keyParams, boolean ascSortOrder) {
  OIndexDefinition definition = index.getDefinition();
  int idxSize = definition.getFields().size();
  int paramsSize = keyParams.size();
  OIndexCursor cursor;
  Object indexResult = index.get(new OSpatialCompositeKey(keyParams).setOperation(SpatialOperation.IsWithin));
  if (indexResult == null || indexResult instanceof OIdentifiable)
    cursor = new OIndexCursorSingleValue((OIdentifiable) indexResult, new OSpatialCompositeKey(keyParams));
  else
    cursor = new OIndexCursorCollectionValue(((Collection<OIdentifiable>) indexResult), new OSpatialCompositeKey(keyParams));

  iContext.setVariable("$luceneIndex", true);
  return cursor;
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:16,代码来源:OLuceneWithinOperator.java


示例19: evaluateRecord

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

  OSQLFunction function = OSQLEngine.getInstance().getFunction(keyword);
  return function.execute(this, iRecord, iCurrentResult, new Object[] { iLeft, iCondition.getRight() }, iContext);
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:8,代码来源:OLuceneSpatialOperator.java


示例20: searchWithin

import com.orientechnologies.orient.core.command.OCommandContext; //导入依赖的package包/类
public Object searchWithin(OSpatialCompositeKey key, OCommandContext context) throws IOException {

    Set<OIdentifiable> result = new HashSet<OIdentifiable>();

    Shape shape = legacyBuilder.makeShape(key, ctx);
    if (shape == null)
      return null;
    SpatialArgs args = new SpatialArgs(SpatialOperation.IsWithin, shape);
    IndexSearcher searcher = searcher();

    Filter filter = strategy.makeFilter(args);

    return new LuceneResultSet(this, new SpatialQueryContext(context, searcher, new MatchAllDocsQuery(), filter));
  }
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:15,代码来源:OLuceneLegacySpatialIndexEngine.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CrashWoodpecker类代码示例发布时间:2022-05-22
下一篇:
Java FlowMappingStartToken类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap