Skip to content

Commit

Permalink
Creating DashboardService, cleaning up the code a bit (compilation er…
Browse files Browse the repository at this point in the history
…ror remains)
  • Loading branch information
semancik committed Apr 12, 2019
1 parent 74e65b2 commit d12fd21
Show file tree
Hide file tree
Showing 13 changed files with 660 additions and 557 deletions.
Expand Up @@ -36,6 +36,7 @@
import com.evolveum.midpoint.model.api.authentication.CompiledUserProfile;
import com.evolveum.midpoint.model.api.authentication.MidPointUserProfilePrincipal;
import com.evolveum.midpoint.model.api.expr.MidpointFunctions;
import com.evolveum.midpoint.model.api.interaction.DashboardService;
import com.evolveum.midpoint.model.api.validator.ResourceValidator;
import com.evolveum.midpoint.prism.delta.ObjectDelta;
import com.evolveum.midpoint.prism.*;
Expand Down Expand Up @@ -258,6 +259,9 @@ public abstract class PageBase extends WebPage implements ModelServiceLocator {

@SpringBean(name = "modelInteractionService")
private ModelInteractionService modelInteractionService;

@SpringBean(name = "dashboardService")
private DashboardService dashboardService;

@SpringBean(name = "modelController")
private TaskService taskService;
Expand Down Expand Up @@ -585,6 +589,11 @@ public SecurityContextManager getSecurityContextManager() {
public ModelInteractionService getModelInteractionService() {
return modelInteractionService;
}

@Override
public DashboardService getDashboardService() {
return dashboardService;
}

protected ModelDiagnosticService getModelDiagnosticService() {
return modelDiagnosticService;
Expand Down
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016-2018 Evolveum
* Copyright (c) 2016-2019 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 @@ -19,6 +19,7 @@
import com.evolveum.midpoint.model.api.ModelInteractionService;
import com.evolveum.midpoint.model.api.ModelService;
import com.evolveum.midpoint.model.api.authentication.CompiledUserProfile;
import com.evolveum.midpoint.model.api.interaction.DashboardService;
import com.evolveum.midpoint.prism.PrismContext;
import com.evolveum.midpoint.repo.common.ObjectResolver;
import com.evolveum.midpoint.repo.common.expression.ExpressionFactory;
Expand Down Expand Up @@ -46,6 +47,8 @@ public interface ModelServiceLocator {

ModelInteractionService getModelInteractionService();

DashboardService getDashboardService();

LocalizationService getLocalizationService();

Task createSimpleTask(String operationName);
Expand Down
Expand Up @@ -37,10 +37,10 @@
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.gui.api.util.WebModelServiceUtils;
import com.evolveum.midpoint.model.api.DashboardWidget;
import com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView;
import com.evolveum.midpoint.model.api.context.EvaluatedPolicyRule;
import com.evolveum.midpoint.model.api.util.DashboardUtils;
import com.evolveum.midpoint.model.api.interaction.DashboardService;
import com.evolveum.midpoint.model.api.interaction.DashboardWidget;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.PrismPropertyValue;
import com.evolveum.midpoint.prism.query.ObjectQuery;
Expand Down Expand Up @@ -165,9 +165,7 @@ private void initLayout() {

@Override
public DashboardWidget getObject() {
DashboardWidget ret = DashboardUtils.createWidgetData(model.getObject(), getPageBase().getModelService(),
getPageBase().getTaskManager(), getPageBase().getExpressionFactory(), getPageBase().getAuditService(),
getPageBase().getClock(), getPageBase().getModelInteractionService());
DashboardWidget ret = getPageBase().getDashboardService().createWidgetData(model.getObject(), task, result);
setDisplay(ret.getDisplay());
return ret;
}
Expand Down
Expand Up @@ -37,6 +37,7 @@

import com.evolveum.midpoint.audit.api.AuditEventRecord;
import com.evolveum.midpoint.common.Clock;
import com.evolveum.midpoint.model.api.interaction.DashboardService;
import com.evolveum.midpoint.model.api.util.DashboardUtils;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.util.exception.CommunicationException;
Expand Down
Expand Up @@ -26,6 +26,7 @@
import com.evolveum.midpoint.model.api.ModelInteractionService;
import com.evolveum.midpoint.model.api.ModelService;
import com.evolveum.midpoint.model.api.authentication.CompiledUserProfile;
import com.evolveum.midpoint.model.api.interaction.DashboardService;
import com.evolveum.midpoint.model.test.AbstractModelIntegrationTest;
import com.evolveum.midpoint.prism.PrismContext;
import com.evolveum.midpoint.prism.PrismObject;
Expand Down Expand Up @@ -197,6 +198,11 @@ public ModelService getModelService() {
public ModelInteractionService getModelInteractionService() {
return modelInteractionService;
}

@Override
public DashboardService getDashboardService() {
return dashboardService;
}

@Override
public Task createSimpleTask(String operationName) {
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2018 Evolveum
* Copyright (c) 2016-2019 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.model.api.ModelInteractionService;
import com.evolveum.midpoint.model.api.ModelService;
import com.evolveum.midpoint.model.api.authentication.CompiledUserProfile;
import com.evolveum.midpoint.model.api.interaction.DashboardService;
import com.evolveum.midpoint.prism.PrismContext;
import com.evolveum.midpoint.prism.util.PrismTestUtil;
import com.evolveum.midpoint.repo.common.expression.ExpressionFactory;
Expand Down Expand Up @@ -55,6 +56,11 @@ public ModelService getModelService() {
public ModelInteractionService getModelInteractionService() {
return null;
}

@Override
public DashboardService getDashboardService() {
return null;
}

@Override
public Task createSimpleTask(String operationName) {
Expand Down Expand Up @@ -101,6 +107,8 @@ public LocalizationService getLocalizationService() {
public Locale getLocale() {
return Locale.US;
}


};
}

Expand Down
5 changes: 0 additions & 5 deletions model/model-api/pom.xml
Expand Up @@ -77,11 +77,6 @@
<artifactId>task-api</artifactId>
<version>4.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.evolveum.midpoint.repo</groupId>
<artifactId>repo-common</artifactId>
<version>4.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.evolveum.midpoint.repo</groupId>
<artifactId>security-api</artifactId>
Expand Down
@@ -0,0 +1,50 @@
/**
* Copyright (c) 2010-2019 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.model.api.interaction;

import java.util.List;

import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.util.annotation.Experimental;
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;
import com.evolveum.midpoint.xml.ns._public.common.common_3.DashboardWidgetType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectCollectionType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;

/**
* @author skublik
*/
@Experimental
public interface DashboardService {

// TODO: check the use of those, do we need them as public in the interface? Move to implementation? Or utils?
public static final String VAR_PROPORTIONAL = "proportional";
public static final String PARAMETER_FROM = "from";

DashboardWidget createWidgetData(DashboardWidgetType widget, Task task, OperationResult result) throws SchemaException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException, ObjectNotFoundException;

List<PrismObject<ObjectType>> searchObjectFromCollection(ObjectCollectionType collection, boolean usingFilter, Task task, OperationResult result) throws SchemaException, ObjectNotFoundException, SecurityViolationException, CommunicationException, ConfigurationException, ExpressionEvaluationException;

ObjectCollectionType getObjectCollectionType(DashboardWidgetType widget, Task task, OperationResult result) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException;

}
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.evolveum.midpoint.model.api;
package com.evolveum.midpoint.model.api.interaction;

import com.evolveum.midpoint.xml.ns._public.common.common_3.DashboardWidgetType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.DisplayType;
Expand Down

0 comments on commit d12fd21

Please sign in to comment.