Skip to content

Commit

Permalink
Remove deprecated TaskType.category property
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed May 25, 2023
1 parent da3fe66 commit a5754af
Show file tree
Hide file tree
Showing 29 changed files with 8 additions and 124 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@
import com.evolveum.midpoint.security.api.AuthorizationConstants;
import com.evolveum.midpoint.security.api.MidPointPrincipal;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.task.api.TaskCategory;
import com.evolveum.midpoint.util.*;
import com.evolveum.midpoint.util.annotation.Experimental;
import com.evolveum.midpoint.util.exception.*;
Expand Down Expand Up @@ -704,14 +703,6 @@ public static boolean isRecurringTask(TaskType task) {
return task != null && TaskTypeUtil.isTaskRecurring(task);
}

// We no longer need to treat workflow-related tasks in a different way.
// Approvals are carried out via cases. So the only workflow-related tasks are those that execute
// approved operations. And they can be treated exactly like all the other tasks.
@Deprecated
public static boolean isWorkflowTask(TaskType task) {
return task != null && TaskCategory.WORKFLOW.equals(task.getCategory());
}

public static boolean isReconciliation(TaskType task) {
return isArchetypedTask(task, SystemObjectsType.ARCHETYPE_RECONCILIATION_TASK);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ public SearchableItemsDefinitions additionalSearchContext(SearchContext ctx) {
SEARCHABLE_OBJECTS.put(TaskType.class, Arrays.asList(
ItemPath.create(TaskType.F_TASK_IDENTIFIER),
ItemPath.create(TaskType.F_NODE),
ItemPath.create(TaskType.F_CATEGORY),
ItemPath.create(TaskType.F_RESULT_STATUS),
ItemPath.create(TaskType.F_EXECUTION_STATE),
ItemPath.create(TaskType.F_HANDLER_URI),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ private boolean getBasicTabEditability(ItemPath path) {

List<ItemPath> pathsToHide = Arrays.asList(TaskType.F_EXECUTION_STATE, TaskType.F_NODE, TaskType.F_NODE_AS_OBSERVED, TaskType.F_RESULT_STATUS,
TaskType.F_RESULT, TaskType.F_NEXT_RUN_START_TIMESTAMP, TaskType.F_NEXT_RETRY_TIMESTAMP, TaskType.F_UNPAUSE_ACTION, TaskType.F_TASK_IDENTIFIER,
TaskType.F_PARENT, TaskType.F_WAITING_REASON, TaskType.F_STATE_BEFORE_SUSPEND, TaskType.F_CATEGORY,
TaskType.F_PARENT, TaskType.F_WAITING_REASON, TaskType.F_STATE_BEFORE_SUSPEND,
TaskType.F_CHANNEL, TaskType.F_DEPENDENT_TASK_REF, TaskType.F_LAST_RUN_START_TIMESTAMP, TaskType.F_LAST_RUN_FINISH_TIMESTAMP, TaskType.F_COMPLETION_TIMESTAMP
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
</ownerRef>
<channel>http://midpoint.evolveum.com/xml/ns/public/common/channels-3#user</channel>
<executionState>closed</executionState>
<category>Utility</category>
<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/execute-deltas/handler-3</handlerUri>
<binding>tight</binding>
</task>
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
<!-- administrator -->
</ownerRef>
<executionState>runnable</executionState>
<category>BulkActions</category>
<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/scripting/handler-3</handlerUri>
<binding>tight</binding>
</task>
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@
<a:version>4.8</a:version>
<a:operation>removed</a:operation>
</a:schemaMigration>
<a:schemaMigration>
<a:element>tns:category</a:element>
<a:version>4.8</a:version>
<a:operation>removed</a:operation>
</a:schemaMigration>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexContent>
Expand Down Expand Up @@ -266,18 +271,6 @@
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="category" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Kind of the task, e.g. live sync, reconciliation, workflow, import from resource.
Used mainly for the GUI.
</xsd:documentation>
<xsd:appinfo>
<a:displayName>TaskType.category</a:displayName>
<a:deprecated>true</a:deprecated>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="handlerUri" type="xsd:anyURI" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,5 @@
<taskIdentifier>44444444-4444-4444-4444-000000001111</taskIdentifier>
<ownerRef oid="c0c010c0-d34d-b33f-f00d-111111111111"/>
<executionState>runnable</executionState>
<category>BulkActions</category>
<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/scripting/handler-3</handlerUri>
</task>
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
relation="org:default"
type="tns:UserType"><!-- administrator --></ownerRef>
<executionState>closed</executionState>
<category>BulkActions</category>
<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/scripting/handler-3</handlerUri>
<binding>tight</binding>
</task>
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
<taskIdentifier>91919191-76e0-59e2-86d6-3d4f02d3ffff</taskIdentifier>
<ownerRef oid="00000000-0000-0000-0000-000000000002"/>
<executionState>suspended</executionState>
<category>LiveSynchronization</category>
<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/synchronization/task/live-sync/handler-3</handlerUri>
<result xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3">
<c:operation>com.evolveum.midpoint.common.operation.liveSync</c:operation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
<taskIdentifier>91919191-76e0-59e2-86d6-3d4f02d3ffff</taskIdentifier>
<ownerRef oid="00000000-0000-0000-0000-000000000002"/>
<executionState>suspended</executionState>
<category>LiveSynchronization</category>
<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/synchronization/task/live-sync/handler-3</handlerUri>
<result xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3">
<c:operation>com.evolveum.midpoint.common.operation.liveSync</c:operation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ public class DefaultColumnUtils {
new ColumnWrapper(AbstractRoleType.F_LINK_REF, "FocusType.linkRef", DisplayValueType.NUMBER)))
.put(TaskType.class, Arrays.asList(
new ColumnWrapper(TaskType.F_NAME),
new ColumnWrapper(TaskType.F_CATEGORY),
new ColumnWrapper(TaskType.F_EXECUTION_STATE),
new ColumnWrapper(TaskType.F_OBJECT_REF),
new ColumnWrapper(TaskType.F_NODE_AS_OBSERVED, "pageTasks.task.executingAt"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.schema.util.ObjectTypeUtil;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.task.api.TaskCategory;
import com.evolveum.midpoint.test.util.MidPointTestConstants;
import com.evolveum.midpoint.test.util.TestUtil;
import com.evolveum.midpoint.util.DebugUtil;
Expand Down Expand Up @@ -403,7 +402,6 @@ public void test142JackNoChangeButTaskExists() throws Exception {

TaskType approvalTask = prismContext.createObjectable(TaskType.class)
.name("approval task")
.category(TaskCategory.WORKFLOW)
.executionState(TaskExecutionStateType.WAITING)
.schedulingState(TaskSchedulingStateType.WAITING)
.ownerRef(userAdministrator.getOid(), UserType.COMPLEX_TYPE)
Expand All @@ -413,7 +411,6 @@ public void test142JackNoChangeButTaskExists() throws Exception {

ObjectQuery query = prismContext.queryFor(TaskType.class)
.item(TaskType.F_OBJECT_REF).ref(USER_JACK_OID)
.and().item(TaskType.F_CATEGORY).eq(TaskCategory.WORKFLOW)
.and().item(TaskType.F_EXECUTION_STATE).eq(TaskExecutionStateType.WAITING)
.build();
SearchResultList<PrismObject<TaskType>> tasks = modelService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import com.evolveum.midpoint.schema.constants.SchemaConstants;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.task.api.TaskCategory;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

@ContextConfiguration(locations = { "classpath:ctx-model-intest-test-main.xml" })
Expand Down Expand Up @@ -216,7 +215,6 @@ public void test200assignArchetypeReconTask() throws Exception {

assertTask(TASK_RECON_OID, "created reconciliation task")
.assertExecutionState(TaskExecutionStateType.SUSPENDED)
.assertCategory(TaskCategory.RECONCILIATION)
.assertBinding(TaskBindingType.TIGHT);
}

Expand All @@ -231,7 +229,6 @@ public void test210assignArchetypeLiveSyncTask() throws Exception {

assertTask(TASK_LIVE_SYNC_OID, "created live synchronization task")
.assertExecutionState(TaskExecutionStateType.SUSPENDED)
.assertCategory(TaskCategory.LIVE_SYNCHRONIZATION)
.assertBinding(TaskBindingType.TIGHT);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
<!-- administrator -->
</ownerRef>
<executionState>runnable</executionState>
<category>BulkActions</category>
<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/scripting/handler-3</handlerUri>
<binding>tight</binding>
</task>
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,5 @@
</extension>
<ownerRef oid="00000000-0000-0000-0000-000000000002"/>
<executionState>runnable</executionState>
<category>BulkActions</category>
<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/iterative-scripting/handler-3</handlerUri>
</task>
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,5 @@
</extension>
<ownerRef oid="00000000-0000-0000-0000-000000000002"/>
<executionState>runnable</executionState>
<category>BulkActions</category>
<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/iterative-scripting/handler-3</handlerUri>
</task>
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ public void createWorkerThreads() throws ConfigurationException {
workerSpecificResults.add(workerSpecificResult);

RunningLightweightTask subtask = coordinatorTask.createSubtask(new WorkerHandler(workerSpecificResult));
subtask.setCategory(coordinatorTask.getCategory());
subtask.setResult(new OperationResult(OP_EXECUTE_WORKER, OperationResultStatus.IN_PROGRESS, (String) null));
subtask.setName("Worker thread " + (i+1) + " of " + threadsCount);
subtask.setExecutionEnvironment(CloneUtil.clone(coordinatorTask.getExecutionEnvironment()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class MTask extends MObject {

public String taskIdentifier;
public TaskBindingType binding;
public String category;
public String category; // not used anymore
public Instant completionTimestamp;
public TaskExecutionStateType executionState;
// Logically fullResult and resultStatus are related, managed by Task manager.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ private QTaskMapping(@NotNull SqaleRepoContext repositoryContext) {

addItemMapping(F_TASK_IDENTIFIER, stringMapper(q -> q.taskIdentifier));
addItemMapping(F_BINDING, enumMapper(q -> q.binding));
addItemMapping(F_CATEGORY, stringMapper(q -> q.category));
addItemMapping(F_COMPLETION_TIMESTAMP,
timestampMapper(q -> q.completionTimestamp));
addItemMapping(F_EXECUTION_STATE, enumMapper(q -> q.executionState));
Expand Down Expand Up @@ -135,7 +134,6 @@ protected PathSet fullObjectItemsToSkip() {

row.taskIdentifier = task.getTaskIdentifier();
row.binding = task.getBinding();
row.category = task.getCategory();
row.completionTimestamp = MiscUtil.asInstant(task.getCompletionTimestamp());
row.executionState = task.getExecutionState();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1738,7 +1738,6 @@ public void test830Task() throws Exception {
.name(objectName)
.taskIdentifier("task-id")
.binding(TaskBindingType.LOOSE)
.category("category")
.completionTimestamp(MiscUtil.asXMLGregorianCalendar(1L))
.executionState(TaskExecutionStateType.RUNNABLE)
.result(new OperationResultType()
Expand Down Expand Up @@ -1771,7 +1770,6 @@ public void test830Task() throws Exception {
MTask row = selectObjectByOid(QTask.class, task.getOid());
assertThat(row.taskIdentifier).isEqualTo("task-id");
assertThat(row.binding).isEqualTo(TaskBindingType.LOOSE);
assertThat(row.category).isEqualTo("category");
assertThat(row.completionTimestamp).isEqualTo(Instant.ofEpochMilli(1));
assertThat(row.executionState).isEqualTo(TaskExecutionStateType.RUNNABLE);
assertThat(row.fullResult).isNotNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class RTask extends RObject implements ROperationResultFull {
private String taskIdentifier;
private RTaskExecutionState executionStatus;
private String node;
private String category;
private String category; // no longer used
private String handlerUri;
//operation result
private byte[] fullResult;
Expand Down Expand Up @@ -302,7 +302,6 @@ public static void copyFromJAXB(TaskType jaxb, RTask repo, RepositoryContext rep
repo.setBinding(RUtil.getRepoEnumValue(jaxb.getBinding(), RTaskBinding.class));
repo.setRecurrence(RUtil.getRepoEnumValue(TaskTypeUtil.getEffectiveRecurrence(jaxb), RTaskRecurrence.class));
repo.setThreadStopAction(RUtil.getRepoEnumValue(jaxb.getThreadStopAction(), RThreadStopAction.class));
repo.setCategory(jaxb.getCategory());
repo.setParent(jaxb.getParent());

repo.setObjectRef(RUtil.jaxbRefToEmbeddedRepoRef(jaxb.getObjectRef(), repositoryContext.relationRegistry));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,6 @@ public TaskAsserter<RA> assertResultMessageContains(String fragment) {
return this;
}

public TaskAsserter<RA> assertCategory(String category) {
assertEquals(category, getTaskBean().getCategory());
return this;
}

public TaskAsserter<RA> assertBinding(TaskBindingType binding) {
assertEquals(binding, getTaskBean().getBinding());
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,22 +383,6 @@ default boolean isTightlyBound() {
*/
void setHandlerUri(String value);

/**
* Task category is a user-oriented term, hinting on what 'kind' of task is the one being considered
* (system task, workflow, live sync, ...). In most cases, category can be derived from the task handler.
*
* Category can be set directly; but if not set directly, it is set automatically on first task execution,
* determined based on task handler URI.
*
* List of categories is in the TaskCategory class.
*/
String getCategory();

/**
* Sets the task category.
*/
void setCategory(String category);

// TODO Rework all three following archetype-setting methods

/**
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,6 @@ public void flushPendingModifications(OperationResult parentResult) {
throw new UnsupportedOperationException();
}

@Override
public String getCategory() {
throw new UnsupportedOperationException();
}

@Override
public String getNode() {
throw new UnsupportedOperationException();
Expand All @@ -365,11 +360,6 @@ public ThreadStopActionType getThreadStopAction() {
throw new UnsupportedOperationException();
}

@Override
public void setCategory(String category) {
throw new UnsupportedOperationException();
}

@Override
public void addArchetypeInformation(@NotNull String archetypeOid) {
throw new UnsupportedOperationException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1715,16 +1715,6 @@ public TaskHandler getHandler() {
getHandlerUri());
}

@Override
public String getCategory() {
return getProperty(TaskType.F_CATEGORY);
}

@Override
public void setCategory(String value) {
setProperty(TaskType.F_CATEGORY, value);
}

public String getChannelFromHandler() {
TaskHandler h = getHandler();
return h != null ? h.getDefaultChannel() : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.evolveum.midpoint.prism.xml.XmlTypeConverter;
import com.evolveum.midpoint.schema.constants.SchemaConstants;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.task.api.TaskCategory;
import com.evolveum.midpoint.task.quartzimpl.*;
import com.evolveum.midpoint.task.quartzimpl.tasks.TaskRetriever;
import com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
</ownerRef>
<channel>http://midpoint.evolveum.com/xml/ns/public/common/channels-3#recompute</channel>
<executionState>closed</executionState>
<category>Recomputation</category>
<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/synchronization/task/recompute/handler-3</handlerUri>
<binding>loose</binding>
</task>
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
<taskIdentifier>50142510-8003-4a47-993a-2434119f5028</taskIdentifier>
<ownerRef oid="00000000-0000-0000-0000-000000000002" relation="org:default" type="c:UserType"/>
<executionState>runnable</executionState>
<category>ImportingAccounts</category>
<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/synchronization/task/import/handler-3</handlerUri>
<objectRef oid="f2dd9222-6aff-4099-b5a2-04ae6b3a00b7" relation="org:default" type="c:ResourceType"/>
<binding>loose</binding>
Expand Down

0 comments on commit a5754af

Please sign in to comment.