/** * Set a specific step and page as reached. * It will also "set back" where a user has reached. * * @param context The current DSpace content * @param id The unique ID of the current workflow/workspace * @param step the step to set as reached, can be also a previous reached step * @param page the page (within the step) to set as reached, can be also a previous reached page */ public static void setBackPageReached(Context context, String id, int step, int page) throws SQLException, AuthorizeException, IOException { InProgressSubmission submission = findSubmission(context, id); if (submission instanceof WorkspaceItem) { WorkspaceItem workspaceItem = (WorkspaceItem) submission; workspaceItem.setStageReached(step); workspaceItem.setPageReached(page > 0 ? page : 1); workspaceItem.update(); context.commit(); } }
/** * Set a specific step and page as reached. * It will also "set back" where a user has reached. * * @param subInfo * the SubmissionInfo object pertaining to the current submission * @param step the step to set as reached, can be also a previous reached step * @param page the page (within the step) to set as reached, can be also a previous reached page */ private void setReachedStepAndPage(SubmissionInfo subInfo, int step, int page) throws SQLException, AuthorizeException, IOException { if (!subInfo.isInWorkflow() && subInfo.getSubmissionItem() != null) { WorkspaceItem wi = (WorkspaceItem) subInfo.getSubmissionItem(); wi.setStageReached(step); wi.setPageReached(page); wi.update(); } }
/** * Sets the number of the page reached for the specified step * * @param session * HTTP session (where page reached is stored) * @param step * the current Submission Process Step (which we want to * increment the page reached) * @param pageNumber * new page reached */ private void updatePageReached(SubmissionInfo subInfo, int page) throws SQLException, AuthorizeException, IOException { if (!subInfo.isInWorkflow() && subInfo.getSubmissionItem() != null) { WorkspaceItem wi = (WorkspaceItem) subInfo.getSubmissionItem(); if (page > wi.getPageReached()) { wi.setPageReached(page); wi.update(); } } }
/** * Indicate the user has advanced to the given stage. This will only * actually do anything when it's a user initially entering a submission. It * will only increase the "stage reached" column - it will not "set back" * where a user has reached. Whenever the "stage reached" column is * increased, the "page reached" column is reset to 1, since you've now * reached page #1 of the next stage. * * @param subInfo * the SubmissionInfo object pertaining to the current submission * @param step * the step the user has just reached */ private void userHasReached(SubmissionInfo subInfo, int step) throws SQLException, AuthorizeException, IOException { if (!subInfo.isInWorkflow() && subInfo.getSubmissionItem() != null) { WorkspaceItem wi = (WorkspaceItem) subInfo.getSubmissionItem(); if (step > wi.getStageReached()) { wi.setStageReached(step); wi.setPageReached(1); // reset page reached back to 1 (since // it's page 1 of the new step) wi.update(); } } }
wsi.setStageReached(lastStep); wsi.setPageReached(AbstractProcessingStep.LAST_PAGE_REACHED); wsi.update();
wi.update(); context.commit();
wsi.setStageReached(lastStep); wsi.setPageReached(AbstractProcessingStep.LAST_PAGE_REACHED); wsi.update();