@Override public IAttribute getAttributeByName(String name, boolean includeInherited) { if (m_datatype != null) { if (m_datatype.isSimple()) { if (VALUE_NAME.equals(name)) { return m_value; } } else { IAttribute a = m_datatype.getAttributeByName(name, includeInherited); if (a != null) { return a; } } } for (SemanticElementRelationship r : m_relationships) { if (name.equals(r.getName())) { return r; } } for (ToBusinessElement e : m_fromMdmi) { if (name.equals(e.getName())) { return e; } } for (ToMessageElement e : m_toMdmi) { if (name.equals(e.getName())) { return e; } } return null; }
public boolean hasValidKeyRelation() { if (null == m_relationships || m_relationships.size() != 1) return false; SemanticElementRelationship r = m_relationships.get(0); MdmiDatatype dt = r.getRelatedSemanticElement().getDatatype(); if (!dt.isPrimitive()) return false; DTSPrimitive d = (DTSPrimitive) dt; return DTSPrimitive.STRING.equals(d); }
public SemanticElementRelationship getRelationshipByName(String name) { for (SemanticElementRelationship r : m_relationships) { if (r.getName().equalsIgnoreCase(name)) { return r; } } return null; }
@Override public boolean hasStaticAttributes() { for (SemanticElementRelationship r : m_relationships) { if (r.isStatic()) { return true; } } return false; }
protected void toString(StringBuffer out, String indent) { out.append(indent + "SemanticElement: " + m_name + "\r\n"); indent += " "; if (m_description != null && m_description.length() > 0) { out.append(indent + "description: " + m_description + "\r\n"); } if (m_elementType != null) { out.append(indent + "element type: " + m_elementType + "\r\n"); } if (m_datatype != null) { out.append(indent + "datatype: " + m_datatype.getTypeName() + "\r\n"); } if (m_multipleInstances) { out.append(indent + "multiple instances: true\r\n"); } if (m_parent != null) { out.append(indent + "parent: " + m_parent.getName() + "\r\n"); } if (m_ordering != null && m_ordering.length() > 0) { out.append(indent + "ordering: " + m_ordering + "\r\n"); } if (m_orderingLanguage != null && m_orderingLanguage.length() > 0) { out.append(indent + "ordering expression language: " + m_orderingLanguage + "\r\n"); } if (m_computedValue != null) { m_computedValue.toString(out, indent); } if (m_computedInValue != null) { m_computedInValue.toString(out, indent); } if (m_computedOutValue != null) { m_computedOutValue.toString(out, indent); } if (m_syntaxNode != null) { out.append(indent + "syntax node: " + m_syntaxNode.getName() + "\r\n"); } if (m_dataRules.size() > 0) { out.append(indent + "DATA RULES: "); for (int i = 0; i < m_dataRules.size(); i++) { DataRule x = m_dataRules.get(i); if (i > 0) { out.append(", "); } out.append(x.getName()); } out.append("\r\n"); } for (int i = 0; i < m_businessRules.size(); i++) { SemanticElementBusinessRule x = m_businessRules.get(i); x.toString(out, indent); } for (int i = 0; i < m_toMdmi.size(); i++) { ToMessageElement x = m_toMdmi.get(i); x.toString(out, indent); } for (int i = 0; i < m_fromMdmi.size(); i++) { ToBusinessElement x = m_fromMdmi.get(i); x.toString(out, indent); } for (int i = 0; i < m_relationships.size(); i++) { SemanticElementRelationship x = m_relationships.get(i); x.toString(out, indent); } for (int i = 0; i < m_qualifiers.size(); i++) { MEPropertyQualifierInstance x = m_qualifiers.get(i); x.toString(out, indent); } Collection<SemanticElement> c = getChildren(); if (c.size() > 0) { int i = 0; out.append(indent + "children: "); for (Iterator<SemanticElement> it = c.iterator(); it.hasNext(); ) { SemanticElement x = it.next(); if (i++ <= 0) { out.append(", "); } out.append(x.getName()); } out.append("\r\n"); } }