use of com.ramussoft.core.attribute.simple.TextPersistent in project ramus by Vitaliy-Yakovchuk.
the class AnyToAnyPlugin method getElementName.
private String getElementName(final IEngine engine, final HashMap<Long, Attribute> attributesCache, final HashMap<Long, Qualifier> qualifiersCache, ResultSet rs) throws SQLException {
Element element = engine.getElement(rs.getLong("element_id"));
if (element == null)
return "";
Qualifier qualifier;
if (!qualifiersCache.containsKey(element.getQualifierId())) {
qualifier = engine.getQualifier(element.getQualifierId());
qualifiersCache.put(element.getQualifierId(), qualifier);
} else
qualifier = qualifiersCache.get(element.getQualifierId());
if (qualifier == null || qualifier.getAttributeForName() < 0l)
return "";
Attribute attribute;
if (!attributesCache.containsKey(qualifier.getAttributeForName())) {
attribute = engine.getAttribute(qualifier.getAttributeForName());
attributesCache.put(qualifier.getAttributeForName(), attribute);
} else
attribute = attributesCache.get(qualifier.getAttributeForName());
if (attribute == null)
return "";
List<Persistent>[] bAttribute = engine.getBinaryAttribute(element.getId(), attribute.getId());
if (bAttribute.length == 0)
return "";
List<Persistent> list = bAttribute[0];
if (list.size() == 0)
return "";
if (list.get(0) instanceof TextPersistent)
return String.valueOf(((TextPersistent) list.get(0)).getValue());
else if (list.get(0) instanceof DFDSName)
return String.valueOf(((DFDSName) list.get(0)).getShortName());
return "";
}
Aggregations