added comments/documentation
parent
4170699f53
commit
6746f0fa0e
|
|
@ -157,28 +157,61 @@ public class Change {
|
||||||
return new ChangeResponse(entriesSize, changes);
|
return new ChangeResponse(entriesSize, changes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean flagApproval(boolean approval, int status) {
|
/**
|
||||||
boolean approvableStatus = (status == 1 || status == 10);
|
* Determines if the change item can be approved based on the approval status
|
||||||
return approval && approvableStatus;
|
* 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean flagCancel(String supportGroupId, int status) throws ARException {
|
/**
|
||||||
|
* 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)
|
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 approvableStatus = status == 1;
|
boolean approvableState = state == 1;
|
||||||
boolean isChangeManager = role.equals("Change Manager");
|
boolean isChangeManager = role.equals("Change Manager");
|
||||||
|
|
||||||
return approvableStatus && isChangeManager;
|
return approvableState && isChangeManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean flagPermit(int status) {
|
/**
|
||||||
return status == 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 {
|
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();
|
||||||
|
|
@ -193,8 +226,7 @@ public class Change {
|
||||||
* Returns the {@link Value} of an entry based on the provided description.
|
* Returns the {@link Value} of an entry based on the provided description.
|
||||||
*
|
*
|
||||||
* @param entry the {@link Entry} from which a value will be retrieved
|
* @param entry the {@link Entry} from which a value will be retrieved
|
||||||
* @param description the name of the field from which the value should be
|
* @param description the name of the field from which the value should be retrieved
|
||||||
* retrieved
|
|
||||||
* @return the value of the entry
|
* @return the value of the entry
|
||||||
*/
|
*/
|
||||||
private Value getValue(Entry entry, String description) {
|
private Value getValue(Entry entry, String description) {
|
||||||
|
|
@ -206,8 +238,7 @@ public class Change {
|
||||||
* timestamp is null.
|
* timestamp is null.
|
||||||
*
|
*
|
||||||
* @param entry the {@link Entry} containing the timestamp value
|
* @param entry the {@link Entry} containing the timestamp value
|
||||||
* @param description the description of the field containing the timestamp
|
* @param description the description of the field containing the timestamp value
|
||||||
* value
|
|
||||||
* @return the converted {@link Date} or null if the timestamp is null
|
* @return the converted {@link Date} or null if the timestamp is null
|
||||||
*/
|
*/
|
||||||
private Date timestampToDateById(Entry entry, String description) {
|
private Date timestampToDateById(Entry entry, String description) {
|
||||||
|
|
|
||||||
|
|
@ -160,40 +160,87 @@ public class ChangeItem {
|
||||||
this.changeImplementerPersonId = changeImplementerPersonId;
|
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() {
|
public boolean getFlagPermit() {
|
||||||
return this.flagPermit;
|
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) {
|
public void setFlagPermit(boolean flagPermit) {
|
||||||
this.flagPermit = 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() {
|
public boolean getFlagApprove() {
|
||||||
return this.flagApprove;
|
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) {
|
public void setFlagApprove(boolean flagApprove) {
|
||||||
this.flagApprove = 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() {
|
public boolean getFlagReject() {
|
||||||
return this.flagReject;
|
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) {
|
public void setFlagReject(boolean flagReject) {
|
||||||
this.flagReject = 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() {
|
public boolean getFlagCancel() {
|
||||||
return this.flagCancel;
|
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) {
|
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.
|
||||||
*
|
*
|
||||||
* @return String that represents the status reason of the change item.
|
* @return String that represents the status reason of the change item.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue