public PentahoMetaDataAttributes(final DataAttributes backend, final IConcept concept) { if (concept == null) { throw new NullPointerException(); } if (backend == null) { throw new NullPointerException(); } this.concept = concept; this.properties = new LinkedHashMap<String, Object>(concept.getProperties()); this.backend = backend; this.conceptMappers = new ArrayList<ConceptQueryMapper>(); this.conceptMappers.add(new AggregationConceptMapper()); this.conceptMappers.add(new AlignmentConceptMapper()); this.conceptMappers.add(new BooleanConceptMapper()); this.conceptMappers.add(new ColorConceptMapper()); this.conceptMappers.add(new ColumnWidthConceptMapper()); this.conceptMappers.add(new DataTypeConceptMapper()); this.conceptMappers.add(new DateConceptMapper()); this.conceptMappers.add(new FieldTypeConceptMapper()); this.conceptMappers.add(new FontSettingsConceptMapper()); this.conceptMappers.add(new NumberConceptMapper()); this.conceptMappers.add(new LocalizedStringConceptMapper()); this.conceptMappers.add(new TableTypeConceptMapper()); this.conceptMappers.add(new URLConceptMapper()); this.conceptMappers.add(new StringConceptMapper()); this.conceptMappers.add(new SecurityConceptMapper()); }
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); }
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; }
public static final String uniquify(final String id, final List<? extends IConcept> concepts) { boolean gotNew = false; boolean found = false; int conceptNr = 1; String newId = id; while (!gotNew) { for (IConcept concept : concepts) { if (concept.getId().equalsIgnoreCase(newId)) { found = true; break; } } if (found) { conceptNr++; newId = id + "_" + conceptNr; // $NON-NLS-1$ found = false; } else { gotNew = true; } } return newId; }