Class ApproveService

java.lang.Object
sk.iway.iwcm.editor.approve.ApproveService

@Service @RequestScope public class ApproveService extends Object
Sluzby spojene so schvalovanim web stranok
  • Constructor Details

  • 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

      public List<UserDetails> getApprovers()
      If approving is needed, return list of approvers. !! If action is selfApproved, there are no set approvers.
      Returns:
    • getApproveUserIds

      public String getApproveUserIds()
      Vrati ciarkou oddeleny zoznam ID pouzivatelov, ktory schvaluju web stranku
      Returns:
    • getApproveUserNames

      public String getApproveUserNames()
    • getEmailsToNotify

      public String getEmailsToNotify(String authorEmail)
    • getDiff

      public static StringBuilder getDiff(DocBasic editedDoc, DocBasic historyDoc, Prop prop)
      Builds the document changes shown to approvers in notification emails.
      Parameters:
      editedDoc - edited document whose changes are described
      historyDoc - original document to compare with, or null for a new document
      prop - 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 record
      originalGroup - original folder state, or null for a new folder
      comment - 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

      public void sendGroupApproveDelRequestEmail(GroupSchedulerDto dto, long scheduleId)
      Sends an approval request email for a folder DELETE action.
      Parameters:
      dto - the pending GroupSchedulerDto record (pendingDelete=true)
      scheduleId - the schedule ID
    • getApproverNotifBody

      public String getApproverNotifBody(String msgKey)