diff --git a/backend/src/main/java/com/nttdata/calender/api/KalenderRestController.java b/backend/src/main/java/com/nttdata/calender/api/KalenderRestController.java index b056362..9a50692 100644 --- a/backend/src/main/java/com/nttdata/calender/api/KalenderRestController.java +++ b/backend/src/main/java/com/nttdata/calender/api/KalenderRestController.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.checkerframework.common.util.report.qual.ReportCall; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.CrossOrigin; diff --git a/backend/src/main/java/com/nttdata/calender/changes/Change.java b/backend/src/main/java/com/nttdata/calender/changes/Change.java index 307eb0a..71c0d0d 100644 --- a/backend/src/main/java/com/nttdata/calender/changes/Change.java +++ b/backend/src/main/java/com/nttdata/calender/changes/Change.java @@ -116,14 +116,22 @@ public class Change { .filter(peopleFullName::equals) .isPresent()); - var state = getValue(entry, "State").getIntValue(); - var inApproval = inApprovalList(api.getUser(), getValueStringByID(entry, "ChangeNr")); + // var state = getValue(entry, "State").getIntValue(); + // var inApproval = inApprovalList(api.getUser(), getValueStringByID(entry, + // "ChangeNr")); - change.setFlagPermit(flagPermit(state)); - change.setFlagApprove(flagApproval(inApproval, state)); - change.setFlagReject(flagApproval(inApproval, state)); - change.setFlagCancel(flagCancel(getValueStringByID(entry, "SupportGroupId"), state)); + // change.setFlagPermit(flagPermit(state)); + // change.setFlagApprove(flagApproval(inApproval, state)); + // change.setFlagReject(flagApproval(inApproval, state)); + // change.setFlagCancel(flagCancel(getValueStringByID(entry, "SupportGroupId"), + // state)); + try { + change.setPackageName( + queryPackageName(getValueStringByID(entry, "PackageType").toString())); + } catch (ARException e) { + e.printStackTrace(); + } changes.add(change); } @@ -157,74 +165,92 @@ public class Change { return peopleInfos.get(0).get(queryPerson.getFieldId("FullName")).toString(); } - /** - * Determines if the change item can be approved based on the approval status - * and the current state. - * - * @param approval The flag indicating whether the change item has been - * approved. - * @param state The current state of the change item. - * @return {@code true} if the change item can be approved, {@code false} - * otherwise. - */ - public boolean flagApproval(boolean approval, int state) { - boolean approvableState = (state == 1 || state == 10); - return approval && approvableState; - } + // /** + // * Determines if the change item can be approved based on the approval status + // * and the current state. + // * + // * @param approval The flag indicating whether the change item has been + // * approved. + // * @param state The current state of the change item. + // * @return {@code true} if the change item can be approved, {@code false} + // * otherwise. + // */ + // public boolean flagApproval(boolean approval, int state) { + // boolean approvableState = (state == 1 || state == 10); + // return approval && approvableState; + // } - /** - * Determines if the change item can be canceled based on the support group ID - * and the current state. - * - * @param supportGroupId The ID of the support group associated with the change - * item - * @param state The current state of the change item - * @return {@code true} if the change item can be canceled, {@code false} - * otherwise. - * @throws ARException if an error occurs during the operation - */ - public boolean flagCancel(String supportGroupId, int state) throws ARException { - var queryRoles = new Query.QueryBuilder("CTM:SupportGroupFuncRoleLookUp").addFieldId("Role", 1000000014) - .build(); - var role = api.queryFieldsById("\'Support Group ID\' = \"" + supportGroupId + "\"", - queryRoles.getFieldIds(), queryRoles.getFormName(), null, 0, 0) - .get(0).get(queryRoles.getFieldId("Role")).toString(); + // /** + // * Determines if the change item can be canceled based on the support group ID + // * and the current state. + // * + // * @param supportGroupId The ID of the support group associated with the + // change item + // * @param state The current state of the change item + // * @return {@code true} if the change item can be canceled, {@code false} + // otherwise. + // * @throws ARException if an error occurs during the operation + // */ + // public boolean flagCancel(String supportGroupId, int state) throws + // ARException { + // var queryRoles = new + // Query.QueryBuilder("CTM:SupportGroupFuncRoleLookUp").addFieldId("Role", + // 1000000014) + // .build(); + // var role = api.queryFieldsById("\'Support Group ID\' = \"" + supportGroupId + + // "\"", + // queryRoles.getFieldIds(), queryRoles.getFormName(), null, 0, 0) + // .get(0).get(queryRoles.getFieldId("Role")).toString(); - boolean approvableState = state == 1; - boolean isChangeManager = role.equals("Change Manager"); + // boolean approvableState = state == 1; + // boolean isChangeManager = role.equals("Change Manager"); - return approvableState && isChangeManager; - } + // return approvableState && isChangeManager; + // } - /** - * Determines if the change item has a permit based on the current state. - * - * @param state The current state of the change item. - * @return {@code true} if the change item has a permit, {@code false} - * otherwise. - */ - public boolean flagPermit(int state) { - return state == 0; - } + // /** + // * Determines if the change item has a permit based on the current state. + // * + // * @param state The current state of the change item. + // * @return {@code true} if the change item has a permit, {@code false} + // otherwise. + // */ + // public boolean flagPermit(int state) { + // return state == 0; + // } - /** - * Checks if the logged in user is in the approval list for the specified change - * item. - * - * @param user The username of the user to check - * @param changeNr The change number of the change item - * @return {@code true} if the user is in the approval list, {@code false} - * otherwise. - * @throws ARException if an error occurs during the operation - */ - public boolean inApprovalList(String user, String changeNr) throws ARException { - var queryApprovalList = new Query.QueryBuilder("ASF:OverviewConsole_TicketsJoinAPDetailSignature") - .addFieldId("Approvers", 13207).build(); - var approversOI = api.queryFieldsById("\'Ticketnumber\' = \"" + changeNr + "\"", - queryApprovalList.getFieldIds(), queryApprovalList.getFormName(), null, 0, 0); - var approvers = approversOI.isEmpty() ? null - : approversOI.get(0).get(queryApprovalList.getFieldId("Approvers")).toString(); - return approvers != null ? approvers.contains(user) : false; + // /** + // * Checks if the logged in user is in the approval list for the specified + // change item. + // * + // * @param user The username of the user to check + // * @param changeNr The change number of the change item + // * @return {@code true} if the user is in the approval list, {@code false} + // otherwise. + // * @throws ARException if an error occurs during the operation + // */ + // public boolean inApprovalList(String user, String changeNr) throws + // ARException { + // var queryApprovalList = new + // Query.QueryBuilder("ASF:OverviewConsole_TicketsJoinAPDetailSignature") + // .addFieldId("Approvers", 13207).build(); + // var approversOI = api.queryFieldsById("\'Ticketnumber\' = \"" + changeNr + + // "\"", + // queryApprovalList.getFieldIds(), queryApprovalList.getFormName(), null, 0, + // 0); + // var approvers = approversOI.isEmpty() ? null + // : + // approversOI.get(0).get(queryApprovalList.getFieldId("Approvers")).toString(); + // return approvers != null ? approvers.contains(user) : false; + // } + private String queryPackageName(String packageType) throws ARException { + var queryPackage = new Query.QueryBuilder("CTR:GenericContractJoinCFG_Package") + .addFieldId("PackageName", 200000020).build(); + var packageName = api + .queryFieldsById("\'InstanceId_Package\' = \"" + packageType + "\"", + queryPackage.getFieldIds(), queryPackage.getFormName(), null, 0, 0) + .get(0); + return packageName.get(queryPackage.getFieldId("PackageName")).toString(); } /** diff --git a/backend/src/main/java/com/nttdata/calender/changes/ChangeItem.java b/backend/src/main/java/com/nttdata/calender/changes/ChangeItem.java index 2c35558..d1b05d8 100644 --- a/backend/src/main/java/com/nttdata/calender/changes/ChangeItem.java +++ b/backend/src/main/java/com/nttdata/calender/changes/ChangeItem.java @@ -27,14 +27,15 @@ public class ChangeItem { private String changeImplementerPersonId; private boolean implementerEdit; private String packageType; + private String packageName; private Date D1; private Date D2; private Date D3; private Date D4; - private boolean flagPermit; - private boolean flagApprove; - private boolean flagReject; - private boolean flagCancel; + // private boolean flagPermit; + // private boolean flagApprove; + // private boolean flagReject; + // private boolean flagCancel; /** * @@ -160,84 +161,92 @@ public class ChangeItem { this.changeImplementerPersonId = changeImplementerPersonId; } - /** - * Retrieves the flag indicating whether the change item has a permit. - * - * @return {@code true} if the change item has a permit, {@code false} - * otherwise. - */ - public boolean getFlagPermit() { - return this.flagPermit; + // /** + // * Retrieves the flag indicating whether the change item has a permit. + // * + // * @return {@code true} if the change item has a permit, {@code false} + // * otherwise. + // */ + // public boolean getFlagPermit() { + // return this.flagPermit; + // } + + // /** + // * Sets the flag indicating whether the change item has a permit. + // * + // * @param flagPermit {@code true} if the change item has a permit, {@code false} + // * otherwise. + // */ + // public void setFlagPermit(boolean flagPermit) { + // this.flagPermit = flagPermit; + // } + + // /** + // * Retrieves the flag indicating whether the change item has been approved. + // * + // * @return {@code true} if the change item has been approved, {@code false} + // * otherwise. + // */ + // public boolean getFlagApprove() { + // return this.flagApprove; + // } + + // /** + // * Sets the flag indicating whether the change item has been approved. + // * + // * @param flagApprove {@code true} if the change item has been approved, + // * {@code false} otherwise. + // */ + // public void setFlagApprove(boolean flagApprove) { + // this.flagApprove = flagApprove; + // } + + // /** + // * Retrieves the flag indicating whether the change item has been rejected. + // * + // * @return {@code true} if the change item has been rejected, {@code false} + // * otherwise. + // */ + // public boolean getFlagReject() { + // return this.flagReject; + // } + + // /** + // * Sets the flag indicating whether the change item has been rejected. + // * + // * @param flagReject {@code true} if the change item has been rejected, + // * {@code false} otherwise. + // */ + // public void setFlagReject(boolean flagReject) { + // this.flagReject = flagReject; + // } + + // /** + // * Retrieves the flag indicating whether the change item has been canceled. + // * + // * @return {@code true} if the change item has been canceled, {@code false} + // * otherwise. + // */ + // public boolean getFlagCancel() { + // return this.flagCancel; + // } + + // /** + // * Sets the flag indicating whether the change item has been canceled. + // * + // * @param flagCancel {@code true} if the change item has been canceled, + // * {@code false} otherwise. + // */ + // public void setFlagCancel(boolean flagCancel) { + // this.flagCancel = flagCancel; + // } + + public String getPackageName() { + return this.packageName; } - /** - * Sets the flag indicating whether the change item has a permit. - * - * @param flagPermit {@code true} if the change item has a permit, {@code false} - * otherwise. - */ - public void setFlagPermit(boolean flagPermit) { - this.flagPermit = flagPermit; - } - - /** - * Retrieves the flag indicating whether the change item has been approved. - * - * @return {@code true} if the change item has been approved, {@code false} - * otherwise. - */ - public boolean getFlagApprove() { - return this.flagApprove; - } - - /** - * Sets the flag indicating whether the change item has been approved. - * - * @param flagApprove {@code true} if the change item has been approved, - * {@code false} otherwise. - */ - public void setFlagApprove(boolean flagApprove) { - this.flagApprove = flagApprove; - } - - /** - * Retrieves the flag indicating whether the change item has been rejected. - * - * @return {@code true} if the change item has been rejected, {@code false} - * otherwise. - */ - public boolean getFlagReject() { - return this.flagReject; - } - - /** - * Sets the flag indicating whether the change item has been rejected. - * - * @param flagReject {@code true} if the change item has been rejected, - * {@code false} otherwise. - */ - public void setFlagReject(boolean flagReject) { - this.flagReject = flagReject; - } - - /** - * Retrieves the flag indicating whether the change item has been canceled. - * - * @return {@code true} if the change item has been canceled, {@code false} - * otherwise. - */ - public boolean getFlagCancel() { - return this.flagCancel; - } - - /** - * Sets the flag indicating whether the change item has been canceled. - * - * @param flagCancel {@code true} if the change item has been canceled, - * {@code false} otherwise. - */ - public void setFlagCancel(boolean flagCancel) { - this.flagCancel = flagCancel; + public void setPackageName(String packageName) { + this.packageName = packageName; } /** diff --git a/backend/src/main/java/com/nttdata/calender/supportgroup/SupportGroup.java b/backend/src/main/java/com/nttdata/calender/supportgroup/SupportGroup.java index 757e488..9207a68 100644 --- a/backend/src/main/java/com/nttdata/calender/supportgroup/SupportGroup.java +++ b/backend/src/main/java/com/nttdata/calender/supportgroup/SupportGroup.java @@ -71,19 +71,22 @@ public class SupportGroup { * @throws ARException if an error occurs during the query */ public void queryUserSupportGroup(RemedyJavaAPI api) throws ARException { - var querySupportGroups = new Query.QueryBuilder("CTM:Support Group Association") - .addFieldId("SupportGroup", 1000000017) - .addFieldId("SupportGroupId", 1000000079) - .build(); - api.impersonateUser("ext_StanzPa"); - var supportGroupUser = api.queryFieldsById("\'Login ID\' = \"" + api.getUser() + "\"", - querySupportGroups.getFieldIds(), querySupportGroups.getFormName(), null, 0, 0); - var result = supportGroupUser.isEmpty() ? null : supportGroupUser.get(0); - if (result != null) { - String supportGroupName = result.get(querySupportGroups.getFieldId("SupportGroup")).toString(); - String supportGroupId = result.get(querySupportGroups.getFieldId("SupportGroupId")).toString(); + var querySupportGroups = new Query.QueryBuilder("CTM:Support Group Association") + .addFieldId("SupportGroupId", 1000000079).build(); + var supportGroupIdOfUser = api.queryFieldsById("\'Login ID\' = \"" + api.getUser() + "\"", + querySupportGroups.getFieldIds(), querySupportGroups.getFormName(), null, 0, 0); + var id = supportGroupIdOfUser.isEmpty() ? null : supportGroupIdOfUser.get(0); + + if (id != null) { + var supportGroupId = id.get(querySupportGroups.getFieldId("SupportGroupId")).toString(); + var querySupportGroupName = new Query.QueryBuilder(formName).addFieldId("SupportGroupName", 1000000015) + .build(); + var supportGroupNameOfUser = api.queryFieldsById("\'Support Group ID\' = \"" + supportGroupId + "\"", + querySupportGroupName.getFieldIds(), querySupportGroupName.getFormName(), null, 0, 0); + var supportGroupName = supportGroupNameOfUser.get(0) + .get(querySupportGroupName.getFieldId("SupportGroupName")).toString(); this.userSupportGroup = new SupportGroupGetResponse(supportGroupName, supportGroupId); } } diff --git a/frontend/src/app/data.service.ts b/frontend/src/app/data.service.ts index 1df4796..1c52c3c 100644 --- a/frontend/src/app/data.service.ts +++ b/frontend/src/app/data.service.ts @@ -275,12 +275,29 @@ export class DataService { ); } - res.push({resourceId: resp.resourceId, approvalStatus: this.validateApproval(resp.approvalStatus), statusReason: resp.statusReason, - changeNr: resp.changeNr, resourceName: resp.resourceName, - vertrag: resp.contract, vertragName: this.getContractName(resp.contract), isExpand: false, - isRes: true, state: resp.state, stateName: this.getStateNameById(resp.state), - supportGroup: resp.supportGroup, tasks: tasks, supportGroupId: resp.supportGroupId, - implementerEdit: resp.implementerEdit, flagApprove: resp.flagApprove, flagCancel: resp.flagChancel, flagPermit: resp.flagPermit, flagReject: resp.flagReject + res.push({ + resourceId: resp.resourceId, + approvalStatus: this.validateApproval(resp.approvalStatus), + statusReason: resp.statusReason, + changeNr: resp.changeNr, + resourceName: resp.resourceName, + vertrag: resp.contract, + vertragName: this.getContractName(resp.contract), + isExpand: false, + isRes: true, + state: resp.state, + stateName: this.getStateNameById(resp.state), + supportGroup: resp.supportGroup, + tasks: tasks, + supportGroupId: resp.supportGroupId, + implementerEdit: resp.implementerEdit, + flagApprove: resp.flagApprove, + flagCancel: resp.flagChancel, + flagPermit: resp.flagPermit, + flagReject: resp.flagReject, + changeImplementerLogin: resp.changeImplementerLogin, + packageName: resp.packageName, + coordinatorSg: resp.coordinatorSg }); diff --git a/frontend/src/ntt-gantt/ntt-gantt.component.html b/frontend/src/ntt-gantt/ntt-gantt.component.html index 616003c..34ca64a 100644 --- a/frontend/src/ntt-gantt/ntt-gantt.component.html +++ b/frontend/src/ntt-gantt/ntt-gantt.component.html @@ -115,16 +115,19 @@