use of com.evolveum.midpoint.util.exception.SchemaException in project midpoint by Evolveum.
the class ScriptExecutionHandlerDto method getScript.
public String getScript() {
ExecuteScriptType script = taskDto.getExtensionPropertyRealValue(SchemaConstants.SE_EXECUTE_SCRIPT, ExecuteScriptType.class);
if (script == null) {
return null;
}
PrismContext prismContext = ((MidPointApplication) Application.get()).getPrismContext();
try {
return WebXmlUtil.stripNamespaceDeclarations(prismContext.xmlSerializer().serializeAnyData(script, SchemaConstants.SE_EXECUTE_SCRIPT));
} catch (SchemaException e) {
throw new SystemException("Couldn't serialize script: " + e.getMessage(), e);
}
}
use of com.evolveum.midpoint.util.exception.SchemaException in project midpoint by Evolveum.
the class DefaultGuiProgressListener method getResourceName.
private String getResourceName(@NotNull String oid) {
String name = nameCache.get(oid);
if (name != null) {
return name;
}
Task task = parentPage.createSimpleTask("getResourceName");
OperationResult result = new OperationResult("getResourceName");
// todo what about security?
Collection<SelectorOptions<GetOperationOptions>> raw = SelectorOptions.createCollection(GetOperationOptions.createRaw());
try {
PrismObject<ResourceType> object = parentPage.getModelService().getObject(ResourceType.class, oid, raw, task, result);
name = PolyString.getOrig(object.asObjectable().getName());
} catch (ObjectNotFoundException | SchemaException | SecurityViolationException | CommunicationException | ConfigurationException | ExpressionEvaluationException e) {
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't determine the name of resource {}", e, oid);
name = "(" + oid + ")";
}
nameCache.put(oid, name);
return name;
}
use of com.evolveum.midpoint.util.exception.SchemaException in project midpoint by Evolveum.
the class ExecuteChangesHandlerDto method getObjectDeltaXml.
public String getObjectDeltaXml() {
ObjectDeltaType objectDeltaType = taskDto.getExtensionPropertyRealValue(SchemaConstants.MODEL_EXTENSION_OBJECT_DELTA, ObjectDeltaType.class);
if (objectDeltaType == null) {
return null;
}
PrismContext prismContext = MidPointApplication.get().getPrismContext();
try {
return WebXmlUtil.stripNamespaceDeclarations(prismContext.xmlSerializer().serializeAnyData(objectDeltaType, SchemaConstants.MODEL_EXTENSION_OBJECT_DELTA));
} catch (SchemaException e) {
throw new SystemException("Couldn't serialize object delta: " + e.getMessage(), e);
}
}
use of com.evolveum.midpoint.util.exception.SchemaException in project midpoint by Evolveum.
the class QueryBasedHandlerDto method getObjectQuery.
public String getObjectQuery() {
QueryType query = taskDto.getExtensionPropertyRealValue(SchemaConstants.MODEL_EXTENSION_OBJECT_QUERY, QueryType.class);
if (query == null) {
return null;
}
PrismContext prismContext = ((MidPointApplication) Application.get()).getPrismContext();
try {
return WebXmlUtil.stripNamespaceDeclarations(prismContext.xmlSerializer().serializeAnyData(query, SchemaConstants.MODEL_EXTENSION_OBJECT_QUERY));
} catch (SchemaException e) {
throw new SystemException("Couldn't serialize query: " + e.getMessage(), e);
}
}
use of com.evolveum.midpoint.util.exception.SchemaException in project midpoint by Evolveum.
the class TaskCurrentStateDtoModel method refresh.
public void refresh(PageBase page) {
object = null;
if (taskModel == null || taskModel.getObject() == null) {
LOGGER.warn("Null or empty taskModel");
return;
}
TaskManager taskManager = page.getTaskManager();
OperationResult result = new OperationResult("refresh");
Task operationTask = taskManager.createTaskInstance("refresh");
String oid = taskModel.getObject().getOid();
try {
LOGGER.debug("Refreshing task {}", taskModel.getObject());
Collection<SelectorOptions<GetOperationOptions>> options = GetOperationOptions.createRetrieveAttributesOptions(TaskType.F_SUBTASK, TaskType.F_NODE_AS_OBSERVED);
PrismObject<TaskType> task = page.getModelService().getObject(TaskType.class, oid, options, operationTask, result);
TaskDto taskDto = new TaskDto(task.asObjectable(), page.getModelService(), page.getTaskService(), page.getModelInteractionService(), taskManager, page.getWorkflowManager(), TaskDtoProviderOptions.fullOptions(), operationTask, result, page);
taskModel.setObject(taskDto);
} catch (CommunicationException | ObjectNotFoundException | SchemaException | SecurityViolationException | ConfigurationException | ExpressionEvaluationException | RuntimeException e) {
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't refresh task {}", e, taskModel.getObject());
}
}
Aggregations