Package org.dspace.app.util

Examples of org.dspace.app.util.SubmissionStepConfig


    private void doStep(Context context, HttpServletRequest request,
            HttpServletResponse response, SubmissionInfo subInfo, int stepNumber)
            throws ServletException, IOException, SQLException,
            AuthorizeException
    {
      SubmissionStepConfig currentStepConfig = null;
     
        if (subInfo.getSubmissionConfig() != null)
        {
            // get step to perform
            currentStepConfig = subInfo.getSubmissionConfig().getStep(stepNumber);
        }
        else
        {
            log.fatal(LogManager.getHeader(context, "no_submission_process",
                    "trying to load step=" + stepNumber
                            + ", but submission process is null"));

            JSPManager.showInternalError(request, response);
        }

        // if this is the furthest step the user has been to, save that info
        if (!subInfo.isInWorkflow() && (currentStepConfig.getStepNumber() > getStepReached(subInfo)))
        {
            // update submission info
            userHasReached(subInfo, currentStepConfig.getStepNumber());
            // commit changes to database
            context.commit();
           
            // flag that we just started this step (for JSPStepManager class)
            setBeginningOfStep(request, true);
        }
      
        // save current step to request attribute
        saveCurrentStepConfig(request, currentStepConfig);

        log.debug("Calling Step Class: '"
                + currentStepConfig.getProcessingClassName() + "'");

        try
        {
           
            JSPStepManager stepManager = JSPStepManager.loadStep(currentStepConfig);
          
            //tell the step class to do its processing
            boolean stepFinished = stepManager.processStep(context, request, response, subInfo);
           
            //if this step is finished, continue to next step
            if(stepFinished)
            {
                // If we finished up an upload, then we need to change
                // the FileUploadRequest object back to a normal HTTPServletRequest
                if(request instanceof FileUploadRequest)
                {
                    request = ((FileUploadRequest)request).getOriginalRequest();
                }
               
                //retrieve any changes to the SubmissionInfo object
                subInfo = getSubmissionInfo(context, request);
               
                //do the next step!
                doNextStep(context, request, response, subInfo, currentStepConfig);
            }
            else
            {
                //commit & close context
                context.complete();
            }
        }
        catch (Exception e)
        {
            log.error("Error loading step class'" + currentStepConfig.getProcessingClassName() + "':", e);
            JSPManager.showInternalError(request, response);
        }

    }
