Search in sources :

Example 16 with AttributeInformation

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;
}
Also used : AttributeInformation(org.codice.alliance.nsili.common.GIAS.AttributeInformation) ArrayList(java.util.ArrayList) Domain(org.codice.alliance.nsili.common.GIAS.Domain)

Example 17 with AttributeInformation

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;
}
Also used : AttributeInformation(org.codice.alliance.nsili.common.GIAS.AttributeInformation) ArrayList(java.util.ArrayList) Domain(org.codice.alliance.nsili.common.GIAS.Domain)

Example 18 with AttributeInformation

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);
}
Also used : AttributeInformation(org.codice.alliance.nsili.common.GIAS.AttributeInformation) Association(org.codice.alliance.nsili.common.GIAS.Association) ArrayList(java.util.ArrayList)

Example 19 with AttributeInformation

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);
}
Also used : AttributeInformation(org.codice.alliance.nsili.common.GIAS.AttributeInformation) HashMap(java.util.HashMap) Objects(java.util.Objects) ArrayList(java.util.ArrayList) List(java.util.List)

Example 20 with AttributeInformation

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;
}
Also used : AttributeInformation(org.codice.alliance.nsili.common.GIAS.AttributeInformation) EntityGraph(org.codice.alliance.nsili.common.UCO.EntityGraph) ArrayList(java.util.ArrayList) EntityNode(org.codice.alliance.nsili.common.UCO.EntityNode)

Aggregations

AttributeInformation (org.codice.alliance.nsili.common.GIAS.AttributeInformation)40 ArrayList (java.util.ArrayList)36 Domain (org.codice.alliance.nsili.common.GIAS.Domain)29 IntegerRange (org.codice.alliance.nsili.common.GIAS.IntegerRange)7 HashMap (java.util.HashMap)5 List (java.util.List)5 Matchers.containsString (org.hamcrest.Matchers.containsString)3 Test (org.junit.Test)3 Objects (java.util.Objects)1 Association (org.codice.alliance.nsili.common.GIAS.Association)1 DateRange (org.codice.alliance.nsili.common.GIAS.DateRange)1 FloatingPointRange (org.codice.alliance.nsili.common.GIAS.FloatingPointRange)1 SortAttribute (org.codice.alliance.nsili.common.GIAS.SortAttribute)1 EntityGraph (org.codice.alliance.nsili.common.UCO.EntityGraph)1 EntityNode (org.codice.alliance.nsili.common.UCO.EntityNode)1 InvalidInputParameter (org.codice.alliance.nsili.common.UCO.InvalidInputParameter)1 ProcessingFault (org.codice.alliance.nsili.common.UCO.ProcessingFault)1 SystemFault (org.codice.alliance.nsili.common.UCO.SystemFault)1 Matchers.anyString (org.mockito.Matchers.anyString)1