Package sk.iway.iwcm.editor.approve
Class ApproveService
java.lang.Object
sk.iway.iwcm.editor.approve.ApproveService
Sluzby spojene so schvalovanim web stranok
-
Constructor Summary
ConstructorsConstructorDescriptionApproveService(GroupsApproveRepository approveRepo, DocHistoryRepository docHistoryRepo, jakarta.servlet.http.HttpServletRequest request) -
Method Summary
Modifier and TypeMethodDescriptionbooleanapproveDocAction(DocHistoryRepository docHistoryRepo, DocDetailsRepository docDetailsRepository, EditorService editorService) Approve action, in other word's approve/reject webpage change (aka waiting docHistory).booleanapproveDocDelAction(DocHistoryRepository docHistoryRepo, DocDetailsRepository docDetailsRepo, EditorService editorService) Approve delete action of webpage, in other word's approve/reject delete change (aka waiting docHistory).approveGroupAction(GroupSchedulerDto dto, GroupSchedulerDtoRepository groupSchedulerDtoRepository, GroupsDB groupsDB) Approve or reject a pending folder edit change stored as a GroupSchedulerDto record.approveGroupDelAction(GroupSchedulerDto dto, GroupSchedulerDtoRepository groupSchedulerDtoRepository, GroupsDB groupsDB) Approve or reject a pending folder DELETE stored as a GroupSchedulerDto record (pendingDelete=true).booleancanApprove(int groupId) GROUP / FOLDER APPROVE LOGICgetApproverNotifBody(String msgKey) If approving is needed, return list of approvers.Vrati ciarkou oddeleny zoznam ID pouzivatelov, ktory schvaluju web strankustatic StringBuilderBuilds the document changes shown to approvers in notification emails.static StringBuildergetDiff(GroupDetails editedGroup, GroupDetails historyGroup, Prop prop, boolean addHeader, boolean addNewLines) static StringBuildergetDiffForEmail(GroupDetails editedGroup, GroupDetails historyGroup, Prop prop) getEmailsToNotify(String authorEmail) booleanbooleanvoidloadApproveTables(int currentGroupId) Initializes hash tables approveByTable and notifyTable (also set selfApproved)booleanReturn true, if webpage need's approve (approveByTable isn't empty).booleanbooleanvoidsendEmails(DocDetails editedDoc, int historyId, DocDetailsRepository docDetailsRepository) Odoslanie emailov o schvalovani alebo notifikacii o zmene (ak je zoznam schvalovani prazdny)voidsendGroupApproveDelRequestEmail(GroupSchedulerDto dto, long scheduleId) Sends an approval request email for a folder DELETE action.voidsendGroupApproveRequestEmail(GroupSchedulerDto dto, GroupDetails originalGroup, String comment) Sends an approval request email to the configured approvers for a folder change.voidsendWebpageApproveDelRequestEmail(DocBasic editedDoc, int historyId, int actualPublishedHistoryId) voidsendWebpageApproveRequestEmail(DocBasic editedDoc, int historyId, int senderUserId, String comment, DocDetailsRepository docDetailsRepository) Odosle email schvalovatelom web stranky s odkazom na schvalenie/zamietnutie stranky
-
Constructor Details
-
ApproveService
@Autowired public ApproveService(GroupsApproveRepository approveRepo, DocHistoryRepository docHistoryRepo, jakarta.servlet.http.HttpServletRequest request)
-
-
Method Details
-
isSelfApproved
public boolean isSelfApproved() -
isCanApproveFirstLevel
public boolean isCanApproveFirstLevel() -
loadApproveTables
public void loadApproveTables(int currentGroupId) Initializes hash tables approveByTable and notifyTable (also set selfApproved)- Parameters:
currentGroupId-
-
needApprove
public boolean needApprove()Return true, if webpage need's approve (approveByTable isn't empty).- Returns:
-
needApproveLevel2
public boolean needApproveLevel2() -
needNotification
public boolean needNotification()- Returns:
-
getApprovers
If approving is needed, return list of approvers. !! If action is selfApproved, there are no set approvers.- Returns:
-
getApproveUserIds
Vrati ciarkou oddeleny zoznam ID pouzivatelov, ktory schvaluju web stranku- Returns:
-
getApproveUserNames
-
getEmailsToNotify
-
getDiff
Builds the document changes shown to approvers in notification emails.- Parameters:
editedDoc- edited document whose changes are describedhistoryDoc- original document to compare with, ornullfor a new documentprop- localized message provider used for change labels- Returns:
- HTML-formatted description of the changed fields
-
approveDocAction
public boolean approveDocAction(DocHistoryRepository docHistoryRepo, DocDetailsRepository docDetailsRepository, EditorService editorService) Approve action, in other word's approve/reject webpage change (aka waiting docHistory). !! request param "zamietni" indicates, if we approve action (webpage will be change like in docHistory) or reject action (no change to webpage) After approve/reject, the waiting docHistory will be removed from waiting list (awaitingApprove param is set as empty string).- Parameters:
docHistoryRepo-editorService-- Returns:
- return true if approve was success
-
approveDocDelAction
public boolean approveDocDelAction(DocHistoryRepository docHistoryRepo, DocDetailsRepository docDetailsRepo, EditorService editorService) Approve delete action of webpage, in other word's approve/reject delete change (aka waiting docHistory). !! request param "zamietni" indicates, if we approve action (webpage gonna be deleted) or reject action (no change to webpage) After approve/reject, the waiting docHistory will be removed from waiting list (awaitingApprove param is set as empty string).- Parameters:
docHistoryRepo-docDetailsRepo-editorService-- Returns:
- retunr link to error or success page
-
sendEmails
public void sendEmails(DocDetails editedDoc, int historyId, DocDetailsRepository docDetailsRepository) Odoslanie emailov o schvalovani alebo notifikacii o zmene (ak je zoznam schvalovani prazdny)- Parameters:
editedDoc-historyId-
-
sendWebpageApproveRequestEmail
public void sendWebpageApproveRequestEmail(DocBasic editedDoc, int historyId, int senderUserId, String comment, DocDetailsRepository docDetailsRepository) Odosle email schvalovatelom web stranky s odkazom na schvalenie/zamietnutie stranky- Parameters:
editedDoc-historyId-senderUserId-comment-
-
sendWebpageApproveDelRequestEmail
public void sendWebpageApproveDelRequestEmail(DocBasic editedDoc, int historyId, int actualPublishedHistoryId) -
canApprove
public boolean canApprove(int groupId) GROUP / FOLDER APPROVE LOGIC -
approveGroupAction
public Pair<Boolean,String> approveGroupAction(GroupSchedulerDto dto, GroupSchedulerDtoRepository groupSchedulerDtoRepository, GroupsDB groupsDB) Approve or reject a pending folder edit change stored as a GroupSchedulerDto record. Request param "zamietni" presence indicates rejection (no change to folder), absence indicates approval (folder is updated).- Parameters:
groupSchedulerDtoRepository-groupsDB-- Returns:
- true if action was successful
-
approveGroupDelAction
public Pair<Boolean,String> approveGroupDelAction(GroupSchedulerDto dto, GroupSchedulerDtoRepository groupSchedulerDtoRepository, GroupsDB groupsDB) Approve or reject a pending folder DELETE stored as a GroupSchedulerDto record (pendingDelete=true). Request param "zamietni" presence = reject deletion, absence = approve deletion.- Parameters:
groupSchedulerDtoRepository-groupsDB-- Returns:
- true if action was successful
-
sendGroupApproveRequestEmail
public void sendGroupApproveRequestEmail(GroupSchedulerDto dto, GroupDetails originalGroup, String comment) Sends an approval request email to the configured approvers for a folder change.- Parameters:
dto- the pending GroupSchedulerDto recordoriginalGroup- original folder state, ornullfor a new foldercomment- optional comment to include
-
getDiffForEmail
public static StringBuilder getDiffForEmail(GroupDetails editedGroup, GroupDetails historyGroup, Prop prop) -
getDiff
public static StringBuilder getDiff(GroupDetails editedGroup, GroupDetails historyGroup, Prop prop, boolean addHeader, boolean addNewLines) -
sendGroupApproveDelRequestEmail
Sends an approval request email for a folder DELETE action.- Parameters:
dto- the pending GroupSchedulerDto record (pendingDelete=true)scheduleId- the schedule ID
-
getApproverNotifBody
-