Search in sources :

Example 11 with AttributeInformation

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

the class NsiliFilterDelegateTest method testPropertyLike.

@Test
public void testPropertyLike() {
    String filter = filterDelegate.propertyIsLike(ANY_TEXT, ATTRIBUTE, false);
    List<AttributeInformation> attributeInformationList = generateAttributeInformation().get(NsiliConstants.NSIL_ALL_VIEW);
    StringBuilder result = new StringBuilder();
    for (AttributeInformation attributeInformation : attributeInformationList) {
        if (attributeInformation.attribute_type.equals(AttributeType.TEXT) && attributeInformation.attribute_domain.discriminator() == DomainType.TEXT_VALUE) {
            result.append(getPrimary(attributeInformation.attribute_name, NsiliFilterFactory.LIKE, NsiliFilterDelegate.SQ + NsiliFilterDelegate.WILDCARD + ATTRIBUTE + NsiliFilterDelegate.WILDCARD + NsiliFilterDelegate.SQ) + NsiliFilterFactory.OR);
        }
    }
    String resultString = result.toString();
    resultString = resultString.substring(0, result.length() - 4);
    assertThat(filter, is(resultString));
    assertThat(filter, not(containsString(NsiliConstants.ADVANCED_GEOSPATIAL)));
}
Also used : AttributeInformation(org.codice.alliance.nsili.common.GIAS.AttributeInformation) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test)

Example 12 with AttributeInformation

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

the class NsiliFilterDelegateTest method testPropertyLikeEmptyAttributesForView.

@Test
public void testPropertyLikeEmptyAttributesForView() {
    Map<String, List<AttributeInformation>> map = new HashMap<>();
    List<AttributeInformation> list = new ArrayList<>();
    map.put(NsiliConstants.NSIL_ALL_VIEW, list);
    NsiliFilterDelegate filterDelegate = new NsiliFilterDelegate(map, NsiliConstants.NSIL_ALL_VIEW);
    String filter = filterDelegate.propertyIsLike(ANY_TEXT, ATTRIBUTE, false);
    assertThat(filter, is(NsiliFilterDelegate.EMPTY_STRING));
}
Also used : AttributeInformation(org.codice.alliance.nsili.common.GIAS.AttributeInformation) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test)

Example 13 with AttributeInformation

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

the class NsiliFilterDelegateTest method generateAttributeInformation.

private static Map<String, List<AttributeInformation>> generateAttributeInformation() {
    List<AttributeInformation> attributeInformationList = new ArrayList<>();
    Domain domain = new Domain();
    domain.t(36);
    attributeInformationList.add(createAttributeInformation(NsiliConstants.NSIL_COMMON + "." + NsiliConstants.IDENTIFIER_UUID, AttributeType.TEXT, domain, NsiliFilterDelegate.EMPTY_STRING, NsiliFilterDelegate.EMPTY_STRING, RequirementMode.MANDATORY, NsiliFilterDelegate.EMPTY_STRING, false, true));
    domain = new Domain();
    DateRange dateRange = new DateRange();
    domain.d(dateRange);
    attributeInformationList.add(createAttributeInformation(NsiliConstants.NSIL_CARD + "." + NsiliConstants.DATE_TIME_MODIFIED, AttributeType.TEXT, domain, NsiliFilterDelegate.EMPTY_STRING, NsiliFilterDelegate.EMPTY_STRING, RequirementMode.MANDATORY, NsiliFilterDelegate.EMPTY_STRING, false, true));
    domain = new Domain();
    domain.g(RECTANGLE_DOMAIN);
    attributeInformationList.add(createAttributeInformation(NsiliConstants.NSIL_COVERAGE + "." + NsiliConstants.SPATIAL_GEOGRAPHIC_REF_BOX, AttributeType.UCOS_RECTANGLE, domain, NsiliFilterDelegate.EMPTY_STRING, NsiliFilterDelegate.EMPTY_STRING, RequirementMode.OPTIONAL, NsiliFilterDelegate.EMPTY_STRING, true, true));
    domain = new Domain();
    domain.ir(new IntegerRange(0, 100));
    attributeInformationList.add(createAttributeInformation(NsiliConstants.NSIL_IMAGERY + "." + NsiliConstants.NUMBER_OF_BANDS, AttributeType.INTEGER, domain, NsiliFilterDelegate.EMPTY_STRING, NsiliFilterDelegate.EMPTY_STRING, RequirementMode.MANDATORY, NsiliFilterDelegate.EMPTY_STRING, true, true));
    HashMap<String, List<AttributeInformation>> map = new HashMap<>();
    map.put(NsiliConstants.NSIL_ALL_VIEW, attributeInformationList);
    return map;
}
Also used : AttributeInformation(org.codice.alliance.nsili.common.GIAS.AttributeInformation) DateRange(org.codice.alliance.nsili.common.GIAS.DateRange) IntegerRange(org.codice.alliance.nsili.common.GIAS.IntegerRange) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Matchers.containsString(org.hamcrest.Matchers.containsString) Domain(org.codice.alliance.nsili.common.GIAS.Domain)

Example 14 with AttributeInformation

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

the class NsiliAttributesGenerator method getNsilGmtiAttributes.

public static List<AttributeInformation> getNsilGmtiAttributes() {
    String prefix = NsiliConstants.NSIL_GMTI + ".";
    Domain domain;
    List<AttributeInformation> attributes = new ArrayList<>();
    domain = new Domain();
    domain.fr(new FloatingPointRange(0.0, 4294967295.0));
    attributes.add(new AttributeInformation(prefix + NsiliConstants.IDENTIFIER_JOB, AttributeType.FLOATING_POINT, domain, "", "", RequirementMode.MANDATORY, "A platform-assigned number identifying the specific requestor task to which the packet pertains. The Job ID shall be unique within a mission.", false, true));
    domain = new Domain();
    domain.ir(POSITIVE_INT_RANGE);
    attributes.add(new AttributeInformation(prefix + NsiliConstants.NUMBER_OF_TARGET_REPORTS, AttributeType.INTEGER, domain, "", "", RequirementMode.MANDATORY, "The total number of target reports within all the dwells in the file.", false, true));
    return attributes;
}
Also used : AttributeInformation(org.codice.alliance.nsili.common.GIAS.AttributeInformation) FloatingPointRange(org.codice.alliance.nsili.common.GIAS.FloatingPointRange) ArrayList(java.util.ArrayList) Domain(org.codice.alliance.nsili.common.GIAS.Domain)

Example 15 with AttributeInformation

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

the class NsiliAttributesGenerator method getNsilTaskAttributes.

public static List<AttributeInformation> getNsilTaskAttributes() {
    String prefix = NsiliConstants.NSIL_TASK + ".";
    Domain domain;
    List<AttributeInformation> attributes = new ArrayList<>();
    domain = new Domain();
    domain.t(255);
    attributes.add(new AttributeInformation(prefix + NsiliConstants.COMMENTS, AttributeType.TEXT, domain, "", "", RequirementMode.OPTIONAL, "Status of the task", false, true));
    domain = new Domain();
    domain.l(getTaskStatusOptions());
    attributes.add(new AttributeInformation(prefix + NsiliConstants.STATUS, AttributeType.TEXT, domain, "", "", RequirementMode.MANDATORY, "Status of the task", 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)

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