Search in sources :

Example 26 with ProcedureEntity

use of org.n52.series.db.beans.ProcedureEntity in project SOS by 52North.

the class AbstractHibernateProcedureDescriptionGeneratorSml method createPosition.

/**
 * Create SensorML Position from Hibernate procedure entity
 *
 * @param procedure
 *            Hibernate procedure entity
 * @param vector
 *            Flag to indicate that the geometry should be defined as a
 *            vector
 *
 * @return SensorML Position
 */
protected SmlPosition createPosition(ProcedureEntity procedure, boolean vector) {
    SmlPosition position = new SmlPosition();
    position.setName(POSITION_NAME);
    position.setFixed(true);
    int srid = geometryHandler.getDefaultResponseEPSG();
    if (procedure.isSetGeometry()) {
        if (procedure.getGeometry().getSRID() > 0) {
            srid = procedure.getGeometry().getSRID();
        }
        final Coordinate c = procedure.getGeometry().getCoordinate();
        if (vector) {
            position.setVector(createVectorForPosition(createCoordinatesForPosition(c.getY(), c.getX(), c.getZ()), srsNamePrefixUrl + srid));
        } else {
            position.setPosition(createCoordinatesForPosition(c.getY(), c.getX(), c.getZ()));
        }
    }
    if (procedure.getGeometry().getSRID() > 0) {
        srid = procedure.getGeometry().getSRID();
    }
    position.setReferenceFrame(srsNamePrefixUrl + srid);
    return position;
}
Also used : Coordinate(org.locationtech.jts.geom.Coordinate) SweCoordinate(org.n52.shetland.ogc.swe.SweCoordinate) SmlPosition(org.n52.shetland.ogc.sensorML.elements.SmlPosition)

Example 27 with ProcedureEntity

use of org.n52.series.db.beans.ProcedureEntity in project SOS by 52North.

the class HibernateProcedureDescriptionGeneratorInspireOmpr30 method generateProcedureDescription.

/**
 * Generate procedure description from Hibernate procedure entity if no
 * description (file, XML text) is available
 *
 * @param p
 *            Hibernate procedure entity
 * @param session
 *            the session
 *
 * @return Generated procedure description
 *
 * @throws OwsExceptionReport
 *             If an error occurs
 */
public SosProcedureDescription<AbstractFeature> generateProcedureDescription(ProcedureEntity p, Locale i18n, Session session) throws OwsExceptionReport {
    setLocale(i18n);
    final Process process = new Process();
    setCommonData(p, process, session);
    // process.setType();
    addResponsibleParty(process);
    return new SosProcedureDescription<AbstractFeature>(process);
}
Also used : SosProcedureDescription(org.n52.shetland.ogc.sos.SosProcedureDescription) Process(org.n52.shetland.inspire.ompr.Process)

Example 28 with ProcedureEntity

use of org.n52.series.db.beans.ProcedureEntity in project SOS by 52North.

the class HibernateProcedureDescriptionGeneratorSml101 method createRulesDefinition.

/**
 * Create the rules definition for ProcessMethod
 *
 * @param procedure
 *            Hibernate procedure entity
 * @param observableProperties
 *            Properties observed by the procedure
 *
 * @return SensorML RulesDefinition
 */
private RulesDefinition createRulesDefinition(ProcedureEntity procedure, String[] observableProperties) {
    RulesDefinition rD = new RulesDefinition();
    String template = processMethodRulesDefinitionDescriptionTemplate;
    String description = String.format(template, procedure.getIdentifier(), String.join(",", observableProperties));
    rD.setDescription(description);
    return rD;
}
Also used : RulesDefinition(org.n52.shetland.ogc.sensorML.RulesDefinition)

Example 29 with ProcedureEntity

use of org.n52.series.db.beans.ProcedureEntity in project SOS by 52North.

the class HibernateProcedureDescriptionGeneratorSml101 method createSmlProcessModel.

/**
 * Create a SensorML ProcessModel from Hibernate procedure entity
 *
 * @param procedure
 *            Hibernate procedure entity
 * @param session
 *            the session
 *
 * @return SensorML ProcessModel
 *
 * @throws OwsExceptionReport
 *             If an error occurs
 */
private ProcessModel createSmlProcessModel(ProcedureEntity procedure, Session session) throws OwsExceptionReport {
    final ProcessModel processModel = new ProcessModel();
    setCommonValues(procedure, processModel, session);
    processModel.setMethod(createMethod(procedure, getObservablePropertiesForProcedure(procedure.getIdentifier())));
    // processModel.setNames(createNames(procedure));
    return processModel;
}
Also used : ProcessModel(org.n52.shetland.ogc.sensorML.ProcessModel)

Example 30 with ProcedureEntity

use of org.n52.series.db.beans.ProcedureEntity in project SOS by 52North.

the class HibernateProcedureDescriptionGeneratorWml20 method generateProcedureDescription.

/**
 * Generate procedure description from Hibernate procedure entity if no description (file, XML text) is
 * available
 *
 * @param procedure Hibernate procedure entity
 * @param i18n the locale
 * @param session the session
 *
 * @return Generated procedure description
 *
 * @throws OwsExceptionReport If an error occurs
 */
@Override
public SosProcedureDescription<AbstractFeature> generateProcedureDescription(ProcedureEntity procedure, Locale i18n, Session session) throws OwsExceptionReport {
    setLocale(i18n);
    final ObservationProcess op = new ObservationProcess();
    setCommonData(procedure, op, session);
    addName(procedure, op);
    op.setProcessType(new ReferenceType(WaterMLConstants.PROCESS_TYPE_ALGORITHM));
    return new SosProcedureDescription<>(op);
}
Also used : SosProcedureDescription(org.n52.shetland.ogc.sos.SosProcedureDescription) ObservationProcess(org.n52.shetland.ogc.om.series.wml.ObservationProcess) ReferenceType(org.n52.shetland.ogc.gml.ReferenceType)

Aggregations

ProcedureEntity (org.n52.series.db.beans.ProcedureEntity)32 NoApplicableCodeException (org.n52.shetland.ogc.ows.exception.NoApplicableCodeException)14 HibernateException (org.hibernate.HibernateException)11 DatasetEntity (org.n52.series.db.beans.DatasetEntity)10 PhenomenonEntity (org.n52.series.db.beans.PhenomenonEntity)10 Criteria (org.hibernate.Criteria)9 Session (org.hibernate.Session)9 OfferingEntity (org.n52.series.db.beans.OfferingEntity)9 SosProcedureDescription (org.n52.shetland.ogc.sos.SosProcedureDescription)9 HashSet (java.util.HashSet)8 FormatEntity (org.n52.series.db.beans.FormatEntity)7 DetachedCriteria (org.hibernate.criterion.DetachedCriteria)6 DateTime (org.joda.time.DateTime)6 ArrayList (java.util.ArrayList)5 Collection (java.util.Collection)5 HashMap (java.util.HashMap)5 Transaction (org.hibernate.Transaction)5 ProcedureHistoryEntity (org.n52.series.db.beans.ProcedureHistoryEntity)5 Set (java.util.Set)4 Collectors.toCollection (java.util.stream.Collectors.toCollection)4