use of com.evolveum.midpoint.repo.api.RepositoryService in project midpoint by Evolveum.
the class TaskManagerQuartzImpl method createTaskInstance.
@Override
@NotNull
public Task createTaskInstance(PrismObject<TaskType> taskPrism, String operationName, OperationResult parentResult) throws SchemaException {
OperationResult result = parentResult.createSubresult(DOT_INTERFACE + "createTaskInstance");
result.addParam("taskPrism", taskPrism);
//Note: we need to be Spring Bean Factory Aware, because some repo implementations are in scope prototype
RepositoryService repoService = (RepositoryService) this.beanFactory.getBean("repositoryService");
TaskQuartzImpl task = new TaskQuartzImpl(this, taskPrism, repoService, operationName);
task.resolveOwnerRef(result);
result.recordSuccessIfUnknown();
return task;
}
use of com.evolveum.midpoint.repo.api.RepositoryService in project midpoint by Evolveum.
the class Utils method resolveReferences.
/**
* Resolves references contained in given PrismObject.
*
* @param object
* @param repository
* @param enforceReferentialIntegrity If true, missing reference causes fatal error when processing (if false, only warning is issued).
* @param forceFilterReevaluation If true, references are reevaluated even if OID is present. (Given that filter is present as well, of course.)
* @param prismContext
* @param result
*/
public static <T extends ObjectType> void resolveReferences(PrismObject<T> object, RepositoryService repository, boolean enforceReferentialIntegrity, boolean forceFilterReevaluation, EvaluationTimeType resolutionTime, boolean throwExceptionOnFailure, PrismContext prismContext, OperationResult result) {
Visitor visitor = visitable -> {
if (!(visitable instanceof PrismReferenceValue)) {
return;
}
resolveRef((PrismReferenceValue) visitable, repository, enforceReferentialIntegrity, forceFilterReevaluation, resolutionTime, prismContext, object.toString(), throwExceptionOnFailure, result);
};
object.accept(visitor);
}
use of com.evolveum.midpoint.repo.api.RepositoryService in project midpoint by Evolveum.
the class MidpointUtil method recordEventInTask.
// additional delta is a bit hack ... TODO refactor (but without splitting the modify operation!)
public static void recordEventInTask(CaseEventType event, ObjectDeltaType additionalDelta, String taskOid, OperationResult result) {
RepositoryService cacheRepositoryService = getCacheRepositoryService();
PrismContext prismContext = getPrismContext();
try {
S_ItemEntry deltaBuilder = DeltaBuilder.deltaFor(TaskType.class, getPrismContext()).item(F_WORKFLOW_CONTEXT, F_EVENT).add(event);
if (additionalDelta != null) {
PrismObject<TaskType> task = cacheRepositoryService.getObject(TaskType.class, taskOid, null, result);
WfPrimaryChangeProcessorStateType state = WfContextUtil.getPrimaryChangeProcessorState(task.asObjectable().getWorkflowContext());
ObjectTreeDeltasType updatedDelta = ObjectTreeDeltas.mergeDeltas(state.getDeltasToProcess(), additionalDelta, prismContext);
// assuming it already exists!
ItemPath deltasToProcessPath = new ItemPath(F_WORKFLOW_CONTEXT, F_PROCESSOR_SPECIFIC_STATE, WfPrimaryChangeProcessorStateType.F_DELTAS_TO_PROCESS);
ItemDefinition<?> deltasToProcessDefinition = getPrismContext().getSchemaRegistry().findContainerDefinitionByCompileTimeClass(WfPrimaryChangeProcessorStateType.class).findItemDefinition(WfPrimaryChangeProcessorStateType.F_DELTAS_TO_PROCESS);
deltaBuilder = deltaBuilder.item(deltasToProcessPath, deltasToProcessDefinition).replace(updatedDelta);
}
cacheRepositoryService.modifyObject(TaskType.class, taskOid, deltaBuilder.asItemDeltas(), result);
} catch (ObjectNotFoundException | SchemaException | ObjectAlreadyExistsException e) {
throw new SystemException("Couldn't record decision to the task " + taskOid + ": " + e.getMessage(), e);
}
}
use of com.evolveum.midpoint.repo.api.RepositoryService in project midpoint by Evolveum.
the class TransportServiceImpl method init.
@PostConstruct
public void init() {
transportSupport = new TransportSupport() {
@Override
public PrismContext prismContext() {
return prismContext;
}
@Override
public ExpressionFactory expressionFactory() {
return expressionFactory;
}
@Override
public RepositoryService repositoryService() {
return repositoryService;
}
@Override
public Protector protector() {
return protector;
}
@Override
public ApplicationContext applicationContext() {
return applicationContext;
}
};
registerLegacyTransports();
}
use of com.evolveum.midpoint.repo.api.RepositoryService in project midpoint by Evolveum.
the class ObjectDeltaUpdater method handleObjectTextInfoChanges.
private void handleObjectTextInfoChanges(Class<? extends ObjectType> type, Collection<? extends ItemDelta<?, ?>> modifications, PrismObject<?> prismObject, RObject object) {
FullTextSearchConfigurationType config = repositoryService.getFullTextSearchConfiguration();
if (!FullTextSearchUtil.isObjectTextInfoRecomputationNeeded(config, type, modifications)) {
return;
}
Set<RObjectTextInfo> newInfos = RObjectTextInfo.createItemsSet((ObjectType) prismObject.asObjectable(), object, new RepositoryContext(repositoryService, prismContext, relationRegistry, extItemDictionary, repositoryConfiguration));
if (newInfos == null || newInfos.isEmpty()) {
object.getTextInfoItems().clear();
} else {
Set<String> existingTexts = object.getTextInfoItems().stream().map(info -> info.getText()).collect(Collectors.toSet());
Set<String> newTexts = newInfos.stream().map(info -> info.getText()).collect(Collectors.toSet());
object.getTextInfoItems().removeIf(existingInfo -> !newTexts.contains(existingInfo.getText()));
for (RObjectTextInfo newInfo : newInfos) {
if (!existingTexts.contains(newInfo.getText())) {
object.getTextInfoItems().add(newInfo);
}
}
}
}
Aggregations