flags auskommentiert
parent
42a3e1f430
commit
b126681f37
|
|
@ -142,13 +142,13 @@ 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));
|
||||
|
||||
changes.add(change);
|
||||
}
|
||||
|
|
@ -157,70 +157,70 @@ public class Change {
|
|||
return new ChangeResponse(entriesSize, changes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Returns the {@link Value} of an entry based on the provided description.
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@ public class ChangeItem {
|
|||
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,85 +160,85 @@ 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;
|
||||
}
|
||||
// /**
|
||||
// * 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;
|
||||
}
|
||||
// /**
|
||||
// * 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;
|
||||
}
|
||||
// /**
|
||||
// * 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;
|
||||
}
|
||||
// /**
|
||||
// * 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;
|
||||
}
|
||||
// /**
|
||||
// * 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;
|
||||
}
|
||||
// /**
|
||||
// * 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;
|
||||
}
|
||||
// /**
|
||||
// * 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;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Gets the status reason of the change item.
|
||||
|
|
|
|||
Loading…
Reference in New Issue