-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into feature/merge
- Loading branch information
Showing
16 changed files
with
414 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
...ugin/src/main/java/com/evolveum/midpoint/studio/action/task/UploadFullProcessingTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package com.evolveum.midpoint.studio.action.task; | ||
|
||
import com.evolveum.midpoint.schema.constants.ObjectTypes; | ||
import com.evolveum.midpoint.schema.result.OperationResult; | ||
import com.evolveum.midpoint.studio.action.transfer.ProcessObjectResult; | ||
import com.evolveum.midpoint.studio.client.MidPointObject; | ||
import com.evolveum.midpoint.studio.impl.Environment; | ||
import com.intellij.openapi.actionSystem.AnActionEvent; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class UploadFullProcessingTask extends ClientBackgroundableTask<TaskState> { | ||
|
||
public static String TITLE = "Upload (Full Processing)"; | ||
|
||
public static final String NOTIFICATION_KEY = TITLE; | ||
|
||
private static final String OPERATION_UPLOAD = "upload"; | ||
private static final String OPERATION_RECOMPUTE = "recompute"; | ||
private static final String OPERATION_TEST_CONNECTION = "test connection"; | ||
|
||
public UploadFullProcessingTask(AnActionEvent event, Environment environment) { | ||
this(event, environment, TITLE, NOTIFICATION_KEY); | ||
} | ||
|
||
protected UploadFullProcessingTask( | ||
AnActionEvent event, Environment environment, String title, String notificationKey) { | ||
|
||
super(event.getProject(), title, notificationKey); | ||
|
||
setEvent(event); | ||
setEnvironment(environment); | ||
} | ||
|
||
@Override | ||
protected ProcessObjectResult processObject(MidPointObject object) throws Exception { | ||
OperationResult result = UploadTaskMixin.uploadExecute(client, object, buildUploadOptions(object)); | ||
|
||
ProcessObjectResult por = validateOperationResult(OPERATION_UPLOAD, result, object.getName()); | ||
|
||
if (object.isExecutable()) { | ||
return por; | ||
} | ||
|
||
OperationResult uploadResult = por.result(); | ||
|
||
if (uploadResult != null && !uploadResult.isSuccess()) { | ||
printProblem("Skipping processing for " + object.getName() + ", there was a problem with upload"); | ||
|
||
return por; | ||
} | ||
|
||
OperationResult recomputeResult = UploadTaskMixin.recompute(client, object); | ||
if (recomputeResult != null) { | ||
validateOperationResult(OPERATION_RECOMPUTE, recomputeResult, object.getName()); | ||
} | ||
|
||
OperationResult testConnectionResult = UploadTaskMixin.testResourceConnection(client, object); | ||
|
||
return validateOperationResult(OPERATION_TEST_CONNECTION, testConnectionResult, object.getName()); | ||
} | ||
|
||
public static List<String> buildUploadOptions(MidPointObject object) { | ||
List<String> options = new ArrayList<>(); | ||
options.add("isImport"); | ||
|
||
ObjectTypes type = object.getType(); | ||
if (type != ObjectTypes.TASK && type != ObjectTypes.SYSTEM_CONFIGURATION) { | ||
options.add("raw"); | ||
} | ||
|
||
return options; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.