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);
}
}
}
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);
}
}
}
}
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;
}
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);
}
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);
}
Aggregations