use of io.arlas.server.core.model.DublinCoreElementName in project ARLAS-server by gisaia.
the class RecordBuilder method getFullResult.
public static RecordType getFullResult(CollectionReference collectionReference, String[] elements, String baseUri, boolean inspireIsEnabled) {
RecordType record = new RecordType();
DublinCoreElementName dublinCoreElementName = collectionReference.params.dublinCoreElementName;
Inspire inspire = collectionReference.params.inspire;
addIdentifier(record, dublinCoreElementName.identifier);
if (elements.length == 0 || elements == null) {
// ADD ALL field
addTitle(record, dublinCoreElementName.title);
if (inspire != null && inspire.keywords != null) {
inspire.keywords.forEach(keyword -> {
if (keyword.value != null) {
addSubject(record, keyword.value);
}
});
}
if (!StringUtil.isNullOrEmpty(dublinCoreElementName.subject)) {
addSubject(record, dublinCoreElementName.subject);
}
if (inspireIsEnabled) {
addType(record, RESOURCE_TYPE);
} else {
addType(record, dublinCoreElementName.type);
}
addBbox(record, dublinCoreElementName.bbox);
addModified(record, dublinCoreElementName.getDate());
addFormat(record, dublinCoreElementName.format);
addAbstract(record, dublinCoreElementName.description);
addUrlToWFS(record, baseUri + "ogc/wfs/" + collectionReference.collectionName + "/?" + OGCConstant.WFS_GET_CAPABILITIES_PARAMETERS);
} else {
for (String element : Arrays.asList(elements)) {
switch(element.toLowerCase()) {
case CSWConstant.DC_FIELD_TITLE:
addTitle(record, dublinCoreElementName.title);
break;
case CSWConstant.DC_FIELD_TYPE:
if (inspireIsEnabled) {
addType(record, RESOURCE_TYPE);
} else {
addType(record, dublinCoreElementName.type);
}
break;
case CSWConstant.DC_FIELD_BBOX:
addBbox(record, dublinCoreElementName.bbox);
break;
case CSWConstant.DC_FIELD_SUBJECT:
if (inspire.keywords != null) {
inspire.keywords.forEach(keyword -> addSubject(record, keyword.value));
}
if (!StringUtil.isNullOrEmpty(dublinCoreElementName.subject)) {
addSubject(record, dublinCoreElementName.subject);
}
break;
case CSWConstant.DC_FIELD_MODIFIED:
addModified(record, dublinCoreElementName.getDate());
break;
case CSWConstant.DC_FIELD_FORMAT:
addFormat(record, dublinCoreElementName.format);
break;
case CSWConstant.DC_FIELD_ABSTRACT:
addAbstract(record, dublinCoreElementName.description);
break;
}
}
}
return record;
}
use of io.arlas.server.core.model.DublinCoreElementName in project ARLAS-server by gisaia.
the class CollectionTool method deleteCsw.
public void deleteCsw() throws IOException {
DataSetTool.clearDataSet();
InputStreamReader dcelementForCollection = new InputStreamReader(CollectionTool.class.getClassLoader().getResourceAsStream("csw.collection.dcelements.json"));
ObjectMapper objectMapper = new ObjectMapper();
DublinCoreElementName[] dcelements = objectMapper.readValue(dcelementForCollection, DublinCoreElementName[].class);
Arrays.asList(dcelements).forEach(dublinCoreElementName -> {
String url = arlasPath + "collections/" + dublinCoreElementName.title.split(" ")[0].toLowerCase();
// DELETE collection
when().delete(url).then().statusCode(200);
});
}
use of io.arlas.server.core.model.DublinCoreElementName in project ARLAS-server by gisaia.
the class RecordBuilder method getBriefResult.
public static BriefRecordType getBriefResult(CollectionReference collectionReference, String[] elements, boolean inspireIsEnabled) {
BriefRecordType briefRecord = new BriefRecordType();
DublinCoreElementName dublinCoreElementName = collectionReference.params.dublinCoreElementName;
addIdentifier(briefRecord, dublinCoreElementName.identifier);
if (elements.length == 0 || elements == null) {
// ADD ALL field
addTitle(briefRecord, dublinCoreElementName.title);
if (inspireIsEnabled) {
addType(briefRecord, RESOURCE_TYPE);
} else {
addType(briefRecord, dublinCoreElementName.type);
}
addBbox(briefRecord, dublinCoreElementName.bbox);
} else {
for (String element : Arrays.asList(elements)) {
switch(element.toLowerCase()) {
case CSWConstant.DC_FIELD_TITLE:
addTitle(briefRecord, dublinCoreElementName.title);
break;
case CSWConstant.DC_FIELD_TYPE:
if (inspireIsEnabled) {
addType(briefRecord, RESOURCE_TYPE);
} else {
addType(briefRecord, dublinCoreElementName.type);
}
break;
case CSWConstant.DC_FIELD_BBOX:
addBbox(briefRecord, dublinCoreElementName.bbox);
break;
}
}
}
return briefRecord;
}
use of io.arlas.server.core.model.DublinCoreElementName in project ARLAS-server by gisaia.
the class RecordBuilder method getSummaryResult.
public static SummaryRecordType getSummaryResult(CollectionReference collectionReference, String[] elements, String baseUri, boolean inspireIsEnabled) {
SummaryRecordType summaryRecord = new SummaryRecordType();
DublinCoreElementName dublinCoreElementName = collectionReference.params.dublinCoreElementName;
Inspire inspire = collectionReference.params.inspire;
addIdentifier(summaryRecord, dublinCoreElementName.identifier);
if (elements.length == 0) {
// ADD ALL field
addTitle(summaryRecord, dublinCoreElementName.title);
if (inspire != null && inspire.keywords != null) {
inspire.keywords.forEach(keyword -> {
addSubject(summaryRecord, keyword.value);
});
}
if (!StringUtil.isNullOrEmpty(dublinCoreElementName.subject)) {
addSubject(summaryRecord, dublinCoreElementName.subject);
}
if (inspireIsEnabled) {
addType(summaryRecord, RESOURCE_TYPE);
} else {
addType(summaryRecord, dublinCoreElementName.type);
}
addBbox(summaryRecord, dublinCoreElementName.bbox);
addModified(summaryRecord, dublinCoreElementName.getDate());
addFormat(summaryRecord, dublinCoreElementName.format);
addAbstract(summaryRecord, dublinCoreElementName.description);
addUrlToWFS(summaryRecord, baseUri + "ogc/wfs/" + collectionReference.collectionName + "/?" + OGCConstant.WFS_GET_CAPABILITIES_PARAMETERS);
} else {
for (String element : Arrays.asList(elements)) {
switch(element.toLowerCase()) {
case CSWConstant.DC_FIELD_TITLE:
addTitle(summaryRecord, dublinCoreElementName.title);
break;
case CSWConstant.DC_FIELD_TYPE:
if (inspireIsEnabled) {
addType(summaryRecord, RESOURCE_TYPE);
} else {
addType(summaryRecord, dublinCoreElementName.type);
}
break;
case CSWConstant.DC_FIELD_BBOX:
addBbox(summaryRecord, dublinCoreElementName.bbox);
break;
case CSWConstant.DC_FIELD_SUBJECT:
if (inspire.keywords != null) {
inspire.keywords.forEach(keyword -> addSubject(summaryRecord, keyword.value));
}
if (!StringUtil.isNullOrEmpty(dublinCoreElementName.subject)) {
addSubject(summaryRecord, dublinCoreElementName.subject);
}
break;
case CSWConstant.DC_FIELD_MODIFIED:
addModified(summaryRecord, dublinCoreElementName.getDate());
break;
case CSWConstant.DC_FIELD_FORMAT:
addFormat(summaryRecord, dublinCoreElementName.format);
break;
case CSWConstant.DC_FIELD_ABSTRACT:
addAbstract(summaryRecord, dublinCoreElementName.description);
break;
}
}
}
return summaryRecord;
}
use of io.arlas.server.core.model.DublinCoreElementName in project ARLAS-server by gisaia.
the class CollectionTool method load.
public void load(long sleepAfter) throws ArlasException {
try {
DataSetTool.loadDataSet();
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
throw e;
}
CollectionReferenceParameters params = new CollectionReferenceParameters();
params.indexName = DataSetTool.DATASET_INDEX_NAME;
params.idPath = DataSetTool.DATASET_ID_PATH;
params.geometryPath = DataSetTool.WKT_GEOMETRIES ? DataSetTool.DATASET_WKT_GEOMETRY_PATH : DataSetTool.DATASET_GEOMETRY_PATH;
params.centroidPath = DataSetTool.DATASET_CENTROID_PATH;
params.h3Path = DataSetTool.DATASET_H3_PATH;
params.timestampPath = DataSetTool.DATASET_TIMESTAMP_PATH;
params.excludeFields = DataSetTool.DATASET_EXCLUDE_FIELDS;
params.excludeWfsFields = DataSetTool.DATASET_EXCLUDE_WFS_FIELDS;
params.rasterTileURL = DataSetTool.DATASET_TILE_URL;
params.rasterTileWidth = 256;
params.rasterTileHeight = 256;
params.inspire = new Inspire();
params.inspire.lineage = DataSetTool.DATASET_INSPIRE_LINEAGE;
params.inspire.topicCategories = Arrays.asList(DataSetTool.DATASET_INSPIRE_TOPIC_CATEGORY);
params.dublinCoreElementName = new DublinCoreElementName();
params.dublinCoreElementName.title = DataSetTool.DATASET_DUBLIN_CORE_TITLE;
params.dublinCoreElementName.description = DataSetTool.DATASET_DUBLIN_CORE_DESCRIPTION;
params.dublinCoreElementName.language = DataSetTool.DATASET_DUBLIN_CORE_LANGUAGE;
// PUT new collection
given().contentType("application/json").body(params).when().put(getUrlPath()).then().statusCode(200);
Filter filter = new Filter();
filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("params.job", OperatorEnum.eq, DataSetTool.jobs[0])));
params.filter = filter;
given().contentType("application/json").body(params).when().put(arlasPath + "collections/" + COLLECTION_NAME_ACTOR).then().statusCode(200);
try {
Thread.sleep(sleepAfter);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
Aggregations