Search in sources :

Example 1 with AreaType

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;
}
Also used : Dataset(eu.europa.ec.fisheries.wsdl.user.types.Dataset) ArrayList(java.util.ArrayList) AreaType(eu.europa.ec.fisheries.uvms.spatial.model.schemas.AreaType) AreaIdentifierType(eu.europa.ec.fisheries.uvms.spatial.model.schemas.AreaIdentifierType)

Aggregations

AreaIdentifierType (eu.europa.ec.fisheries.uvms.spatial.model.schemas.AreaIdentifierType)1 AreaType (eu.europa.ec.fisheries.uvms.spatial.model.schemas.AreaType)1 Dataset (eu.europa.ec.fisheries.wsdl.user.types.Dataset)1 ArrayList (java.util.ArrayList)1