Modified: ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListCurrentProducts.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListCurrentProducts.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListCurrentProducts.groovy (original) +++ ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListCurrentProducts.groovy Wed Nov 2 19:09:13 2016 @@ -16,50 +16,50 @@ * specific language governing permissions and limitations * under the License. */ -import org.apache.ofbiz.entity.condition.*; -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.util.EntityUtil; +import org.apache.ofbiz.entity.condition.* +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.util.EntityUtil -roleTypeId = null; -paramCond = []; -products = []; -productId = parameters.productId; -internalName = parameters.internalName; -statusId = parameters.statusId; +roleTypeId = null +paramCond = [] +products = [] +productId = parameters.productId +internalName = parameters.internalName +statusId = parameters.statusId if ("Any".equals(statusId)) { - statusId = null; + statusId = null } -partyId = parameters.partyId; +partyId = parameters.partyId if(!security.hasEntityPermission("SCRUM", "_ADMIN", session)){ if(security.hasEntityPermission("SCRUM_PRODUCT", "_ADMIN", session)){ - roleTypeId = "PRODUCT_OWNER"; + roleTypeId = "PRODUCT_OWNER" } } if (userLogin) { if(UtilValidate.isNotEmpty(partyId)){ - paramCond.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId)); + paramCond.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId)) } if(UtilValidate.isNotEmpty(productId)){ - paramCond.add(EntityCondition.makeCondition("productId", EntityOperator.LIKE, productId + "%")); + paramCond.add(EntityCondition.makeCondition("productId", EntityOperator.LIKE, productId + "%")) } if(UtilValidate.isNotEmpty(internalName)){ - paramCond.add(EntityCondition.makeCondition("internalName", EntityOperator.LIKE, "%" + internalName + "%")); + paramCond.add(EntityCondition.makeCondition("internalName", EntityOperator.LIKE, "%" + internalName + "%")) } if(UtilValidate.isNotEmpty(statusId)){ if ("PRODUCT_ACTIVE".equals(statusId)) { - paramCond.add(EntityCondition.makeCondition("supportDiscontinuationDate", EntityOperator.EQUALS, null)); + paramCond.add(EntityCondition.makeCondition("supportDiscontinuationDate", EntityOperator.EQUALS, null)) } else { - paramCond.add(EntityCondition.makeCondition("supportDiscontinuationDate", EntityOperator.NOT_EQUAL, null)); + paramCond.add(EntityCondition.makeCondition("supportDiscontinuationDate", EntityOperator.NOT_EQUAL, null)) } } - 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)); + 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)) - allProducts = from("ProductAndRole").where(paramCond).orderBy("groupName", "internalName").queryList(); + allProducts = from("ProductAndRole").where(paramCond).orderBy("groupName", "internalName").queryList() partyAndSecurityGroupList = select("partyId", "groupId") .from("ScrumMemberUserLoginAndSecurityGroup").where(EntityCondition.makeCondition([ @@ -68,27 +68,27 @@ if (userLogin) { EntityCondition.makeCondition ("thruDate", EntityOperator.EQUALS, null) ], EntityJoinOperator.AND)) .orderBy("partyId") - .queryList(); + .queryList() - context.partyAndSecurityGroupList = partyAndSecurityGroupList; - boolean addAllProducts = false; + context.partyAndSecurityGroupList = partyAndSecurityGroupList + boolean addAllProducts = false allProducts.each { product -> - product = product.getAllFields(); - productMap = from("Product").where("productId", product.productId).queryOne(); + product = product.getAllFields() + productMap = from("Product").where("productId", product.productId).queryOne() product.put("longDescription",productMap.longDescription) if(security.hasEntityPermission("SCRUM", "_ADMIN", session)){ - addAllProducts = true; + addAllProducts = true }else{ - ismember = false; + ismember = false if (partyAndSecurityGroupList) { - groupId = partyAndSecurityGroupList[0].groupId; + groupId = partyAndSecurityGroupList[0].groupId if ("SCRUM_PRODUCT_OWNER".equals(groupId)) { - productAndRoleList = from("ProductRole").where("productId", product.productId, "partyId", userLogin.partyId, "thruDate", null).queryList(); + productAndRoleList = from("ProductRole").where("productId", product.productId, "partyId", userLogin.partyId, "thruDate", null).queryList() if (productAndRoleList) { productAndRoleList.each { productAndRoleMap -> - productIdInner = productAndRoleMap.productId; + productIdInner = productAndRoleMap.productId if (productIdInner.equals(product.productId)) { - ismember = true; + ismember = true } } } @@ -99,14 +99,14 @@ if (userLogin) { EntityCondition.makeCondition ("roleTypeId", EntityOperator.EQUALS, "STAKEHOLDER"), EntityCondition.makeCondition ("partyStatusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED"), EntityCondition.makeCondition ("thruDate", EntityOperator.EQUALS, null) - ], EntityJoinOperator.AND); - scrumRolesPersonAndCompanyList = from("ScrumRolesPersonAndCompany").where(scrumRolesCond).queryList(); - productRoleList = from("ProductRole").where("partyId", scrumRolesPersonAndCompanyList[0].partyIdFrom, "roleTypeId", "PRODUCT_OWNER_COMP", "thruDate", null).queryList(); + ], EntityJoinOperator.AND) + scrumRolesPersonAndCompanyList = from("ScrumRolesPersonAndCompany").where(scrumRolesCond).queryList() + productRoleList = from("ProductRole").where("partyId", scrumRolesPersonAndCompanyList[0].partyIdFrom, "roleTypeId", "PRODUCT_OWNER_COMP", "thruDate", null).queryList() if (productRoleList) { productRoleList.each { productRoleMap -> - stakeholderProduct = productRoleMap.productId; + stakeholderProduct = productRoleMap.productId if (stakeholderProduct.equals(product.productId)) { - ismember = true; + ismember = true } } } @@ -114,25 +114,25 @@ if (userLogin) { if (ismember == false) { productAndRoleList = from("ProductAndRole").where("productId" : product.productId, "partyId" : userLogin.partyId, "roleTypeId" : "STAKEHOLDER", "supportDiscontinuationDate" : null, "thruDate" : null).queryList() if (productAndRoleList) { - ismember = true; + ismember = true } } } else if ("SCRUM_MASTER".equals(groupId)) { //check in product. - productRoleList = []; - productRoleList = from("ProductAndRole").where("productId" : product.productId, "partyId" : userLogin.partyId, "roleTypeId" : "SCRUM_MASTER", "supportDiscontinuationDate" : null, "thruDate" : null).queryList(); + productRoleList = [] + productRoleList = from("ProductAndRole").where("productId" : product.productId, "partyId" : userLogin.partyId, "roleTypeId" : "SCRUM_MASTER", "supportDiscontinuationDate" : null, "thruDate" : null).queryList() if (productRoleList) { - ismember = true; + ismember = true } //check in project. if (ismember == false) { - projects = []; - projects = from("WorkEffortAndProduct").where("productId", product.productId, "workEffortTypeId", "SCRUM_PROJECT", "currentStatusId", "SPJ_ACTIVE").queryList(); + projects = [] + projects = from("WorkEffortAndProduct").where("productId", product.productId, "workEffortTypeId", "SCRUM_PROJECT", "currentStatusId", "SPJ_ACTIVE").queryList() if (projects) { projects.each { project -> - projectPartyAssignment = from("WorkEffortPartyAssignment").where("partyId", userLogin.partyId, "workEffortId", project.workEffortId).queryList(); + projectPartyAssignment = from("WorkEffortPartyAssignment").where("partyId", userLogin.partyId, "workEffortId", project.workEffortId).queryList() if (projectPartyAssignment) { - ismember = true; + ismember = true } } } @@ -140,47 +140,47 @@ if (userLogin) { //check in sprint. if (ismember == false) { projects.each { project -> - allSprintList = []; - allSprintList = from("WorkEffort").where("workEffortParentId", project.workEffortId, "currentStatusId", "SPRINT_ACTIVE").queryList(); + allSprintList = [] + allSprintList = from("WorkEffort").where("workEffortParentId", project.workEffortId, "currentStatusId", "SPRINT_ACTIVE").queryList() allSprintList.each { SprintListMap -> - sprintId = SprintListMap.workEffortId; - workEffortPartyAssignment = from("WorkEffortPartyAssignment").where("partyId", userLogin.partyId, "workEffortId", sprintId).queryList(); + sprintId = SprintListMap.workEffortId + workEffortPartyAssignment = from("WorkEffortPartyAssignment").where("partyId", userLogin.partyId, "workEffortId", sprintId).queryList() if (workEffortPartyAssignment) { - ismember = true; + ismember = true } } } } } else { - projects = []; - projects = from("WorkEffortAndProduct").where("productId", product.productId, "workEffortTypeId", "SCRUM_PROJECT", "currentStatusId", "SPJ_ACTIVE").queryList(); + projects = [] + projects = from("WorkEffortAndProduct").where("productId", product.productId, "workEffortTypeId", "SCRUM_PROJECT", "currentStatusId", "SPJ_ACTIVE").queryList() if (projects) { projects.each { project -> - allSprintList = []; - allSprintList = from("WorkEffort").where("workEffortParentId", project.workEffortId, "currentStatusId", "SPRINT_ACTIVE").queryList(); + allSprintList = [] + allSprintList = from("WorkEffort").where("workEffortParentId", project.workEffortId, "currentStatusId", "SPRINT_ACTIVE").queryList() allSprintList.each { SprintListMap -> - sprintId = SprintListMap.workEffortId; - workEffortPartyAssignment = from("WorkEffortPartyAssignment").where("partyId", userLogin.partyId, "workEffortId", sprintId).queryList(); + sprintId = SprintListMap.workEffortId + workEffortPartyAssignment = from("WorkEffortPartyAssignment").where("partyId", userLogin.partyId, "workEffortId", sprintId).queryList() if (workEffortPartyAssignment) { - ismember = true; + ismember = true } } } } if (ismember == false) { exprBldr = [EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CRQ_REVIEWED"), - EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CRQ_REOPENED")]; + 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 = from("UnPlannedBacklogsAndTasks").where(unplannedBacklogCond).queryList(); + EntityCondition.makeCondition(exprBldr, EntityOperator.OR)] + unplannedBacklogCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND) + unplannedBacklogList = from("UnPlannedBacklogsAndTasks").where(unplannedBacklogCond).queryList() if (unplannedBacklogList) { unplannedBacklogList.each { unplannedMap -> - workEffortId = unplannedMap.workEffortId; - workEffortPartyAssignment = from("WorkEffortPartyAssignment").where("partyId", userLogin.partyId, "workEffortId", workEffortId).queryList(); + workEffortId = unplannedMap.workEffortId + workEffortPartyAssignment = from("WorkEffortPartyAssignment").where("partyId", userLogin.partyId, "workEffortId", workEffortId).queryList() if (workEffortPartyAssignment) { - ismember = true; + ismember = true } } } @@ -188,17 +188,17 @@ if (userLogin) { } if (ismember) { - products.add(product); + products.add(product) } } } if(addAllProducts) - products.add(product); + products.add(product) } } else { - Debug.logError("Party ID missing =========>>> : null ", ""); + Debug.logError("Party ID missing =========>>> : null ", "") } if (products){ - context.listIt = products; + context.listIt = products } Modified: ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListCurrentSprints.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListCurrentSprints.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListCurrentSprints.groovy (original) +++ ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListCurrentSprints.groovy Wed Nov 2 19:09:13 2016 @@ -17,53 +17,53 @@ * under the License. */ -import org.apache.ofbiz.entity.condition.*; -import org.apache.ofbiz.base.util.*; +import org.apache.ofbiz.entity.condition.* +import org.apache.ofbiz.base.util.* cond = EntityCondition.makeCondition([ EntityCondition.makeCondition ("projectTypeId", EntityOperator.EQUALS, "SCRUM_PROJECT"), EntityCondition.makeCondition ("projectStatusId", EntityOperator.NOT_EQUAL, "SPJ_CLOSED") - ], EntityJoinOperator.AND); + ], 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"]); + ], EntityJoinOperator.AND) +fields = new HashSet(["partyId", "groupId"]) -allSprints = from("ProjectSprint").where(cond).orderBy("projectName", "-sprintActualStartDate").queryList(); -partyAndSecurityGroupList = select("partyId", "groupId").from("ScrumMemberUserLoginAndSecurityGroup").where(securityGroupCond).orderBy("partyId").queryList(); -oldProjectId = null; -newProjectId = null; -countSprint = 0; -sprints = []; +allSprints = from("ProjectSprint").where(cond).orderBy("projectName", "-sprintActualStartDate").queryList() +partyAndSecurityGroupList = select("partyId", "groupId").from("ScrumMemberUserLoginAndSecurityGroup").where(securityGroupCond).orderBy("partyId").queryList() +oldProjectId = null +newProjectId = null +countSprint = 0 +sprints = [] allSprints.each { sprint -> - newProjectId = sprint.projectId; - productAndRole = from("ProductAndRole").where("roleTypeId", "PRODUCT_OWNER_COMP", "productId", sprint.productId).queryList(); - companyId = ""; - companyName = ""; + newProjectId = sprint.projectId + productAndRole = from("ProductAndRole").where("roleTypeId", "PRODUCT_OWNER_COMP", "productId", sprint.productId).queryList() + companyId = "" + companyName = "" if (productAndRole.size() > 0) { - companyName = productAndRole.get(0).groupName; - companyId = productAndRole.get(0).partyId; + companyName = productAndRole.get(0).groupName + companyId = productAndRole.get(0).partyId } - sprint = sprint.getAllFields(); + sprint = sprint.getAllFields() sprint.put("companyId", companyId) sprint.put("companyName", companyName) - product = from("Product").where("productId", sprint.productId).queryOne(); - productName = ""; - if (product != null) productName = product.internalName; - sprint.put("productName", productName); + product = from("Product").where("productId", sprint.productId).queryOne() + 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; + oldProjectId = newProjectId + countSprint = 0 + ismember = false if (partyAndSecurityGroupList) { - groupId = partyAndSecurityGroupList[0].groupId; + groupId = partyAndSecurityGroupList[0].groupId if ("SCRUM_PRODUCT_OWNER".equals(groupId)) { - productAndRoleList = from("ProductRole").where("productId", sprint.productId, "partyId", partyAndSecurityGroupList.getAt(0).partyId, "thruDate", null).queryList(); + productAndRoleList = from("ProductRole").where("productId", sprint.productId, "partyId", partyAndSecurityGroupList.getAt(0).partyId, "thruDate", null).queryList() if (productAndRoleList) { - ismember = true; + ismember = true } }else if("SCRUM_STAKEHOLDER".equals(groupId)) { // check in company relationship. @@ -72,14 +72,14 @@ allSprints.each { sprint -> EntityCondition.makeCondition ("roleTypeId", EntityOperator.EQUALS, "STAKEHOLDER"), EntityCondition.makeCondition ("partyStatusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED"), EntityCondition.makeCondition ("thruDate", EntityOperator.EQUALS, null) - ], EntityJoinOperator.AND); - scrumRolesPersonAndCompanyList = from("ScrumRolesPersonAndCompany").where(scrumRolesCond).queryList(); - productRoleList = from("ProductRole").where("partyId", scrumRolesPersonAndCompanyList[0].partyIdFrom, "roleTypeId", "PRODUCT_OWNER_COMP", "thruDate", null).queryList(); + ], EntityJoinOperator.AND) + scrumRolesPersonAndCompanyList = from("ScrumRolesPersonAndCompany").where(scrumRolesCond).queryList() + productRoleList = from("ProductRole").where("partyId", scrumRolesPersonAndCompanyList[0].partyIdFrom, "roleTypeId", "PRODUCT_OWNER_COMP", "thruDate", null).queryList() if (productRoleList) { productRoleList.each { productRoleMap -> - stakeholderProduct = productRoleMap.productId; + stakeholderProduct = productRoleMap.productId if (stakeholderProduct.equals(sprint.productId)) { - ismember = true; + ismember = true } } } @@ -88,49 +88,49 @@ allSprints.each { sprint -> productAndRoleList = from("ProductAndRole") .where("productId", sprint.productId, "partyId", userLogin.partyId, "roleTypeId", "STAKEHOLDER", "supportDiscontinuationDate", null, "thruDate", null) - .queryList(); + .queryList() if (productAndRoleList) { - ismember = true; + ismember = true } } } else if("SCRUM_MASTER".equals(groupId)) { //check in product - productRoleList = []; + productRoleList = [] productRoleList = from("ProductAndRole") .where("productId" : sprint.productId, "partyId" : userLogin.partyId, "roleTypeId" : "SCRUM_MASTER", "supportDiscontinuationDate" : null, "thruDate" : null) - .queryList(); + .queryList() if (productRoleList) { - ismember = true; + ismember = true } //check in project. if (ismember == false) { - projectPartyAssignment = from("WorkEffortPartyAssignment").where("workEffortId", sprint.projectId, "partyId", userLogin.partyId).queryList(); + projectPartyAssignment = from("WorkEffortPartyAssignment").where("workEffortId", sprint.projectId, "partyId", userLogin.partyId).queryList() if (projectPartyAssignment) { - ismember = true; + ismember = true } } //check in sprint. if (ismember == false) { - allSprintList = []; - allSprintList = from("WorkEffort").where("workEffortParentId", sprint.projectId).queryList(); + allSprintList = [] + allSprintList = from("WorkEffort").where("workEffortParentId", sprint.projectId).queryList() allSprintList.each { SprintListMap -> - sprintId = SprintListMap.workEffortId; - workEffortPartyAssignment = from("WorkEffortPartyAssignment").where("workEffortId", sprintId, "partyId", userLogin.partyId).queryList(); + sprintId = SprintListMap.workEffortId + workEffortPartyAssignment = from("WorkEffortPartyAssignment").where("workEffortId", sprintId, "partyId", userLogin.partyId).queryList() if (workEffortPartyAssignment) { - ismember = true; + ismember = true } } } } else { - allSprintList = []; - allSprintList = from("WorkEffort").where("workEffortParentId", sprint.projectId).queryList(); + allSprintList = [] + allSprintList = from("WorkEffort").where("workEffortParentId", sprint.projectId).queryList() allSprintList.each { SprintListMap -> - sprintId = SprintListMap.workEffortId; - workEffortPartyAssignment = from("WorkEffortPartyAssignment").where("workEffortId", sprintId, "partyId", userLogin.partyId).queryList(); + sprintId = SprintListMap.workEffortId + workEffortPartyAssignment = from("WorkEffortPartyAssignment").where("workEffortId", sprintId, "partyId", userLogin.partyId).queryList() if (workEffortPartyAssignment) { - ismember = true; + ismember = true } } } @@ -139,18 +139,18 @@ allSprints.each { sprint -> || ((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++; + sprints.add(sprint) + countSprint++ } } else { if (countSprint < 4) { - ismember = false; + ismember = false if (partyAndSecurityGroupList) { - groupId = partyAndSecurityGroupList[0].groupId; + groupId = partyAndSecurityGroupList[0].groupId if ("SCRUM_PRODUCT_OWNER".equals(groupId)) { - productAndRoleList = from("ProductRole").where("productId", sprint.productId, "partyId", partyAndSecurityGroupList.getAt(0).partyId, "thruDate", null).queryList(); + productAndRoleList = from("ProductRole").where("productId", sprint.productId, "partyId", partyAndSecurityGroupList.getAt(0).partyId, "thruDate", null).queryList() if (productAndRoleList) { - ismember = true; + ismember = true } }else if("SCRUM_STAKEHOLDER".equals(groupId)) { // check in company relationship. @@ -159,58 +159,58 @@ allSprints.each { sprint -> EntityCondition.makeCondition ("roleTypeId", EntityOperator.EQUALS, "STAKEHOLDER"), EntityCondition.makeCondition ("partyStatusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED"), EntityCondition.makeCondition ("thruDate", EntityOperator.EQUALS, null) - ], EntityJoinOperator.AND); - scrumRolesPersonAndCompanyList = from("ScrumRolesPersonAndCompany").where(scrumRolesCond).queryList(); - productRoleList = from("ProductRole").where("partyId", scrumRolesPersonAndCompanyList[0].partyIdFrom, "roleTypeId", "PRODUCT_OWNER_COMP", "thruDate", null).queryList(); + ], EntityJoinOperator.AND) + scrumRolesPersonAndCompanyList = from("ScrumRolesPersonAndCompany").where(scrumRolesCond).queryList() + productRoleList = from("ProductRole").where("partyId", scrumRolesPersonAndCompanyList[0].partyIdFrom, "roleTypeId", "PRODUCT_OWNER_COMP", "thruDate", null).queryList() if (productRoleList) { productRoleList.each { productRoleMap -> - stakeholderProduct = productRoleMap.productId; + stakeholderProduct = productRoleMap.productId if (stakeholderProduct.equals(sprint.productId)) { - ismember = true; + ismember = true } } } //check in product. if (ismember == false) { - productAndRoleList = from("ProductAndRole").where("productId" : sprint.productId, "partyId" : userLogin.partyId, "roleTypeId" : "STAKEHOLDER", "supportDiscontinuationDate" : null, "thruDate" : null).queryList(); + productAndRoleList = from("ProductAndRole").where("productId" : sprint.productId, "partyId" : userLogin.partyId, "roleTypeId" : "STAKEHOLDER", "supportDiscontinuationDate" : null, "thruDate" : null).queryList() if (productAndRoleList) { - ismember = true; + ismember = true } } } else if("SCRUM_MASTER".equals(groupId)) { //check in product - productRoleList = []; - productRoleList = from("ProductAndRole").where("productId" : sprint.productId, "partyId" : userLogin.partyId, "roleTypeId" : "SCRUM_MASTER", "supportDiscontinuationDate" : null, "thruDate" : null).queryList(); + productRoleList = [] + productRoleList = from("ProductAndRole").where("productId" : sprint.productId, "partyId" : userLogin.partyId, "roleTypeId" : "SCRUM_MASTER", "supportDiscontinuationDate" : null, "thruDate" : null).queryList() if (productRoleList) { - ismember = true; + ismember = true } //check in project. if (ismember == false) { - projectPartyAssignment = from("WorkEffortPartyAssignment").where("workEffortId", sprint.projectId, "partyId", userLogin.partyId).queryList(); + projectPartyAssignment = from("WorkEffortPartyAssignment").where("workEffortId", sprint.projectId, "partyId", userLogin.partyId).queryList() if (projectPartyAssignment) { - ismember = true; + ismember = true } } //check in sprint. if (ismember == false) { - allSprintList = []; - allSprintList = from("WorkEffort").where("workEffortParentId", sprint.projectId).queryList(); + allSprintList = [] + allSprintList = from("WorkEffort").where("workEffortParentId", sprint.projectId).queryList() allSprintList.each { SprintListMap -> - sprintId = SprintListMap.workEffortId; - workEffortPartyAssignment = from("WorkEffortPartyAssignment").where("workEffortId", sprintId, "partyId", userLogin.partyId).queryList(); + sprintId = SprintListMap.workEffortId + workEffortPartyAssignment = from("WorkEffortPartyAssignment").where("workEffortId", sprintId, "partyId", userLogin.partyId).queryList() if (workEffortPartyAssignment) { - ismember = true; + ismember = true } } } } else { - allSprintList = []; - allSprintList = from("WorkEffort").where("workEffortParentId", sprint.projectId).queryList(); + allSprintList = [] + allSprintList = from("WorkEffort").where("workEffortParentId", sprint.projectId).queryList() allSprintList.each { SprintListMap -> - sprintId = SprintListMap.workEffortId; - workEffortPartyAssignment = from("WorkEffortPartyAssignment").where("workEffortId", sprintId, "partyId", userLogin.partyId).queryList(); + sprintId = SprintListMap.workEffortId + workEffortPartyAssignment = from("WorkEffortPartyAssignment").where("workEffortId", sprintId, "partyId", userLogin.partyId).queryList() if (workEffortPartyAssignment) { - ismember = true; + ismember = true } } } @@ -219,13 +219,13 @@ allSprints.each { sprint -> || ((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++; + sprints.add(sprint) + countSprint++ } } } } if (sprints) { sprints = UtilMisc.sortMaps(sprints, ["companyName", "projectName", "productName"]) - context.sprints = sprints; + context.sprints = sprints } Modified: ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListRevision.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListRevision.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListRevision.groovy (original) +++ ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListRevision.groovy Wed Nov 2 19:09:13 2016 @@ -17,76 +17,76 @@ * under the License. */ -import org.apache.ofbiz.base.util.UtilMisc; -import org.apache.ofbiz.base.util.Debug; -import org.apache.ofbiz.entity.util.*; -import org.apache.ofbiz.entity.condition.*; +import org.apache.ofbiz.base.util.UtilMisc +import org.apache.ofbiz.base.util.Debug +import org.apache.ofbiz.entity.util.* +import org.apache.ofbiz.entity.condition.* -custRequestList = []; -custAndWorkEffortList = []; -revisionList = []; -listIt = []; +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 = []; + 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 + "%")); + 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("custRequestId", EntityOperator.LIKE, parameters.custRequestId + "%")) } - andList.add(EntityCondition.makeCondition(orList, EntityOperator.OR)); - custRequestCond = EntityCondition.makeCondition(andList, EntityOperator.AND); - custRequestList = from("CustRequestAndCustRequestItem").where(custRequestCond).queryList(); + andList.add(EntityCondition.makeCondition(orList, EntityOperator.OR)) + custRequestCond = EntityCondition.makeCondition(andList, EntityOperator.AND) + custRequestList = from("CustRequestAndCustRequestItem").where(custRequestCond).queryList() - 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 = from("CustRequestAndWorkEffort").where(custAndWorkEffortCond).queryList(); + 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 = from("CustRequestAndWorkEffort").where(custAndWorkEffortCond).queryList() //for workEffortId - workEffortIds = EntityUtil.getFieldListFromEntityList(custAndWorkEffortList, "workEffortId", true); - revisionAndList = []; + workEffortIds = EntityUtil.getFieldListFromEntityList(custAndWorkEffortList, "workEffortId", true) + revisionAndList = [] if (parameters.workEffortId) { - revisionAndList.add(EntityCondition.makeCondition("workEffortId", EntityOperator.LIKE, parameters.workEffortId + "%")); + revisionAndList.add(EntityCondition.makeCondition("workEffortId", EntityOperator.LIKE, parameters.workEffortId + "%")) } else { - revisionAndList.add(EntityCondition.makeCondition("workEffortId", EntityOperator.IN, workEffortIds)); + 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 = from("WorkEffortAndContentDataResource").where(revisionCond).orderBy("-fromDate").queryList(); + revisionAndList.add(EntityCondition.makeCondition("workEffortContentTypeId", EntityOperator.EQUALS, "TASK_SUB_INFO")) + revisionCond = EntityCondition.makeCondition(revisionAndList, EntityOperator.AND) + revisionList = from("WorkEffortAndContentDataResource").where(revisionCond).orderBy("-fromDate").queryList() 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 = from("CustRequestAndWorkEffort").where("workEffortId", revisionMap.workEffortId).queryList(); + 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 = from("CustRequestAndWorkEffort").where("workEffortId", revisionMap.workEffortId).queryList() if (custAndWorkEfffList) { - custAndWorkEfffMap = custAndWorkEfffList[0]; - custAndCustItemList = from("CustRequestAndCustRequestItem").where("custRequestId", custAndWorkEfffMap.custRequestId).queryList(); + custAndWorkEfffMap = custAndWorkEfffList[0] + custAndCustItemList = from("CustRequestAndCustRequestItem").where("custRequestId", custAndWorkEfffMap.custRequestId).queryList() if (custAndCustItemList) { - custAndCustItemMap = custAndCustItemList[0]; - inputMap.productId = custAndCustItemMap.productId; - inputMap.custRequestId = custAndCustItemMap.custRequestId; + custAndCustItemMap = custAndCustItemList[0] + inputMap.productId = custAndCustItemMap.productId + inputMap.custRequestId = custAndCustItemMap.custRequestId } } - listIt.add(inputMap); + listIt.add(inputMap) } - context.listIt = listIt; + context.listIt = listIt } } Modified: ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListScrumPreferenceSecurityGroup.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListScrumPreferenceSecurityGroup.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListScrumPreferenceSecurityGroup.groovy (original) +++ ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListScrumPreferenceSecurityGroup.groovy Wed Nov 2 19:09:13 2016 @@ -17,70 +17,70 @@ * under the License. */ -import org.apache.ofbiz.entity.condition.*; -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.util.EntityUtil; -import org.apache.ofbiz.entity.condition.EntityCondition; -import org.apache.ofbiz.entity.condition.EntityOperator; - -partyId = parameters.partyId; - -andCond = []; -orCond = []; -combinedCondList = []; - -andCond.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId)); -andCond.add(EntityCondition.makeCondition("partyStatusId", EntityOperator.EQUALS, "PARTY_ENABLED")); - -orCond.add(EntityCondition.makeCondition("groupId", EntityOperator.EQUALS, "SCRUM_PRODUCT_OWNER")); -orCond.add(EntityCondition.makeCondition("groupId", EntityOperator.EQUALS, "SCRUM_MASTER")); -orCond.add(EntityCondition.makeCondition("groupId", EntityOperator.EQUALS, "SCRUM_TEAM")); -orCond.add(EntityCondition.makeCondition("enabled", EntityOperator.EQUALS, "Y")); -orCond.add(EntityCondition.makeCondition("enabled", EntityOperator.EQUALS, null)); - -orCondList = EntityCondition.makeCondition(orCond, EntityOperator.OR); -andCondList = EntityCondition.makeCondition(andCond, EntityOperator.AND); - -combinedCondList.add(orCondList); -combinedCondList.add(andCondList); - -combinedConds = EntityCondition.makeCondition(combinedCondList, EntityOperator.AND); - -scrumUserLoginSecurityGroupList = from("ScrumMemberUserLoginAndSecurityGroup").where(combinedConds).queryList(); -userPreferenceList = []; -userPreferenceOutList = []; +import org.apache.ofbiz.entity.condition.* +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.util.EntityUtil +import org.apache.ofbiz.entity.condition.EntityCondition +import org.apache.ofbiz.entity.condition.EntityOperator + +partyId = parameters.partyId + +andCond = [] +orCond = [] +combinedCondList = [] + +andCond.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId)) +andCond.add(EntityCondition.makeCondition("partyStatusId", EntityOperator.EQUALS, "PARTY_ENABLED")) + +orCond.add(EntityCondition.makeCondition("groupId", EntityOperator.EQUALS, "SCRUM_PRODUCT_OWNER")) +orCond.add(EntityCondition.makeCondition("groupId", EntityOperator.EQUALS, "SCRUM_MASTER")) +orCond.add(EntityCondition.makeCondition("groupId", EntityOperator.EQUALS, "SCRUM_TEAM")) +orCond.add(EntityCondition.makeCondition("enabled", EntityOperator.EQUALS, "Y")) +orCond.add(EntityCondition.makeCondition("enabled", EntityOperator.EQUALS, null)) + +orCondList = EntityCondition.makeCondition(orCond, EntityOperator.OR) +andCondList = EntityCondition.makeCondition(andCond, EntityOperator.AND) + +combinedCondList.add(orCondList) +combinedCondList.add(andCondList) + +combinedConds = EntityCondition.makeCondition(combinedCondList, EntityOperator.AND) + +scrumUserLoginSecurityGroupList = from("ScrumMemberUserLoginAndSecurityGroup").where(combinedConds).queryList() +userPreferenceList = [] +userPreferenceOutList = [] if (scrumUserLoginSecurityGroupList) { scrumUserLoginSecurityGroupList.each { scrumUserLoginSecurityGroupMap -> if (scrumUserLoginSecurityGroupMap.groupId == "SCRUM_PRODUCT_OWNER") { - ownerCond = []; - ownerCond.add(EntityCondition.makeCondition("enumTypeId", EntityOperator.EQUALS, "SCRUM_PREFERENCE")); - ownerCond.add(EntityCondition.makeCondition("enumId", EntityOperator.NOT_EQUAL, "MASTER_NOTIFY")); - ownerConds = EntityCondition.makeCondition(ownerCond, EntityOperator.AND); - userPreferenceList = from("Enumeration").where(ownerConds).queryList(); + ownerCond = [] + ownerCond.add(EntityCondition.makeCondition("enumTypeId", EntityOperator.EQUALS, "SCRUM_PREFERENCE")) + ownerCond.add(EntityCondition.makeCondition("enumId", EntityOperator.NOT_EQUAL, "MASTER_NOTIFY")) + ownerConds = EntityCondition.makeCondition(ownerCond, EntityOperator.AND) + userPreferenceList = from("Enumeration").where(ownerConds).queryList() } else if (scrumUserLoginSecurityGroupMap.groupId == "SCRUM_MASTER") { - masterCond = []; - masterCond.add(EntityCondition.makeCondition("enumTypeId", EntityOperator.EQUALS, "SCRUM_PREFERENCE")); - masterCond.add(EntityCondition.makeCondition("enumId", EntityOperator.EQUALS, "MASTER_NOTIFY")); - masterConds = EntityCondition.makeCondition(masterCond, EntityOperator.AND); - userPreferenceList = from("Enumeration").where(masterConds).queryList(); + masterCond = [] + masterCond.add(EntityCondition.makeCondition("enumTypeId", EntityOperator.EQUALS, "SCRUM_PREFERENCE")) + masterCond.add(EntityCondition.makeCondition("enumId", EntityOperator.EQUALS, "MASTER_NOTIFY")) + masterConds = EntityCondition.makeCondition(masterCond, EntityOperator.AND) + userPreferenceList = from("Enumeration").where(masterConds).queryList() } /*else if (scrumUserLoginSecurityGroupMap.groupId == "SCRUM_TEAM") { - teamCond = []; - teamCond.add(EntityCondition.makeCondition("enumTypeId", EntityOperator.EQUALS, "SCRUM_PREFERENCE")); - teamCond.add(EntityCondition.makeCondition("enumId", EntityOperator.EQUALS, "INVITE_NOTIFI")); - teamConds = EntityCondition.makeCondition(teamCond, EntityOperator.AND); - userPreferenceList = delegator.findList("Enumeration" , teamConds, null, null, null, false); + teamCond = [] + teamCond.add(EntityCondition.makeCondition("enumTypeId", EntityOperator.EQUALS, "SCRUM_PREFERENCE")) + teamCond.add(EntityCondition.makeCondition("enumId", EntityOperator.EQUALS, "INVITE_NOTIFI")) + teamConds = EntityCondition.makeCondition(teamCond, EntityOperator.AND) + userPreferenceList = delegator.findList("Enumeration" , teamConds, null, null, null, false) }*/ if (userPreferenceList) { userPreferenceList.each { userPreferenceMap -> - userPreferenceOutList.add(userPreferenceMap); + userPreferenceOutList.add(userPreferenceMap) } } } - context.userPreferenceList = userPreferenceOutList; + context.userPreferenceList = userPreferenceOutList } else { if (security.hasEntityPermission("SCRUM", "_ADMIN", session)) { - userPreferenceList = from("Enumeration").where("enumTypeId", "SCRUM_PREFERENCE").queryList(); - context.userPreferenceList = userPreferenceList; + userPreferenceList = from("Enumeration").where("enumTypeId", "SCRUM_PREFERENCE").queryList() + context.userPreferenceList = userPreferenceList } } Modified: ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListScrumResource.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListScrumResource.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListScrumResource.groovy (original) +++ ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListScrumResource.groovy Wed Nov 2 19:09:13 2016 @@ -17,37 +17,37 @@ * under the License. */ -import java.util.*; -import java.lang.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.entity.condition.*; -import org.apache.ofbiz.entity.util.*; -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.condition.EntityFunction; +import java.util.* +import java.lang.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.entity.condition.* +import org.apache.ofbiz.entity.util.* +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.condition.EntityFunction -def module = "ListScrumResource.groovy"; +def module = "ListScrumResource.groovy" -performFindInMap = [:]; -performFindInMap.entityName = "ScrumMemberUserLoginAndSecurityGroup"; -inputFields = [:]; -outputList = []; +performFindInMap = [:] +performFindInMap.entityName = "ScrumMemberUserLoginAndSecurityGroup" +inputFields = [:] +outputList = [] -inputFields.putAll(parameters); -performFindInMap.noConditionFind = "Y"; -performFindInMap.inputFields = inputFields; -performFindInMap.orderBy = parameters.sortField; +inputFields.putAll(parameters) +performFindInMap.noConditionFind = "Y" +performFindInMap.inputFields = inputFields +performFindInMap.orderBy = parameters.sortField if (parameters.sortField) { - performFindInMap.orderBy = "lastName"; + performFindInMap.orderBy = "lastName" } -performFindResults = runService('performFind', performFindInMap); -resultList = performFindResults.listIt.getCompleteList(); -performFindResults.listIt.close(); +performFindResults = runService('performFind', performFindInMap) +resultList = performFindResults.listIt.getCompleteList() +performFindResults.listIt.close() resultList.each() { result -> if (!"N".equals(result.enabled)) { - outputList.add(result); + outputList.add(result) } } if (outputList) { - context.listIt = outputList; + context.listIt = outputList } \ No newline at end of file Modified: ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListScrumRolesPersonAndCompany.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListScrumRolesPersonAndCompany.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListScrumRolesPersonAndCompany.groovy (original) +++ ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListScrumRolesPersonAndCompany.groovy Wed Nov 2 19:09:13 2016 @@ -17,51 +17,51 @@ * under the License. */ -import org.apache.ofbiz.entity.condition.*; -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.util.EntityUtil; +import org.apache.ofbiz.entity.condition.* +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.util.EntityUtil productId = parameters.productId -personAndCompanyList = []; +personAndCompanyList = [] if (productId) { - productRoleList = from("ProductRole").where("productId" : productId, "roleTypeId" : "PRODUCT_OWNER_COMP").queryList(); + productRoleList = from("ProductRole").where("productId" : productId, "roleTypeId" : "PRODUCT_OWNER_COMP").queryList() 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 = from("ScrumRolesPersonAndCompany").where(personAndComCond).orderBy("groupName").queryList(); + ], EntityJoinOperator.AND) + personAndCompanyList = from("ScrumRolesPersonAndCompany").where(personAndComCond).orderBy("groupName").queryList() } } if (personAndCompanyList) { - context.companyCurrentList = personAndCompanyList; - context.companyCurrent = personAndCompanyList[0].partyId; + context.companyCurrentList = personAndCompanyList + context.companyCurrent = personAndCompanyList[0].partyId } else { - context.companyCurrent = null; + context.companyCurrent = null } // Get owner with security group -scrumRolesPersonAndCompanyList = []; +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 = from("ScrumRolesPersonAndCompany").where(personAndComConds).orderBy("groupName").queryList(); + ], EntityJoinOperator.AND) +personAndCompanyList = from("ScrumRolesPersonAndCompany").where(personAndComConds).orderBy("groupName").queryList() if (personAndCompanyList) { personAndCompanyList.each { personAndCompanyMap -> - partyId = personAndCompanyMap.partyId; + partyId = personAndCompanyMap.partyId securityGroupCond = EntityCondition.makeCondition([ EntityCondition.makeCondition ("partyId", EntityOperator.EQUALS, partyId), EntityCondition.makeCondition ("partyStatusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED") - ], EntityJoinOperator.AND); - securityGroupList = from("ScrumMemberUserLoginAndSecurityGroup").where(securityGroupCond).queryList(); + ], EntityJoinOperator.AND) + securityGroupList = from("ScrumMemberUserLoginAndSecurityGroup").where(securityGroupCond).queryList() if (securityGroupList) { - scrumRolesPersonAndCompanyList.add(personAndCompanyMap); + scrumRolesPersonAndCompanyList.add(personAndCompanyMap) } } } -context.scrumRolesPersonAndCompanyList = scrumRolesPersonAndCompanyList; +context.scrumRolesPersonAndCompanyList = scrumRolesPersonAndCompanyList Modified: ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListTimeSheets.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListTimeSheets.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListTimeSheets.groovy (original) +++ ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListTimeSheets.groovy Wed Nov 2 19:09:13 2016 @@ -17,58 +17,58 @@ * under the License. */ -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.entity.util.*; -import org.apache.ofbiz.entity.condition.*; -import org.apache.ofbiz.base.util.Debug; -import org.apache.ofbiz.base.util.UtilDateTime; +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.entity.util.* +import org.apache.ofbiz.entity.condition.* +import org.apache.ofbiz.base.util.Debug +import org.apache.ofbiz.base.util.UtilDateTime // get all timesheets of all user, including the planned hours -timesheets = []; -inputFields = [:]; +timesheets = [] +inputFields = [:] if (!parameters.noConditionFind) { parameters.noConditionFind = "N" } -inputFields.putAll(parameters); -performFindResults = runService('performFind', ["entityName": "Timesheet", "inputFields": inputFields, "orderBy": "fromDate DESC"]); +inputFields.putAll(parameters) +performFindResults = runService('performFind', ["entityName": "Timesheet", "inputFields": inputFields, "orderBy": "fromDate DESC"]) if (performFindResults.listSize > 0) { - timesheetsDb = performFindResults.listIt.getCompleteList(); - performFindResults.listIt.close(); + 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 = from("EmplLeave").where(leaveExprsList).cursorScrollInsensitive().distinct().queryIterator(); - leaveHours = 0.00; + //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 = from("EmplLeave").where(leaveExprsList).cursorScrollInsensitive().distinct().queryIterator() + leaveHours = 0.00 while ((emplLeaveMap = emplLeaveList.next())) { - emplLeaveEntry = emplLeaveMap; + emplLeaveEntry = emplLeaveMap resultHour = runService('getPartyLeaveHoursForDate', - ["userLogin": parameters.userLogin, "partyId": emplLeaveEntry.partyId, "leaveTypeId": emplLeaveEntry.leaveTypeId, "fromDate": emplLeaveEntry.fromDate]); + ["userLogin": parameters.userLogin, "partyId": emplLeaveEntry.partyId, "leaveTypeId": emplLeaveEntry.leaveTypeId, "fromDate": emplLeaveEntry.fromDate]) if (resultHour) { - leaveActualHours = resultHour.hours.doubleValue(); - leaveHours += leaveActualHours; + leaveActualHours = resultHour.hours.doubleValue() + leaveHours += leaveActualHours } } - //get hours from TimeEntry; - timesheet = [:]; - timesheet.putAll(timesheetDb); - entries = timesheetDb.getRelated("TimeEntry", null, null, false); - hours = 0.00; + //get hours from TimeEntry + timesheet = [:] + timesheet.putAll(timesheetDb) + entries = timesheetDb.getRelated("TimeEntry", null, null, false) + hours = 0.00 entries.each { timeEntry -> if (timeEntry.hours) { - hours += timeEntry.hours.doubleValue(); + hours += timeEntry.hours.doubleValue() } } - timesheet.weekNumber = UtilDateTime.weekNumber(timesheetDb.fromDate); - timesheet.hours = hours + leaveHours; - timesheets.add(timesheet); - emplLeaveList.close(); + timesheet.weekNumber = UtilDateTime.weekNumber(timesheetDb.fromDate) + timesheet.hours = hours + leaveHours + timesheets.add(timesheet) + emplLeaveList.close() } - context.timesheets = timesheets; + context.timesheets = timesheets } Modified: ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListUnplanBacklog.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListUnplanBacklog.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListUnplanBacklog.groovy (original) +++ ofbiz/trunk/specialpurpose/scrum/groovyScripts/ListUnplanBacklog.groovy Wed Nov 2 19:09:13 2016 @@ -17,32 +17,32 @@ * under the License. */ -import org.apache.ofbiz.entity.condition.*; -import org.apache.ofbiz.base.util.*; +import org.apache.ofbiz.entity.condition.* +import org.apache.ofbiz.base.util.* -taskStatusId = null; -paraBacklogStatusId = backlogStatusId; +taskStatusId = null +paraBacklogStatusId = backlogStatusId -orStsExprs = []; +orStsExprs = [] if (backlogStatusId != "Any") { - taskStatusId = "STS_CREATED"; - orStsExprs.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CRQ_REVIEWED")); + 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")); + orStsExprs.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CRQ_REVIEWED")) + orStsExprs.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CRQ_COMPLETED")) } -orCurentExprs = []; +orCurentExprs = [] if (taskStatusId) { - orCurentExprs.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.EQUALS, taskStatusId)); - orCurentExprs.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.EQUALS, null)); + orCurentExprs.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.EQUALS, taskStatusId)) + orCurentExprs.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.EQUALS, null)) } -andExprs = []; - 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 = from("UnPlannedBacklogsAndTasks").where(unplannedBacklogCond).orderBy("-custRequestId","workEffortTypeId","custSequenceNum").queryList(); +andExprs = [] + 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 = from("UnPlannedBacklogsAndTasks").where(unplannedBacklogCond).orderBy("-custRequestId","workEffortTypeId","custSequenceNum").queryList() -context.listIt = unplannedBacklogList; -context.paraBacklogStatusId = paraBacklogStatusId; +context.listIt = unplannedBacklogList +context.paraBacklogStatusId = paraBacklogStatusId Modified: ofbiz/trunk/specialpurpose/scrum/groovyScripts/ProductBilling.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/groovyScripts/ProductBilling.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/groovyScripts/ProductBilling.groovy (original) +++ ofbiz/trunk/specialpurpose/scrum/groovyScripts/ProductBilling.groovy Wed Nov 2 19:09:13 2016 @@ -18,76 +18,76 @@ * under the License. */ -import java.sql.Timestamp; -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.base.util.UtilDateTime; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.entity.condition.*; -import org.apache.ofbiz.entity.util.*; +import java.sql.Timestamp +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.base.util.UtilDateTime +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.entity.condition.* +import org.apache.ofbiz.entity.util.* -productId = parameters.productId; +productId = parameters.productId entryExprs = EntityCondition.makeCondition([ EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId), EntityCondition.makeCondition("invoiceId", EntityOperator.NOT_EQUAL, null), - ], EntityOperator.AND); + ], EntityOperator.AND) // check if latest invoice generated is still in process so allow re-generation to correct errors -entryIterator = from("ProjectSprintBacklogTaskAndTimeEntryTimeSheet").where(entryExprs).orderBy("-fromDate").queryIterator(); +entryIterator = from("ProjectSprintBacklogTaskAndTimeEntryTimeSheet").where(entryExprs).orderBy("-fromDate").queryIterator() while (entryItem = entryIterator.next()) { - invoice = entryItem.getRelatedOne("Invoice", false); + invoice = entryItem.getRelatedOne("Invoice", false) 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; + context.partyIdFrom = invoice.partyIdFrom + context.partyId = invoice.partyId + context.invoiceId = invoice.invoiceId + context.invoiceDate = invoice.invoiceDate + break } } -entryIterator.close(); +entryIterator.close() //start of this month -context.thruDate = UtilDateTime.getMonthStart(UtilDateTime.nowTimestamp()); +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")); +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; + fromDate = parameters.fromDate if (fromDate.length() < 14) { - fromDate = fromDate + " " + "00:00:00.000"; + fromDate = fromDate + " " + "00:00:00.000" } - taskConds.add(EntityCondition.makeCondition("fromDate", EntityOperator.GREATER_THAN_EQUAL_TO, Timestamp.valueOf(fromDate))); + taskConds.add(EntityCondition.makeCondition("fromDate", EntityOperator.GREATER_THAN_EQUAL_TO, Timestamp.valueOf(fromDate))) } if (parameters.thruDate) { - thruDate = parameters.thruDate; + thruDate = parameters.thruDate if (thruDate.length() < 14) { - thruDate = thruDate + " " + "00:00:00.000"; + thruDate = thruDate + " " + "00:00:00.000" } - taskConds.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, Timestamp.valueOf(thruDate))); + taskConds.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, Timestamp.valueOf(thruDate))) } else { - taskConds.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, context.thruDate)); + 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")); + taskConds.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.NOT_EQUAL, "RF_SCRUM_MEETINGS")) } // get sprint task list -def sprintTasks = from("ProjectSprintBacklogTaskAndTimeEntryTimeSheet").where(taskConds).queryList(); +def sprintTasks = from("ProjectSprintBacklogTaskAndTimeEntryTimeSheet").where(taskConds).queryList() // get cancelled backlog task list -def cancelledBacklogTasks = from("CancelledBacklogsTaskAndTimeEntryTimeSheet").where(taskConds).queryList(); +def cancelledBacklogTasks = from("CancelledBacklogsTaskAndTimeEntryTimeSheet").where(taskConds).queryList() // get unplanned task list -def unplannedTasks = from("UnPlannedBacklogsTaskAndTimeEntryTimeSheet").where(taskConds).queryList(); +def unplannedTasks = from("UnPlannedBacklogsTaskAndTimeEntryTimeSheet").where(taskConds).queryList() -def hoursNotYetBilledTasks = []; -hoursNotYetBilledTasks.addAll(sprintTasks); -hoursNotYetBilledTasks.addAll(cancelledBacklogTasks); -hoursNotYetBilledTasks.addAll(unplannedTasks); +def hoursNotYetBilledTasks = [] +hoursNotYetBilledTasks.addAll(sprintTasks) +hoursNotYetBilledTasks.addAll(cancelledBacklogTasks) +hoursNotYetBilledTasks.addAll(unplannedTasks) context.hoursNotYetBilledTasks = UtilMisc.sortMaps(hoursNotYetBilledTasks, ["productId","custRequestId","taskId","fromDate"]) // get time entry date timeEntryList = UtilMisc.sortMaps(hoursNotYetBilledTasks, ["fromDate"]) if (!parameters.fromDate && timeEntryList) { - context.resultDate = timeEntryList[0].fromDate; + context.resultDate = timeEntryList[0].fromDate } Modified: ofbiz/trunk/specialpurpose/scrum/groovyScripts/ProductEmail.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/groovyScripts/ProductEmail.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/groovyScripts/ProductEmail.groovy (original) +++ ofbiz/trunk/specialpurpose/scrum/groovyScripts/ProductEmail.groovy Wed Nov 2 19:09:13 2016 @@ -17,86 +17,86 @@ * under the License. */ -import java.util.*; -import java.lang.*; -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.base.util.Debug; -import org.apache.ofbiz.base.util.UtilValidate; -import org.apache.ofbiz.entity.util.*; +import java.util.* +import java.lang.* +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.base.util.Debug +import org.apache.ofbiz.base.util.UtilValidate +import org.apache.ofbiz.entity.util.* -productId = parameters.productId; -loginPartyId = userLogin.partyId; -communicationEventId = parameters.communicationEventId; -now = UtilDateTime.nowTimestamp(); +productId = parameters.productId +loginPartyId = userLogin.partyId +communicationEventId = parameters.communicationEventId +now = UtilDateTime.nowTimestamp() try{ if (UtilValidate.isNotEmpty(loginPartyId)) { if (UtilValidate.isNotEmpty(productId)) { - context.product = from("Product").where("productId", productId).queryOne(); + context.product = from("Product").where("productId", productId).queryOne() } - communicationEvent = from("CommunicationEvent").where("communicationEventId", communicationEventId).queryOne(); - communicationEvent.communicationEventTypeId = "EMAIL_COMMUNICATION"; - communicationEvent.contactMechTypeId = "EMAIL_ADDRESS"; - communicationEvent.datetimeStarted = now; - checkOwner = from("ProductRole").where("productId", productId,"partyId", loginPartyId,"roleTypeId", "PRODUCT_OWNER").queryList(); + communicationEvent = from("CommunicationEvent").where("communicationEventId", communicationEventId).queryOne() + communicationEvent.communicationEventTypeId = "EMAIL_COMMUNICATION" + communicationEvent.contactMechTypeId = "EMAIL_ADDRESS" + communicationEvent.datetimeStarted = now + checkOwner = from("ProductRole").where("productId", productId,"partyId", loginPartyId,"roleTypeId", "PRODUCT_OWNER").queryList() if (checkOwner) { /* for product owner to our company */ // for owner - productRole = from("ProductRole").where("productId", productId,"roleTypeId", "PRODUCT_OWNER").queryList(); + productRole = from("ProductRole").where("productId", productId,"roleTypeId", "PRODUCT_OWNER").queryList() context.productOwnerId = productRole[0].partyId - parentCom = from("CommunicationEvent").where("communicationEventId", communicationEventId).queryOne(); + parentCom = from("CommunicationEvent").where("communicationEventId", communicationEventId).queryOne() if (parentCom) { - context.partyIdFrom = productRole[0].partyId; + context.partyIdFrom = productRole[0].partyId } else { - context.partyIdFrom = parentCom.partyIdTo; + context.partyIdFrom = parentCom.partyIdTo } - resultsIdFrom = runService('getPartyEmail', ["partyId" : productRole[0].partyId, "userLogin" : userLogin]); + resultsIdFrom = runService('getPartyEmail', ["partyId" : productRole[0].partyId, "userLogin" : userLogin]) if (resultsIdFrom.contactMechId != null) { - context.contactMechIdFrom = resultsIdFrom.contactMechId; - communicationEvent.contactMechIdFrom = resultsIdFrom.contactMechId; + context.contactMechIdFrom = resultsIdFrom.contactMechId + communicationEvent.contactMechIdFrom = resultsIdFrom.contactMechId } // for team - defaultPartyIdTo = organizationPartyId; - resultsIdTo = runService('getPartyEmail', ["partyId" : defaultPartyIdTo,"contactMechPurposeTypeId" :"SUPPORT_EMAIL", "userLogin" : userLogin]); + defaultPartyIdTo = organizationPartyId + resultsIdTo = runService('getPartyEmail', ["partyId" : defaultPartyIdTo,"contactMechPurposeTypeId" :"SUPPORT_EMAIL", "userLogin" : userLogin]) if (resultsIdTo.contactMechId != null) { - context.contactMechIdTo = resultsIdTo.contactMechId; - communicationEvent.contactMechIdTo = resultsIdTo.contactMechId; + context.contactMechIdTo = resultsIdTo.contactMechId + communicationEvent.contactMechIdTo = resultsIdTo.contactMechId } - context.partyIdTo = defaultPartyIdTo; - communicationEvent.store(); - context.communicationEvent = communicationEvent; + context.partyIdTo = defaultPartyIdTo + communicationEvent.store() + context.communicationEvent = communicationEvent } else { /* from company to owner */ // for team - defaultPartyIdFrom = organizationPartyId; - context.partyIdFrom = defaultPartyIdFrom; - resultsIdFrom = runService('getPartyEmail', ["partyId" : defaultPartyIdFrom,"contactMechPurposeTypeId" :"SUPPORT_EMAIL", "userLogin" : userLogin]); + defaultPartyIdFrom = organizationPartyId + context.partyIdFrom = defaultPartyIdFrom + resultsIdFrom = runService('getPartyEmail', ["partyId" : defaultPartyIdFrom,"contactMechPurposeTypeId" :"SUPPORT_EMAIL", "userLogin" : userLogin]) if (resultsIdFrom.contactMechId != null) { - context.contactMechIdFrom = resultsIdFrom.contactMechId; - communicationEvent.contactMechIdFrom = resultsIdFrom.contactMechId; + context.contactMechIdFrom = resultsIdFrom.contactMechId + communicationEvent.contactMechIdFrom = resultsIdFrom.contactMechId } // for owner - productRole = from("ProductRole").where("productId", productId,"roleTypeId", "PRODUCT_OWNER").queryList(); - context.productOwnerId = productRole[0].partyId; - parentCom = from("CommunicationEvent").where("communicationEventId", communicationEventId).queryOne(); + productRole = from("ProductRole").where("productId", productId,"roleTypeId", "PRODUCT_OWNER").queryList() + context.productOwnerId = productRole[0].partyId + parentCom = from("CommunicationEvent").where("communicationEventId", communicationEventId).queryOne() if(parentCom){ - context.partyIdTo = productRole[0].partyId; + context.partyIdTo = productRole[0].partyId } else { - context.partyIdTo = parentCom.partyIdFrom; + context.partyIdTo = parentCom.partyIdFrom } - resultsIdTo = runService('getPartyEmail', ["partyId" : productRole[0].partyId, "userLogin" : userLogin]); + resultsIdTo = runService('getPartyEmail', ["partyId" : productRole[0].partyId, "userLogin" : userLogin]) if (resultsIdTo.contactMechId != null) { - context.contactMechIdTo = resultsIdTo.contactMechId; - communicationEvent.contactMechIdTo = resultsIdTo.contactMechId; + context.contactMechIdTo = resultsIdTo.contactMechId + communicationEvent.contactMechIdTo = resultsIdTo.contactMechId } - communicationEvent.store(); - context.communicationEvent = communicationEvent; + communicationEvent.store() + context.communicationEvent = communicationEvent } } } catch (exeption) { - Debug.logInfo("catch exeption ================" + exeption,""); + Debug.logInfo("catch exeption ================" + exeption,"") } catch (GenericEntityException e) { - Debug.logInfo("catch GenericEntityException ================" + e.getMessage(),""); + Debug.logInfo("catch GenericEntityException ================" + e.getMessage(),"") } Modified: ofbiz/trunk/specialpurpose/scrum/groovyScripts/QuickAddBacklog.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/groovyScripts/QuickAddBacklog.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/groovyScripts/QuickAddBacklog.groovy (original) +++ ofbiz/trunk/specialpurpose/scrum/groovyScripts/QuickAddBacklog.groovy Wed Nov 2 19:09:13 2016 @@ -17,77 +17,77 @@ * under the License. */ -import org.apache.ofbiz.base.util.Debug; +import org.apache.ofbiz.base.util.Debug try{ // for sprint dropdown - workEffortList = []; - sprintList = from("WorkEffort").where("workEffortTypeId", "SCRUM_SPRINT","currentStatusId", "SPRINT_ACTIVE").queryList(); + workEffortList = [] + sprintList = from("WorkEffort").where("workEffortTypeId", "SCRUM_SPRINT","currentStatusId", "SPRINT_ACTIVE").queryList() if (sprintList) { sprintList.each{ sprintMap -> - workEffortMap = [:]; - workEffortParentId = sprintMap.workEffortParentId; + workEffortMap = [:] + workEffortParentId = sprintMap.workEffortParentId if (workEffortParentId) { - projectList = from("WorkEffortAndProduct").where("workEffortId", workEffortParentId).queryList(); - projectMap = projectList[0]; + projectList = from("WorkEffortAndProduct").where("workEffortId", workEffortParentId).queryList() + projectMap = projectList[0] // make sure that project dose not closed if (projectMap.currentStatusId != "SPJ_CLOSED") { - productMap = from("Product").where("productId", projectMap.productId).queryOne(); - 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); + productMap = from("Product").where("productId", projectMap.productId).queryOne() + 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; + context.workEffortList = workEffortList } // for backlog category - productId = null; + productId = null if (parameters.productId) { - productId = parameters.productId; + productId = parameters.productId } else { if (parameters.keyId) { - indexList = parameters.keyId.tokenize(","); - productId = indexList[0].toString().trim(); + indexList = parameters.keyId.tokenize(",") + productId = indexList[0].toString().trim() } } - categoryList = []; + categoryList = [] if (productId) { - sprintList = from("CustRequestAndCustRequestItem").where("custRequestTypeId", "RF_PARENT_BACKLOG","productId", productId).queryList(); + sprintList = from("CustRequestAndCustRequestItem").where("custRequestTypeId", "RF_PARENT_BACKLOG","productId", productId).queryList() } else { - sprintList = from("CustRequestAndCustRequestItem").where("custRequestTypeId", "RF_PARENT_BACKLOG").queryList(); + sprintList = from("CustRequestAndCustRequestItem").where("custRequestTypeId", "RF_PARENT_BACKLOG").queryList() } if (sprintList) { sprintList.each{ categoryMap -> - inputMap = [:]; - productIdIn = categoryMap.productId; + inputMap = [:] + productIdIn = categoryMap.productId if (productIdIn) { - productMap = from("Product").where("productId", productIdIn).queryOne(); - inputMap.productId = productMap.productId; - inputMap.internalName = productMap.internalName; - inputMap.custRequestId = categoryMap.custRequestId; - inputMap.custRequestName = categoryMap.custRequestName; - categoryList.add(inputMap); + productMap = from("Product").where("productId", productIdIn).queryOne() + inputMap.productId = productMap.productId + inputMap.internalName = productMap.internalName + inputMap.custRequestId = categoryMap.custRequestId + inputMap.custRequestName = categoryMap.custRequestName + categoryList.add(inputMap) } } - context.categoryList = categoryList; + context.categoryList = categoryList } }catch(e){ - Debug.logInfo("catch e ================" + 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; + ansValue = input.toString().substring(0,Math.min(input.toString().length(),length)) + return ansValue } else { - return input; + return input } } |
Free forum by Nabble | Edit this page |