flags auskommentiert
parent
42a3e1f430
commit
b126681f37
|
|
@ -142,13 +142,13 @@ public class Change {
|
||||||
.filter(peopleFullName::equals)
|
.filter(peopleFullName::equals)
|
||||||
.isPresent());
|
.isPresent());
|
||||||
|
|
||||||
var state = getValue(entry, "State").getIntValue();
|
// var state = getValue(entry, "State").getIntValue();
|
||||||
var inApproval = inApprovalList(api.getUser(), getValueStringByID(entry, "ChangeNr"));
|
// var inApproval = inApprovalList(api.getUser(), getValueStringByID(entry, "ChangeNr"));
|
||||||
|
|
||||||
change.setFlagPermit(flagPermit(state));
|
// change.setFlagPermit(flagPermit(state));
|
||||||
change.setFlagApprove(flagApproval(inApproval, state));
|
// change.setFlagApprove(flagApproval(inApproval, state));
|
||||||
change.setFlagReject(flagApproval(inApproval, state));
|
// change.setFlagReject(flagApproval(inApproval, state));
|
||||||
change.setFlagCancel(flagCancel(getValueStringByID(entry, "SupportGroupId"), state));
|
// change.setFlagCancel(flagCancel(getValueStringByID(entry, "SupportGroupId"), state));
|
||||||
|
|
||||||
changes.add(change);
|
changes.add(change);
|
||||||
}
|
}
|
||||||
|
|
@ -157,70 +157,70 @@ public class Change {
|
||||||
return new ChangeResponse(entriesSize, changes);
|
return new ChangeResponse(entriesSize, changes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Determines if the change item can be approved based on the approval status
|
// * Determines if the change item can be approved based on the approval status
|
||||||
* and the current state.
|
// * and the current state.
|
||||||
*
|
// *
|
||||||
* @param approval The flag indicating whether the change item has been
|
// * @param approval The flag indicating whether the change item has been
|
||||||
* approved.
|
// * approved.
|
||||||
* @param state The current state of the change item.
|
// * @param state The current state of the change item.
|
||||||
* @return {@code true} if the change item can be approved, {@code false}
|
// * @return {@code true} if the change item can be approved, {@code false}
|
||||||
* otherwise.
|
// * otherwise.
|
||||||
*/
|
// */
|
||||||
public boolean flagApproval(boolean approval, int state) {
|
// public boolean flagApproval(boolean approval, int state) {
|
||||||
boolean approvableState = (state == 1 || state == 10);
|
// boolean approvableState = (state == 1 || state == 10);
|
||||||
return approval && approvableState;
|
// return approval && approvableState;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Determines if the change item can be canceled based on the support group ID
|
// * Determines if the change item can be canceled based on the support group ID
|
||||||
* and the current state.
|
// * and the current state.
|
||||||
*
|
// *
|
||||||
* @param supportGroupId The ID of the support group associated with the change item
|
// * @param supportGroupId The ID of the support group associated with the change item
|
||||||
* @param state The current state of 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.
|
// * @return {@code true} if the change item can be canceled, {@code false} otherwise.
|
||||||
* @throws ARException if an error occurs during the operation
|
// * @throws ARException if an error occurs during the operation
|
||||||
*/
|
// */
|
||||||
public boolean flagCancel(String supportGroupId, int state) throws ARException {
|
// public boolean flagCancel(String supportGroupId, int state) throws ARException {
|
||||||
var queryRoles = new Query.QueryBuilder("CTM:SupportGroupFuncRoleLookUp").addFieldId("Role", 1000000014)
|
// var queryRoles = new Query.QueryBuilder("CTM:SupportGroupFuncRoleLookUp").addFieldId("Role", 1000000014)
|
||||||
.build();
|
// .build();
|
||||||
var role = api.queryFieldsById("\'Support Group ID\' = \"" + supportGroupId + "\"",
|
// var role = api.queryFieldsById("\'Support Group ID\' = \"" + supportGroupId + "\"",
|
||||||
queryRoles.getFieldIds(), queryRoles.getFormName(), null, 0, 0)
|
// queryRoles.getFieldIds(), queryRoles.getFormName(), null, 0, 0)
|
||||||
.get(0).get(queryRoles.getFieldId("Role")).toString();
|
// .get(0).get(queryRoles.getFieldId("Role")).toString();
|
||||||
|
|
||||||
boolean approvableState = state == 1;
|
// boolean approvableState = state == 1;
|
||||||
boolean isChangeManager = role.equals("Change Manager");
|
// 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.
|
// * Determines if the change item has a permit based on the current state.
|
||||||
*
|
// *
|
||||||
* @param state The current state of the change item.
|
// * @param state The current state of the change item.
|
||||||
* @return {@code true} if the change item has a permit, {@code false} otherwise.
|
// * @return {@code true} if the change item has a permit, {@code false} otherwise.
|
||||||
*/
|
// */
|
||||||
public boolean flagPermit(int state) {
|
// public boolean flagPermit(int state) {
|
||||||
return state == 0;
|
// return state == 0;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Checks if the logged in user is in the approval list for the specified change item.
|
// * 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 user The username of the user to check
|
||||||
* @param changeNr The change number of the change item
|
// * @param changeNr The change number of the change item
|
||||||
* @return {@code true} if the user is in the approval list, {@code false} otherwise.
|
// * @return {@code true} if the user is in the approval list, {@code false} otherwise.
|
||||||
* @throws ARException if an error occurs during the operation
|
// * @throws ARException if an error occurs during the operation
|
||||||
*/
|
// */
|
||||||
public boolean inApprovalList(String user, String changeNr) throws ARException {
|
// public boolean inApprovalList(String user, String changeNr) throws ARException {
|
||||||
var queryApprovalList = new Query.QueryBuilder("ASF:OverviewConsole_TicketsJoinAPDetailSignature")
|
// var queryApprovalList = new Query.QueryBuilder("ASF:OverviewConsole_TicketsJoinAPDetailSignature")
|
||||||
.addFieldId("Approvers", 13207).build();
|
// .addFieldId("Approvers", 13207).build();
|
||||||
var approversOI = api.queryFieldsById("\'Ticketnumber\' = \"" + changeNr + "\"",
|
// var approversOI = api.queryFieldsById("\'Ticketnumber\' = \"" + changeNr + "\"",
|
||||||
queryApprovalList.getFieldIds(), queryApprovalList.getFormName(), null, 0, 0);
|
// queryApprovalList.getFieldIds(), queryApprovalList.getFormName(), null, 0, 0);
|
||||||
var approvers = approversOI.isEmpty() ? null
|
// var approvers = approversOI.isEmpty() ? null
|
||||||
: approversOI.get(0).get(queryApprovalList.getFieldId("Approvers")).toString();
|
// : approversOI.get(0).get(queryApprovalList.getFieldId("Approvers")).toString();
|
||||||
return approvers != null ? approvers.contains(user) : false;
|
// return approvers != null ? approvers.contains(user) : false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link Value} of an entry based on the provided description.
|
* Returns the {@link Value} of an entry based on the provided description.
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,10 @@ public class ChangeItem {
|
||||||
private Date D2;
|
private Date D2;
|
||||||
private Date D3;
|
private Date D3;
|
||||||
private Date D4;
|
private Date D4;
|
||||||
private boolean flagPermit;
|
// private boolean flagPermit;
|
||||||
private boolean flagApprove;
|
// private boolean flagApprove;
|
||||||
private boolean flagReject;
|
// private boolean flagReject;
|
||||||
private boolean flagCancel;
|
// private boolean flagCancel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -160,85 +160,85 @@ public class ChangeItem {
|
||||||
this.changeImplementerPersonId = changeImplementerPersonId;
|
this.changeImplementerPersonId = changeImplementerPersonId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Retrieves the flag indicating whether the change item has a permit.
|
// * Retrieves the flag indicating whether the change item has a permit.
|
||||||
*
|
// *
|
||||||
* @return {@code true} if the change item has a permit, {@code false}
|
// * @return {@code true} if the change item has a permit, {@code false}
|
||||||
* otherwise.
|
// * otherwise.
|
||||||
*/
|
// */
|
||||||
public boolean getFlagPermit() {
|
// public boolean getFlagPermit() {
|
||||||
return this.flagPermit;
|
// return this.flagPermit;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Sets the flag indicating whether the change item has a permit.
|
// * Sets the flag indicating whether the change item has a permit.
|
||||||
*
|
// *
|
||||||
* @param flagPermit {@code true} if the change item has a permit, {@code false}
|
// * @param flagPermit {@code true} if the change item has a permit, {@code false}
|
||||||
* otherwise.
|
// * otherwise.
|
||||||
*/
|
// */
|
||||||
public void setFlagPermit(boolean flagPermit) {
|
// public void setFlagPermit(boolean flagPermit) {
|
||||||
this.flagPermit = flagPermit;
|
// this.flagPermit = flagPermit;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Retrieves the flag indicating whether the change item has been approved.
|
// * Retrieves the flag indicating whether the change item has been approved.
|
||||||
*
|
// *
|
||||||
* @return {@code true} if the change item has been approved, {@code false}
|
// * @return {@code true} if the change item has been approved, {@code false}
|
||||||
* otherwise.
|
// * otherwise.
|
||||||
*/
|
// */
|
||||||
public boolean getFlagApprove() {
|
// public boolean getFlagApprove() {
|
||||||
return this.flagApprove;
|
// return this.flagApprove;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Sets the flag indicating whether the change item has been approved.
|
// * Sets the flag indicating whether the change item has been approved.
|
||||||
*
|
// *
|
||||||
* @param flagApprove {@code true} if the change item has been approved,
|
// * @param flagApprove {@code true} if the change item has been approved,
|
||||||
* {@code false} otherwise.
|
// * {@code false} otherwise.
|
||||||
*/
|
// */
|
||||||
public void setFlagApprove(boolean flagApprove) {
|
// public void setFlagApprove(boolean flagApprove) {
|
||||||
this.flagApprove = flagApprove;
|
// this.flagApprove = flagApprove;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Retrieves the flag indicating whether the change item has been rejected.
|
// * Retrieves the flag indicating whether the change item has been rejected.
|
||||||
*
|
// *
|
||||||
* @return {@code true} if the change item has been rejected, {@code false}
|
// * @return {@code true} if the change item has been rejected, {@code false}
|
||||||
* otherwise.
|
// * otherwise.
|
||||||
*/
|
// */
|
||||||
public boolean getFlagReject() {
|
// public boolean getFlagReject() {
|
||||||
return this.flagReject;
|
// return this.flagReject;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Sets the flag indicating whether the change item has been rejected.
|
// * Sets the flag indicating whether the change item has been rejected.
|
||||||
*
|
// *
|
||||||
* @param flagReject {@code true} if the change item has been rejected,
|
// * @param flagReject {@code true} if the change item has been rejected,
|
||||||
* {@code false} otherwise.
|
// * {@code false} otherwise.
|
||||||
*/
|
// */
|
||||||
public void setFlagReject(boolean flagReject) {
|
// public void setFlagReject(boolean flagReject) {
|
||||||
this.flagReject = flagReject;
|
// this.flagReject = flagReject;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Retrieves the flag indicating whether the change item has been canceled.
|
// * Retrieves the flag indicating whether the change item has been canceled.
|
||||||
*
|
// *
|
||||||
* @return {@code true} if the change item has been canceled, {@code false}
|
// * @return {@code true} if the change item has been canceled, {@code false}
|
||||||
* otherwise.
|
// * otherwise.
|
||||||
*/
|
// */
|
||||||
public boolean getFlagCancel() {
|
// public boolean getFlagCancel() {
|
||||||
return this.flagCancel;
|
// return this.flagCancel;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Sets the flag indicating whether the change item has been canceled.
|
// * Sets the flag indicating whether the change item has been canceled.
|
||||||
*
|
// *
|
||||||
* @param flagCancel {@code true} if the change item has been canceled,
|
// * @param flagCancel {@code true} if the change item has been canceled,
|
||||||
* {@code false} otherwise.
|
// * {@code false} otherwise.
|
||||||
*/
|
// */
|
||||||
public void setFlagCancel(boolean flagCancel) {
|
// public void setFlagCancel(boolean flagCancel) {
|
||||||
this.flagCancel = flagCancel;
|
// this.flagCancel = flagCancel;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the status reason of the change item.
|
* Gets the status reason of the change item.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue