コード例 #1
0
  public DataSchemaFieldDefinition(
      final String name,
      final DataAttributes attributes,
      final DataAttributeContext dataAttributeContext) {
    if (attributes == null) {
      throw new NullPointerException();
    }

    if (name == null) {
      throw new NullPointerException();
    }
    if (dataAttributeContext == null) {
      throw new NullPointerException();
    }
    this.name = name;
    this.type =
        (Class)
            attributes.getMetaAttribute(
                MetaAttributeNames.Core.NAMESPACE,
                MetaAttributeNames.Core.TYPE,
                Class.class,
                dataAttributeContext);
    this.displayName =
        (String)
            attributes.getMetaAttribute(
                MetaAttributeNames.Formatting.NAMESPACE,
                MetaAttributeNames.Formatting.LABEL,
                String.class,
                dataAttributeContext);

    final Object source =
        attributes.getMetaAttribute(
            MetaAttributeNames.Core.NAMESPACE,
            MetaAttributeNames.Core.SOURCE,
            String.class,
            dataAttributeContext);
    if (MetaAttributeNames.Core.SOURCE_VALUE_ENVIRONMENT.equals(source)) {
      icon = (IconLoader.getInstance().getPropertiesDataSetIcon());
    } else if (MetaAttributeNames.Core.SOURCE_VALUE_EXPRESSION.equals(source)) {
      icon = (IconLoader.getInstance().getFunctionIcon());
    } else if (MetaAttributeNames.Core.SOURCE_VALUE_PARAMETER.equals(source)) {
      icon = (IconLoader.getInstance().getParameterIcon());
    } else if (MetaAttributeNames.Core.SOURCE_VALUE_TABLE.equals(source)) {
      icon = (IconLoader.getInstance().getDataSetsIcon());
    } else {
      icon = (IconLoader.getInstance().getGenericSquare());
    }
  }
コード例 #2
0
  public String[] getMetaAttributeNames(final String domainName) {
    if (PmdDataFactoryModule.META_DOMAIN.equals(domainName)) {
      return properties.keySet().toArray(new String[properties.size()]);
    }

    return backend.getMetaAttributeNames(domainName);
  }
コード例 #3
0
  public Object getMetaAttribute(
      final String domain,
      final String name,
      final Class type,
      final DataAttributeContext context,
      final Object defaultValue) {
    if (domain == null) {
      throw new NullPointerException();
    }
    if (name == null) {
      throw new NullPointerException();
    }
    if (context == null) {
      throw new NullPointerException();
    }

    if (PmdDataFactoryModule.META_DOMAIN.equals(domain)) {
      final Object value = concept.getProperty(name);
      if (value == null) {
        return defaultValue;
      }

      // this metadata layer is not cloneable, so malicious client code may
      // modify metadata objects.
      // We cant solve the problem here, so all we can do is hope and pray.
      return convertFromPmd(value, type, defaultValue, context);
    }

    return backend.getMetaAttribute(domain, name, type, context, defaultValue);
  }
コード例 #4
0
 public Object clone() throws CloneNotSupportedException {
   final PentahoMetaDataAttributes attributes = (PentahoMetaDataAttributes) super.clone();
   attributes.backend = (DataAttributes) backend.clone();
   attributes.concept = (IConcept) concept.clone();
   attributes.properties = (LinkedHashMap<String, Object>) properties.clone();
   attributes.conceptMappers = (ArrayList<ConceptQueryMapper>) conceptMappers.clone();
   return attributes;
 }
コード例 #5
0
 public String[] getMetaAttributeDomains() {
   final String[] backendDomains = backend.getMetaAttributeDomains();
   return StringUtils.merge(NAMESPACES, backendDomains);
 }