Skip to content

Commit

Permalink
It compiles! Ship it!
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed May 12, 2017
1 parent 30fd4e2 commit 8ef0729
Show file tree
Hide file tree
Showing 59 changed files with 351 additions and 255 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2016 Evolveum
* Copyright (c) 2010-2017 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -173,8 +173,7 @@ public Search load() {
}

protected Search createSearch() {
return SearchFactory.createSearch(type, parentPage.getPrismContext(),
parentPage.getModelInteractionService());
return SearchFactory.createSearch(type, parentPage);
}

private BoxedTablePanel<SelectableBean<O>> createTable() {
Expand Down
@@ -1,3 +1,18 @@
/*
* Copyright (c) 2010-2017 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.evolveum.midpoint.gui.api.component.delta;

import com.evolveum.midpoint.util.DebugUtil;
Expand All @@ -17,6 +32,7 @@
import com.evolveum.midpoint.prism.delta.ObjectDelta;
import com.evolveum.midpoint.schema.DeltaConvertor;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.util.exception.ExpressionEvaluationException;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
Expand Down Expand Up @@ -79,7 +95,7 @@ public String getObject() {
final SceneDto sceneDto;
try {
sceneDto = loadSceneForDelta();
} catch (SchemaException e) {
} catch (SchemaException | ExpressionEvaluationException e) {
OperationResult result = new OperationResult(ObjectDeltaOperationPanel.class.getName() + ".loadSceneForDelta");
result.recordFatalError("Couldn't fetch or visualize the delta: " + e.getMessage(), e);
parentPage.showResult(result);
Expand Down Expand Up @@ -135,7 +151,7 @@ private String getBoxCssClass() {

}

private SceneDto loadSceneForDelta() throws SchemaException {
private SceneDto loadSceneForDelta() throws SchemaException, ExpressionEvaluationException {
Scene scene;

ObjectDelta<? extends ObjectType> delta;
Expand All @@ -151,7 +167,7 @@ private SceneDto loadSceneForDelta() throws SchemaException {
scene = parentPage.getModelInteractionService().visualizeDelta(delta,
parentPage.createSimpleTask(ID_PARAMETERS_DELTA),
new OperationResult(ID_PARAMETERS_DELTA));
} catch (SchemaException e) {
} catch (SchemaException | ExpressionEvaluationException e) {
LoggingUtils.logException(LOGGER, "SchemaException while visualizing delta:\n{}",
e, DebugUtil.debugDump(delta));
throw e;
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2016 Evolveum
* Copyright (c) 2010-2017 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -172,7 +172,7 @@ public void determineBackgroundTaskVisibility(PageBase pageBase) {
try {
pageBase.getModelService().getObject(TaskType.class, backgroundTaskOid, null, task, task.getResult());
backgroundTaskVisible = true;
} catch (ObjectNotFoundException|SchemaException|SecurityViolationException|CommunicationException|ConfigurationException e) {
} catch (ObjectNotFoundException|SchemaException|SecurityViolationException|CommunicationException|ConfigurationException|ExpressionEvaluationException e) {
LOGGER.debug("Task {} is not visible by the current user: {}: {}", backgroundTaskOid, e.getClass(), e.getMessage());
backgroundTaskVisible = false;
}
Expand Down
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016 Evolveum
* Copyright (c) 2016-2017 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,9 +17,12 @@

import com.evolveum.midpoint.model.api.ModelInteractionService;
import com.evolveum.midpoint.model.api.ModelService;
import com.evolveum.midpoint.prism.PrismContext;
import com.evolveum.midpoint.task.api.Task;

/**
* Interface that allows location of ModelService and ModelInteractionService.
* Interface that allows location of model and model-like services,
* such as ModelService and ModelInteractionService.
* Used by GUI components that need to interact with the midPoint IDM model,
* especially for loading data.
* Usually implemented by PageBase and similar "central" GUI classes.
Expand All @@ -31,5 +34,9 @@ public interface ModelServiceLocator {
ModelService getModelService();

ModelInteractionService getModelInteractionService();

Task createSimpleTask(String operationName);

PrismContext getPrismContext();

}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2016 Evolveum
* Copyright (c) 2010-2017 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -333,7 +333,7 @@ public static <T extends ObjectType> int countObjects(Class<T> type, ObjectQuery
try {
count = page.getModelService().countObjects(type, query, null, task, parentResult);
} catch (SchemaException | ObjectNotFoundException | SecurityViolationException
| ConfigurationException | CommunicationException ex) {
| ConfigurationException | CommunicationException | ExpressionEvaluationException ex) {
parentResult.recordFatalError("WebModelUtils.couldntCountObjects", ex);
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't count objects", ex);
}
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016 Evolveum
* Copyright (c) 2016-2017 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -322,8 +322,7 @@ public void detach() {
private static final long serialVersionUID = 1L;
@Override
public Search load() {
Search search = SearchFactory.createSearch(AbstractRoleType.class, pageBase.getPrismContext(),
pageBase.getModelInteractionService());
Search search = SearchFactory.createSearch(AbstractRoleType.class, pageBase);
return search;
}
};
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2016 Evolveum
* Copyright (c) 2010-2017 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -40,6 +40,7 @@
import com.evolveum.midpoint.util.MiscUtil;
import com.evolveum.midpoint.util.exception.CommunicationException;
import com.evolveum.midpoint.util.exception.ConfigurationException;
import com.evolveum.midpoint.util.exception.ExpressionEvaluationException;
import com.evolveum.midpoint.util.exception.ObjectNotFoundException;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.exception.SecurityViolationException;
Expand Down Expand Up @@ -1146,7 +1147,7 @@ public void detach() {

private <O extends ObjectType> PrismObject<O> getTargetObject(AssignmentEditorDto dto)
throws ObjectNotFoundException, SchemaException, SecurityViolationException,
CommunicationException, ConfigurationException {
CommunicationException, ConfigurationException, ExpressionEvaluationException {
PrismContainerValue<AssignmentType> assignment = dto.getOldValue();

PrismReference targetRef = assignment.findReference(AssignmentType.F_TARGET_REF);
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2016 Evolveum
* Copyright (c) 2010-2017 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -112,8 +112,7 @@ public MultipleAssignmentSelector(String id, IModel<List<AssignmentEditorDto>> s

@Override
public Search load() {
Search search = SearchFactory.createSearch(RoleType.class, getPageBase().getPrismContext(),
getPageBase().getModelInteractionService());
Search search = SearchFactory.createSearch(RoleType.class, getPageBase());
return search;
}
};
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2013 Evolveum
* Copyright (c) 2010-2017 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,6 +25,7 @@
import com.evolveum.midpoint.prism.delta.ObjectDelta;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.util.exception.ExpressionEvaluationException;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.exception.SystemException;
import com.evolveum.midpoint.web.component.prism.show.WrapperScene;
Expand Down Expand Up @@ -82,7 +83,7 @@ public ModelOperationStatusDto(ModelContext<?> modelContext, ModelInteractionSer
}
primaryScenes = modelInteractionService.visualizeDeltas(primaryDeltas, opTask, result);
// secondaryScenes = modelInteractionService.visualizeDeltas(secondaryDeltas, opTask, result);
} catch (SchemaException e) {
} catch (SchemaException | ExpressionEvaluationException e) {
throw new SystemException(e); // TODO
}
final WrapperScene primaryWrapperScene = new WrapperScene(primaryScenes, primaryDeltas.size() != 1 ? "PagePreviewChanges.primaryChangesMore" : "PagePreviewChanges.primaryChangesOne", primaryDeltas.size());
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2016 Evolveum
* Copyright (c) 2010-2017 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,6 +27,7 @@
import com.evolveum.midpoint.schema.util.ConnectorTypeUtil;
import com.evolveum.midpoint.schema.util.ReportTypeUtil;
import com.evolveum.midpoint.schema.util.ResourceTypeUtil;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.util.exception.ConfigurationException;
import com.evolveum.midpoint.util.exception.ObjectNotFoundException;
import com.evolveum.midpoint.util.exception.SchemaException;
Expand Down Expand Up @@ -94,10 +95,11 @@ public <O extends ObjectType> ObjectWrapper<O> createObjectWrapper(String displa
ContainerStatus status,
boolean delayContainerCreation) {
try {
OperationResult result = new OperationResult(CREATE_OBJECT_WRAPPER);
Task task = modelServiceLocator.createSimpleTask(CREATE_OBJECT_WRAPPER);
OperationResult result = task.getResult();

PrismObjectDefinition<O> objectDefinitionForEditing = modelServiceLocator.getModelInteractionService()
.getEditObjectDefinition(object, AuthorizationPhaseType.REQUEST, result);
.getEditObjectDefinition(object, AuthorizationPhaseType.REQUEST, task, result);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Edit definition for {}:\n{}", object, objectDefinitionForEditing.debugDump(1));
}
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2016 Evolveum
* Copyright (c) 2010-2017 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,6 +23,7 @@
import com.evolveum.midpoint.prism.delta.ObjectDelta;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.util.DebugUtil;
import com.evolveum.midpoint.util.exception.ExpressionEvaluationException;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.exception.SystemException;
import com.evolveum.midpoint.util.logging.Trace;
Expand Down Expand Up @@ -86,7 +87,7 @@ public PagePreviewChanges(ModelContext<? extends ObjectType> modelContext, Model
Task task = createSimpleTask("visualize");
primaryScenes = modelInteractionService.visualizeDeltas(primaryDeltas, task, task.getResult());
secondaryScenes = modelInteractionService.visualizeDeltas(secondaryDeltas, task, task.getResult());
} catch (SchemaException e) {
} catch (SchemaException | ExpressionEvaluationException e) {
throw new SystemException(e); // TODO
}
if (LOGGER.isTraceEnabled()) {
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2016 Evolveum
* Copyright (c) 2010-2017 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,6 +23,7 @@
import com.evolveum.midpoint.schema.DeltaConvertor;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.util.exception.ExpressionEvaluationException;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectTreeDeltasType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
Expand All @@ -38,7 +39,7 @@ public class SceneUtil {

public static Scene visualizeObjectTreeDeltas(ObjectTreeDeltasType deltas, String displayNameKey,
PrismContext prismContext, ModelInteractionService modelInteractionService,
Task task, OperationResult result) throws SchemaException {
Task task, OperationResult result) throws SchemaException, ExpressionEvaluationException {
List<Scene> scenes = new ArrayList<>();
if (deltas != null) {
if (deltas.getFocusPrimaryDelta() != null) {
Expand Down
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016 Evolveum
* Copyright (c) 2016-2017 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,6 +27,7 @@
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.util.exception.CommunicationException;
import com.evolveum.midpoint.util.exception.ConfigurationException;
import com.evolveum.midpoint.util.exception.ExpressionEvaluationException;
import com.evolveum.midpoint.util.exception.ObjectNotFoundException;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.exception.SecurityViolationException;
Expand Down Expand Up @@ -86,7 +87,8 @@ private void initLayout(final LoadableModel<ObjectWrapper<F>> focusModel, Loadab
List<PrismObject<RoleType>> availableRoles;
try {
availableRoles = pageBase.getModelService().searchObjects(RoleType.class, null, null, task, task.getResult());
} catch (SchemaException | ObjectNotFoundException | SecurityViolationException | CommunicationException | ConfigurationException e) {
} catch (SchemaException | ObjectNotFoundException | SecurityViolationException | CommunicationException |
ConfigurationException | ExpressionEvaluationException e) {
task.getResult().recordFatalError(e);
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't load roles", e);
availableRoles = new ArrayList<>();
Expand Down

0 comments on commit 8ef0729

Please sign in to comment.