From 1caa3ccd64689f383998e8569be5d64d4d798463 Mon Sep 17 00:00:00 2001 From: Hans Bakker Date: Mon, 18 Feb 2008 01:19:06 +0000 Subject: [PATCH] make project find more standard using performfind service git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk/specialpurpose@628593 13f79535-47bb-0310-9956-ffa450edef68 --- .../WEB-INF/actions/ListProjects.bsh | 110 ------------------ projectmgr/widget/Menus.xml | 10 +- projectmgr/widget/ProjectScreens.xml | 14 ++- projectmgr/widget/TaskScreens.xml | 2 +- projectmgr/widget/forms/ProjectForms.xml | 58 ++++++--- 5 files changed, 57 insertions(+), 137 deletions(-) delete mode 100644 projectmgr/webapp/projectmgr/WEB-INF/actions/ListProjects.bsh diff --git a/projectmgr/webapp/projectmgr/WEB-INF/actions/ListProjects.bsh b/projectmgr/webapp/projectmgr/WEB-INF/actions/ListProjects.bsh deleted file mode 100644 index ce99e478f..000000000 --- a/projectmgr/webapp/projectmgr/WEB-INF/actions/ListProjects.bsh +++ /dev/null @@ -1,110 +0,0 @@ -/* -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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. - */ - -import java.util.*; -import java.lang.*; -import org.ofbiz.entity.*; -import org.ofbiz.base.util.*; -import org.ofbiz.base.util.UtilMisc; -import org.ofbiz.service.LocalDispatcher; -import org.ofbiz.entity.util.*; -import org.ofbiz.base.util.*; -import org.ofbiz.entity.condition.*; -import java.sql.Timestamp; - - -EntityOperator checkCondition(String condition){ - - switch (condition) { - case "equals": return EntityOperator.EQUALS; break; - case "like": return EntityOperator.LIKE; break; - case "contains": return EntityOperator.LIKE; break; - case "empty": return EntityOperator.NOT; break; - case "notEqual": return EntityOperator.NOT_EQUAL; break; - default: return EntityOperator.EQUALS;break; - } -} - -LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); -fromDate = parameters.get("fromDate"); -projectId = parameters.get("projectId"); -subProjects = parameters.get("subProjects"); // if provided only give subprojects of a certain main project -projectName = parameters.get("projectName"); -projectId_op = parameters.get("projectId_op"); -projectName_op = parameters.get("projectName_op"); - -conditions = UtilMisc.toList(new EntityExpr("workEffortTypeId", EntityOperator.EQUALS, "PROJECT")); - -if (!UtilValidate.isEmpty(fromDate)) { - conditions.add(new EntityExpr("lastStatusUpdate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate + " 00:00:00.0")); - } - - -if (subProjects != null) { - conditions.add(new EntityExpr("workEffortParentId", EntityOperator.EQUALS, projectId)); - conditions.add(new EntityExpr("workEffortTypeId", EntityOperator.EQUALS, "PROJECT")); -} else { - if (!UtilValidate.isEmpty(projectId)) { - if(!UtilValidate.isEmpty(projectId_op)){ - if( projectId_op.equals("contains") || projectId_op.equals("like") ) { - conditions.add(new EntityExpr("workEffortId", EntityOperator.LIKE, "%"+projectId+"%")); - }else{ - conditions.add(new EntityExpr("workEffortId", checkCondition(projectId_op), projectId)); - } - } - } -} - - -if (!UtilValidate.isEmpty(projectName)) { - if(!UtilValidate.isEmpty(projectName_op)) { - if( projectName_op.equals("contains") || projectName_op.equals("like") ) { - conditions.add(new EntityExpr("workEffortName", EntityOperator.LIKE, "%"+projectName+"%")); - }else{ - conditions.add(new EntityExpr("workEffortName", checkCondition(projectName_op), projectName)); - } - } -} - - -entityName = "WorkEffort"; -if (security.hasPermission("PROJECTMGR_ROLE_VIEW", session)) { - conditions.add(new EntityExpr("partyId", EntityOperator.EQUALS, userLogin.getString("partyId"))); - entityName = "WorkEffortAndPartyAssign"; -} - - -allConditions = new EntityConditionList( conditions, EntityOperator.AND ); -orderBy = UtilMisc.toList("lastStatusUpdate DESC"); -projects = new LinkedList(); -listProjects = delegator.findByConditionCache(entityName, allConditions, UtilMisc.toList("workEffortId"), orderBy); - -if (!UtilValidate.isEmpty(listProjects)) { - itr = listProjects.iterator(); - while (itr.hasNext()) { - project = itr.next(); - result = dispatcher.runSync("getProject", UtilMisc.toMap("userLogin", parameters.get("userLogin"), "projectId", project.getString("workEffortId"))); - projects.add(result.get("projectInfo")); - } - context.put("projects", projects); -} - - - diff --git a/projectmgr/widget/Menus.xml b/projectmgr/widget/Menus.xml index 02a3452db..6851f90ca 100644 --- a/projectmgr/widget/Menus.xml +++ b/projectmgr/widget/Menus.xml @@ -175,13 +175,17 @@ + - - - diff --git a/projectmgr/widget/ProjectScreens.xml b/projectmgr/widget/ProjectScreens.xml index 2dd4127de..008a4f192 100644 --- a/projectmgr/widget/ProjectScreens.xml +++ b/projectmgr/widget/ProjectScreens.xml @@ -19,7 +19,7 @@ under the License. --> + xsi:noNamespaceSchemaLocation="../../../framework/widget/dtd/widget-screen.xsd">
@@ -27,9 +27,12 @@ under the License. -