use of org.codice.alliance.nsili.common.GIAS.AttributeInformation in project alliance by codice.
the class NsiliFilterDelegate method isSupportedQueryableAttribute.
private boolean isSupportedQueryableAttribute(String propertyName) {
List<String> mappedProperties = NsiliFilterFactory.mapToNsilQuery(propertyName);
boolean supportedQueryAttribute = false;
for (AttributeInformation attributeInformation : queryableAttributes.get(view)) {
for (String mappedProperty : mappedProperties) {
if (attributeInformation.attribute_name.equals(mappedProperty)) {
supportedQueryAttribute = true;
break;
}
}
}
return supportedQueryAttribute;
}
use of org.codice.alliance.nsili.common.GIAS.AttributeInformation in project alliance by codice.
the class NsiliFilterFactory method buildPropertyIsLike.
public String buildPropertyIsLike(String propertyName, String value) {
if (queryableAttributes == null) {
return NsiliFilterDelegate.EMPTY_STRING;
}
// Replace * with %, since * is not a valid wildcard in BQS
value = value.replaceAll("\\*", NsiliFilterDelegate.WILDCARD);
value = value.replaceAll("\\?", NsiliFilterDelegate.WILDCARD);
boolean addPrefixWildcard = false;
boolean addPostfixWildcard = false;
if (!value.startsWith(NsiliFilterDelegate.WILDCARD)) {
addPrefixWildcard = true;
}
if (!value.endsWith(NsiliFilterDelegate.WILDCARD)) {
addPostfixWildcard = true;
}
List<AttributeInformation> attributeInformationList = queryableAttributes.get(view);
if (attributeInformationList == null) {
return NsiliFilterDelegate.EMPTY_STRING;
}
Map<String, AttributeInformation> attrInfoMap = createAttrInfoMap(attributeInformationList);
List<String> filters = new ArrayList<>();
// anyText searches we will grab each attribute in NSILI, else we add only the attribute
if (propertyName.equals(Metacard.ANY_TEXT)) {
for (AttributeInformation attributeInformation : attributeInformationList) {
if (isTextAttributeType(attributeInformation)) {
setTextFilter(value, addPrefixWildcard, addPostfixWildcard, filters, attributeInformation);
}
}
} else {
List<String> propertyList = mapToNsilQuery(propertyName);
String operator = EQ;
if (addPrefixWildcard || addPostfixWildcard) {
operator = LIKE;
}
for (String property : propertyList) {
AttributeInformation attrInfo = attrInfoMap.get(property);
setNonTextFilter(value, addPrefixWildcard, addPostfixWildcard, filters, operator, property, attrInfo);
}
}
return buildOrFilter(filters);
}
use of org.codice.alliance.nsili.common.GIAS.AttributeInformation in project alliance by codice.
the class NsiliSourceTest method getAttributeInformationMap.
private HashMap<String, List<AttributeInformation>> getAttributeInformationMap() {
HashMap<String, List<AttributeInformation>> map = new HashMap<>();
List<AttributeInformation> list = new ArrayList<>();
Domain domain = new Domain();
domain.t(200);
AttributeInformation attributeInformation = new AttributeInformation(GMTI, AttributeType.TEXT, domain, NsiliFilterDelegate.EMPTY_STRING, NsiliFilterDelegate.EMPTY_STRING, RequirementMode.OPTIONAL, NsiliFilterDelegate.EMPTY_STRING, false, true);
list.add(attributeInformation);
map.put(NsiliConstants.NSIL_ALL_VIEW, list);
return map;
}
use of org.codice.alliance.nsili.common.GIAS.AttributeInformation in project alliance by codice.
the class NsiliAttributesGenerator method getNsilRelatedFileAttributes.
public static List<AttributeInformation> getNsilRelatedFileAttributes() {
String prefix = NsiliConstants.NSIL_RELATED_FILE + ".";
Domain domain;
List<AttributeInformation> attributes = new ArrayList<>();
domain = new Domain();
domain.t(200);
attributes.add(new AttributeInformation(prefix + NsiliConstants.CREATOR, AttributeType.TEXT, domain, "", "", RequirementMode.MANDATORY, "An entity primarily responsible for making the content of the related file. Creator is responsible for the intellectual or creative content of the resource.", true, true));
domain = new Domain();
domain.d(DATE_RANGE);
attributes.add(new AttributeInformation(prefix + NsiliConstants.DATE_TIME_DECLARED, AttributeType.UCOS_ABS_TIME, domain, "", "", RequirementMode.MANDATORY, "Date and time on which the related file was declared, filed or stored (the date the content of the related file was compiled).", true, true));
domain = new Domain();
domain.fr(MAX_STANAG_4559_RANGE);
attributes.add(new AttributeInformation(prefix + NsiliConstants.EXTENT, AttributeType.FLOATING_POINT, domain, "", "", RequirementMode.OPTIONAL, "(Estimated) size of the file, expressed in megabytes. The transfer size is > 0.0.", true, false));
domain = new Domain();
domain.t(0);
attributes.add(new AttributeInformation(prefix + NsiliConstants.FILE_TYPE, AttributeType.TEXT, domain, "", "", RequirementMode.OPTIONAL, "The related file type.", false, false));
domain = new Domain();
domain.t(0);
attributes.add(new AttributeInformation(prefix + NsiliConstants.URL, AttributeType.TEXT, domain, "", "", RequirementMode.OPTIONAL, "An unambiguous reference (in form of an URL) to the related file.", false, false));
domain = new Domain();
domain.bv(true);
attributes.add(new AttributeInformation(prefix + NsiliConstants.IS_FILE_LOCAL, AttributeType.BOOLEAN_DATA, domain, "", "", RequirementMode.OPTIONAL, "Indicates whether the related file is available locally in the library, or resides in a remote library.", true, false));
return attributes;
}
use of org.codice.alliance.nsili.common.GIAS.AttributeInformation in project alliance by codice.
the class NsiliAttributesGenerator method getNsilCardAttributes.
public static List<AttributeInformation> getNsilCardAttributes() {
String prefix = NsiliConstants.NSIL_CARD + ".";
Domain domain;
List<AttributeInformation> attributes = new ArrayList<>();
domain = new Domain();
domain.t(50);
attributes.add(new AttributeInformation(prefix + NsiliConstants.IDENTIFIER, AttributeType.TEXT, domain, "", "", RequirementMode.OPTIONAL, "Alphanumeric identification code associated with the product. The code must universally uniquely identify the product.", true, false));
domain = new Domain();
domain.d(DATE_RANGE);
attributes.add(new AttributeInformation(prefix + NsiliConstants.SOURCE_DATE_TIME_MODIFIED, AttributeType.UCOS_ABS_TIME, domain, "", "", RequirementMode.OPTIONAL, "The date and time upon which information (cataloguing metadata) about the product was last stored or changed in the source IPL. For any STANAG 4559 Edition 3 server that is not the source of the product, but which have received this product through synchronization, the value of this attribute shall stay unchanged as it is in the source STANAG 4559 server. This then means that the date-time value represent the instant in time when the product was uploaded or changed at the product-source STANAG 4559 Server.", true, false));
domain = new Domain();
domain.d(DATE_RANGE);
attributes.add(new AttributeInformation(prefix + NsiliConstants.DATE_TIME_MODIFIED, AttributeType.UCOS_ABS_TIME, domain, "", "", RequirementMode.OPTIONAL, "The date and time upon which information (cataloguing metadata) about the product was last stored or changed in the local IPL. This attribute is used when synchronizing metadata, to capture when the metadata was synchronized (and not when the metadata was created at the source STANAG 4559 Server). For local products, not received through synchronization, the value of this attribute shall be identical to the value of the 'sourceDateTimeModified' attribute.", true, false));
domain = new Domain();
domain.l(getNsilCardStatusOptions());
attributes.add(new AttributeInformation(prefix + NsiliConstants.STATUS, AttributeType.TEXT, domain, "", "", RequirementMode.OPTIONAL, "The status of the product metadata indicating if the metadata entry is new, has been changed or is marked as obsolete. Note: 1. The Library should remove the URL (productURL) when it sets the status to 'OBSOLETE'. Also the ordering of an obsolete product via OrderMgr should not be allowed. 2. A metadata entry should never be removed. 3. The product can never be modified after it has been posted to a library. The 'CHANGED' status refers to the metadata only.", true, false));
domain = new Domain();
domain.ir(NUM_OF_PARTS_RANGE);
attributes.add(new AttributeInformation(prefix + NsiliConstants.NUM_OF_PARTS, AttributeType.INTEGER, domain, "", "", RequirementMode.OPTIONAL, "A number specifying the number of parts belonging to the product", true, false));
domain = new Domain();
domain.t(30);
attributes.add(new AttributeInformation(prefix + NsiliConstants.PUBLISHER, AttributeType.TEXT, domain, "", "", RequirementMode.OPTIONAL, "The name of the organization responsible for making the resource (product) available in an IPL. By doing so the publisher enables the discovery of that resource by a requestor entity (client). Examples of organizations are 'CJTF', 'LCC', 'ACC' etc.", true, true));
domain = new Domain();
domain.t(30);
attributes.add(new AttributeInformation(prefix + NsiliConstants.SOURCE_LIBRARY, AttributeType.TEXT, domain, "", "", RequirementMode.OPTIONAL, "Alphanumeric identification code of the library in which the product was initially ingested. This identifier is NOT identifying the library the client is currently connected to.", true, false));
return attributes;
}
Aggregations