Added: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/FindTaskList.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/FindTaskList.groovy?rev=1142915&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/FindTaskList.groovy (added) +++ ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/FindTaskList.groovy Tue Jul 5 08:15:32 2011 @@ -0,0 +1,221 @@ +/* +* 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 javolution.util.FastList; +import org.apache.tools.ant.taskdefs.Parallel.TaskList; +import org.ofbiz.base.util.*; +import org.ofbiz.entity.*; +import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.base.util.UtilDateTime; +import org.ofbiz.entity.util.*; +import org.ofbiz.entity.condition.*; +import java.sql.Timestamp; + +taskId = parameters.taskId;; +taskName = parameters.taskName; +sprintId = parameters.sprintId; +sprintName = parameters.sprintName; +taskTypeId = parameters.taskTypeId; +projectId = parameters.projectId; +projectName = parameters.projectName; +backlogTypeId = parameters.unplannedFlag; +statusId = parameters.statusId; +partyId = parameters.partyId; + +unplannedTaskList = []; +plannedTaskList = []; +resultList=[]; +taskList=[]; +implementTaskList=[]; +testTaskList=[]; +errorTaskList = []; +installTaskList = []; + +// get Unplaned task list +if ((taskId != null)||(taskName != null)||(taskTypeId != null)||(sprintId != null)||(sprintName != null) + ||(projectId != null)||(projectName != null)||(backlogTypeId != null)||(statusId != null) + ||(partyId != null)||(viewIndex_1 > 0)||(viewIndex_2 > 0)||(viewIndex_3 > 0)||(viewIndex_4 > 0) + ||(viewIndexNo_1 > 0)||(viewIndexNo_2 > 0)||(viewIndexNo_3 > 0)||(viewIndexNo_4 > 0)){ + if ((taskId != null)||(taskName != null)||(taskTypeId != null)){ + exprBldr = FastList.newInstance(); + if (taskId) { + exprBldr.add(EntityCondition.makeCondition("workEffortId", EntityOperator.EQUALS, taskId)); + } + if (taskName){ + exprBldr.add(EntityCondition.makeCondition("workEffortName", EntityOperator.LIKE, "%"+taskName+"%")); + } + if (taskTypeId){ + exprBldr.add(EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, taskTypeId)); + } + if (statusId){ + exprBldr.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.EQUALS, statusId)); + } + unplannedCond = EntityCondition.makeCondition(exprBldr, EntityOperator.AND); + unplannedTaskList = delegator.findList("UnPlannedBacklogsAndTasks", unplannedCond, null,["-createdDate"] ,null, false); + } + else{ + unplannedTaskList = delegator.findList("UnPlannedBacklogsAndTasks", null, null,["-createdDate"] ,null, false); + } + + exprBldr2 = FastList.newInstance(); + if (taskId) { + exprBldr2.add(EntityCondition.makeCondition("taskId", EntityOperator.EQUALS, taskId)); + } + if (taskName){ + exprBldr2.add(EntityCondition.makeCondition("taskName", EntityOperator.LIKE, "%"+taskName+"%")); + } + if (taskTypeId){ + exprBldr2.add(EntityCondition.makeCondition("taskTypeId", EntityOperator.EQUALS, taskTypeId)); + } + if (statusId){ + exprBldr2.add(EntityCondition.makeCondition("taskCurrentStatusId", EntityOperator.EQUALS, statusId)); + } + if (sprintId){ + exprBldr2.add(EntityCondition.makeCondition("sprintId", EntityOperator.EQUALS, sprintId)); + } + if (sprintName){ + exprBldr2.add(EntityCondition.makeCondition("sprintName", EntityOperator.LIKE, "%"+sprintName+"%")); + } + if (projectId){ + exprBldr2.add(EntityCondition.makeCondition("projectId", EntityOperator.EQUALS, projectId)); + } + if (projectName){ + exprBldr2.add(EntityCondition.makeCondition("projectName", EntityOperator.LIKE, "%"+projectName+"%")); + } + exprBldr2.add(EntityCondition.makeCondition("sprintTypeId", EntityOperator.EQUALS, "SCRUM_SPRINT")); + plannedCond = EntityCondition.makeCondition(exprBldr2, EntityOperator.AND); + plannedTaskList = delegator.findList("ProjectSprintBacklogAndTask", plannedCond, null,["-taskCreatedDate"] ,null, false); + + unplannedTaskList.each{ unplannedTaskMap -> + unplannedMap = [:]; + unplannedMap.taskId = unplannedTaskMap.workEffortId; + unplannedMap.sprintId = null; + unplannedMap.projectId = null; + unplannedMap.productId = unplannedTaskMap.productId; + unplannedMap.taskName = unplannedTaskMap.workEffortName; + unplannedMap.taskTypeId = unplannedTaskMap.workEffortTypeId; + unplannedMap.taskCurrentStatusId = unplannedTaskMap.currentStatusId; + unplannedMap.taskEstimatedMilliSeconds = unplannedTaskMap.estimatedMilliSeconds; + unplannedMap.taskCreatedDate = unplannedTaskMap.createdDate; + unplannedMap.custRequestId = unplannedTaskMap.custRequestId; + unplannedMap.description = unplannedTaskMap.description; + unplannedMap.custRequestTypeId = unplannedTaskMap.custRequestTypeId; + unplannedMap.taskActualMilliSeconds = unplannedTaskMap.actualMilliSeconds; + unplannedMap.taskEstimatedStartDate = unplannedTaskMap.estimatedStartDate; + taskList.add(unplannedMap); + } + + plannedTaskList.each{ plannedTaskMap -> + plannedMap = [:]; + plannedMap.taskId = plannedTaskMap.taskId; + plannedMap.taskName = plannedTaskMap.taskName; + plannedMap.taskTypeId = plannedTaskMap.taskTypeId; + plannedMap.taskCurrentStatusId = plannedTaskMap.taskCurrentStatusId; + plannedMap.taskEstimatedMilliSeconds = plannedTaskMap.taskEstimatedMilliSeconds; + plannedMap.taskCreatedDate = plannedTaskMap.taskCreatedDate; + plannedMap.sprintId = plannedTaskMap.sprintId; + plannedMap.sprintName = plannedTaskMap.sprintName; + plannedMap.projectId = plannedTaskMap.projectId; + plannedMap.projectName = plannedTaskMap.projectName; + plannedMap.custRequestId = plannedTaskMap.custRequestId; + plannedMap.description = plannedTaskMap.description; + plannedMap.custRequestTypeId = plannedTaskMap.custRequestTypeId; + plannedMap.taskActualMilliSeconds = plannedTaskMap.taskActualMilliSeconds; + plannedMap.taskEstimatedStartDate = plannedTaskMap.taskEstimatedStartDate; + taskList.add(plannedMap); + } + //Check the backlog + if (backlogTypeId){ + if (backlogTypeId=="Y"){ + taskList.each{taskMap -> + if(taskMap.custRequestTypeId=="RF_UNPLAN_BACKLOG"){ + resultList.add(taskMap); + } + } + } + if (backlogTypeId=="N"){ + taskList.each{taskMap -> + if(taskMap.custRequestTypeId=="RF_PROD_BACKLOG"){ + resultList.add(taskMap); + } + } + } + } else { + taskList.each { taskMap -> + resultList.add(taskMap); + } + } + // Check party assigned + if (partyId){ + assignedList = resultList; + resultList = []; + assignedList.each { assignedMap -> + workEffortId = assignedMap.taskId; + assignToList = delegator.findByAnd("WorkEffortPartyAssignment",["workEffortId" : workEffortId, "partyId" : partyId]); + if (assignToList) { + assignedMap.partyId = assignToList[0].partyId; + resultList.add(assignedMap); + } + } + } else { + assignedList = resultList; + resultList = []; + assignedList.each { assignedMap -> + workEffortId = assignedMap.taskId; + assignToList = delegator.findByAnd("WorkEffortPartyAssignment",["workEffortId" : workEffortId]); + if (assignToList) { + assignedMap.partyId = assignToList[0].partyId; + resultList.add(assignedMap); + } else { + resultList.add(assignedMap); + } + } + } + + resultList.each{resultMap -> + if (resultMap.taskTypeId=="SCRUM_TASK_IMPL"){ + implementTaskList.add(resultMap); + } + if (resultMap.taskTypeId=="SCRUM_TASK_INST"){ + installTaskList.add(resultMap); + } + if (resultMap.taskTypeId=="SCRUM_TASK_TEST"){ + testTaskList.add(resultMap); + } + if (resultMap.taskTypeId=="SCRUM_TASK_ERROR"){ + errorTaskList.add(resultMap); + } + } + + if (implementTaskList){ + context.implementTaskList = implementTaskList; + } + if (installTaskList){ + context.installTaskList = installTaskList; + } + if (testTaskList){ + context.testTaskList = testTaskList; + } + if (errorTaskList){ + context.errorTaskList = errorTaskList; + } +} Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/FindTaskList.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/FindTaskList.groovy ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/FindTaskList.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListCurrentProducts.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListCurrentProducts.groovy?rev=1142915&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListCurrentProducts.groovy (added) +++ ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListCurrentProducts.groovy Tue Jul 5 08:15:32 2011 @@ -0,0 +1,202 @@ +/* + * 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 org.ofbiz.entity.condition.*; +import org.ofbiz.base.util.*; +import org.ofbiz.entity.util.EntityUtil; + +roleTypeId = null; +paramCond = []; +products = []; +productId = parameters.productId; +internalName = parameters.internalName; +statusId = parameters.statusId; +if ("Any".equals(statusId)) { + statusId = null; +} +partyId = parameters.partyId; + +if(!security.hasEntityPermission("SCRUM", "_ADMIN", session)){ + if(security.hasEntityPermission("SCRUM_PRODUCT", "_ADMIN", session)){ + roleTypeId = "PRODUCT_OWNER"; + } +} + +if (userLogin) { + if(UtilValidate.isNotEmpty(partyId)){ + paramCond.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId)); + } + if(UtilValidate.isNotEmpty(productId)){ + paramCond.add(EntityCondition.makeCondition("productId", EntityOperator.LIKE, productId + "%")); + } + if(UtilValidate.isNotEmpty(internalName)){ + paramCond.add(EntityCondition.makeCondition("internalName", EntityOperator.LIKE, "%" + internalName + "%")); + } + if(UtilValidate.isNotEmpty(statusId)){ + paramCond.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, statusId)); + } + + paramCond.add(EntityCondition.makeCondition("productTypeId", EntityOperator.EQUALS, "SCRUM_ITEM")); + paramCond.add(EntityCondition.makeCondition("roleTypeId", EntityOperator.EQUALS, "PRODUCT_OWNER_COMP")); + paramCond.add(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null)); + + cond = EntityCondition.makeCondition(paramCond, EntityOperator.AND); + + allProducts = delegator.findList("ProductAndRole", cond, null, ["groupName", "internalName"], null, false); + + securityGroupCond = EntityCondition.makeCondition([ + EntityCondition.makeCondition ("partyId", EntityOperator.EQUALS, userLogin.partyId), + EntityCondition.makeCondition ("partyStatusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED"), + EntityCondition.makeCondition ("thruDate", EntityOperator.EQUALS, null) + ], EntityJoinOperator.AND); + fields = new HashSet(["partyId", "groupId"]); + partyAndSecurityGroupList = delegator.findList("ScrumMemberUserLoginAndSecurityGroup", securityGroupCond, fields, ["partyId"], null, false); + context.partyAndSecurityGroupList = partyAndSecurityGroupList; + boolean addAllProducts = false; + allProducts.each { product -> + product = product.getAllFields(); + productMap = delegator.findByPrimaryKey("Product", ["productId" : product.productId]); + product.put("longDescription",productMap.longDescription) + if(security.hasEntityPermission("SCRUM", "_ADMIN", session)){ + addAllProducts = true; + }else{ + ismember = false; + if (partyAndSecurityGroupList) { + groupId = partyAndSecurityGroupList[0].groupId; + if ("SCRUM_PRODUCT_OWNER".equals(groupId)) { + productAndRoleList = delegator.findByAnd("ProductRole", ["productId" : product.productId, "partyId" : userLogin.partyId, "thruDate" : null]); + if (productAndRoleList) { + productAndRoleList.each { productAndRoleMap -> + productIdInner = productAndRoleMap.productId; + if (productIdInner.equals(product.productId)) { + ismember = true; + } + } + } + } else if ("SCRUM_STAKEHOLDER".equals(groupId)) { + // check in company relationship. + scrumRolesCond = EntityCondition.makeCondition([ + EntityCondition.makeCondition ("partyId", EntityOperator.EQUALS, userLogin.partyId), + EntityCondition.makeCondition ("roleTypeId", EntityOperator.EQUALS, "STAKEHOLDER"), + EntityCondition.makeCondition ("partyStatusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED"), + EntityCondition.makeCondition ("thruDate", EntityOperator.EQUALS, null) + ], EntityJoinOperator.AND); + scrumRolesPersonAndCompanyList = delegator.findList("ScrumRolesPersonAndCompany", scrumRolesCond, null, null, null, false); + productRoleList = delegator.findByAnd("ProductRole", ["partyId" : scrumRolesPersonAndCompanyList[0].partyIdFrom, "roleTypeId" : "PRODUCT_OWNER_COMP", "thruDate" : null]); + if (productRoleList) { + productRoleList.each { productRoleMap -> + stakeholderProduct = productRoleMap.productId; + if (stakeholderProduct.equals(product.productId)) { + ismember = true; + } + } + } + //check in product. + if (ismember == false) { + productAndRoleList = delegator.findByAnd("ProductAndRole", ["productId" : product.productId, "partyId" : userLogin.partyId + , "roleTypeId" : "STAKEHOLDER", "statusId" : "PRODUCT_ACTIVE", "thruDate" : null]); + if (productAndRoleList) { + ismember = true; + } + } + } else if ("SCRUM_MASTER".equals(groupId)) { + //check in product. + productRoleList = []; + productRoleList = delegator.findByAnd("ProductAndRole", ["productId" : product.productId, "partyId" : userLogin.partyId + , "roleTypeId" : "SCRUM_MASTER", "statusId" : "PRODUCT_ACTIVE", "thruDate" : null]); + if (productRoleList) { + ismember = true; + } + //check in project. + if (ismember == false) { + projects = []; + projects = delegator.findByAnd("WorkEffortAndProduct", ["productId" : product.productId, "workEffortTypeId" : "SCRUM_PROJECT", "currentStatusId" : "SPJ_ACTIVE"]); + if (projects) { + projects.each { project -> + projectPartyAssignment = delegator.findByAnd("WorkEffortPartyAssignment", ["partyId" : userLogin.partyId, "workEffortId" : project.workEffortId]); + if (projectPartyAssignment) { + ismember = true; + } + } + } + } + //check in sprint. + if (ismember == false) { + projects.each { project -> + allSprintList = []; + allSprintList = delegator.findByAnd("WorkEffort", ["workEffortParentId" : project.workEffortId, "currentStatusId" : "SPRINT_ACTIVE"]); + allSprintList.each { SprintListMap -> + sprintId = SprintListMap.workEffortId; + workEffortPartyAssignment = delegator.findByAnd("WorkEffortPartyAssignment", ["partyId" : userLogin.partyId, "workEffortId" : sprintId]) + if (workEffortPartyAssignment) { + ismember = true; + } + } + } + } + } else { + projects = []; + projects = delegator.findByAnd("WorkEffortAndProduct", ["productId" : product.productId, "workEffortTypeId" : "SCRUM_PROJECT", "currentStatusId" : "SPJ_ACTIVE"]); + if (projects) { + projects.each { project -> + allSprintList = []; + allSprintList = delegator.findByAnd("WorkEffort", ["workEffortParentId" : project.workEffortId, "currentStatusId" : "SPRINT_ACTIVE"]); + allSprintList.each { SprintListMap -> + sprintId = SprintListMap.workEffortId; + workEffortPartyAssignment = delegator.findByAnd("WorkEffortPartyAssignment", ["partyId" : userLogin.partyId, "workEffortId" : sprintId]) + if (workEffortPartyAssignment) { + ismember = true; + } + } + } + } + if (ismember == false) { + exprBldr = [EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CRQ_REVIEWED"), + EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CRQ_REOPENED")]; + andExprs = [EntityCondition.makeCondition("productId", EntityOperator.EQUALS, product.productId), + EntityCondition.makeCondition("currentStatusId", EntityOperator.EQUALS, "STS_CREATED"), + EntityCondition.makeCondition(exprBldr, EntityOperator.OR)]; + unplannedBacklogCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND); + unplannedBacklogList = delegator.findList("UnPlannedBacklogsAndTasks", unplannedBacklogCond, null,null ,null, false); + if (unplannedBacklogList) { + unplannedBacklogList.each { unplannedMap -> + workEffortId = unplannedMap.workEffortId; + workEffortPartyAssignment = delegator.findByAnd("WorkEffortPartyAssignment", ["partyId" : userLogin.partyId, "workEffortId" : workEffortId]) + if (workEffortPartyAssignment) { + ismember = true; + } + } + } + } + } + + if (ismember) { + products.add(product); + } + } + } + if(addAllProducts) + products.add(product); + } +} else { + Debug.logError("Party ID missing =========>>> : null ", ""); +} + +if (products){ + context.listIt = products; +} \ No newline at end of file Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListCurrentProducts.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListCurrentProducts.groovy ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListCurrentProducts.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListCurrentSprints.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListCurrentSprints.groovy?rev=1142915&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListCurrentSprints.groovy (added) +++ ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListCurrentSprints.groovy Tue Jul 5 08:15:32 2011 @@ -0,0 +1,228 @@ +/* + * 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 org.ofbiz.entity.condition.*; +import org.ofbiz.base.util.*; + +cond = EntityCondition.makeCondition([ + EntityCondition.makeCondition ("projectTypeId", EntityOperator.EQUALS, "SCRUM_PROJECT"), + EntityCondition.makeCondition ("projectStatusId", EntityOperator.NOT_EQUAL, "SPJ_CLOSED") + ], EntityJoinOperator.AND); +securityGroupCond = EntityCondition.makeCondition([ + EntityCondition.makeCondition ("partyId", EntityOperator.EQUALS, userLogin.partyId), + EntityCondition.makeCondition ("partyStatusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED"), + EntityCondition.makeCondition ("thruDate", EntityOperator.EQUALS, null) + ], EntityJoinOperator.AND); +fields = new HashSet(["partyId", "groupId"]); + +allSprints = delegator.findList("ProjectSprint", cond, null, ["projectName", "-sprintActualStartDate"], null, false); +partyAndSecurityGroupList = delegator.findList("ScrumMemberUserLoginAndSecurityGroup", securityGroupCond, fields, ["partyId"], null, false); +oldProjectId = null; +newProjectId = null; +countSprint = 0; +sprints = []; +allSprints.each { sprint -> + newProjectId = sprint.projectId; + productAndRole = delegator.findByAnd("ProductAndRole", ["roleTypeId" : "PRODUCT_OWNER_COMP", "productId" : sprint.productId], null); + companyId = ""; + companyName = ""; + if (productAndRole.size() > 0) { + companyName = productAndRole.get(0).groupName; + companyId = productAndRole.get(0).partyId; + } + sprint = sprint.getAllFields(); + sprint.put("companyId", companyId) + sprint.put("companyName", companyName) + product = delegator.findByPrimaryKey("Product",["productId" : sprint.productId]); + productName = ""; + if (product != null) productName = product.internalName; + sprint.put("productName", productName); + //sprint.add("companyName", companyName, "String") + if (oldProjectId != newProjectId) { + oldProjectId = newProjectId; + countSprint = 0; + ismember = false; + if (partyAndSecurityGroupList) { + groupId = partyAndSecurityGroupList[0].groupId; + if ("SCRUM_PRODUCT_OWNER".equals(groupId)) { + productAndRoleList = delegator.findByAnd("ProductRole", ["productId" : sprint.productId, "partyId" : partyAndSecurityGroupList.getAt(0).partyId, "thruDate" : null]); + if (productAndRoleList) { + ismember = true; + } + }else if("SCRUM_STAKEHOLDER".equals(groupId)) { + // check in company relationship. + scrumRolesCond = EntityCondition.makeCondition([ + EntityCondition.makeCondition ("partyId", EntityOperator.EQUALS, userLogin.partyId), + EntityCondition.makeCondition ("roleTypeId", EntityOperator.EQUALS, "STAKEHOLDER"), + EntityCondition.makeCondition ("partyStatusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED"), + EntityCondition.makeCondition ("thruDate", EntityOperator.EQUALS, null) + ], EntityJoinOperator.AND); + scrumRolesPersonAndCompanyList = delegator.findList("ScrumRolesPersonAndCompany", scrumRolesCond, null, null, null, false); + productRoleList = delegator.findByAnd("ProductRole", ["partyId" : scrumRolesPersonAndCompanyList[0].partyIdFrom, "roleTypeId" : "PRODUCT_OWNER_COMP", "thruDate" : null]); + if (productRoleList) { + productRoleList.each { productRoleMap -> + stakeholderProduct = productRoleMap.productId; + if (stakeholderProduct.equals(sprint.productId)) { + ismember = true; + } + } + } + //check in product. + if (ismember == false) { + productAndRoleList = delegator.findByAnd("ProductAndRole", ["productId" : sprint.productId, "partyId" : userLogin.partyId + , "roleTypeId" : "STAKEHOLDER", "statusId" : "PRODUCT_ACTIVE", "thruDate" : null]); + if (productAndRoleList) { + ismember = true; + } + } + } else if("SCRUM_MASTER".equals(groupId)) { + //check in product + productRoleList = []; + productRoleList = delegator.findByAnd("ProductAndRole", ["productId" : sprint.productId, "partyId" : userLogin.partyId + , "roleTypeId" : "SCRUM_MASTER", "statusId" : "PRODUCT_ACTIVE", "thruDate" : null]); + if (productRoleList) { + ismember = true; + } + //check in project. + if (ismember == false) { + projectPartyAssignment = delegator.findByAnd("WorkEffortPartyAssignment", ["workEffortId" : sprint.projectId, "partyId" : userLogin.partyId]); + if (projectPartyAssignment) { + ismember = true; + } + } + //check in sprint. + if (ismember == false) { + allSprintList = []; + allSprintList = delegator.findByAnd("WorkEffort", ["workEffortParentId" : sprint.projectId]); + allSprintList.each { SprintListMap -> + sprintId = SprintListMap.workEffortId; + workEffortPartyAssignment = delegator.findByAnd("WorkEffortPartyAssignment", ["workEffortId" : sprintId, "partyId" : userLogin.partyId]); + if (workEffortPartyAssignment) { + ismember = true; + } + } + } + } else { + allSprintList = []; + allSprintList = delegator.findByAnd("WorkEffort", ["workEffortParentId" : sprint.projectId]); + allSprintList.each { SprintListMap -> + sprintId = SprintListMap.workEffortId; + workEffortPartyAssignment = delegator.findByAnd("WorkEffortPartyAssignment", ["workEffortId" : sprintId, "partyId" : userLogin.partyId]); + if (workEffortPartyAssignment) { + ismember = true; + } + } + } + } + if (security.hasEntityPermission("SCRUM", "_ADMIN", session) + || ((security.hasEntityPermission("SCRUM", "_ROLE_ADMIN", session) || security.hasEntityPermission("SCRUM", "_ROLE_VIEW", session) + || security.hasEntityPermission("SCRUM_PROJECT", "_ROLE_ADMIN", session) || security.hasEntityPermission("SCRUM_PROJECT", "_ROLE_VIEW", session) + || security.hasEntityPermission("SCRUM_PROJECT", "_VIEW", session)) && ismember)) { + sprints.add(sprint); + countSprint++; + } + } else { + if (countSprint < 4) { + ismember = false; + if (partyAndSecurityGroupList) { + groupId = partyAndSecurityGroupList[0].groupId; + if ("SCRUM_PRODUCT_OWNER".equals(groupId)) { + productAndRoleList = delegator.findByAnd("ProductRole", ["productId" : sprint.productId, "partyId" : partyAndSecurityGroupList.getAt(0).partyId, "thruDate" : null]); + if (productAndRoleList) { + ismember = true; + } + }else if("SCRUM_STAKEHOLDER".equals(groupId)) { + // check in company relationship. + scrumRolesCond = EntityCondition.makeCondition([ + EntityCondition.makeCondition ("partyId", EntityOperator.EQUALS, userLogin.partyId), + EntityCondition.makeCondition ("roleTypeId", EntityOperator.EQUALS, "STAKEHOLDER"), + EntityCondition.makeCondition ("partyStatusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED"), + EntityCondition.makeCondition ("thruDate", EntityOperator.EQUALS, null) + ], EntityJoinOperator.AND); + scrumRolesPersonAndCompanyList = delegator.findList("ScrumRolesPersonAndCompany", scrumRolesCond, null, null, null, false); + productRoleList = delegator.findByAnd("ProductRole", ["partyId" : scrumRolesPersonAndCompanyList[0].partyIdFrom, "roleTypeId" : "PRODUCT_OWNER_COMP", "thruDate" : null]); + if (productRoleList) { + productRoleList.each { productRoleMap -> + stakeholderProduct = productRoleMap.productId; + if (stakeholderProduct.equals(sprint.productId)) { + ismember = true; + } + } + } + //check in product. + if (ismember == false) { + productAndRoleList = delegator.findByAnd("ProductAndRole", ["productId" : sprint.productId, "partyId" : userLogin.partyId + , "roleTypeId" : "STAKEHOLDER", "statusId" : "PRODUCT_ACTIVE", "thruDate" : null]); + if (productAndRoleList) { + ismember = true; + } + } + } else if("SCRUM_MASTER".equals(groupId)) { + //check in product + productRoleList = []; + productRoleList = delegator.findByAnd("ProductAndRole", ["productId" : sprint.productId, "partyId" : userLogin.partyId + , "roleTypeId" : "SCRUM_MASTER", "statusId" : "PRODUCT_ACTIVE", "thruDate" : null]); + if (productRoleList) { + ismember = true; + } + //check in project. + if (ismember == false) { + projectPartyAssignment = delegator.findByAnd("WorkEffortPartyAssignment", ["workEffortId" : sprint.projectId, "partyId" : userLogin.partyId]); + if (projectPartyAssignment) { + ismember = true; + } + } + //check in sprint. + if (ismember == false) { + allSprintList = []; + allSprintList = delegator.findByAnd("WorkEffort", ["workEffortParentId" : sprint.projectId]); + allSprintList.each { SprintListMap -> + sprintId = SprintListMap.workEffortId; + workEffortPartyAssignment = delegator.findByAnd("WorkEffortPartyAssignment", ["workEffortId" : sprintId, "partyId" : userLogin.partyId]); + if (workEffortPartyAssignment) { + ismember = true; + } + } + } + } else { + allSprintList = []; + allSprintList = delegator.findByAnd("WorkEffort", ["workEffortParentId" : sprint.projectId]); + allSprintList.each { SprintListMap -> + sprintId = SprintListMap.workEffortId; + workEffortPartyAssignment = delegator.findByAnd("WorkEffortPartyAssignment", ["workEffortId" : sprintId, "partyId" : userLogin.partyId]); + if (workEffortPartyAssignment) { + ismember = true; + } + } + } + } + if (security.hasEntityPermission("SCRUM", "_ADMIN", session) + || ((security.hasEntityPermission("SCRUM", "_ROLE_ADMIN", session) || security.hasEntityPermission("SCRUM", "_ROLE_VIEW", session) + || security.hasEntityPermission("SCRUM_PROJECT", "_ROLE_ADMIN", session) || security.hasEntityPermission("SCRUM_PROJECT", "_ROLE_VIEW", session) + || security.hasEntityPermission("SCRUM_PROJECT", "_VIEW", session)) && ismember)) { + sprints.add(sprint); + countSprint++; + } + } + } +} +if (sprints) { + sprints = UtilMisc.sortMaps(sprints, ["companyName", "projectName", "productName"]) + context.sprints = sprints; +} Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListCurrentSprints.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListCurrentSprints.groovy ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListCurrentSprints.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListRevision.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListRevision.groovy?rev=1142915&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListRevision.groovy (added) +++ ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListRevision.groovy Tue Jul 5 08:15:32 2011 @@ -0,0 +1,92 @@ +/* +* 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 org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.Debug; +import org.ofbiz.entity.util.*; +import org.ofbiz.entity.condition.*; + +custRequestList = []; +custAndWorkEffortList = []; +revisionList = []; +listIt = []; +//for productId and custRequestId +if ((parameters.productId != null)||(parameters.custRequestId != null)||(parameters.workEffortId != null)||(viewIndex > 0)) { + orList = []; + orList.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.EQUALS, "RF_PROD_BACKLOG")); + orList.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.EQUALS, "RF_UNPLAN_BACKLOG")); + andList = []; + if (parameters.productId) { + andList.add(EntityCondition.makeCondition("productId", EntityOperator.LIKE, parameters.productId + "%")); + } + if (parameters.custRequestId) { + andList.add(EntityCondition.makeCondition("custRequestId", EntityOperator.LIKE, parameters.custRequestId + "%")); + } + andList.add(EntityCondition.makeCondition(orList, EntityOperator.OR)); + custRequestCond = EntityCondition.makeCondition(andList, EntityOperator.AND); + custRequestList = delegator.findList("CustRequestAndCustRequestItem", custRequestCond, null,null ,null, false); + + custRequestIds = EntityUtil.getFieldListFromEntityList(custRequestList, "custRequestId", true); + taskOrList = []; + taskOrList.add(EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, "SCRUM_TASK_ERROR")); + taskOrList.add(EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, "SCRUM_TASK_TEST")); + taskOrList.add(EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, "SCRUM_TASK_IMPL")); + taskOrList.add(EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, "SCRUM_TASK_INST")); + taskAndList = []; + taskAndList.add(EntityCondition.makeCondition("custRequestId", EntityOperator.IN, custRequestIds)); + taskAndList.add(EntityCondition.makeCondition(taskOrList, EntityOperator.OR)); + custAndWorkEffortCond = EntityCondition.makeCondition(taskAndList, EntityOperator.AND); + custAndWorkEffortList = delegator.findList("CustRequestAndWorkEffort", custAndWorkEffortCond, null,null ,null, false); + + //for workEffortId + workEffortIds = EntityUtil.getFieldListFromEntityList(custAndWorkEffortList, "workEffortId", true); + revisionAndList = []; + if (parameters.workEffortId) { + revisionAndList.add(EntityCondition.makeCondition("workEffortId", EntityOperator.LIKE, parameters.workEffortId + "%")); + } else { + revisionAndList.add(EntityCondition.makeCondition("workEffortId", EntityOperator.IN, workEffortIds)); + } + revisionAndList.add(EntityCondition.makeCondition("workEffortContentTypeId", EntityOperator.EQUALS, "TASK_SUB_INFO")); + revisionCond = EntityCondition.makeCondition(revisionAndList, EntityOperator.AND); + revisionList = delegator.findList("WorkEffortAndContentDataResource", revisionCond, null,["-fromDate"] ,null, false); + + if (revisionList) { + revisionList.each { revisionMap -> + inputMap = [:]; + inputMap.workEffortId = revisionMap.workEffortId; + inputMap.contentId = revisionMap.contentId; + inputMap.fromDate = revisionMap.fromDate; + inputMap.contentName = revisionMap.contentName; + inputMap.description = revisionMap.description; + inputMap.drObjectInfo = revisionMap.drObjectInfo; + custAndWorkEfffList = delegator.findByAnd("CustRequestAndWorkEffort", ["workEffortId" : revisionMap.workEffortId]); + if (custAndWorkEfffList) { + custAndWorkEfffMap = custAndWorkEfffList[0]; + custAndCustItemList = delegator.findByAnd("CustRequestAndCustRequestItem", ["custRequestId" : custAndWorkEfffMap.custRequestId]); + if (custAndCustItemList) { + custAndCustItemMap = custAndCustItemList[0]; + inputMap.productId = custAndCustItemMap.productId; + inputMap.custRequestId = custAndCustItemMap.custRequestId; + } + } + listIt.add(inputMap); + } + context.listIt = listIt; + } +} Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListRevision.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListRevision.groovy ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListRevision.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListScrumResource.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListScrumResource.groovy?rev=1142915&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListScrumResource.groovy (added) +++ ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListScrumResource.groovy Tue Jul 5 08:15:32 2011 @@ -0,0 +1,55 @@ +/* + * 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.entity.condition.*; +import org.ofbiz.entity.util.*; +import org.ofbiz.base.util.*; +import javolution.util.FastMap; +import javolution.util.FastList; +import org.ofbiz.entity.condition.EntityFunction; + +def module = "ListScrumResource.groovy"; + +performFindInMap = [:]; +performFindInMap.entityName = "ScrumMemberUserLoginAndSecurityGroup"; +inputFields = [:]; +outputList = []; + +inputFields.putAll(parameters); +performFindInMap.noConditionFind = "Y"; +performFindInMap.inputFields = inputFields; +performFindInMap.orderBy = parameters.sortField; +if (parameters.sortField) { + performFindInMap.orderBy = "lastName"; +} +performFindResults = dispatcher.runSync("performFind", performFindInMap); +resultList = performFindResults.listIt.getCompleteList(); +performFindResults.listIt.close(); + +resultList.each() { result -> + if (!"N".equals(result.enabled)) { + outputList.add(result); + } +} +if (outputList) { + context.listIt = outputList; +} \ No newline at end of file Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListScrumResource.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListScrumResource.groovy ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListScrumResource.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListScrumRolesPersonAndCompany.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListScrumRolesPersonAndCompany.groovy?rev=1142915&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListScrumRolesPersonAndCompany.groovy (added) +++ ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListScrumRolesPersonAndCompany.groovy Tue Jul 5 08:15:32 2011 @@ -0,0 +1,67 @@ +/* +* 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 org.ofbiz.entity.condition.*; +import org.ofbiz.base.util.*; +import org.ofbiz.entity.util.EntityUtil; + +productId = parameters.productId +personAndCompanyList = []; + +if (productId) { + productRoleList = delegator.findByAnd("ProductRole", ["productId" : productId, "roleTypeId" : "PRODUCT_OWNER_COMP"]); + if (productRoleList) { + personAndComCond = EntityCondition.makeCondition([ + EntityCondition.makeCondition ("roleTypeId", EntityOperator.EQUALS, "PRODUCT_OWNER"), + EntityCondition.makeCondition ("partyIdFrom", EntityOperator.EQUALS, productRoleList[0].partyId), + EntityCondition.makeCondition ("partyStatusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED"), + EntityCondition.makeCondition ("thruDate", EntityOperator.EQUALS, null) + ], EntityJoinOperator.AND); + personAndCompanyList = delegator.findList("ScrumRolesPersonAndCompany", personAndComCond, null, ["groupName"], null, false); + } +} +if (personAndCompanyList) { + context.companyCurrentList = personAndCompanyList; + context.companyCurrent = personAndCompanyList[0].partyId; + } else { + context.companyCurrent = null; +} + +// Get owner with security group +scrumRolesPersonAndCompanyList = []; +personAndComConds = EntityCondition.makeCondition([ + EntityCondition.makeCondition ("roleTypeId", EntityOperator.EQUALS, "PRODUCT_OWNER"), + EntityCondition.makeCondition ("partyStatusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED"), + EntityCondition.makeCondition ("thruDate", EntityOperator.EQUALS, null) + ], EntityJoinOperator.AND); +personAndCompanyList = delegator.findList("ScrumRolesPersonAndCompany", personAndComConds, null, ["groupName"], null, false); +if (personAndCompanyList) { + personAndCompanyList.each { personAndCompanyMap -> + partyId = personAndCompanyMap.partyId; + securityGroupCond = EntityCondition.makeCondition([ + EntityCondition.makeCondition ("partyId", EntityOperator.EQUALS, partyId), + EntityCondition.makeCondition ("partyStatusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED") + ], EntityJoinOperator.AND); + securityGroupList = delegator.findList("ScrumMemberUserLoginAndSecurityGroup", securityGroupCond, null, null, null, false); + if (securityGroupList) { + scrumRolesPersonAndCompanyList.add(personAndCompanyMap); + } + } + } +context.scrumRolesPersonAndCompanyList = scrumRolesPersonAndCompanyList; \ No newline at end of file Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListScrumRolesPersonAndCompany.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListScrumRolesPersonAndCompany.groovy ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListScrumRolesPersonAndCompany.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListTimeSheets.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListTimeSheets.groovy?rev=1142915&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListTimeSheets.groovy (added) +++ ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListTimeSheets.groovy Tue Jul 5 08:15:32 2011 @@ -0,0 +1,82 @@ +/* +* 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 org.ofbiz.entity.*; +import org.ofbiz.entity.util.*; +import org.ofbiz.entity.condition.*; +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilDateTime; + +// get all timesheets of all user, including the planned hours +timesheets = []; +performFindInMap = [:]; +inputFields = [:]; +performFindInMap.entityName = "Timesheet"; + +if (!parameters.noConditionFind) { + parameters.noConditionFind = "N" +} +inputFields.putAll(parameters); +performFindInMap.inputFields = inputFields; +performFindInMap.orderBy = "fromDate DESC"; +performFindResults = dispatcher.runSync("performFind", performFindInMap); +if (performFindResults.listSize > 0) { + timesheetsDb = performFindResults.listIt.getCompleteList(); + performFindResults.listIt.close(); + + timesheetsDb.each { timesheetDb -> + //get hours from EmplLeave; + findOpts = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true); + leaveExprsList = []; + leaveExprsList.add(EntityCondition.makeCondition("fromDate", EntityOperator.GREATER_THAN_EQUAL_TO, timesheetDb.fromDate)); + leaveExprsList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, timesheetDb.thruDate)); + leaveExprsList.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, timesheetDb.partyId)); + emplLeaveList = delegator.find("EmplLeave", EntityCondition.makeCondition(leaveExprsList, EntityOperator.AND), null, null, null, findOpts); + leaveHours = 0.00; + + while ((emplLeaveMap = emplLeaveList.next())) { + emplLeaveEntry = emplLeaveMap; + inputData = [:]; + inputData.userLogin = parameters.userLogin; + inputData.partyId = emplLeaveEntry.partyId; + inputData.leaveTypeId = emplLeaveEntry.leaveTypeId; + inputData.fromDate = emplLeaveEntry.fromDate; + resultHour = dispatcher.runSync("getPartyLeaveHoursForDate", inputData); + if (resultHour) { + leaveActualHours = resultHour.hours.doubleValue(); + leaveHours += leaveActualHours; + } + } + //get hours from TimeEntry; + timesheet = [:]; + timesheet.putAll(timesheetDb); + entries = timesheetDb.getRelated("TimeEntry"); + hours = 0.00; + entries.each { timeEntry -> + if (timeEntry.hours) { + hours += timeEntry.hours.doubleValue(); + } + } + timesheet.weekNumber = UtilDateTime.weekNumber(timesheetDb.fromDate); + timesheet.hours = hours + leaveHours; + timesheets.add(timesheet); + emplLeaveList.close(); + } + context.timesheets = timesheets; +} Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListTimeSheets.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListTimeSheets.groovy ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListTimeSheets.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListUnplanBacklog.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListUnplanBacklog.groovy?rev=1142915&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListUnplanBacklog.groovy (added) +++ ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListUnplanBacklog.groovy Tue Jul 5 08:15:32 2011 @@ -0,0 +1,49 @@ +/* +* 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 javolution.util.FastList; +import org.ofbiz.entity.condition.*; +import org.ofbiz.base.util.*; + +taskStatusId = null; +paraBacklogStatusId = backlogStatusId; + +orStsExprs = FastList.newInstance(); + if (backlogStatusId != "Any") { + taskStatusId = "STS_CREATED"; + orStsExprs.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CRQ_REVIEWED")); + } else { + orStsExprs.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CRQ_REVIEWED")); + orStsExprs.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CRQ_COMPLETED")); + } +orCurentExprs = FastList.newInstance(); + if (taskStatusId) { + orCurentExprs.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.EQUALS, taskStatusId)); + orCurentExprs.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.EQUALS, null)); + } +andExprs = FastList.newInstance(); + andExprs.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, parameters.productId)); + andExprs.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.EQUALS, "RF_UNPLAN_BACKLOG")); + andExprs.add(EntityCondition.makeCondition(orStsExprs, EntityOperator.OR)); + andExprs.add(EntityCondition.makeCondition(orCurentExprs, EntityOperator.OR)); +unplannedBacklogCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND); +unplannedBacklogList = delegator.findList("UnPlannedBacklogsAndTasks", unplannedBacklogCond, null,["-custRequestId","workEffortTypeId","sequenceNum"],null, false); + +context.listIt = unplannedBacklogList; +context.paraBacklogStatusId = paraBacklogStatusId; Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListUnplanBacklog.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListUnplanBacklog.groovy ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListUnplanBacklog.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ProductBilling.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ProductBilling.groovy?rev=1142915&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ProductBilling.groovy (added) +++ ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ProductBilling.groovy Tue Jul 5 08:15:32 2011 @@ -0,0 +1,90 @@ +/* +/* + * 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 org.ofbiz.entity.*; +import org.ofbiz.base.util.*; +import org.ofbiz.entity.*; +import org.ofbiz.entity.condition.*; +import org.ofbiz.entity.util.*; +import org.ofbiz.base.util.UtilDateTime; + +productId = parameters.productId; +entryExprs = + EntityCondition.makeCondition([ + EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId), + EntityCondition.makeCondition("invoiceId", EntityOperator.NOT_EQUAL, null), + ], EntityOperator.AND); +orderBy = ["-fromDate"]; +// check if latest invoice generated is still in process so allow re-generation to correct errors +entryIterator = delegator.find("ProjectSprintBacklogTaskAndTimeEntryTimeSheet", entryExprs, null, null, orderBy, null); +while (entryItem = entryIterator.next()) { + invoice = entryItem.getRelatedOne("Invoice"); + if (invoice.getString("statusId").equals("INVOICE_IN_PROCESS")) { + context.partyIdFrom = invoice.partyIdFrom; + context.partyId = invoice.partyId; + context.invoiceId = invoice.invoiceId; + context.invoiceDate = invoice.invoiceDate; + break; + } + } +entryIterator.close(); +//start of this month +context.thruDate = UtilDateTime.getMonthStart(UtilDateTime.nowTimestamp()); + +// build find task conditions +def taskConds = UtilMisc.toList(EntityCondition.makeCondition("productId", parameters.productId)); +taskConds.add(EntityCondition.makeCondition("invoiceId", null)); +taskConds.add(EntityCondition.makeCondition("timesheetStatusId", "TIMESHEET_COMPLETED")); +if (parameters.fromDate) { + fromDate = parameters.fromDate; + if (fromDate.length() < 14) { + fromDate = fromDate + " " + "00:00:00.000"; + } + taskConds.add(EntityCondition.makeCondition("fromDate", EntityOperator.GREATER_THAN_EQUAL_TO, Timestamp.valueOf(fromDate))); +} +if (parameters.thruDate) { + thruDate = parameters.thruDate; + if (thruDate.length() < 14) { + thruDate = thruDate + " " + "00:00:00.000"; + } + taskConds.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, Timestamp.valueOf(thruDate))); +} else { + taskConds.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, context.thruDate)); +} +// include meeting ? +if ("N".equals(includeMeeting)) { + taskConds.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.NOT_EQUAL, "RF_SCRUM_MEETINGS")); +} +// get sprint task list +def sprintTasks = delegator.findList("ProjectSprintBacklogTaskAndTimeEntryTimeSheet", EntityCondition.makeCondition(taskConds), null, null, null, false); + +// get unplanned task list +def unplannedTasks = delegator.findList("UnPlannedBacklogsTaskAndTimeEntryTimeSheet", EntityCondition.makeCondition(taskConds), null, null, null, false); + +def hoursNotYetBilledTasks = []; +hoursNotYetBilledTasks.addAll(sprintTasks); +hoursNotYetBilledTasks.addAll(unplannedTasks); +context.hoursNotYetBilledTasks = UtilMisc.sortMaps(hoursNotYetBilledTasks, ["custRequestId","fromDate"]) + +// get time entry date +timeEntryList = UtilMisc.sortMaps(hoursNotYetBilledTasks, ["fromDate"]) +if (!parameters.fromDate && timeEntryList) { + context.resultDate = timeEntryList[0].fromDate; +} Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ProductBilling.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ProductBilling.groovy ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ProductBilling.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ProductEmail.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ProductEmail.groovy?rev=1142915&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ProductEmail.groovy (added) +++ ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ProductEmail.groovy Tue Jul 5 08:15:32 2011 @@ -0,0 +1,102 @@ +/* + * 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.base.util.*; +import org.ofbiz.entity.*; +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.entity.util.*; + +productId = parameters.productId; +loginPartyId = userLogin.partyId; +communicationEventId = parameters.communicationEventId; +now = UtilDateTime.nowTimestamp(); +try{ + if (UtilValidate.isNotEmpty(loginPartyId)) { + if (UtilValidate.isNotEmpty(productId)) { + context.product = delegator.findByPrimaryKey("Product",["productId" : productId]); + } + communicationEvent = delegator.findByPrimaryKey("CommunicationEvent",["communicationEventId" : communicationEventId]); + communicationEvent.communicationEventTypeId = "EMAIL_COMMUNICATION"; + communicationEvent.contactMechTypeId = "EMAIL_ADDRESS"; + communicationEvent.datetimeStarted = now; + checkOwner = delegator.findByAnd("ProductRole",["productId" : productId,"partyId" : loginPartyId,"roleTypeId" : "PRODUCT_OWNER"]); + if (checkOwner) { + /* for product owner to our company */ + + // for owner + productRole = delegator.findByAnd("ProductRole",["productId" : productId,"roleTypeId" : "PRODUCT_OWNER"]); + context.productOwnerId = productRole[0].partyId + parentCom = delegator.findByPrimaryKey("CommunicationEvent",["communicationEventId" : communicationEventId]); + if (parentCom) { + context.partyIdFrom = productRole[0].partyId; + } else { + context.partyIdFrom = parentCom.partyIdTo; + } + resultsIdFrom = dispatcher.runSync("getPartyEmail", ["partyId" : productRole[0].partyId, "userLogin" : userLogin]); + if (resultsIdFrom.contactMechId != null) { + context.contactMechIdFrom = resultsIdFrom.contactMechId; + communicationEvent.contactMechIdFrom = resultsIdFrom.contactMechId; + } + // for team + defaultPartyIdTo = organizationPartyId; + resultsIdTo = dispatcher.runSync("getPartyEmail", ["partyId" : defaultPartyIdTo,"contactMechPurposeTypeId" :"SUPPORT_EMAIL", "userLogin" : userLogin]); + if (resultsIdTo.contactMechId != null) { + context.contactMechIdTo = resultsIdTo.contactMechId; + communicationEvent.contactMechIdTo = resultsIdTo.contactMechId; + } + context.partyIdTo = defaultPartyIdTo; + communicationEvent.store(); + context.communicationEvent = communicationEvent; + } else { + /* from company to owner */ + + // for team + defaultPartyIdFrom = organizationPartyId; + context.partyIdFrom = defaultPartyIdFrom; + resultsIdFrom = dispatcher.runSync("getPartyEmail", ["partyId" : defaultPartyIdFrom,"contactMechPurposeTypeId" :"SUPPORT_EMAIL", "userLogin" : userLogin]); + if (resultsIdFrom.contactMechId != null) { + context.contactMechIdFrom = resultsIdFrom.contactMechId; + communicationEvent.contactMechIdFrom = resultsIdFrom.contactMechId; + } + // for owner + productRole = delegator.findByAnd("ProductRole",["productId" : productId,"roleTypeId" : "PRODUCT_OWNER"]); + context.productOwnerId = productRole[0].partyId; + parentCom = delegator.findByPrimaryKey("CommunicationEvent",["communicationEventId" : communicationEventId]); + if(parentCom){ + context.partyIdTo = productRole[0].partyId; + } else { + context.partyIdTo = parentCom.partyIdFrom; + } + resultsIdTo = dispatcher.runSync("getPartyEmail", ["partyId" : productRole[0].partyId, "userLogin" : userLogin]); + if (resultsIdTo.contactMechId != null) { + context.contactMechIdTo = resultsIdTo.contactMechId; + communicationEvent.contactMechIdTo = resultsIdTo.contactMechId; + } + communicationEvent.store(); + context.communicationEvent = communicationEvent; + } + } +} catch (exeption) { + Debug.logInfo("catch exeption ================" + exeption,""); +} catch (GenericEntityException e) { + Debug.logInfo("catch GenericEntityException ================" + e.getMessage(),""); +} Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ProductEmail.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ProductEmail.groovy ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ProductEmail.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/QuickAddBacklog.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/QuickAddBacklog.groovy?rev=1142915&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/QuickAddBacklog.groovy (added) +++ ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/QuickAddBacklog.groovy Tue Jul 5 08:15:32 2011 @@ -0,0 +1,93 @@ +/* +* 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 org.ofbiz.base.util.Debug; + +try{ + // for sprint dropdown + workEffortList = []; + sprintList = delegator.findByAnd("WorkEffort",["workEffortTypeId" : "SCRUM_SPRINT","currentStatusId" : "SPRINT_ACTIVE"]); + if (sprintList) { + sprintList.each{ sprintMap -> + workEffortMap = [:]; + workEffortParentId = sprintMap.workEffortParentId; + if (workEffortParentId) { + projectList = delegator.findByAnd("WorkEffortAndProduct",["workEffortId" : workEffortParentId]); + projectMap = projectList[0]; + // make sure that project dose not closed + if (projectMap.currentStatusId != "SPJ_CLOSED") { + productMap = delegator.findByPrimaryKey("Product",["productId" : projectMap.productId]); + workEffortMap.productId = productMap.productId; + workEffortMap.internalName = returnNameAsString(productMap.internalName,30); + workEffortMap.projectId = projectMap.workEffortId; + workEffortMap.projectName = returnNameAsString(projectMap.workEffortName,30); + workEffortMap.sprintId = sprintMap.workEffortId; + workEffortMap.sprintName = returnNameAsString(sprintMap.workEffortName,30); + workEffortMap.keyId = productMap.productId+","+projectMap.workEffortId+","+sprintMap.workEffortId; + workEffortList.add(workEffortMap); + } + } + } + context.workEffortList = workEffortList; + } + + // for backlog category + productId = null; + if (parameters.productId) { + productId = parameters.productId; + } else { + if (parameters.keyId) { + indexList = parameters.keyId.tokenize(","); + productId = indexList[0].toString().trim(); + } + } + categoryList = []; + if (productId) { + sprintList = delegator.findByAnd("CustRequestAndCustRequestItem",["custRequestTypeId" : "RF_PARENT_BACKLOG","productId" : productId]); + } else { + sprintList = delegator.findByAnd("CustRequestAndCustRequestItem",["custRequestTypeId" : "RF_PARENT_BACKLOG"]); + } + if (sprintList) { + sprintList.each{ categoryMap -> + inputMap = [:]; + productIdIn = categoryMap.productId; + if (productIdIn) { + productMap = delegator.findByPrimaryKey("Product",["productId" : productIdIn]); + inputMap.productId = productMap.productId; + inputMap.internalName = productMap.internalName; + inputMap.custRequestId = categoryMap.custRequestId; + inputMap.custRequestName = categoryMap.custRequestName; + categoryList.add(inputMap); + } + } + context.categoryList = categoryList; + } +}catch(e){ + Debug.logInfo("catch e ================" + e,""); +} + +//subString function +def String returnNameAsString(input,length) { + if (input.length() > length ) { + ansValue = input.toString().substring(0,Math.min(input.toString().length(),length)); + return ansValue; + } else { + return input; + } +} \ No newline at end of file Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/QuickAddBacklog.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/QuickAddBacklog.groovy ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/QuickAddBacklog.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/SprintBacklogListItems.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/SprintBacklogListItems.groovy?rev=1142915&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/SprintBacklogListItems.groovy (added) +++ ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/SprintBacklogListItems.groovy Tue Jul 5 08:15:32 2011 @@ -0,0 +1,122 @@ +/* +* 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 javolution.util.FastList; +import org.ofbiz.entity.condition.*; +import org.ofbiz.base.util.*; + +taskStatusId = null; +reopenedStatusId = null; +backlogStatusId = parameters.backlogStatusId; +paraBacklogStatusId = backlogStatusId; +currentStatus = sprintStatus.currentStatusId; +projectSprintList = []; + +if ("SPRINT_CLOSED".equals(currentStatus)) { + backlogStatusId = null; +} else { + if (backlogStatusId == "Any") { + backlogStatusId = null; + } else { + backlogStatusId = "CRQ_REVIEWED"; + reopenedStatusId = "CRQ_REOPENED"; + taskStatusId = "STS_CREATED"; + } +} +orCurentExprs = FastList.newInstance(); + if (taskStatusId) { + orCurentExprs.add(EntityCondition.makeCondition("taskCurrentStatusId", EntityOperator.EQUALS, taskStatusId)); + orCurentExprs.add(EntityCondition.makeCondition("taskCurrentStatusId", EntityOperator.EQUALS, "SPRINT_ACTIVE")); + } +orBacklogExprs = FastList.newInstance(); + if (backlogStatusId) { + orBacklogExprs.add(EntityCondition.makeCondition("backlogStatusId", EntityOperator.EQUALS, backlogStatusId)); + } + if (reopenedStatusId) { + orBacklogExprs.add(EntityCondition.makeCondition("backlogStatusId", EntityOperator.EQUALS, reopenedStatusId)); + } +andExprs = FastList.newInstance(); + if (parameters.projectId) { + andExprs.add(EntityCondition.makeCondition("projectId", EntityOperator.EQUALS, parameters.projectId)); + } else { + andExprs.add(EntityCondition.makeCondition("projectId", EntityOperator.EQUALS, sprintStatus.workEffortParentId)); + } + if (orBacklogExprs) { + andExprs.add(EntityCondition.makeCondition(orBacklogExprs, EntityOperator.OR)); + } + if (orCurentExprs) { + andExprs.add(EntityCondition.makeCondition(orCurentExprs, EntityOperator.OR)); + } + andExprs.add(EntityCondition.makeCondition("sprintId", EntityOperator.EQUALS, parameters.sprintId)); + andExprs.add(EntityCondition.makeCondition("sprintTypeId", EntityOperator.EQUALS, "SCRUM_SPRINT")); + +projectSprintCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND); +projectSprintList = delegator.findList("ProjectSprintBacklogAndTask", projectSprintCond, null,["sequenceNum","custRequestId","taskTypeId"],null, false); + +context.listIt = projectSprintList; +context.paraBacklogStatusId = paraBacklogStatusId; + +//get backlog and task information +if (parameters.sprintId) { + //get total backlog size + completedBacklog = 0; + reviewedBacklog = 0; + totalbacklog = 0; + allTask = []; + sprintList = delegator.findByAnd("CustRequestWorkEffort", ["workEffortId" : parameters.sprintId]); + sprintList.each { sprintMap -> + custMap = sprintMap.getRelatedOne("CustRequest"); + //if ("RF_PROD_BACKLOG".equals(custMap.custRequestTypeId)) { + totalbacklog += 1; + if ("CRQ_REVIEWED".equals(custMap.statusId)){ + reviewedBacklog += 1; + } else { + completedBacklog += 1; + } + //get task + workEffortList = custMap.getRelated("CustRequestWorkEffort"); + if (workEffortList) { + allTask.addAll(workEffortList); + } + //} + } + //get total task size + completedTask = 0; + createdTask = 0; + totalTask = 0; + if (allTask) { + allTask.each { taskMap -> + workEffMap = taskMap.getRelatedOne("WorkEffort"); + if (!"SCRUM_SPRINT".equals(workEffMap.workEffortTypeId)) { + totalTask += 1; + if ("STS_CREATED".equals(workEffMap.currentStatusId)){ + createdTask += 1; + } else { + completedTask += 1; + } + } + } + } + context.completedBacklog = completedBacklog; + context.reviewedBacklog = reviewedBacklog; + context.totalbacklog = totalbacklog; + context.completedTask = completedTask; + context.createdTask = createdTask; + context.totalTask = totalTask; +} Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/SprintBacklogListItems.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/SprintBacklogListItems.groovy ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/SprintBacklogListItems.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/SprintBacklogOptions.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/SprintBacklogOptions.groovy?rev=1142915&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/SprintBacklogOptions.groovy (added) +++ ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/SprintBacklogOptions.groovy Tue Jul 5 08:15:32 2011 @@ -0,0 +1,37 @@ +/* +* 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 org.ofbiz.base.util.Debug; + +custRequestWorkEffortList = []; +sprintStatusId = "SPRINT_CLOSED"; +sprintId = null; +custRequestWorkEffortList = custRequestMap.getRelated("CustRequestWorkEffort"); +if (custRequestWorkEffortList) { + custRequestWorkEffortList.each { custWorkEffortMap -> + workEffortMap = custWorkEffortMap.getRelatedOne("WorkEffort"); + if ("SCRUM_SPRINT".equals(workEffortMap.workEffortTypeId) && "SPRINT_ACTIVE".equals(workEffortMap.currentStatusId)) { + sprintId = workEffortMap.workEffortId; + sprintStatusId = "SPRINT_ACTIVE"; + } + } + +} +context.sprintId = sprintId; +context.sprintStatusId = sprintStatusId; Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/SprintBacklogOptions.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/SprintBacklogOptions.groovy ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/SprintBacklogOptions.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain |
Free forum by Nabble | Edit this page |