Loading src/main/java/org/etsi/osl/metrico/mapper/JobMapper.java +15 −19 Original line number Diff line number Diff line Loading @@ -20,23 +20,26 @@ public class JobMapper { job.setMeasurementCollectionJobRef(UUID.fromString(measurementCollectionJob.getUuid())); if(measurementCollectionJob.getDataAccessEndpoint().size()!=1){ if(measurementCollectionJob.getDataAccessEndpoint().size()!=1){ // DataAccessEndpoint will provide the Monitoring API IP throw new IllegalArgumentException("DataAccessEndpoint should be exactly one"); }else { DataAccessEndpoint dataAccessEndpoint = measurementCollectionJob.getDataAccessEndpoint().get(0); job.setDataAccessEndPointRef(UUID.fromString(dataAccessEndpoint.getUuid())); if(SupportedDataAccessEndpoints.contains(dataAccessEndpoint.getApiType())){ if (SupportedDataAccessEndpoints.contains(dataAccessEndpoint.getApiType())) { // SupportedDataAccessEndpoints is an ENUM with all the supported API types job.setApiType(dataAccessEndpoint.getApiType()); } else if (dataAccessEndpoint.getApiType() == null) { throw new IllegalArgumentException("API type needs to be defined"); } else { throw new IllegalArgumentException("API type " + dataAccessEndpoint.getApiType() + " not supported"); } if (dataAccessEndpoint.getUri() != null) { job.setDataAccessEndPointUri(dataAccessEndpoint.getUri()); } else { throw new IllegalArgumentException("DataAccessEndpointUri cannot be null"); } } if(measurementCollectionJob.getJobCollectionFilter().getMappings().size() == 1){ DataFilterMap query = measurementCollectionJob.getJobCollectionFilter(); Loading @@ -46,17 +49,10 @@ public class JobMapper { throw new IllegalArgumentException("There should be exactly one query"); } } job.setStartDateTime(measurementCollectionJob.getScheduleDefinition().get(0).getScheduleDefinitionStartTime()); job.setEndDateTime(measurementCollectionJob.getScheduleDefinition().get(0).getScheduleDefinitionEndTime()); // job.setStartDateTime(measurementCollectionJob.getReportingPeriod()); @Valid Granularity granularity = measurementCollectionJob.getGranularity(); job.setExecutionInterval(convertGranularityToSeconds(measurementCollectionJob.getGranularity().getValue())); logger.atDebug().setMessage("Received MeasurementCollectionJob:\n" + measurementCollectionJob + "\nConverted it to Job:\n" + job).log(); Loading Loading
src/main/java/org/etsi/osl/metrico/mapper/JobMapper.java +15 −19 Original line number Diff line number Diff line Loading @@ -20,23 +20,26 @@ public class JobMapper { job.setMeasurementCollectionJobRef(UUID.fromString(measurementCollectionJob.getUuid())); if(measurementCollectionJob.getDataAccessEndpoint().size()!=1){ if(measurementCollectionJob.getDataAccessEndpoint().size()!=1){ // DataAccessEndpoint will provide the Monitoring API IP throw new IllegalArgumentException("DataAccessEndpoint should be exactly one"); }else { DataAccessEndpoint dataAccessEndpoint = measurementCollectionJob.getDataAccessEndpoint().get(0); job.setDataAccessEndPointRef(UUID.fromString(dataAccessEndpoint.getUuid())); if(SupportedDataAccessEndpoints.contains(dataAccessEndpoint.getApiType())){ if (SupportedDataAccessEndpoints.contains(dataAccessEndpoint.getApiType())) { // SupportedDataAccessEndpoints is an ENUM with all the supported API types job.setApiType(dataAccessEndpoint.getApiType()); } else if (dataAccessEndpoint.getApiType() == null) { throw new IllegalArgumentException("API type needs to be defined"); } else { throw new IllegalArgumentException("API type " + dataAccessEndpoint.getApiType() + " not supported"); } if (dataAccessEndpoint.getUri() != null) { job.setDataAccessEndPointUri(dataAccessEndpoint.getUri()); } else { throw new IllegalArgumentException("DataAccessEndpointUri cannot be null"); } } if(measurementCollectionJob.getJobCollectionFilter().getMappings().size() == 1){ DataFilterMap query = measurementCollectionJob.getJobCollectionFilter(); Loading @@ -46,17 +49,10 @@ public class JobMapper { throw new IllegalArgumentException("There should be exactly one query"); } } job.setStartDateTime(measurementCollectionJob.getScheduleDefinition().get(0).getScheduleDefinitionStartTime()); job.setEndDateTime(measurementCollectionJob.getScheduleDefinition().get(0).getScheduleDefinitionEndTime()); // job.setStartDateTime(measurementCollectionJob.getReportingPeriod()); @Valid Granularity granularity = measurementCollectionJob.getGranularity(); job.setExecutionInterval(convertGranularityToSeconds(measurementCollectionJob.getGranularity().getValue())); logger.atDebug().setMessage("Received MeasurementCollectionJob:\n" + measurementCollectionJob + "\nConverted it to Job:\n" + job).log(); Loading