Search in sources :

Example 6 with MetadataType

use of net.opengis.ows.x11.MetadataType in project midpoint by Evolveum.

the class CredentialPolicyEvaluator method addMissingMetadata.

private void addMissingMetadata(PrismContainerValue<R> cVal) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException {
    if (hasValueChange(cVal)) {
        if (!hasMetadata(cVal)) {
            MetadataType metadataType = metadataManager.createCreateMetadata(context, now, task);
            ContainerDelta<MetadataType> metadataDelta = ContainerDelta.createModificationAdd(getCredentialsContainerPath().subPath(AbstractCredentialType.F_METADATA), UserType.class, prismContext, metadataType);
            context.getFocusContext().swallowToSecondaryDelta(metadataDelta);
        }
    }
}
Also used : MetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType)

Example 7 with MetadataType

use of net.opengis.ows.x11.MetadataType in project midpoint by Evolveum.

the class ProjectionCredentialsProcessor method applyMetadata.

private <F extends FocusType> void applyMetadata(LensContext<F> context, final LensProjectionContext projectionContext, XMLGregorianCalendar now, Task task, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException, PolicyViolationException {
    ObjectDelta<ShadowType> accountDelta = projectionContext.getDelta();
    if (projectionContext.isDelete()) {
        return;
    }
    if (accountDelta == null) {
        LOGGER.trace("Skipping application of password metadata. Shadow delta not specified.");
        return;
    }
    PropertyDelta<ProtectedStringType> passwordValueDelta = accountDelta.findPropertyDelta(SchemaConstants.PATH_PASSWORD_VALUE);
    if (passwordValueDelta == null) {
        LOGGER.trace("Skipping application of password metadata. No password change.");
        return;
    }
    if (projectionContext.isAdd()) {
        MetadataType metadataType = operationalDataManager.createCreateMetadata(context, now, task);
        ContainerDelta<MetadataType> metadataDelta = ContainerDelta.createDelta(SchemaConstants.PATH_PASSWORD_METADATA, projectionContext.getObjectDefinition());
        PrismContainerValue cval = metadataType.asPrismContainerValue();
        cval.setOriginTypeRecursive(OriginType.OUTBOUND);
        metadataDelta.addValuesToAdd(metadataType.asPrismContainerValue());
        projectionContext.swallowToSecondaryDelta(metadataDelta);
    } else if (projectionContext.isModify()) {
        ContainerDelta<MetadataType> metadataDelta = accountDelta.findContainerDelta(SchemaConstants.PATH_PASSWORD_METADATA);
        if (metadataDelta == null) {
            Collection<? extends ItemDelta<?, ?>> modifyMetadataDeltas = operationalDataManager.createModifyMetadataDeltas(context, SchemaConstants.PATH_PASSWORD_METADATA, projectionContext.getObjectDefinition(), now, task);
            for (ItemDelta itemDelta : modifyMetadataDeltas) {
                itemDelta.setOriginTypeRecursive(OriginType.OUTBOUND);
                projectionContext.swallowToSecondaryDelta(itemDelta);
            }
        }
    }
}
Also used : PrismContainerValue(com.evolveum.midpoint.prism.PrismContainerValue) ContainerDelta(com.evolveum.midpoint.prism.delta.ContainerDelta) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) MetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType) Collection(java.util.Collection) ItemDelta(com.evolveum.midpoint.prism.delta.ItemDelta) ProtectedStringType(com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType)

Example 8 with MetadataType

use of net.opengis.ows.x11.MetadataType in project midpoint by Evolveum.

the class PageCreatedReports method initColumns.

