Search in sources :

Example 31 with MetadataType

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;
}
Also used : ConstructionType(com.evolveum.midpoint.xml.ns._public.common.common_3.ConstructionType) ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType) MetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType)

Example 32 with MetadataType

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);
}
Also used : TriggerType(com.evolveum.midpoint.xml.ns._public.common.common_3.TriggerType) MetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType) OperationExecutionType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationExecutionType)

Example 33 with MetadataType

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;
}
Also used : MetadataType(org.openarchives.oai._2.MetadataType) JsonObject(io.vertx.core.json.JsonObject) MetadataPrefix(org.folio.oaipmh.MetadataPrefix)

Example 34 with MetadataType

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));
    }
}
Also used : MetadataType(org.geotoolkit.ows.xml.v110.MetadataType)

Example 35 with MetadataType

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;
    }
}
Also used : Function(java.util.function.Function) Set(java.util.Set) HashSet(java.util.HashSet) RecordType(org.openarchives.oai._2.RecordType) JAXBElement(javax.xml.bind.JAXBElement) Element(org.w3c.dom.Element) MetadataType(org.openarchives.oai._2.MetadataType) HashSet(java.util.HashSet)

Aggregations

MetadataType (com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType)30 ActivationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType)7 AssignmentType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)6 ConstructionType (com.evolveum.midpoint.xml.ns._public.common.common_3.ConstructionType)4 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)3 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)3 PrismContainerDefinition (com.evolveum.midpoint.prism.PrismContainerDefinition)2 PrismContext (com.evolveum.midpoint.prism.PrismContext)2 PrismReferenceDefinition (com.evolveum.midpoint.prism.PrismReferenceDefinition)2 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)2 ProtectedStringType (com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType)2 List (java.util.List)2 Duration (javax.xml.datatype.Duration)2 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)2 MetadataType (org.openarchives.oai._2.MetadataType)2 Test (org.testng.annotations.Test)2 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)1 PrismContainerValue (com.evolveum.midpoint.prism.PrismContainerValue)1 ContainerDelta (com.evolveum.midpoint.prism.delta.ContainerDelta)1 ItemDelta (com.evolveum.midpoint.prism.delta.ItemDelta)1