Search in sources :

Example 6 with AttributeInformation

use of org.codice.alliance.nsili.common.GIAS.AttributeInformation in project alliance by codice.

the class NsiliAttributesGenerator method getNsilEntityAttributes.

public static List<AttributeInformation> getNsilEntityAttributes() {
    String prefix = NsiliConstants.NSIL_ENTITY + ".";
    Domain domain;
    List<AttributeInformation> attributes = new ArrayList<>();
    domain = new Domain();
    domain.l(getEntityTypeOptions());
    attributes.add(new AttributeInformation(prefix + NsiliConstants.TYPE, AttributeType.TEXT, domain, "", "", RequirementMode.MANDATORY, "Information rating of the data source and the information of the data source upon which the report is generated by assessing the Reliability of the Source and Credibility of the Information according to STANAG 2511, 2190 and 2191. The rating is specified by the combination of reliability and credibility values, e.g. B2. If the report is generated upon multiple source, multiple ratings are separated by commas (e.g. B2,C3,C6).", false, true));
    domain = new Domain();
    domain.t(255);
    attributes.add(new AttributeInformation(prefix + NsiliConstants.NAME, AttributeType.TEXT, domain, "", "", RequirementMode.MANDATORY, "The name identifying the entity.", false, true));
    domain = new Domain();
    domain.t(255);
    attributes.add(new AttributeInformation(prefix + NsiliConstants.ALIAS, AttributeType.TEXT, domain, "", "", RequirementMode.OPTIONAL, "The alias of the entity.", 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 7 with AttributeInformation

use of org.codice.alliance.nsili.common.GIAS.AttributeInformation in project alliance by codice.

the class NsiliAttributesGenerator method getNsilTdlAttributes.

public static List<AttributeInformation> getNsilTdlAttributes() {
    String prefix = NsiliConstants.NSIL_TDL + ".";
    Domain domain;
    List<AttributeInformation> attributes = new ArrayList<>();
    domain = new Domain();
    domain.ir(new IntegerRange(0, 127));
    attributes.add(new AttributeInformation(prefix + NsiliConstants.ACTIVITY, AttributeType.INTEGER, domain, "", "", RequirementMode.OPTIONAL, "A number that together with the 'platform' number defines the identity of a track", false, true));
    domain = new Domain();
    domain.l(getTdlMessageNumberOptions());
    attributes.add(new AttributeInformation(prefix + NsiliConstants.MESSAGE_NUM, AttributeType.TEXT, domain, "", "", RequirementMode.MANDATORY, "The Link 16 J Series message number.", false, true));
    domain = new Domain();
    domain.ir(new IntegerRange(0, 63));
    attributes.add(new AttributeInformation(prefix + NsiliConstants.PLATFORM, AttributeType.INTEGER, domain, "", "", RequirementMode.OPTIONAL, "A number that together with the 'activity' number defines the identity of a track", false, true));
    domain = new Domain();
    domain.t(10);
    attributes.add(new AttributeInformation(prefix + NsiliConstants.TRACK_NUM, AttributeType.TEXT, domain, "", "", RequirementMode.OPTIONAL, "Link 16 J Series track number for the track found in the product. The track number shall be in the decoded 5-character format (e.g. EK627).", false, true));
    return attributes;
}
Also used : AttributeInformation(org.codice.alliance.nsili.common.GIAS.AttributeInformation) IntegerRange(org.codice.alliance.nsili.common.GIAS.IntegerRange) ArrayList(java.util.ArrayList) Domain(org.codice.alliance.nsili.common.GIAS.Domain)

Example 8 with AttributeInformation

use of org.codice.alliance.nsili.common.GIAS.AttributeInformation in project alliance by codice.

the class SampleNsiliClient method getResultAttributes.

private String[] getResultAttributes() throws InvalidInputParameter, SystemFault, ProcessingFault {
    AttributeInformation[] attributeInformationArray = dataModelMgr.get_attributes(NsiliConstants.NSIL_ALL_VIEW, new NameValue[0]);
    String[] resultAttributes = new String[attributeInformationArray.length];
    for (int c = 0; c < attributeInformationArray.length; c++) {
        AttributeInformation attributeInformation = attributeInformationArray[c];
        resultAttributes[c] = attributeInformation.attribute_name;
    }
    return resultAttributes;
}
Also used : AttributeInformation(org.codice.alliance.nsili.common.GIAS.AttributeInformation)

Example 9 with AttributeInformation

use of org.codice.alliance.nsili.common.GIAS.AttributeInformation in project alliance by codice.

the class AttributeInformationGenerator method generateMandatoryNSIL_ALL_VIEWAttributeList.

// All attributes here are queryable
private static AttributeInformation[] generateMandatoryNSIL_ALL_VIEWAttributeList() {
    List<AttributeInformation> attributeInformationList = new ArrayList<>();
    Domain domain = new Domain();
    domain.t(36);
    attributeInformationList.add(createAttributeInformation(NsiliConstants.IDENTIFIER_UUID, AttributeType.TEXT, domain, "", "", RequirementMode.MANDATORY, "", false, true));
    domain = new Domain();
    domain.l(NsiliConstants.getContentStrings().toArray(new String[NsiliConstants.getContentStrings().size()]));
    attributeInformationList.add(createAttributeInformation(NsiliConstants.TYPE, AttributeType.TEXT, domain, "", "", RequirementMode.MANDATORY, "", false, true));
    domain = new Domain();
    domain.t(159);
    attributeInformationList.add(createAttributeInformation(NsiliConstants.TARGET_NUMBER, AttributeType.TEXT, domain, "", "", RequirementMode.OPTIONAL, "", false, true));
    domain = new Domain();
    domain.t(200);
    attributeInformationList.add(createAttributeInformation(NsiliConstants.SOURCE, AttributeType.TEXT, domain, "", "", RequirementMode.OPTIONAL, "", false, true));
    domain = new Domain();
    domain.t(40);
    attributeInformationList.add(createAttributeInformation(NsiliConstants.IDENTIFIER_MISSION, AttributeType.TEXT, domain, "", "", RequirementMode.OPTIONAL, "", false, true));
    domain = new Domain();
    domain.d(DATE_RANGE);
    attributeInformationList.add(createAttributeInformation(NsiliConstants.DATE_TIME_DECLARED, AttributeType.UCOS_ABS_TIME, domain, "UTC", "", RequirementMode.OPTIONAL, "", true, true));
    attributeInformationList.add(createAttributeInformation(NsiliConstants.DATE_TIME_MODIFIED, AttributeType.UCOS_ABS_TIME, domain, "UTC", "", RequirementMode.OPTIONAL, "", false, true));
    domain = new Domain();
    domain.g(RECTANGLE_DOMAIN);
    attributeInformationList.add(createAttributeInformation(NsiliConstants.SPATIAL_GEOGRAPHIC_REF_BOX, AttributeType.UCOS_RECTANGLE, domain, "", "", RequirementMode.OPTIONAL, "", true, true));
    domain = new Domain();
    domain.fps(FLOATING_POINT_RANGE);
    attributeInformationList.add(createAttributeInformation(NsiliConstants.IDENTIFIER_JOB, AttributeType.FLOATING_POINT, domain, "", "", RequirementMode.MANDATORY, "", false, true));
    domain = new Domain();
    domain.ir(new IntegerRange(0, 2147483647));
    attributeInformationList.add(createAttributeInformation(NsiliConstants.NUMBER_OF_TARGET_REPORTS, AttributeType.INTEGER, domain, "", "", RequirementMode.MANDATORY, "", false, true));
    domain = new Domain();
    domain.l(IMAGERY_DOMAIN);
    attributeInformationList.add(createAttributeInformation(NsiliConstants.CATEGORY, AttributeType.TEXT, domain, "", "", RequirementMode.MANDATORY, "", false, true));
    domain = new Domain();
    domain.l(DECOMPRESSION_TECHNIQUE);
    attributeInformationList.add(createAttributeInformation(NsiliConstants.DECOMPRESSION_TECHNIQUE, AttributeType.TEXT, domain, "", "", RequirementMode.MANDATORY, "", false, true));
    domain = new Domain();
    domain.t(10);
    attributeInformationList.add(createAttributeInformation(NsiliConstants.IDENTIFIER, AttributeType.TEXT, domain, "", "", RequirementMode.MANDATORY, "", false, true));
    domain = new Domain();
    domain.ir(new IntegerRange(0, 99999));
    attributeInformationList.add(createAttributeInformation(NsiliConstants.NUMBER_OF_BANDS, AttributeType.INTEGER, domain, "", "", RequirementMode.MANDATORY, "", false, true));
    domain = new Domain();
    domain.t(200);
    attributeInformationList.add(createAttributeInformation(NsiliConstants.RECIPIENT, AttributeType.TEXT, domain, "", "", RequirementMode.MANDATORY, "", false, true));
    domain = new Domain();
    domain.t(2048);
    attributeInformationList.add(createAttributeInformation(NsiliConstants.MESSAGE_BODY, AttributeType.TEXT, domain, "", "", RequirementMode.MANDATORY, "", false, true));
    domain = new Domain();
    domain.l(MESSAGE_TYPE);
    attributeInformationList.add(createAttributeInformation(NsiliConstants.MESSAGE_TYPE, AttributeType.TEXT, domain, "", "", RequirementMode.MANDATORY, "", false, true));
    domain = new Domain();
    domain.l(CLASSIFICATION_DOMAIN);
    attributeInformationList.add(createAttributeInformation(NsiliConstants.CLASSIFICATION, AttributeType.TEXT, domain, "", "", RequirementMode.MANDATORY, "", true, true));
    domain = new Domain();
    domain.t(20);
    attributeInformationList.add(createAttributeInformation(NsiliConstants.POLICY, AttributeType.TEXT, domain, "", "", RequirementMode.MANDATORY, "", true, true));
    domain = new Domain();
    domain.t(50);
    attributeInformationList.add(createAttributeInformation(NsiliConstants.RELEASABILITY, AttributeType.TEXT, domain, "", "", RequirementMode.MANDATORY, "", true, true));
    domain = new Domain();
    domain.t(0);
    attributeInformationList.add(createAttributeInformation(NsiliConstants.PART_IDENTIFIER, AttributeType.TEXT, domain, "", "", RequirementMode.MANDATORY, "", false, true));
    domain = new Domain();
    domain.t(200);
    attributeInformationList.add(createAttributeInformation(NsiliConstants.CREATOR, AttributeType.TEXT, domain, "", "", RequirementMode.MANDATORY, "", true, true));
    domain = new Domain();
    domain.l(ENCODING_SCHEMES);
    attributeInformationList.add(createAttributeInformation(NsiliConstants.ENCODING_SCHEME, AttributeType.TEXT, domain, "", "", RequirementMode.MANDATORY, "", false, true));
    AttributeInformation[] attributeInformationArray = new AttributeInformation[attributeInformationList.size()];
    for (int i = 0; i < attributeInformationArray.length; i++) {
        attributeInformationArray[i] = attributeInformationList.get(i);
    }
    return attributeInformationArray;
}
Also used : AttributeInformation(org.codice.alliance.nsili.common.GIAS.AttributeInformation) IntegerRange(org.codice.alliance.nsili.common.GIAS.IntegerRange) ArrayList(java.util.ArrayList) Domain(org.codice.alliance.nsili.common.GIAS.Domain)

Example 10 with AttributeInformation

use of org.codice.alliance.nsili.common.GIAS.AttributeInformation in project alliance by codice.

the class NsiliSource method initSortableAndResultAttributes.

/**
 * Obtains all possible attributes for all possible views that the Federated Source can provide,
 * and populates a sortableAttributes map, as well as resultAttributes map that will be used for
 * querying the server. According to ANNEX D, TABLE D-6, the passed parameter in get_view_names is
 * an empty list(not used).
 *
 * @return a map of each view and the attributes provided by the source for that view
 */
private void initSortableAndResultAttributes() {
    if (views == null || views.length == 0) {
        return;
    }
    HashMap<String, String[]> resultAttributesMap = new HashMap<>();
    HashMap<String, List<String>> sortableAttributesMap = new HashMap<>();
    try {
        for (int i = 0; i < views.length; i++) {
            List<String> sortableAttributesList = new ArrayList<>();
            AttributeInformation[] attributeInformationArray = dataModelMgr.get_attributes(views[i].view_name, new NameValue[0]);
            String[] resultAttributes = new String[attributeInformationArray.length];
            LOGGER.debug("Attributes for view: {}", views[i].view_name);
            for (int c = 0; c < attributeInformationArray.length; c++) {
                AttributeInformation attributeInformation = attributeInformationArray[c];
                resultAttributes[c] = attributeInformation.attribute_name;
                if (LOGGER.isDebugEnabled()) {
                    getModeStr(attributeInformation);
                }
                if (attributeInformation.sortable) {
                    sortableAttributesList.add(attributeInformation.attribute_name);
                }
            }
            sortableAttributesMap.put(views[i].view_name, sortableAttributesList);
            resultAttributesMap.put(views[i].view_name, resultAttributes);
        }
    } catch (ProcessingFault | SystemFault | InvalidInputParameter e) {
        LOGGER.debug("{} : Unable to retrieve queryable attributes.", sourceId, e);
    }
    if (resultAttributesMap.size() == 0) {
        LOGGER.debug("{} : Received empty attributes list from STANAG source.", getId());
    }
    this.sortableAttributes = sortableAttributesMap;
    this.resultAttributes = resultAttributesMap;
}
Also used : AttributeInformation(org.codice.alliance.nsili.common.GIAS.AttributeInformation) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ProcessingFault(org.codice.alliance.nsili.common.UCO.ProcessingFault) SystemFault(org.codice.alliance.nsili.common.UCO.SystemFault) List(java.util.List) ArrayList(java.util.ArrayList) InvalidInputParameter(org.codice.alliance.nsili.common.UCO.InvalidInputParameter)

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