示例#1
0
 @SuppressWarnings("unchecked")
 private void addSearchResult(IEntity entity, ISearchField projectField) {
   String fieldName = projectField.getFieldName();
   if (isRelationshipField(projectField)) {
     // CMS-3430 : treat a projection of relationship field as
     // project on the reference oid
     List<IEntity> projectFieldValues = (List<IEntity>) entity.getFieldValues(fieldName);
     for (IEntity e : projectFieldValues) {
       rootProjections.add(e.getId());
     }
   } else {
     rootProjections.addAll(projectField.getSearchValue(entity));
   }
 }
示例#2
0
  @Override
  public boolean isIndexUsable(ISearchField field, MetaClass metaClass) {
    Collection<IndexInfo> indexes = metaClass.getIndexesOnField(field.getFieldName());
    for (IndexInfo index : indexes) {
      String firstKey = index.getKeyList().get(0);
      MetaField metaField = metaClass.getFieldByName(firstKey);

      String physicalKeyName = getFieldValueName(metaField);
      if (metaField.getDataType().equals(DataTypeEnum.RELATIONSHIP)) {
        physicalKeyName =
            metaField.getFlattenValueDbName()
                + AbstractEntityIDHelper.DOT
                + InternalFieldEnum.ID.getDbName();
      }
      if (physicalKeyName.equals(field.getFullDbName())) {
        return true;
      }
    }
    return false;
  }