Example #1
0
 @Override
 public MetaClass getMetaClass(String className, int version, MetadataContext context) {
   MetaClass meta = getMetaClass(className);
   if (meta.getVersion() == version) {
     return meta;
   }
   return delegate.getMetaClass(className, version, context);
 }
Example #2
0
 @Override
 public List<MetaClass> getMetaClasses(MetadataContext context) {
   List<MetaClass> allMetas = delegate.getMetaClasses(context);
   Map<String, MetaClass> metaMap = new HashMap<String, MetaClass>();
   for (MetaClass mc : allMetas) {
     metaMap.put(mc.getName(), mc);
   }
   metaMap.putAll(nameCache);
   return new ArrayList<MetaClass>(metaMap.values());
 }
Example #3
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;
  }