View Full Code Here


     */
    public static SubmissionStepConfig getCurrentStepConfig(
            HttpServletRequest request, SubmissionInfo si)
    {
        int stepNum = -1;
        SubmissionStepConfig step = (SubmissionStepConfig) request
                .getAttribute("step");

        if (step == null)
        {
            // try and get it as a parameter
View Full Code Here

     * @return whether or not the current step is the first step
     */
    public static boolean isFirstStep(HttpServletRequest request,
            SubmissionInfo si)
    {
        SubmissionStepConfig step = getCurrentStepConfig(request, si);

        return ((step != null) && (getPreviousVisibleStep(request, si) == null));
    }
View Full Code Here

     * @return the previous step in the item submission process if any
     */
    public static SubmissionStepConfig getPreviousVisibleStep(HttpServletRequest request,
            SubmissionInfo si)
    {
        SubmissionStepConfig step = getCurrentStepConfig(request, si);

        SubmissionStepConfig currentStepConfig, previousStep = null;

        int currentStepNum = step.getStepNumber();
       
        //need to find a previous step that is VISIBLE to the user!
        while(currentStepNum>FIRST_STEP)
        {
            // update the current step & do this previous step
            currentStepNum--;
       
            //get previous step
            currentStepConfig = si.getSubmissionConfig().getStep(currentStepNum);
       
            if(currentStepConfig.isVisible())
            {
                previousStep = currentStepConfig;
                break;
            }
        }
View Full Code Here

    public static String getSubmissionParameters(Context context,
            HttpServletRequest request) throws SQLException, ServletException
    {
        SubmissionInfo si = getSubmissionInfo(context, request);

        SubmissionStepConfig step = getCurrentStepConfig(request, si);

        String info = "";

        if ((si.getSubmissionItem() != null) && si.isInWorkflow())
        {
            info = info
                    + "<input type=\"hidden\" name=\"workflow_id\" value=\""
                    + si.getSubmissionItem().getID() + "\"/>";
        }
        else if (si.getSubmissionItem() != null)
        {
            info = info
                    + "<input type=\"hidden\" name=\"workspace_item_id\" value=\""
                    + si.getSubmissionItem().getID() + "\"/>";
        }

        if (si.getBundle() != null)
        {
            info = info + "<input type=\"hidden\" name=\"bundle_id\" value=\""
                    + si.getBundle().getID() + "\"/>";
        }

        if (si.getBitstream() != null)
        {
            info = info
                    + "<input type=\"hidden\" name=\"bitstream_id\" value=\""
                    + si.getBitstream().getID() + "\"/>";
        }

        if (step != null)
        {
            info = info + "<input type=\"hidden\" name=\"step\" value=\""
                    + step.getStepNumber() + "\"/>";
        }

        // save the current page from the current Step Servlet
        int page = AbstractProcessingStep.getCurrentPage(request);
        info = info + "<input type=\"hidden\" name=\"page\" value=\"" + page
View Full Code Here

        // loop through all steps
        for (int i = 0; i < subInfo.getSubmissionConfig().getNumberOfSteps(); i++)
        {
            // get the current step info
            SubmissionStepConfig currentStep = subInfo.getSubmissionConfig()
                    .getStep(i);
            int stepNumber = currentStep.getStepNumber();
           
            //Skip over the "Select Collection" step, since
            // a user is never allowed to return to that step or jump from that step
            if(currentStep.getId()!=null && currentStep.getId().equals(SubmissionStepConfig.SELECT_COLLECTION_STEP))
            {
                continue;
            }
           
            // default to just one page in this step
            int numPages = 1;

            try
            {
                // load the processing class for this step
                ClassLoader loader = subInfo.getClass().getClassLoader();
                Class<?> stepClass = loader.loadClass(currentStep.getProcessingClassName());
  
                // call the "getNumberOfPages()" method of the class
                // to get it's number of pages
                AbstractProcessingStep step = (AbstractProcessingStep) stepClass
                        .newInstance();

                // get number of pages from servlet
                numPages = step.getNumberOfPages(request, subInfo);
            }
            catch (Exception e)
            {
                log.error("Error loading step information from Step Class '"
                                + currentStep.getProcessingClassName()
                                + "' Error:", e);
            }

            // save each of the step's pages to the progress bar
            for (int j = 1; j <= numPages; j++)
View Full Code Here

            // (We cannot review steps that we haven't gotten to!!)
            if (stepNum < SubmissionController.getCurrentStepConfig(request,
                    subInfo).getStepNumber())
            {
                // load this step's information
                SubmissionStepConfig s = subProcessConfig.getStep(stepNum);

                try
                {
                    JSPStepManager stepManager = JSPStepManager.loadStep(s);
               
                    // get this step's review JSP
                    String reviewJSP = stepManager.getReviewJSP(context, request, response, subInfo);

                    if ((reviewJSP != null) && (reviewJSP.length() > 0))
                    {
                        // save the path to this steps JSP to our reviewData Hashmap
                        // (with the key = stepNum.pageNum)
                        reviewData.put(stepAndPage, reviewJSP);
                    }
                }
                catch(Exception e)
                {
                    log.error("Problem loading Review JSP for step #" + s.getStepNumber() + ".  ", e);
                    JSPManager.showIntegrityError(request, response);
                    return;
                }
            }
        }
View Full Code Here

            {
                break;
            }
           
            //load up step configuration
            SubmissionStepConfig stepConfig = subConfig.getStep(currentStepAndPage.getStep());
           
            //load the step's XML-UI Class
            AbstractStep stepUIClass = loadXMLUIClass(stepConfig.getXMLUIClassName());
           
            try
            {
                //initialize this class (with proper step parameter)
                parameters.setParameter("step", currentStepAndPage.toString());
                stepUIClass.setup(resolver, objectModel, src, parameters);
            }
            catch(Exception e)
            {
                throw new UIException("Unable to initialize AbstractStep identified by "
                                        + stepConfig.getXMLUIClassName() + ":", e);
            }
           
            //If this stepUIClass is not a value AbstractSubmissionStep,
            //we will be unable to display its review information!
            if(stepUIClass instanceof AbstractSubmissionStep)
            {
                //add the Review section for this step,
                //and return a reference to that newly created step section
                List stepSection = ((AbstractSubmissionStep) stepUIClass).addReviewSection(review);
               
                //as long as this step has something to review
                if(stepSection!=null)
                {   
                    //add a Jump To button for this section
                    addJumpButton(stepSection, T_submit_jump, currentStepAndPage);
                }
            }
            else
            {
                //Log a warning that this step cannot be reviewed!
                log.warn("The Step represented by " + stepConfig.getXMLUIClassName() + " is not a valid AbstractSubmissionStep, so it cannot be reviewed during the ReviewStep!");
            }  
        }
       
     
    // Part C:
View Full Code Here

TOP

Related Classes of org.dspace.app.util.SubmissionStepConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.