use of com.evolveum.midpoint.xml.ns._public.common.common_3.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 com.evolveum.midpoint.xml.ns._public.common.common_3.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 com.evolveum.midpoint.xml.ns._public.common.common_3.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 com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType in project midpoint by Evolveum.
the class TestUtil method assertCreateTimestamp.
public static void assertCreateTimestamp(PrismObject<? extends ObjectType> object, XMLGregorianCalendar start, XMLGregorianCalendar end) {
MetadataType metadata = object.asObjectable().getMetadata();
assertNotNull("No metadata in " + object, metadata);
assertBetween("createTimestamp in " + object, start, end, metadata.getCreateTimestamp());
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType in project midpoint by Evolveum.
the class OperationalDataManager method applyMetadataAdd.
public <T extends ObjectType, F extends ObjectType> void applyMetadataAdd(LensContext<F> context, PrismObject<T> objectToAdd, XMLGregorianCalendar now, Task task, OperationResult result) throws SchemaException {
T objectType = objectToAdd.asObjectable();
MetadataType metadataType = objectType.getMetadata();
if (metadataType == null) {
metadataType = new MetadataType();
objectType.setMetadata(metadataType);
}
transplantRequestMetadata(context, metadataType);
applyCreateMetadata(context, metadataType, now, task);
if (workflowManager != null) {
metadataType.getCreateApproverRef().addAll(workflowManager.getApprovedBy(task, result));
}
if (objectToAdd.canRepresent(FocusType.class)) {
applyAssignmentMetadataObject((LensContext<? extends FocusType>) context, objectToAdd, now, task, result);
}
}
Aggregations