use of com.evolveum.midpoint.util.exception.CommonException in project midpoint by Evolveum.
the class ClassicCollectionReportExportActivityRun method iterateOverItemsInBucket.
@Override
public void iterateOverItemsInBucket(OperationResult result) throws CommonException {
// Issue the search to audit or model/repository
// And use the following handler to handle the results
AtomicInteger sequence = new AtomicInteger(0);
Handler<Containerable> handler = record -> {
ItemProcessingRequest<Containerable> request = ContainerableProcessingRequest.create(sequence.getAndIncrement(), record, this);
coordinator.submit(request, result);
return true;
};
searchSpecificationHolder.run(handler, result);
}
use of com.evolveum.midpoint.util.exception.CommonException in project midpoint by Evolveum.
the class ResourceDependencyEditor method createResourceList.
private List<ObjectReferenceType> createResourceList() {
resourceMap.clear();
OperationResult result = new OperationResult(OPERATION_LOAD_RESOURCES);
Task task = getPageBase().createSimpleTask(OPERATION_LOAD_RESOURCES);
List<PrismObject<ResourceType>> resources = null;
List<ObjectReferenceType> references = new ArrayList<>();
try {
resources = getPageBase().getModelService().searchObjects(ResourceType.class, null, null, task, result);
result.recomputeStatus();
} catch (CommonException | RuntimeException e) {
result.recordFatalError(getString("ResourceDependencyEditor.message.createResourceList.fatalError"), e);
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't get resource list.", e);
}
if (resources != null) {
ObjectReferenceType ref;
for (PrismObject<ResourceType> r : resources) {
resourceMap.put(r.getOid(), WebComponentUtil.getName(r));
ref = new ObjectReferenceType();
ref.setType(ResourceType.COMPLEX_TYPE);
ref.setOid(r.getOid());
references.add(ref);
}
}
return references;
}
use of com.evolveum.midpoint.util.exception.CommonException in project midpoint by Evolveum.
the class ExpressionVariableEditorDialog method createObjectReferenceListDeprecated.
private List<ObjectReferenceType> createObjectReferenceListDeprecated() {
objectMap.clear();
OperationResult result = new OperationResult(OPERATION_LOAD_REPOSITORY_OBJECTS);
Task task = getPageBase().createSimpleTask(OPERATION_LOAD_REPOSITORY_OBJECTS);
List<PrismObject<ObjectType>> objects = null;
List<ObjectReferenceType> references = new ArrayList<>();
try {
objects = getPageBase().getModelService().searchObjects(ObjectType.class, null, null, task, result);
result.recomputeStatus();
} catch (CommonException | RuntimeException e) {
result.recordFatalError("ExpressionVariableEditorDialog.message.createObjectReferenceListDeprecated.fatalError", e);
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't load objects from repository", e);
}
if (objects != null) {
ObjectReferenceType ref;
for (PrismObject<ObjectType> obj : objects) {
objectMap.put(obj.getOid(), WebComponentUtil.getName(obj));
ref = new ObjectReferenceType();
ref.setOid(obj.getOid());
references.add(ref);
}
}
return references;
}
use of com.evolveum.midpoint.util.exception.CommonException in project midpoint by Evolveum.
the class MappingEditorDialog method createPasswordPolicyList.
private List<ObjectReferenceType> createPasswordPolicyList() {
policyMap.clear();
OperationResult result = new OperationResult(OPERATION_LOAD_PASSWORD_POLICIES);
Task task = getPageBase().createSimpleTask(OPERATION_LOAD_PASSWORD_POLICIES);
List<PrismObject<ValuePolicyType>> policies = null;
List<ObjectReferenceType> references = new ArrayList<>();
try {
policies = getPageBase().getModelService().searchObjects(ValuePolicyType.class, null, null, task, result);
result.recomputeStatus();
} catch (CommonException | RuntimeException e) {
result.recordFatalError(getString("MappingEditorDialog.message.createPasswordPolicyList.fatalError"), e);
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't load password policies", e);
}
if (policies != null) {
ObjectReferenceType ref;
for (PrismObject<ValuePolicyType> policy : policies) {
policyMap.put(policy.getOid(), WebComponentUtil.getName(policy));
ref = new ObjectReferenceType();
ref.setType(ValuePolicyType.COMPLEX_TYPE);
ref.setOid(policy.getOid());
references.add(ref);
}
}
return references;
}
use of com.evolveum.midpoint.util.exception.CommonException in project midpoint by Evolveum.
the class SynchronizationReactionEditor method createObjectTemplateList.
private List<ObjectReferenceType> createObjectTemplateList() {
objectTemplateMap.clear();
OperationResult result = new OperationResult(OPERATION_LOAD_OBJECT_TEMPLATES);
Task task = getPageBase().createSimpleTask(OPERATION_LOAD_OBJECT_TEMPLATES);
List<PrismObject<ObjectTemplateType>> templates = null;
List<ObjectReferenceType> references = new ArrayList<>();
try {
templates = getPageBase().getModelService().searchObjects(ObjectTemplateType.class, null, null, task, result);
result.recomputeStatus();
} catch (CommonException | RuntimeException e) {
result.recordFatalError(getString("SynchronizationReactionEditor.message.createObjectTemplateList.fatalError"), e);
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't load object templates from repository", e);
}
if (templates != null) {
ObjectReferenceType ref;
for (PrismObject<ObjectTemplateType> template : templates) {
objectTemplateMap.put(template.getOid(), WebComponentUtil.getName(template));
ref = new ObjectReferenceType();
ref.setType(ObjectTemplateType.COMPLEX_TYPE);
ref.setOid(template.getOid());
references.add(ref);
}
}
return references;
}
Aggregations