use of eu.europa.ec.fisheries.uvms.spatial.model.schemas.AreaType in project UVMS-ActivityModule-APP by UnionVMS.
the class UsmUtils method convertDataSetToAreaId.
public static List<AreaIdentifierType> convertDataSetToAreaId(List<Dataset> datasets) throws ServiceException {
List<AreaIdentifierType> areaRestrictions = new ArrayList<>(datasets.size());
for (Dataset dataset : datasets) {
int lastIndexDelimiter = dataset.getDiscriminator().lastIndexOf(USMSpatial.DELIMITER);
if (lastIndexDelimiter > -1) {
AreaIdentifierType areaIdentifierType = new AreaIdentifierType();
AreaType areaType = AreaType.valueOf(dataset.getDiscriminator().substring(0, lastIndexDelimiter));
String areaId = dataset.getDiscriminator().substring(lastIndexDelimiter + 1);
if (areaType != null && StringUtils.isNotBlank(areaId)) {
areaIdentifierType.setAreaType(areaType);
areaIdentifierType.setId(areaId);
areaRestrictions.add(areaIdentifierType);
}
}
}
return areaRestrictions;
}
Aggregations