use of org.codice.alliance.nsili.common.GIAS.AttributeInformation in project alliance by codice.
the class NsiliAttributesGenerator method getNsilIntrepAttributes.
public static List<AttributeInformation> getNsilIntrepAttributes() {
String prefix = NsiliConstants.NSIL_INTREP + ".";
Domain domain;
List<AttributeInformation> attributes = new ArrayList<>();
domain = new Domain();
domain.l(getSituationTypeOptions());
attributes.add(new AttributeInformation(prefix + NsiliConstants.SITUATION_TYPE, AttributeType.TEXT, domain, "", "", RequirementMode.MANDATORY, "Represents the type of situation.", false, true));
return attributes;
}
use of org.codice.alliance.nsili.common.GIAS.AttributeInformation in project alliance by codice.
the class NsiliAttributesGenerator method getNsilPartAttributes.
public static List<AttributeInformation> getNsilPartAttributes() {
String prefix = NsiliConstants.NSIL_PART + ".";
Domain domain;
List<AttributeInformation> attributes = new ArrayList<>();
domain = new Domain();
domain.t(0);
attributes.add(new AttributeInformation(prefix + NsiliConstants.PART_IDENTIFIER, AttributeType.TEXT, domain, "", "", RequirementMode.MANDATORY, "String describing the part of the containing Product.", false, true));
return attributes;
}
use of org.codice.alliance.nsili.common.GIAS.AttributeInformation in project alliance by codice.
the class NsiliDataModel method initAssociations.
private void initAssociations() {
List<AttributeInformation> associationAttrs = new ArrayList<>();
associationAttrs.addAll(NsiliAttributesGenerator.getNsilCardAttributes());
associationAttrs.addAll(NsiliAttributesGenerator.getNsilRelationAttributes());
AttributeInformation[] associationAttrArray = associationAttrs.toArray(new AttributeInformation[0]);
Association hasPartAssoc = new Association(NsiliConstants.HAS_PART, NsiliConstants.NSIL_ALL_VIEW, NsiliConstants.NSIL_ALL_VIEW, "Described resource (e.g. 'Target Folder') includes the referenced resource either physically or logically.", Cardinality.MANY_TO_MANY, associationAttrArray);
Association isVersionAssoc = new Association(NsiliConstants.IS_VERSION_OF, NsiliConstants.NSIL_ALL_VIEW, NsiliConstants.NSIL_ALL_VIEW, "Described resource (source) is a version edition or adaptation of the referenced resource (destination). A change in version implies substantive changes in content rather than differences in format.", Cardinality.MANY_TO_ONE, associationAttrArray);
Association replacesAssoc = new Association(NsiliConstants.REPLACES, NsiliConstants.NSIL_ALL_VIEW, NsiliConstants.NSIL_ALL_VIEW, "Described resource (source) supplants, displaces or supersedes the referenced resource (destination).", Cardinality.ONE_TO_MANY, associationAttrArray);
Association isSupportDataToAssoc = new Association(NsiliConstants.IS_SUPPORT_DATA_TO, NsiliConstants.NSIL_ALL_VIEW, NsiliConstants.NSIL_ALL_VIEW, "Described resource (source) supplements information to the referenced RFI and IR (destination)", Cardinality.ONE_TO_MANY, associationAttrArray);
Association originatingFromAssoc = new Association(NsiliConstants.ORIGINATING_FROM, NsiliConstants.NSIL_ALL_VIEW, NsiliConstants.NSIL_ALL_VIEW, "Described resource (source) originates from referenced resource (destination) and thereby shows the hierarchical relationship between the two products.", Cardinality.MANY_TO_ONE, associationAttrArray);
Association followsAssoc = new Association(NsiliConstants.FOLLOWS, NsiliConstants.NSIL_ALL_VIEW, NsiliConstants.NSIL_ALL_VIEW, "Described resource (source in association) is the next in the chronological sequence after the referenced resource (destination in the association).", Cardinality.ONE_TO_ONE, associationAttrArray);
associations.add(hasPartAssoc);
associations.add(isVersionAssoc);
associations.add(replacesAssoc);
associations.add(isSupportDataToAssoc);
associations.add(originatingFromAssoc);
associations.add(followsAssoc);
}
use of org.codice.alliance.nsili.common.GIAS.AttributeInformation in project alliance by codice.
the class NsiliDataModel method updateMandatoryAttrs.
private void updateMandatoryAttrs(String viewName, EntityNode[] viewNodes) {
Map<String, List<String>> attrMap = new HashMap<>();
List<AttributeInformation> nodeAttrs = Arrays.stream(viewNodes).map(e -> e.entity_name).map(this::getAttributeInformation).filter(Objects::nonNull).flatMap(List::stream).collect(Collectors.toList());
for (AttributeInformation nodeAttr : nodeAttrs) {
if (nodeAttr.mode == RequirementMode.MANDATORY) {
String attributeName = nodeAttr.attribute_name;
String[] attrNameArr = attributeName.split("\\.");
if (attrNameArr.length == 2) {
String parentNode = attrNameArr[0];
String attrName = attrNameArr[1];
List<String> attrs = attrMap.get(parentNode);
if (attrs == null) {
attrs = new ArrayList<>(4);
attrMap.put(parentNode, attrs);
}
attrs.add(attrName);
}
}
}
requiredAttrMap.put(viewName, attrMap);
}
use of org.codice.alliance.nsili.common.GIAS.AttributeInformation in project alliance by codice.
the class NsiliDataModel method getAttributesForView.
public List<AttributeInformation> getAttributesForView(String viewName) {
List<AttributeInformation> attributeInformation = new ArrayList<>();
EntityGraph graph = getEntityGraph(viewName);
for (EntityNode node : graph.nodes) {
List<AttributeInformation> nodeAttrs = getAttributeInformation(node.entity_name);
if (nodeAttrs != null) {
attributeInformation.addAll(nodeAttrs);
}
}
return attributeInformation;
}
Aggregations