use of com.ramussoft.core.attribute.simple.ElementListPropertyPersistent in project ramus by Vitaliy-Yakovchuk.
the class ProjectionConnectionPlugin method getConnection.
@SuppressWarnings("unchecked")
@Override
public Connection getConnection(Data data, Qualifier qualifier, String name) {
Hashtable<String, EConnection> hash = (Hashtable<String, EConnection>) data.get("Projections.Hash");
List<String> nulls = (List<String>) data.get("Projections.Nulls");
if (hash == null) {
hash = new Hashtable<String, EConnection>();
data.put("Projections.Hash", hash);
}
if (nulls == null) {
nulls = new Vector<String>();
data.put("Projections.Nulls", nulls);
}
EConnection connection = hash.get(name);
if (connection == null) {
if (nulls.indexOf(name) >= 0)
return null;
for (Attribute attribute : data.getAttributes()) {
if ((attribute.getName().equals(name) && (attribute.getAttributeType().toString().equals("Core.ElementList")))) {
ElementListPropertyPersistent property = (ElementListPropertyPersistent) data.getEngine().getAttribute(null, attribute);
if (property != null) {
connection = new EConnection(attribute, property);
}
}
}
}
if (connection == null)
nulls.add(name);
else
hash.put(name, connection);
return connection;
}
use of com.ramussoft.core.attribute.simple.ElementListPropertyPersistent in project ramus by Vitaliy-Yakovchuk.
the class StandardAttributesPlugin method initQualifiers.
private void initQualifiers(Engine engine) {
qualifiers = engine.createSystemQualifier();
attributes = engine.createSystemQualifier();
qualifiers.setName(QUALIFIERS_QUALIFIER);
attributes.setName(ATTRIBUTES_QUALIFIER);
aList = engine.createSystemAttribute(new AttributeType("Core", "ElementList", false));
aList.setName(QUALIFIER_ATTRIBUTES);
aQualifierId = engine.createSystemAttribute(new AttributeType("Core", "Long", true));
aQualifierId.setName(QUALIFIER_ID);
engine.updateAttribute(aQualifierId);
aAttributeId = engine.createSystemAttribute(new AttributeType("Core", "Long", true));
aAttributeId.setName(ATTRIBUTE_ID);
engine.updateAttribute(aAttributeId);
nameAttribute = engine.createSystemAttribute(new AttributeType("Core", "Text", true));
nameAttribute.setName(ATTRIBUTE_NAME);
engine.updateAttribute(nameAttribute);
attributeTypeName = engine.createSystemAttribute(new AttributeType("Core", "Text", true));
attributeTypeName.setName(ATTRIBUTE_TYPE_NAME);
engine.updateAttribute(attributeTypeName);
ElementListPropertyPersistent property = new ElementListPropertyPersistent();
property.setQualifier1(qualifiers.getId());
property.setQualifier2(attributes.getId());
engine.setAttribute(null, aList, property);
qualifiers.getSystemAttributes().add(aList);
qualifiers.getSystemAttributes().add(aQualifierId);
qualifiers.getSystemAttributes().add(nameAttribute);
qualifiers.setAttributeForName(nameAttribute.getId());
Attribute h = (Attribute) engine.getPluginProperty("Core", HierarchicalPlugin.HIERARHICAL_ATTRIBUTE);
qualifiers.getSystemAttributes().add(h);
attributes.getSystemAttributes().add(aList);
attributes.getSystemAttributes().add(h);
attributes.getSystemAttributes().add(aAttributeId);
attributes.getSystemAttributes().add(nameAttribute);
attributes.getSystemAttributes().add(attributeTypeName);
attributes.setAttributeForName(nameAttribute.getId());
engine.updateQualifier(qualifiers);
engine.updateQualifier(attributes);
engine.updateAttribute(aList);
}
Aggregations