示例#1
0
  private synchronized void init() {
    if (initialised) {
      return;
    }
    attributeNameToResourceName = getAttributeNameToResourceName(schema);
    hiddenAttributeNames = getHiddenAttributeNames();

    for (Object attributeName : schema.getAttributeSchemaNames()) {
      AttributeSchemaConverter attributeSchemaConverter;

      final AttributeSchema attributeSchema =
          this.schema.getAttributeSchema((String) attributeName);
      final AttributeSchema.Syntax syntax = attributeSchema.getSyntax();

      attributeSchemaConverter = getAttributeSchemaValue(syntax);

      final String resourceName = attributeSchema.getResourceName();
      if (resourceName == null) {
        attributeSchemaConverters.put((String) attributeName, attributeSchemaConverter);
      } else {
        attributeSchemaConverters.put(resourceName, attributeSchemaConverter);
      }
    }

    resourceNameToAttributeName = attributeNameToResourceName.inverse();
    attributeNameToSection = getAttributeNameToSection();

    initialised = true;
  }
示例#2
0
  private BiMap<String, String> getAttributeNameToResourceName(ServiceSchema schema) {
    HashBiMap<String, String> result = HashBiMap.create();

    for (String attributeName : (Set<String>) schema.getAttributeSchemaNames()) {
      final String resourceName = schema.getAttributeSchema(attributeName).getResourceName();
      if (resourceName != null) {
        result.put(attributeName, resourceName);
      }
    }
    return result;
  }