use of org.geotoolkit.ows.xml.v200.MetadataType in project midpoint by Evolveum.
the class QAssignmentMapping method toSchemaObject.
@Override
public AssignmentType toSchemaObject(MAssignment row) {
// TODO is there any place we can put row.ownerOid reasonably?
// repositoryContext().prismContext().itemFactory().createObject(... definition?)
// assignment.asPrismContainerValue().setParent(new ObjectType().oid(own)); abstract not possible
// For assignments we can use ownerType, but this is not general for all containers.
// Inspiration: com.evolveum.midpoint.repo.sql.helpers.CertificationCaseHelper.updateLoadedCertificationCase
// (if even possible with abstract type definition)
AssignmentType assignment = new AssignmentType().id(row.cid).lifecycleState(row.lifecycleState).order(row.orderValue).orgRef(objectReference(row.orgRefTargetOid, row.orgRefTargetType, row.orgRefRelationId)).targetRef(objectReference(row.targetRefTargetOid, row.targetRefTargetType, row.targetRefRelationId)).tenantRef(objectReference(row.tenantRefTargetOid, row.tenantRefTargetType, row.tenantRefRelationId));
if (row.policySituations != null) {
for (Integer policySituationId : row.policySituations) {
assignment.policySituation(resolveIdToUri(policySituationId));
}
}
if (row.subtypes != null) {
for (String subtype : row.subtypes) {
assignment.subtype(subtype);
}
}
if (row.resourceRefTargetOid != null) {
assignment.construction(new ConstructionType(prismContext()).resourceRef(objectReference(row.resourceRefTargetOid, row.resourceRefTargetType, row.resourceRefRelationId)));
}
ActivationType activation = new ActivationType(prismContext()).administrativeStatus(row.administrativeStatus).effectiveStatus(row.effectiveStatus).enableTimestamp(asXMLGregorianCalendar(row.enableTimestamp)).disableTimestamp(asXMLGregorianCalendar(row.disableTimestamp)).disableReason(row.disableReason).validityStatus(row.validityStatus).validFrom(asXMLGregorianCalendar(row.validFrom)).validTo(asXMLGregorianCalendar(row.validTo)).validityChangeTimestamp(asXMLGregorianCalendar(row.validityChangeTimestamp)).archiveTimestamp(asXMLGregorianCalendar(row.archiveTimestamp));
if (!activation.asPrismContainerValue().isEmpty()) {
assignment.activation(activation);
}
MetadataType metadata = new MetadataType(prismContext()).creatorRef(objectReference(row.creatorRefTargetOid, row.creatorRefTargetType, row.creatorRefRelationId)).createChannel(resolveIdToUri(row.createChannelId)).createTimestamp(asXMLGregorianCalendar(row.createTimestamp)).modifierRef(objectReference(row.modifierRefTargetOid, row.modifierRefTargetType, row.modifierRefRelationId)).modifyChannel(resolveIdToUri(row.modifyChannelId)).modifyTimestamp(asXMLGregorianCalendar(row.modifyTimestamp));
if (!metadata.asPrismContainerValue().isEmpty()) {
assignment.metadata(metadata);
}
return assignment;
}
use of org.geotoolkit.ows.xml.v200.MetadataType in project midpoint by Evolveum.
the class QObjectMapping method storeRelatedEntities.
/**
* Stores other entities related to the main object row like containers, references, etc.
* This is not part of {@link #toRowObjectWithoutFullObject} because it requires know OID
* which is not assured before calling that method.
*
* *Always call this super method first in overriding methods.*
*
* @param row master row for the added object("aggregate root")
* @param schemaObject schema objects for which the details are stored
* @param jdbcSession JDBC session used to insert related rows
*/
public void storeRelatedEntities(@NotNull R row, @NotNull S schemaObject, @NotNull JdbcSession jdbcSession) throws SchemaException {
Objects.requireNonNull(row.oid);
// We're after insert, we can set this for the needs of owned entities (assignments).
row.objectType = MObjectType.fromSchemaType(schemaObject.getClass());
MetadataType metadata = schemaObject.getMetadata();
if (metadata != null) {
storeRefs(row, metadata.getCreateApproverRef(), QObjectReferenceMapping.getForCreateApprover(), jdbcSession);
storeRefs(row, metadata.getModifyApproverRef(), QObjectReferenceMapping.getForModifyApprover(), jdbcSession);
}
List<TriggerType> triggers = schemaObject.getTrigger();
if (!triggers.isEmpty()) {
triggers.forEach(t -> QTriggerMapping.get().insert(t, row, jdbcSession));
}
List<OperationExecutionType> operationExecutions = schemaObject.getOperationExecution();
if (!operationExecutions.isEmpty()) {
operationExecutions.forEach(oe -> QOperationExecutionMapping.get().insert(oe, row, jdbcSession));
}
storeRefs(row, schemaObject.getParentOrgRef(), QObjectReferenceMapping.getForParentOrg(), jdbcSession);
}
use of org.geotoolkit.ows.xml.v200.MetadataType in project mod-oai-pmh by folio-org.
the class AbstractHelper method buildOaiMetadata.
protected MetadataType buildOaiMetadata(Request request, String content) {
MetadataType metadata = new MetadataType();
MetadataPrefix metadataPrefix = MetadataPrefix.fromName(request.getMetadataPrefix());
byte[] byteSource = metadataPrefix.convert(content);
Object record = ResponseConverter.getInstance().bytesToObject(byteSource);
metadata.setAny(record);
return metadata;
}
use of org.geotoolkit.ows.xml.v200.MetadataType in project geotoolkit by Geomatys.
the class CoverageDescriptionType method setMetadata.
@Override
public void setMetadata(final String href) {
if (href != null) {
this.metadata = new ArrayList<>();
this.metadata.add(new MetadataType(href));
}
}
use of org.geotoolkit.ows.xml.v200.MetadataType in project openaire-cris-validator by EuroCRIS.
the class FileLoggingConnectionStreamFactory method wrapCheckOAIIdentifier.
private CheckingIterable<RecordType> wrapCheckOAIIdentifier(final CheckingIterable<RecordType> checker) {
final Optional<String> repoIdentifier = endpoint.getRepositoryIdentifer();
if (repoIdentifier.isPresent()) {
final Function<RecordType, Set<String>> expectedFunction = new Function<RecordType, Set<String>>() {
@Override
public Set<String> apply(final RecordType x) {
final MetadataType metadata = x.getMetadata();
final Set<String> results = new HashSet<>();
if (metadata != null) {
final Element el = (Element) metadata.getAny();
final String id = el.getAttribute("id");
results.add("oai:" + repoIdentifier.get() + ":" + el.getLocalName() + "s/" + id);
results.add("oai:" + repoIdentifier.get() + ":" + id);
} else {
// make the test trivially satisfied for records with no metadata
results.add(x.getHeader().getIdentifier());
}
return results;
}
};
return checker.checkForAllValueInSet(expectedFunction, ((final RecordType record) -> record.getHeader().getIdentifier()), "OAI identifier other than expected");
} else {
return checker;
}
}
Aggregations