Пример #1
0
  private static <T> SchemaFeatures getSchemaFeature(
      Object iUserObject, String elementName, Feature<T> feature) {
    SchemaObject schema = Roma.session().getSchemaObject(iUserObject);
    if (schema == null) return null;
    SchemaFeatures features = null;
    if (FeatureType.ACTION.equals(feature.getType())) {
      if (elementName == null) return null;
      features = schema.getAction(elementName);
      if (features == null) {
        if (schema.getSchemaClass().getAction(elementName) == null)
          throw new ConfigurationException(
              "Action '" + elementName + "' not found in class '" + schema + "'");
      }
    } else if (FeatureType.FIELD.equals(feature.getType())) {
      if (elementName == null) return null;
      features = schema.getField(elementName);
      if (features == null) {
        if (schema.getSchemaClass().getField(elementName) == null)
          throw new ConfigurationException(
              "Field '" + elementName + "' not found in class '" + schema + "'");
      }
    } else if (FeatureType.CLASS.equals(feature.getType())) features = schema;
    else if (FeatureType.EVENT.equals(feature.getType())) {
      if (elementName == null) return null;
      features = schema.getEvent(elementName);
    }

    return features;
  }