Skip to content

Commit

Permalink
#605: Impl module filter combo box to module items
Browse files Browse the repository at this point in the history
  • Loading branch information
mtnhan committed Nov 23, 2022
1 parent f144372 commit ea6ac03
Show file tree
Hide file tree
Showing 35 changed files with 130 additions and 132 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import java.io.Serializable;

import javax.annotation.PostConstruct;
import javax.faces.view.ViewScoped;
import javax.inject.Named;

import org.meveo.admin.exception.BusinessException;
Expand All @@ -37,7 +36,6 @@
import org.meveo.api.export.ExportFormat;
import org.meveo.model.IEntity;
import org.meveo.model.module.MeveoModule;
import org.meveo.service.base.local.IPersistenceService;
import org.primefaces.event.FileUploadEvent;
import org.primefaces.model.DefaultStreamedContent;
import org.primefaces.model.StreamedContent;
Expand All @@ -52,7 +50,7 @@
*/
@Named
//@ViewScoped
public abstract class BaseCrudBean<T extends IEntity, D extends BaseEntityDto> extends BaseBean<T> implements Serializable {
public abstract class BaseCrudBean<T extends IEntity, D extends BaseEntityDto> extends ModuleItemBaseBean<T> implements Serializable {

private static final long serialVersionUID = 1L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* @param <T>
*/
public abstract class CustomFieldBean<T extends IEntity> extends BaseBean<T> {
public abstract class CustomFieldBean<T extends IEntity> extends ModuleItemBaseBean<T> {

private static final long serialVersionUID = 1L;
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.meveo.admin.action.admin.endpoint;
package org.meveo.admin.action;

import org.meveo.admin.action.BaseBean;
import org.meveo.model.IEntity;

import java.util.List;
Expand All @@ -14,24 +13,25 @@

@Named
public abstract class ModuleItemBaseBean<T extends IEntity> extends BaseBean<T>{

private String workingModule;

@Inject
private MeveoModuleService meveoModuleService;

public ModuleItemBaseBean() {
protected ModuleItemBaseBean() {
super();
}

public ModuleItemBaseBean(Class<T> clazz) {
protected ModuleItemBaseBean(Class<T> clazz) {
super(clazz);
}

@PostConstruct
@Override
public void init() {
super.init();
workingModule = this.getUserCurrentModule();
this.workingModule = super.getUserCurrentModule();
this.filters.put("moduleBelonging", workingModule);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.meveo.model.IEntity;
import org.meveo.service.base.local.IPersistenceService;

public abstract class UpdateMapTypeFieldBean<T extends IEntity> extends BaseBean<T> {
public abstract class UpdateMapTypeFieldBean<T extends IEntity> extends ModuleItemBaseBean<T> {

/**
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.meveo.admin.action.admin.custom;

import org.meveo.admin.action.BaseBean;
import org.meveo.admin.action.ModuleItemBaseBean;
import org.meveo.admin.exception.BusinessException;
import org.meveo.admin.web.interceptor.ActionMethod;
import org.meveo.commons.utils.ReflectionUtils;
Expand All @@ -26,7 +26,7 @@
*/
@Named
@ViewScoped
public abstract class BackingCustomBean <T extends BusinessEntity> extends BaseBean<T> {
public abstract class BackingCustomBean <T extends BusinessEntity> extends ModuleItemBaseBean<T> {

private static final long serialVersionUID = 1187554162639618526L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ public class CustomEntityTemplateListBean extends CustomEntityTemplateBean {
private List<CustomizedEntity> selectedCustomizedEntities;

@PostConstruct
public void init() {
public void init() {
this.filters.put("customEntity", true);
this.filters.put("userCurrentModule", this.getUserCurrentModule());
this.setWorkingModule(super.getUserCurrentModule());
this.filters.put("moduleBelonging", this.getWorkingModule());
}

public LazyDataModel<CustomizedEntity> getCustomizedEntities() {
Expand Down Expand Up @@ -89,15 +90,15 @@ public List<CustomizedEntity> load(int first, int pageSize, String sortField, So
String sortBy = sortOrder != null ? sortOrder.name() : null;
String primitiveEntity = (String) filters.get("primitiveEntity");
primitiveEntity = primitiveEntity == null ? "0" : primitiveEntity;
String currentModule = (String) filters.get("userCurrentModule");
String moduleBelonging = (String) filters.get("moduleBelonging");

CustomizedEntityFilter filter = new CustomizedEntityFilter();
filter.setEntityName(query);
filter.setCustomEntityTemplatesOnly(isCustomEntityOnly);
filter.setSortBy(sortField);
filter.setSortBy(sortBy);
filter.setPrimitiveEntity(primitiveEntity);
filter.setModuleCode(currentModule);
filter.setModuleCode(moduleBelonging);

if (StringUtils.isBlank(cecId)) {
filter.setIncludeNonManagedEntities(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.apache.commons.collections.CollectionUtils;
import org.jboss.seam.international.status.Messages;
import org.jboss.seam.international.status.builder.BundleKey;
import org.meveo.admin.action.BaseBean;
import org.meveo.admin.action.ModuleItemBaseBean;
import org.meveo.admin.exception.BusinessException;
import org.meveo.admin.web.interceptor.ActionMethod;
import org.meveo.api.technicalservice.endpoint.EndpointApi;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,6 @@ public class WebsocketClientBean extends BaseCrudBean<WebsocketClient, Websocket
public WebsocketClientBean() {
super(WebsocketClient.class);
}

@PostConstruct
@Override
public void init() {
super.init();
this.filters.put("moduleBelonging", this.getUserCurrentModule());
}

@Override
public BaseCrudApi<WebsocketClient, WebsocketClientDto> getBaseCrudApi() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import javax.faces.view.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;
import org.meveo.admin.action.BaseBean;
import org.meveo.admin.action.ModuleItemBaseBean;
import org.meveo.model.technicalservice.wsendpoint.WSEndpoint;
import org.meveo.service.base.local.IPersistenceService;
import org.meveo.service.technicalservice.wsendpoint.WSEndpointService;
Expand All @@ -16,7 +16,7 @@
*/
@Named
@ViewScoped
public class WsEndpointBean extends BaseBean<WSEndpoint> {
public class WsEndpointBean extends ModuleItemBaseBean<WSEndpoint> {

@Inject
private WSEndpointService wsEndpointService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.meveo.admin.action.admin.endpoint;

import javax.annotation.PostConstruct;
import javax.enterprise.context.ConversationScoped;
import javax.inject.Named;

Expand All @@ -10,12 +9,4 @@
*/
@Named
@ConversationScoped
public class WsEndpointListBean extends WsEndpointBean {

@PostConstruct
@Override
public void init() {
super.init();
this.filters.put("moduleBelonging", this.getUserCurrentModule());
}
}
public class WsEndpointListBean extends WsEndpointBean {}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.apache.commons.lang3.StringUtils;
import org.jboss.seam.international.status.builder.BundleKey;
import org.meveo.admin.action.BaseBean;
import org.meveo.admin.action.ModuleItemBaseBean;
import org.meveo.admin.action.admin.ViewBean;
import org.meveo.admin.exception.BusinessException;
import org.meveo.admin.web.interceptor.ActionMethod;
Expand All @@ -61,7 +62,6 @@
import org.meveo.model.scripts.ScriptInstanceNode;
import org.meveo.model.scripts.ScriptSourceTypeEnum;
import org.meveo.model.security.Role;
import org.meveo.model.wf.WFAction;
import org.meveo.service.admin.impl.RoleService;
import org.meveo.service.base.local.IPersistenceService;
import org.meveo.service.script.CustomScriptService;
Expand All @@ -87,7 +87,7 @@
@Named
@ViewScoped
@ViewBean
public class ScriptInstanceBean extends BaseBean<ScriptInstance> {
public class ScriptInstanceBean extends ModuleItemBaseBean<ScriptInstance> {
private static final long serialVersionUID = 1L;
private static final String JAVA = "java";
private static final String ES5 = "es5";
Expand Down Expand Up @@ -593,10 +593,10 @@ public TreeNode computeRootNode() {

List<ScriptInstanceDto> scriptInstances = new ArrayList<>();
if (!org.meveo.commons.utils.StringUtils.isBlank(code)) {
scriptInstances = scriptInstanceApi.getScriptsForTreeView(this.getUserCurrentModule(), code);
scriptInstances = scriptInstanceApi.getScriptsForTreeView(this.getWorkingModule(), code);
isExpand = true;
} else {
scriptInstances = scriptInstanceApi.getScriptsForTreeView(this.getUserCurrentModule(), null);
scriptInstances = scriptInstanceApi.getScriptsForTreeView(this.getWorkingModule(), null);
}
rootNode = new DefaultTreeNode("document", new ScriptInstanceNode("", ""), null);
rootNode.setExpanded(isExpand);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import javax.inject.Named;

import org.jboss.seam.international.status.builder.BundleKey;
import org.meveo.admin.action.BaseBean;
import org.meveo.admin.action.ModuleItemBaseBean;
import org.meveo.admin.exception.BusinessException;
import org.meveo.admin.util.XmlUtil;
import org.meveo.admin.web.interceptor.ActionMethod;
Expand All @@ -26,7 +26,7 @@
**/
@Named
@ViewScoped
public class FilterBean extends BaseBean<Filter> {
public class FilterBean extends ModuleItemBaseBean<Filter> {

private static final long serialVersionUID = 6689238784280187702L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,4 @@
public class EmailNotificationListBean extends EmailNotificationBean {

private static final long serialVersionUID = -3037867704912788042L;

@PostConstruct
@Override
public void init() {
super.init();
this.filters.put("moduleBelonging", this.getUserCurrentModule());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package org.meveo.admin.action.notification;

import javax.annotation.PostConstruct;
import javax.enterprise.context.ConversationScoped;
import javax.inject.Named;

Expand All @@ -27,11 +26,4 @@
public class InboundRequestListBean extends InboundRequestBean {

private static final long serialVersionUID = -3037867704912788043L;

@PostConstruct
@Override
public void init() {
super.init();
this.filters.put("moduleBelonging", this.getUserCurrentModule());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,4 @@
public class JobTriggerListBean extends JobTriggerBean {

private static final long serialVersionUID = -3037867704912788045L;

@PostConstruct
@Override
public void init() {
super.init();
this.filters.put("moduleBelonging", this.getUserCurrentModule());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,10 @@ public class NotificationHistoryBean extends BaseBean<NotificationHistory> {
@Inject
private ScriptNotificationService notificationService;



public NotificationHistoryBean() {
super(NotificationHistory.class);
}

@PostConstruct
@Override
public void init() {
super.init();
this.filters.put("moduleBelonging", this.getUserCurrentModule());
}

@Override
protected IPersistenceService<NotificationHistory> getPersistenceService() {
return notificationHistoryService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package org.meveo.admin.action.notification;

import javax.annotation.PostConstruct;
import javax.enterprise.context.ConversationScoped;
import javax.inject.Named;

Expand All @@ -27,11 +26,4 @@
public class NotificationListBean extends NotificationBean {

private static final long serialVersionUID = -3037867704912788045L;

@PostConstruct
@Override
public void init() {
super.init();
this.filters.put("moduleBelonging", this.getUserCurrentModule());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,4 @@
public class WebHookListBean extends WebHookBean {

private static final long serialVersionUID = -3037867704912788046L;

@PostConstruct
@Override
public void init() {
super.init();
this.filters.put("moduleBelonging", this.getUserCurrentModule());
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.meveo.admin.action.notification;

import javax.annotation.PostConstruct;
import javax.enterprise.context.ConversationScoped;
import javax.inject.Named;

Expand All @@ -13,12 +12,4 @@
public class WebNotificationListBean extends WebNotificationBean {

private static final long serialVersionUID = -7160105377348715515L;

@PostConstruct
@Override
public void init() {
super.init();
this.filters.put("moduleBelonging", this.getUserCurrentModule());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.apache.commons.lang3.StringUtils;
import org.jboss.seam.international.status.builder.BundleKey;
import org.meveo.admin.action.BaseBean;
import org.meveo.admin.action.ModuleItemBaseBean;
import org.meveo.admin.action.admin.ViewBean;
import org.meveo.admin.exception.BusinessException;
import org.meveo.admin.web.interceptor.ActionMethod;
Expand All @@ -45,7 +46,6 @@
import org.meveo.model.crm.custom.CustomFieldStorageTypeEnum;
import org.meveo.model.crm.custom.CustomFieldTypeEnum;
import org.meveo.model.customEntities.CustomEntityTemplate;
import org.meveo.model.scripts.FunctionIO;
import org.meveo.model.wf.WFAction;
import org.meveo.model.wf.WFTransition;
import org.meveo.model.wf.Workflow;
Expand All @@ -70,7 +70,7 @@
@Named
@ViewScoped
@ViewBean
public class WorkflowBean extends BaseBean<Workflow> {
public class WorkflowBean extends ModuleItemBaseBean<Workflow> {

private static final long serialVersionUID = 1L;
private static final String LESS_SEPARATOR = " < ";
Expand Down
Loading

0 comments on commit ea6ac03

Please sign in to comment.