protected <T extends SweAbstractDataComponent> T setCommonValues( T component, Data<?> valuedObservation) throws CodedException { if (valuedObservation != null) { PhenomenonEntity op = valuedObservation.getDataset().getPhenomenon(); component.setIdentifier(op.getIdentifier()); component.setDefinition(op.getIdentifier()); component.setDescription(op.getDescription()); if (op.isSetNameCodespace()) { String codespace = op.getNameCodespace().getName(); try { component.setName(new CodeType(op.getName(), new URI(codespace))); } catch (URISyntaxException e) { throw new NoApplicableCodeException().causedBy(e).withMessage( "Error while creating URI from '{}'", codespace); } } else { component.setName(op.getName()); } if (valuedObservation.getDataset().hasUnit() && component instanceof SweAbstractUomType) { SweAbstractUomType<?> uomType = (SweAbstractUomType<?>) component; uomType.setUom(valuedObservation.getDataset().getUnit().getUnit()); } } return component; }
protected <T extends SweAbstractDataComponent> T setCommonValues( T component, Data<?> valuedObservation) throws CodedException { if (valuedObservation != null) { PhenomenonEntity op = valuedObservation.getDataset().getPhenomenon(); component.setIdentifier(op.getIdentifier()); component.setDefinition(op.getIdentifier()); component.setDescription(op.getDescription()); if (op.isSetNameCodespace()) { String codespace = op.getNameCodespace().getName(); try { component.setName(new CodeType(op.getName(), new URI(codespace))); } catch (URISyntaxException e) { throw new NoApplicableCodeException().causedBy(e).withMessage( "Error while creating URI from '{}'", codespace); } } else { component.setName(op.getName()); } if (valuedObservation.getDataset().hasUnit() && component instanceof SweAbstractUomType) { SweAbstractUomType<?> uomType = (SweAbstractUomType<?>) component; uomType.setUom(valuedObservation.getDataset().getUnit().getUnit()); } } return component; }