//TODO - consider adding Author name, File Type and ReportType to columns
private List<IColumn<SelectableBean<ReportOutputType>, String>> initColumns(final AjaxDownloadBehaviorFromStream ajaxDownloadBehavior) {
    List<IColumn<SelectableBean<ReportOutputType>, String>> columns = new ArrayList<>();
    IColumn column;
    column = new CheckBoxHeaderColumn();
    columns.add(column);
    column = new PropertyColumn(createStringResource("pageCreatedReports.table.name"), "name", "value.name");
    columns.add(column);
    column = new PropertyColumn(createStringResource("pageCreatedReports.table.description"), "value.description");
    columns.add(column);
    column = new AbstractColumn<SelectableBean<ReportOutputType>, String>(createStringResource("pageCreatedReports.table.time"), "createTimestamp") {

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<ReportOutputType>>> cellItem, String componentId, final IModel<SelectableBean<ReportOutputType>> rowModel) {
            cellItem.add(new DateLabelComponent(componentId, new AbstractReadOnlyModel<Date>() {

                @Override
                public Date getObject() {
                    ReportOutputType object = rowModel.getObject().getValue();
                    MetadataType metadata = object != null ? object.getMetadata() : null;
                    if (metadata == null) {
                        return null;
                    }
                    return XmlTypeConverter.toDate(metadata.getCreateTimestamp());
                }
            }, DateLabelComponent.LONG_MEDIUM_STYLE));
        }
    };
    columns.add(column);
    column = new AbstractColumn<SelectableBean<ReportOutputType>, String>(new Model(), null) {

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<ReportOutputType>>> cellItem, String componentId, final IModel<SelectableBean<ReportOutputType>> model) {
            DownloadButtonPanel panel = new DownloadButtonPanel(componentId) {

                @Override
                protected void deletePerformed(AjaxRequestTarget target) {
                    deleteSelectedPerformed(target, ReportDeleteDialogDto.Operation.DELETE_SINGLE, model.getObject().getValue());
                }

                @Override
                protected void downloadPerformed(AjaxRequestTarget target) {
                    currentReport = model.getObject().getValue();
                    PageCreatedReports.this.downloadPerformed(target, model.getObject().getValue(), ajaxDownloadBehavior);
                }
            };
            cellItem.add(panel);
        }
    };
    columns.add(column);
    column = new InlineMenuHeaderColumn<InlineMenuable>(initInlineMenu()) {

        @Override
        public void populateItem(Item<ICellPopulator<InlineMenuable>> cellItem, String componentId, IModel<InlineMenuable> rowModel) {
            cellItem.add(new Label(componentId));
        }
    };
    columns.add(column);
    return columns;
}
Also used : PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) Label(org.apache.wicket.markup.html.basic.Label) ReportOutputType(com.evolveum.midpoint.xml.ns._public.common.common_3.ReportOutputType) CheckBoxHeaderColumn(com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) MetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType) DateLabelComponent(com.evolveum.midpoint.web.component.DateLabelComponent) InlineMenuable(com.evolveum.midpoint.web.component.data.column.InlineMenuable) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) DownloadButtonPanel(com.evolveum.midpoint.web.page.admin.reports.component.DownloadButtonPanel) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) IModel(org.apache.wicket.model.IModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) PropertyModel(org.apache.wicket.model.PropertyModel) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel)

Example 9 with MetadataType

use of net.opengis.ows.x11.MetadataType in project midpoint by Evolveum.

the class ProvisioningUtil method addPasswordMetadata.

public static void addPasswordMetadata(PasswordType p, XMLGregorianCalendar now, PrismObject<UserType> owner) {
    MetadataType metadata = p.getMetadata();
    if (metadata != null) {
        return;
    }
    // Supply some metadata if they are not present. However the
    // normal thing is that those metadata are provided by model
    metadata = new MetadataType();
    metadata.setCreateTimestamp(now);
    if (owner != null) {
        metadata.creatorRef(owner.getOid(), null);
    }
    p.setMetadata(metadata);
}
Also used : MetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType)

Example 10 with MetadataType

use of net.opengis.ows.x11.MetadataType in project midpoint by Evolveum.

the class AbstractModelIntegrationTest method assertModifyMetadata.

protected <O extends ObjectType> void assertModifyMetadata(PrismObject<O> object, XMLGregorianCalendar start, XMLGregorianCalendar end) {
    MetadataType metadataType = object.asObjectable().getMetadata();
    PrismObject<UserType> defaultActor = getDefaultActor();
    assertMetadata(object.toString(), metadataType, false, false, start, end, defaultActor == null ? null : defaultActor.getOid(), DEFAULT_CHANNEL);
}
Also used : MetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)

Aggregations

MetadataType (com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType)23 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)4 ActivationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType)4 AssignmentType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)4 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)3 PrismContext (com.evolveum.midpoint.prism.PrismContext)2 ProtectedStringType (com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType)2 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)2 Test (org.testng.annotations.Test)2 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)1 PrismContainerDefinition (com.evolveum.midpoint.prism.PrismContainerDefinition)1 PrismContainerValue (com.evolveum.midpoint.prism.PrismContainerValue)1 PrismReferenceDefinition (com.evolveum.midpoint.prism.PrismReferenceDefinition)1 ContainerDelta (com.evolveum.midpoint.prism.delta.ContainerDelta)1 ItemDelta (com.evolveum.midpoint.prism.delta.ItemDelta)1 RObject (com.evolveum.midpoint.repo.sql.data.common.RObject)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 DateLabelComponent (com.evolveum.midpoint.web.component.DateLabelComponent)1 MetadataPanel (com.evolveum.midpoint.web.component.assignment.MetadataPanel)1 CheckBoxHeaderColumn (com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn)1