use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class ValuePolicyProcessor method checkProhibitedValues.
private <O extends ObjectType, R extends ObjectType> boolean checkProhibitedValues(String newPassword, ProhibitedValuesType prohibitedValuesType, ObjectBasedValuePolicyOriginResolver<O> originResolver, Consumer<ProhibitedValueItemType> failAction, String shortDesc, Task task, OperationResult result) throws SchemaException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException, SecurityViolationException {
if (prohibitedValuesType == null || originResolver == null) {
return true;
}
MutableBoolean isAcceptable = new MutableBoolean(true);
for (ProhibitedValueItemType prohibitedItemType : prohibitedValuesType.getItem()) {
ItemPathType itemPathType = prohibitedItemType.getPath();
if (itemPathType == null) {
throw new SchemaException("No item path defined in prohibited item in " + shortDesc);
}
ItemPath itemPath = itemPathType.getItemPath();
ResultHandler<R> handler = (object, objectResult) -> {
PrismProperty<Object> objectProperty = object.findProperty(itemPath);
if (objectProperty == null) {
return true;
}
if (isMatching(newPassword, objectProperty)) {
if (failAction != null) {
failAction.accept(prohibitedItemType);
}
isAcceptable.setValue(false);
return false;
}
return true;
};
originResolver.resolve(prohibitedItemType, handler, shortDesc, task, result);
}
return isAcceptable.booleanValue();
}
use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class DefaultColumnUtils method createColumns.
private static <C extends Containerable> void createColumns(GuiObjectListViewType view, Class<? extends C> type) {
view.createColumnList();
List<GuiObjectColumnType> columns = view.getColumn();
List<ColumnWrapper> defaultColumns = getColumnsForType(type);
String previousColumn = null;
for (ColumnWrapper defaultColumn : defaultColumns) {
String localPathPath = defaultColumn.getPath().lastName().getLocalPart();
String columnName = localPathPath + "Column";
GuiObjectColumnType column = new GuiObjectColumnType();
column.setName(columnName);
column.setPreviousColumn(previousColumn);
ItemPathType itemPathType = new ItemPathType();
itemPathType.setItemPath(defaultColumn.getPath());
column.setPath(itemPathType);
column.setDisplayValue(defaultColumn.getDisplayValue());
if (defaultColumn.isSortable()) {
column.setSortProperty(localPathPath);
}
if (!StringUtils.isEmpty(defaultColumn.getLabel())) {
DisplayType display = new DisplayType();
PolyStringType label = new PolyStringType(defaultColumn.getLabel());
label.setTranslation(new PolyStringTranslationType().key(defaultColumn.getLabel()));
display.setLabel(label);
column.setDisplay(display);
}
columns.add(column);
previousColumn = columnName;
}
}
use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class FocusValidityScanPartialRun method createFilterForValidityChecking.
private ObjectFilter createFilterForValidityChecking(TimeValidityPolicyConstraintType validityConstraint) {
ItemPathType itemPathType = validityConstraint.getItem();
ItemPath path = java.util.Objects.requireNonNull(itemPathType.getItemPath(), "No path defined in the validity constraint");
XMLGregorianCalendar lowerBound = CloneUtil.clone(lastScanTimestamp);
XMLGregorianCalendar upperBound = CloneUtil.clone(thisScanTimestamp);
Duration negativeOffset = getNegativeActivationOffset(validityConstraint);
if (lowerBound != null) {
lowerBound.add(negativeOffset);
}
upperBound.add(negativeOffset);
return createFilterForItemTimestamp(path, lowerBound, upperBound);
}
use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class SearchTest method initSystem.
@Override
public void initSystem() throws Exception {
OperationResult result = new OperationResult("add objects");
PrismObject<UserType> beforeConfig = prismContext.createObjectable(UserType.class).name("before-config").description(DESCRIPTION_TO_FIND).asPrismObject();
beforeConfigOid = repositoryService.addObject(beforeConfig, null, result);
FullTextSearchConfigurationType fullTextConfig = new FullTextSearchConfigurationType();
FullTextSearchIndexedItemsConfigurationType entry = new FullTextSearchIndexedItemsConfigurationType();
entry.getItem().add(new ItemPathType(ObjectType.F_NAME));
entry.getItem().add(new ItemPathType(ObjectType.F_DESCRIPTION));
fullTextConfig.getIndexed().add(entry);
repositoryService.applyFullTextSearchConfiguration(fullTextConfig);
logger.info("Applying full text search configuration: {}", fullTextConfig);
List<PrismObject<? extends Objectable>> objects = prismContext.parserFor(new File(FOLDER_BASIC, "objects.xml")).parseObjects();
objects.addAll(prismContext.parserFor(new File(FOLDER_BASIC, "objects-2.xml")).parseObjects());
// noinspection rawtypes
for (PrismObject object : objects) {
// noinspection unchecked
repositoryService.addObject(object, null, result);
if (object.getName().getOrig().equals("atestuserX00002")) {
x00002Oid = object.getOid();
}
}
result.recomputeStatus();
assertTrue(result.isSuccess());
}
use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class AutoAssignMappingCollector method collectAutoassignMappings.
<AH extends AssignmentHolderType> void collectAutoassignMappings(LensContext<AH> context, List<FocalMappingEvaluationRequest<?, ?>> mappings, OperationResult result) throws SchemaException {
if (!autoassignEnabled(context.getSystemConfiguration())) {
return;
}
ObjectQuery query = prismContext.queryFor(AbstractRoleType.class).item(SchemaConstants.PATH_AUTOASSIGN_ENABLED).eq(true).build();
ResultHandler<AbstractRoleType> handler = (role, objectResult) -> {
AutoassignSpecificationType autoassign = role.asObjectable().getAutoassign();
if (autoassign == null) {
return true;
}
if (!isTrue(autoassign.isEnabled())) {
return true;
}
FocalAutoassignSpecificationType focalAutoassignSpec = autoassign.getFocus();
if (focalAutoassignSpec == null) {
return true;
}
if (!isApplicableFor(focalAutoassignSpec.getSelector(), context.getFocusContext(), objectResult)) {
return true;
}
for (AutoassignMappingType autoMapping : focalAutoassignSpec.getMapping()) {
AutoassignMappingType mapping = LensUtil.setMappingTarget(autoMapping, new ItemPathType(SchemaConstants.PATH_ASSIGNMENT));
mappings.add(new AutoassignRoleMappingEvaluationRequest(mapping, role.asObjectable()));
LOGGER.trace("Collected autoassign mapping {} from {}", mapping.getName(), role);
}
return true;
};
cacheRepositoryService.searchObjectsIterative(AbstractRoleType.class, query, handler, createReadOnlyCollection(), true, result);
}
Aggregations