private static void addChilds(ProcedureEntity procedure, Collection<String> procedures) { if (procedure.hasChildren()) { for (ProcedureEntity child : procedure.getChildren()) { procedures.add(child.getIdentifier()); } } }
@Override public String getLabelFrom(String locale) { StringBuilder sb = new StringBuilder(); sb.append(phenomenon.getLabelFrom(locale)) .append(" "); sb.append(procedure.getLabelFrom(locale)) .append(", "); sb.append(feature.getLabelFrom(locale)) .append(", "); return sb.append(offering.getLabelFrom(locale)) .toString(); }
private Collection<String> getParents(ProcedureEntity procedure) { Set<String> parentProcedures = Sets.newTreeSet(); if (procedure.hasParents()) { for (ProcedureEntity parentEntity : procedure.getParents()) { parentProcedures.add(parentEntity.getIdentifier()); parentProcedures.addAll(getParents(parentEntity)); } } return parentProcedures; }
public static ProcedureEntity createProcedure(String domainId, String name, boolean insitu, boolean mobile, ProxyServiceEntity service) { ProcedureEntity procedure = new ProcedureEntity(); procedure.setName(name); procedure.setDomainId(domainId); procedure.setInsitu(insitu); procedure.setMobile(mobile); procedure.setService(service); return procedure; }
ProcedureEntity procedure = getProcedureForIdentifierIncludeDeleted(identifier, session); if (procedure == null) { procedure = new ProcedureEntity(); procedure.setFormat(procedureDescriptionFormat); procedure.setIdentifier(identifier); if (procedureDescription.getProcedureDescription() instanceof AbstractFeature) { AbstractFeature af = (AbstractFeature) procedureDescription.getProcedureDescription(); if (af.isSetName()) { procedure.setName(af.getFirstName().getValue()); procedure.setDescription(af.getDescription()); ProcedureEntity parent = getProcedureForIdentifier(procedureDescription.getParentProcedure().getHref(), session); if (parent != null) { procedure.setParents(Sets.newHashSet(parent)); if (procedureDescription.getTypeOf() != null && !procedure.isSetTypeOf()) { ProcedureEntity typeOfProc = getProcedureForIdentifier(procedureDescription.getTypeOf().getTitle(), session); if (typeOfProc != null) { procedure.setTypeOf(typeOfProc); procedure.setType(isType); procedure.setAggregation(procedureDescription.isAggregation()); procedure.setReference(procedureDescription.isReference()); procedure.setDeleted(false); session.saveOrUpdate(procedure); session.flush();
protected List<String> createDescriptions(ProcedureEntity procedure, String[] observableProperties) { String template = this.descriptionTemplate; String identifier = procedure.getIdentifier(); String obsProps = Arrays.stream(observableProperties).collect(Collectors.joining(",")); // String type = procedure.isSpatial() ? "sensor system" : "procedure"; String type = "procedure"; return Lists.newArrayList(String.format(template, type, identifier, obsProps)); }
@Override public SosProcedureDescription<?> create(ProcedureEntity p, String descriptionFormat, Locale i18n, HibernateProcedureCreationContext ctx, Session s) throws OwsExceptionReport { String xml = loadDescriptionFromHttp(p.getDescriptionFile()); return new SosProcedureDescriptionUnknownType(p.getIdentifier(), p.getFormat().getFormat(), xml); }
getProcedureDatasets(); for (ProcedureEntity procedure : procedures) { String identifier = procedure.getIdentifier(); getCache().addProcedure(identifier); if (procedure.isSetName()) { getCache().addProcedureIdentifierHumanReadableName(identifier, procedure.getName()); setTypeInstanceProcedure(procedure); Set<String> parents = new HashSet<>(); if (procedure.hasParents()) { getParents(parents, procedure); getCache().addParentProcedures(identifier, parents);
private void addName(ProcedureEntity procedure, ObservationProcess op) { String name = procedure.getIdentifier(); if (procedure.isSetName()) { name = procedure.getName(); } op.addParameter(createName("shortName", name)); op.addParameter(createName("longName", name)); }
private void setTypeInstanceProcedure(ProcedureEntity procedure) { if (procedure.isSetTypeOf()) { getCache().addTypeOfProcedure(procedure.getTypeOf().getIdentifier(), procedure.getIdentifier()); } }
public ProcedureEntity updateProcedure(ProcedureEntity procedure, SosProcedureDescription procedureDescription, Session session) { if (procedureDescription.getProcedureDescription() instanceof AbstractFeature) { AbstractFeature af = (AbstractFeature) procedureDescription.getProcedureDescription(); if (af.isSetName()) { if (!procedure.isSetName() || (procedure.isSetName() && !checkForName(af.getName(), procedure.getName()))) { procedure.setName(af.getFirstName().getValue()); } if (af.isSetDescription() && !af.getDescription().equals(procedure.getDescription())) { procedure.setDescription(af.getDescription()); } } session.saveOrUpdate(procedure); session.flush(); session.refresh(procedure); } return procedure; }
: hProcedure.getFormat().getFormat(); if (getActiveProfile().isEncodeProcedureInObservation()) { return getCreatorContext().getProcedureConverter().createSosProcedureDescription(hProcedure, pdf, } else { SosProcedureDescriptionUnknownType sosProcedure = new SosProcedureDescriptionUnknownType(hProcedure.getIdentifier(), pdf, null); if (hProcedure.isSetName()) { sosProcedure.setHumanReadableIdentifier(hProcedure.getName()); addName(sosProcedure, hProcedure);
protected Set<AbstractSensorML> getChildProcedures() throws OwsExceptionReport { if (!getProcedure().hasChildren()) { return Sets.newHashSet(); for (ProcedureEntity child : getProcedure().getChildren()) { for (ProcedureHistoryEntity cph : child.getProcedureHistory()) { TimePeriod thisCvptValidTime = new TimePeriod(cph.getStartTime(), cph.getEndTime());
private void getParents(Set<String> parents, ProcedureEntity procedure) { for (ProcedureEntity parent : procedure.getParents()) { parents.add(parent.getIdentifier()); getParents(parents, parent); } }
Locale requestedLocale = getLocale(); if (i18nDAO == null) { feature.addName(procedure.getName()); feature.setDescription(procedure.getDescription()); } else { if (requestedLocale != null) { I18NProcedureMetadata i18n = i18nDAO.getMetadata(procedure.getIdentifier(), requestedLocale); Optional<LocalizedString> name = i18n.getName().getLocalization(requestedLocale); if (name.isPresent()) { if (ServiceConfiguration.getInstance().isShowAllLanguageValues()) { i18n = i18nDAO.getMetadata(procedure.getIdentifier()); } else { i18n = i18nDAO.getMetadata(procedure.getIdentifier(), defaultLocale); feature.addName(procedure.getName()); feature.setDescription(procedure.getDescription());
private void setIdentifier(DescribedObject describedObject, ProcedureEntity procedure) { CodeWithAuthority cwa = new CodeWithAuthority(procedure.getIdentifier()); if (procedure.isSetIdentifierCodespace()) { cwa.setCodeSpace(procedure.getIdentifierCodespace().getName()); } else { cwa.setCodeSpace(OGCConstants.UNIQUE_ID); } describedObject.setIdentifier(cwa); }
@Override public SosProcedureDescription<?> create(ProcedureEntity p, String descriptionFormat, Locale i18n, HibernateProcedureCreationContext ctx, Session s) throws OwsExceptionReport { SosProcedureDescription<?> desc = new SosProcedureDescription<>(readXml(vpt.getXml(), ctx)); desc.setIdentifier(p.getIdentifier()); desc.setDescriptionFormat(p.getFormat().getFormat()); return desc; }
private Set<? extends HierarchicalParameterOutput> getProcedureParents(ProcedureEntity entity, DbQuery dbQuery) { return !entity.hasParents() ? Collections.singleton(createCondensed(new ProcedureOutput(), entity, dbQuery)) : new HashSet<>(entity.getParents().stream() .map(e -> createCondensed(new ProcedureOutput(), e, dbQuery)) .collect(Collectors.toSet())); }
private ProcedureOutput createCondensed(ProcedureEntity entity, DbQuery parameters) { ProcedureOutput result = new ProcedureOutput(); result.setLabel(entity.getLabelFrom(parameters.getLocale())); result.setId(Long.toString(entity.getPkid())); result.setDomainId(entity.getDomainId()); checkForHref(result, parameters); return result; }
public static Set<String> getAllProcedureIdentifiersFromDatasetEntitys( Collection<DatasetEntity> datasets, ProcedureFlag procedureFlag) { Set<String> procedures = new HashSet<String>(datasets.size()); for (DatasetEntity dataset : datasets) { if (dataset.getProcedure() != null) { boolean addProcedure = false; if (procedureFlag == null) { //add all procedures addProcedure = true; } else { if (procedureFlag.equals(ProcedureFlag.PARENT) && !dataset.getProcedure().hasParents()) { addProcedure = true; } else if (procedureFlag.equals(ProcedureFlag.HIDDEN_CHILD) && dataset.getProcedure().hasParents()) { addProcedure = true; } } if (addProcedure) { procedures.add(dataset.getProcedure().getIdentifier()); } } } return procedures; }