private List obtainPropertiesNamesUsedToCalculate() throws XavaException { Set result = new HashSet(); Iterator itProperties = getMetaPropertiesCalculated().iterator(); while (itProperties.hasNext()) { MetaProperty metaProperty = (MetaProperty) itProperties.next(); if (!metaProperty.hasCalculator()) continue; MetaSetsContainer metaCalculator = metaProperty.getMetaCalculator(); if (!metaCalculator.containsMetaSets()) continue; Iterator itSets = metaCalculator.getMetaSets().iterator(); while (itSets.hasNext()) { MetaSet set = (MetaSet) itSets.next(); String propertyNameFrom = set.getPropertyNameFrom(); if (!Is.emptyString(propertyNameFrom)) { String qualifiedName = metaProperty.getQualifiedName(); int idx = qualifiedName.indexOf('.'); String ref = idx < 0 ? "" : qualifiedName.substring(0, idx + 1); String qualifiedPropertyNameFrom = ref + propertyNameFrom; if (!getPropertiesNames().contains(qualifiedPropertyNameFrom)) { result.add(qualifiedPropertyNameFrom); } } } } return new ArrayList(result); }
/** @return Not null, read only and of type <tt>MetaProperty</tt>. */ public Collection getMetaPropertiesHiddenCalculated() throws XavaException { if (metaPropertiesHiddenCalculated == null) { metaPropertiesHiddenCalculated = new ArrayList(); Iterator it = getMetaPropertiesHidden().iterator(); while (it.hasNext()) { MetaProperty metaProperty = (MetaProperty) it.next(); if (metaProperty.isCalculated()) { metaPropertiesHiddenCalculated.add(metaProperty); } } } return metaPropertiesHiddenCalculated; }
public Collection getCmpFieldsColumnsInMultipleProperties() throws XavaException { Collection cmpFieldsColumnsInMultipleProperties = new ArrayList(); Iterator it = getMetaProperties().iterator(); String table = getMapping().getTableToQualifyColumn(); while (it.hasNext()) { MetaProperty p = (MetaProperty) it.next(); PropertyMapping mapping = p.getMapping(); if (mapping != null) { if (mapping.hasMultipleConverter()) { Iterator itFields = mapping.getCmpFields().iterator(); while (itFields.hasNext()) { CmpField field = (CmpField) itFields.next(); cmpFieldsColumnsInMultipleProperties.add(table + "." + field.getColumn()); } } } } return cmpFieldsColumnsInMultipleProperties; }
public void addMetaProperty(MetaProperty metaProperty) { if (metaPropertiesTab == null) { metaPropertiesTab = new HashMap(); } metaPropertiesTab.put(metaProperty.getName(), metaProperty); }
public List namesToMetaProperties(Collection names) throws XavaException { List metaProperties = new ArrayList(); Iterator it = names.iterator(); int i = -1; while (it.hasNext()) { i++; String name = (String) it.next(); MetaProperty metaPropertyTab = null; try { MetaProperty metaProperty = getMetaModel().getMetaProperty(name).cloneMetaProperty(); metaProperty.setQualifiedName(name); String labelId = null; if (representCollection()) { labelId = getId() + "." + name; // If there is no specific translation for the collection, // we take the translation from the default tab. if (!Labels.existsExact(labelId)) { labelId = getIdForDefaultTab() + ".properties." + name; } } else { labelId = getId() + ".properties." + name; } if (Labels.exists(labelId)) { metaProperty.setLabelId(labelId); } else if (metaPropertiesTab != null) { // By now only the label overwritten from the property of tab metaPropertyTab = (MetaProperty) metaPropertiesTab.get(name); if (metaPropertyTab != null) { metaProperty = metaProperty.cloneMetaProperty(); metaProperty.setLabel(metaPropertyTab.getLabel()); } } metaProperties.add(metaProperty); } catch (ElementNotFoundException ex) { MetaProperty notInEntity = new MetaProperty(); notInEntity.setName(name); notInEntity.setTypeName("java.lang.Object"); if (metaPropertyTab != null) { notInEntity.setLabel(metaPropertyTab.getLabel()); } metaProperties.add(notInEntity); } } return metaProperties; }