Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Mar 9, 2020
2 parents 9d149c3 + b0f9223 commit 7598173
Show file tree
Hide file tree
Showing 28 changed files with 276 additions and 170 deletions.
Expand Up @@ -6,10 +6,14 @@
*/
package com.evolveum.midpoint.gui.impl.prism;

import java.util.Collection;
import java.util.Collections;
import java.util.List;

import com.evolveum.midpoint.prism.PrismValue;

import com.evolveum.midpoint.web.page.admin.server.RefreshableTabPanel;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
Expand Down Expand Up @@ -37,7 +41,7 @@
* @author katka
*
*/
public abstract class ItemPanel<VW extends PrismValueWrapper, IW extends ItemWrapper> extends BasePanel<IW>{
public abstract class ItemPanel<VW extends PrismValueWrapper, IW extends ItemWrapper> extends BasePanel<IW> implements RefreshableTabPanel {

private static final long serialVersionUID = 1L;

Expand Down Expand Up @@ -314,4 +318,9 @@ protected boolean isHeaderVisible() {
public ItemPanelSettings getSettings() {
return itemPanelSettings;
}

@Override
public Collection<Component> getComponentsToUpdate() {
return Collections.singleton(this);
}
}
Expand Up @@ -154,14 +154,12 @@ protected void addValue(AjaxRequestTarget target) {

target.add(PrismReferencePanel.this);
}

// @Override
// protected EnableBehaviour getEnableBehaviourOfValuePanel(PrismReferenceWrapper<R> iw) {
// return new EnableBehaviour(() -> !iw.isReadOnly() || isLink(iw));
// }


@Override
public boolean isEnabled() {
if (getEditabilityHandler() != null && !getEditabilityHandler().isEditable(getModelObject())) {
return false;
}
return !getModelObject().isReadOnly() || isLink(getModelObject());
}

Expand Down
Expand Up @@ -6,8 +6,6 @@

import com.evolveum.midpoint.gui.api.util.WebModelServiceUtils;
import com.evolveum.midpoint.report.api.ReportConstants;
import com.evolveum.midpoint.report.api.ReportManager;
import com.evolveum.midpoint.schema.constants.SchemaConstants;
import com.evolveum.midpoint.web.component.AjaxDownloadBehaviorFromStream;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;

Expand Down Expand Up @@ -119,7 +117,7 @@ protected Collection<SelectorOptions<GetOperationOptions>> buildGetOptions() {

return getOperationOptionsBuilder()
// retrieve
.item(TaskType.F_SUBTASK).retrieve()
.item(TaskType.F_SUBTASK_REF).retrieve()
.item(TaskType.F_NODE_AS_OBSERVED).retrieve()
.item(TaskType.F_NEXT_RUN_START_TIMESTAMP).retrieve()
.item(TaskType.F_NEXT_RETRY_TIMESTAMP).retrieve()
Expand Down Expand Up @@ -520,9 +518,9 @@ public void refresh(AjaxRequestTarget target) {
// target.add(getMainPanel());

for (Component component : getMainPanel().getTabbedPanel()) {
if (component instanceof TaskTabPanel) {
if (component instanceof RefreshableTabPanel) {

for (Component c : ((TaskTabPanel) component).getComponentsToUpdate()) {
for (Component c : ((RefreshableTabPanel) component).getComponentsToUpdate()) {
target.add(c);
}
}
Expand Down
Expand Up @@ -186,7 +186,7 @@ private Collection<SelectorOptions<GetOperationOptions>> createOperationOptions(
propertiesToGet.add(TaskType.F_NODE_AS_OBSERVED);
propertiesToGet.add(TaskType.F_NEXT_RUN_START_TIMESTAMP);
propertiesToGet.add(TaskType.F_NEXT_RETRY_TIMESTAMP);
propertiesToGet.add(TaskType.F_SUBTASK);
propertiesToGet.add(TaskType.F_SUBTASK_REF);

GetOperationOptionsBuilder getOperationOptionsBuilder = getSchemaHelper().getOperationOptionsBuilder();
getOperationOptionsBuilder = getOperationOptionsBuilder.resolveNames();
Expand Down
@@ -1,20 +1,20 @@
/*
* Copyright (c) 2010-2017 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

package com.evolveum.midpoint.web.page.admin.server;

import org.apache.wicket.Component;

import java.util.Collection;

/**
* @author mederly
*/
@FunctionalInterface
public interface TaskTabPanel {
Collection<Component> getComponentsToUpdate();
}
/*
* Copyright (c) 2010-2017 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

package com.evolveum.midpoint.web.page.admin.server;

import org.apache.wicket.Component;

import java.util.Collection;

/**
* @author mederly
*/
@FunctionalInterface
public interface RefreshableTabPanel {
Collection<Component> getComponentsToUpdate();
}
Expand Up @@ -44,7 +44,7 @@
/**
* Created by honchar.
*/
public class TaskErrorsTabPanel extends BasePanel<PrismObjectWrapper<TaskType>> implements TaskTabPanel {
public class TaskErrorsTabPanel extends BasePanel<PrismObjectWrapper<TaskType>> implements RefreshableTabPanel {
private static final long serialVersionUID = 1L;

private static final String ID_TASK_ERRORS = "taskErrors";
Expand Down
Expand Up @@ -26,7 +26,7 @@
/**
*
*/
public class TaskInternalPerformanceTabPanel extends BasePanel<PrismContainerWrapper<OperationStatsType>> implements TaskTabPanel {
public class TaskInternalPerformanceTabPanel extends BasePanel<PrismContainerWrapper<OperationStatsType>> implements RefreshableTabPanel {
private static final long serialVersionUID = 1L;

private static final transient Trace LOGGER = TraceManager.getTrace(TaskInternalPerformanceTabPanel.class);
Expand Down
Expand Up @@ -10,9 +10,6 @@
import com.evolveum.midpoint.prism.PrismReferenceValue;
import com.evolveum.midpoint.schema.constants.ObjectTypes;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.schema.statistics.ActionsExecutedInformation;
import com.evolveum.midpoint.schema.statistics.IterativeTaskInformation;
import com.evolveum.midpoint.schema.statistics.SynchronizationInformation;
import com.evolveum.midpoint.schema.util.TaskTypeUtil;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.task.api.TaskCategory;
Expand All @@ -37,9 +34,8 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.stream.Stream;

public class TaskOperationStatisticsPanel extends BasePanel<PrismObjectWrapper<TaskType>> implements TaskTabPanel {
public class TaskOperationStatisticsPanel extends BasePanel<PrismObjectWrapper<TaskType>> implements RefreshableTabPanel {

private static final String ID_PROCESSING_INFO = "processingInfo";
private static final String ID_SYNCHORNIZATION_SITUATIONS = "synchronizationSituation";
Expand Down Expand Up @@ -129,7 +125,7 @@ private void resolveSubTasks(TaskType subTask, boolean alreadyLoaded, List<TaskT
subTaskWithLoadedSubtasks = subTask.asPrismObject();
} else {
subTaskWithLoadedSubtasks = WebModelServiceUtils.loadObject(TaskType.class, subTask.getOid(),
getSchemaHelper().getOperationOptionsBuilder().item(TaskType.F_SUBTASK).retrieve().build(), getPageBase(), task, result);
getSchemaHelper().getOperationOptionsBuilder().item(TaskType.F_SUBTASK_REF).retrieve().build(), getPageBase(), task, result);
}

if (subTaskWithLoadedSubtasks == null) {
Expand Down
Expand Up @@ -37,7 +37,7 @@
*/

//TODO implement correctly
public class TaskOperationTabPanel extends BasePanel<PrismContainerWrapper<LensContextType>> implements TaskTabPanel {
public class TaskOperationTabPanel extends BasePanel<PrismContainerWrapper<LensContextType>> implements RefreshableTabPanel {
private static final long serialVersionUID = 1L;

private static final String ID_MODEL_OPERATION_STATUS_PANEL = "modelOperationStatusPanel";
Expand Down
Expand Up @@ -24,7 +24,7 @@
/**
* @author semancik
*/
public class TaskPerformanceTabPanel extends BasePanel<PrismObjectWrapper<TaskType>> implements TaskTabPanel {
public class TaskPerformanceTabPanel extends BasePanel<PrismObjectWrapper<TaskType>> implements RefreshableTabPanel {
private static final long serialVersionUID = 1L;

private static final String ID_STATISTICS_PANEL = "statisticsPanel";
Expand Down
Expand Up @@ -39,7 +39,7 @@
/**
* @author semancik
*/
public class TaskResultTabPanel extends BasePanel<PrismObjectWrapper<TaskType>> implements TaskTabPanel {
public class TaskResultTabPanel extends BasePanel<PrismObjectWrapper<TaskType>> implements RefreshableTabPanel {
private static final long serialVersionUID = 1L;

private static final String ID_OPERATION_RESULT = "operationResult";
Expand Down
Expand Up @@ -30,7 +30,7 @@
/**
* @author semancik
*/
public class TaskSubtasksAndThreadsTabPanel extends BasePanel<PrismObjectWrapper<TaskType>> implements TaskTabPanel {
public class TaskSubtasksAndThreadsTabPanel extends BasePanel<PrismObjectWrapper<TaskType>> implements RefreshableTabPanel {
private static final long serialVersionUID = 1L;

private static final String ID_WORKER_THREADS_TABLE = "workerThreadsTable";
Expand Down
Expand Up @@ -74,7 +74,7 @@ public boolean computeSubtasksAndThreadsVisible(PageTask parentPage, PrismObject
subtasksAndThreadsVisible = configuresWorkerThreads(task) && isThreadsReadable;
} else if (!parentPage.isAdd() && !WebComponentUtil.isWorkflowTask(taskWrapper.getObject().asObjectable())) {
subtasksAndThreadsVisible = configuresWorkerThreads(task) && isThreadsReadable
|| !CollectionUtils.isNotEmpty(task.getSubtask());
|| !CollectionUtils.isNotEmpty(task.getSubtaskRef());
} else {
subtasksAndThreadsVisible = false;
}
Expand Down
Expand Up @@ -175,7 +175,7 @@ public boolean isRoot() {
private static final Set<ItemPath> PATHS_NOT_RETURNED_BY_DEFAULT = new HashSet<>(Arrays.asList(
ItemPath.create(UserType.F_JPEG_PHOTO),
ItemPath.create(TaskType.F_RESULT),
ItemPath.create(TaskType.F_SUBTASK),
ItemPath.create(TaskType.F_SUBTASK_REF),
ItemPath.create(TaskType.F_NODE_AS_OBSERVED),
ItemPath.create(TaskType.F_NEXT_RUN_START_TIMESTAMP),
ItemPath.create(TaskType.F_NEXT_RETRY_TIMESTAMP),
Expand Down
Expand Up @@ -117,4 +117,13 @@ public static OperationStatsType getAggregatedOperationStats(TaskType task, Pris
.synchronizationInformation(synchronizationInformation)
.actionsExecutedInformation(actionsExecutedInformation);
}

public static TaskType findChild(TaskType parent, String childOid) {
for (TaskType subtask : getResolvedSubtasks(parent)) {
if (childOid.equals(subtask.getOid())) {
return subtask;
}
}
return null;
}
}
Expand Up @@ -2617,18 +2617,6 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="subtask" type="tns:TaskType" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>
Set of task's subtasks.
TRANSIENT attribute. In the repository the parent-child relationship is stored using "parent" property.
TODO: do we still need this?
</xsd:documentation>
<xsd:appinfo>
<a:objectReference>tns:subtaskRef</a:objectReference>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="subtaskRef" type="c:ObjectReferenceType" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>
Expand Down
Expand Up @@ -102,7 +102,7 @@ private void executeReconciliation(TestResource reconciliationTask, String accou

System.out.println("Task tree suspended.");
Collection<SelectorOptions<GetOperationOptions>> getSubtasks = getOperationOptionsBuilder()
.item(TaskType.F_SUBTASK).retrieve()
.item(TaskType.F_SUBTASK_REF).retrieve()
.build();
PrismObject<TaskType> rootAfterSuspension1 = taskManager.getObject(TaskType.class, reconciliationTask.oid, getSubtasks, result);
display("Tree after suspension", TaskDebugUtil.dumpTaskTree(rootAfterSuspension1.asObjectable()));
Expand Down Expand Up @@ -189,7 +189,7 @@ private void executeRecomputation(TestResource recomputationTask, String rolePre

System.out.println("Task tree suspended.");
Collection<SelectorOptions<GetOperationOptions>> getSubtasks = getOperationOptionsBuilder()
.item(TaskType.F_SUBTASK).retrieve()
.item(TaskType.F_SUBTASK_REF).retrieve()
.build();
PrismObject<TaskType> rootAfterSuspension1 = taskManager.getObject(TaskType.class, recomputationTask.oid, getSubtasks, result);
display("Tree after suspension", TaskDebugUtil.dumpTaskTree(rootAfterSuspension1.asObjectable()));
Expand Down
Expand Up @@ -3130,7 +3130,7 @@ protected void dumpTaskTree(String oid, OperationResult result)
throws ObjectNotFoundException,
SchemaException {
Collection<SelectorOptions<GetOperationOptions>> options = schemaHelper.getOperationOptionsBuilder()
.item(TaskType.F_SUBTASK).retrieve()
.item(TaskType.F_SUBTASK_REF).retrieve()
.build();
PrismObject<TaskType> task = taskManager.getObject(TaskType.class, oid, options, result);
dumpTaskAndSubtasks(task.asObjectable(), 0);
Expand Down Expand Up @@ -3822,7 +3822,7 @@ protected PrismObject<TaskType> getTask(String taskOid)
protected PrismObject<TaskType> getTaskTree(String taskOid) throws ObjectNotFoundException, SchemaException, SecurityViolationException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
Task task = createPlainTask("getTaskTree");
OperationResult result = task.getResult();
PrismObject<TaskType> retTask = modelService.getObject(TaskType.class, taskOid, retrieveItemsNamed(TaskType.F_RESULT, TaskType.F_SUBTASK), task, result);
PrismObject<TaskType> retTask = modelService.getObject(TaskType.class, taskOid, retrieveItemsNamed(TaskType.F_RESULT, TaskType.F_SUBTASK_REF), task, result);
result.computeStatus();
TestUtil.assertSuccess("getObject(Task) result not success", result);
return retTask;
Expand Down
Expand Up @@ -264,10 +264,6 @@ void modifyTask(String oid, Collection<? extends ItemDelta> modifications, Opera
@NotNull
Task getTaskWithResult(String taskOid, OperationResult parentResult) throws ObjectNotFoundException, SchemaException;

/**
* BEWARE: This method does not obey taskManager-related options, e.g. retrieve(F_SUBTASK). If you need to apply them,
* use getTaskObject instead. See MID-5374.
*/
@NotNull
Task getTask(String taskOid, Collection<SelectorOptions<GetOperationOptions>> options, OperationResult parentResult) throws ObjectNotFoundException, SchemaException;

Expand Down

0 comments on commit 7598173

Please sign in to comment.