⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editarchiveaction.java

📁 一套完整的档案管理系统
💻 JAVA
字号:
/*
 *
 *       "This product includes software developed by the
 *        Apache Software Foundation (http://www.apache.org/)."
 *
 */


package com.stsc.archive.file;

import java.io.IOException;
import java.util.Hashtable;
import java.util.Locale;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.util.MessageResources;


/**
 * Implementation of <strong>Action</strong> that show archive list.
 *
 * @author Lu Tianxiong
 * @version $Revision: 1.0 $ $Date: 2003/04/04 11:56:08 $
 */

public final class EditArchiveAction extends Action {


    // --------------------------------------------------------- Public Methods


    /**
     * Process the specified HTTP request, and create the corresponding HTTP
     * response (or forward to another web component that will create it).
     * Return an <code>ActionForward</code> instance describing where and how
     * control should be forwarded, or <code>null</code> if the response has
     * already been completed.
     *
     * @param mapping The ActionMapping used to select this instance
     * @param actionForm The optional ActionForm bean for this request (if any)
     * @param request The HTTP request we are processing
     * @param response The HTTP response we are creating
     *
     * @exception IOException if an input/output error occurs
     * @exception ServletException if a servlet exception occurs
     */
    public ActionForward perform(ActionMapping mapping,
				 ActionForm form,
				 HttpServletRequest request,
				 HttpServletResponse response)
	throws IOException, ServletException {

System.out.println("mapping.getAttribute(): = " + mapping.getAttribute());
System.out.println("mapping.getScope(): = " + mapping.getScope());

	// Extract attributes we will need
	//Locale locale = getLocale(request);
	//MessageResources messages = getResources();
	HttpSession session = request.getSession();

	// Validate the request parameters specified by the user
	ActionErrors errors = new ActionErrors();

        String action = request.getParameter("action");
        if (action==null) action="Create";
        
        String serialno = request.getParameter("serialno");
        if (serialno==null) serialno = "";
        
        
        Archive archive = null;
        
	if (action.equals("Create")) {
	    archive = new Archive();
	} else {
        ArchiveList archiveList = (ArchiveList) session.getAttribute(Constants.ARCHIVELIST_KEY);
        if (archiveList == null) {
		    return (mapping.findForward("failure"));            
        }
	    archive = archiveList.findArchive(serialno);
	}
	
	if (archive==null) {
	    if (servlet.getDebug() >= 1)
		servlet.log(" No archive for serialno " + serialno);
	    return (mapping.findForward("failure"));            
	}
	//System.out.println("11111111111111111111111111111111111111");
	session.setAttribute(Constants.ARCHIVE_KEY, archive);
     ArchiveForm archiveform = (ArchiveForm) form;  
	// Populate the subscription form
	if (form == null) {
	    form = new ArchiveForm();
            if ("request".equals(mapping.getScope()))
                request.setAttribute(mapping.getAttribute(), form);

            else
                session.setAttribute(mapping.getAttribute(), form);
	}
	
	//System.out.println("22222222222222222222222222222222222");
	archiveform.setAction(action);
	
        try {
			//System.out.println("44444444444444444444444444444");
				archiveform.setDeleted(archive.getDeleted());
				archiveform.setArchiveno(archive.getArchiveno());
				archiveform.setStatus(archive.getStatus());
				//2003-05-28 add by liqf
				archiveform.setVolumnno(archive.getVolumnno());
				archiveform.setFlowno(archive.getFlowno());

				archiveform.setUnitno(archive.getUnitno());
				System.out.println("archive.getAttachmentpath()========"+archive.getAttachmentpath());
				archiveform.setAttachmentpath(archive.getAttachmentpath());
			
                archiveform.setSerialno(String.valueOf(archive.getSerialno()));
				archiveform.setArchivetype(archive.getArchivetype());
				archiveform.setCode(archive.getCode());
				archiveform.setCategory(archive.getCategory());
				archiveform.setFiletype(archive.getFiletype());
				archiveform.setTitle(archive.getTitle());
				archiveform.setTitleremark(archive.getTitleremark());
				archiveform.setFileno(archive.getFileno());
				archiveform.setLiteraturetype(archive.getLiteraturetype());
                archiveform.setFiledate(archive.getFiledate());
				archiveform.setPagenumber(String.valueOf(archive.getPagenumber()));
				archiveform.setDuty(archive.getDuty());
				archiveform.setOtherduty(archive.getOtherduty());
				archiveform.setElectronicfilename(archive.getElectronicfilename());
				archiveform.setAttachmenttitle(archive.getAttachmenttitle());
				archiveform.setKeyword(archive.getKeyword());
				archiveform.setMemo(archive.getMemo());
				archiveform.setAnnotation(archive.getAnnotation());
				archiveform.setAbstractmsg(archive.getAbstractmsg());
				archiveform.setCopys(String.valueOf(archive.getCopys()));
				archiveform.setLendnum(String.valueOf(archive.getLendnum()));
				archiveform.setSecurityclass(archive.getSecurityclass());
				archiveform.setSecurityterm(String.valueOf(archive.getSecurityterm()));
                archiveform.setDecryptiondate(archive.getDecryptiondate());
				//modify by liqf 2003-06-03
				//archiveform.setRetentionperiod(String.valueOf(archive.getRetentionperiod()));
				archiveform.setRetentionperiod(archive.getRetentionperiod());
                archiveform.setArchivedate(archive.getArchivedate());
                archiveform.setDestroydate(archive.getDestroydate());
				archiveform.setArchivalcode(archive.getArchivalcode());
				archiveform.setArchiveno(archive.getArchiveno());
				archiveform.setHandover(archive.getHandover());
				archiveform.setSuggest(archive.getSuggest());
				archiveform.setRecordtransfer(archive.getRecordtransfer());
				archiveform.setFilingtrace(archive.getFilingtrace());
				archiveform.setFilingscripts(archive.getFilingscripts());
				//java.text.SimpleDateFormat sdf1 = new java.text.SimpleDateFormat(Constants.DATEFORMAT);
				archiveform.setReappraisedates(archive.getreappraisedates());
           
            archiveform.setAction(action);
			//2003-05-14 add by liqf,
			session.setAttribute("archiveForm",archiveform);
        } catch (Throwable t) {
            System.out.println("SubscriptionForm.populate" + t);
            servlet.log("SubscriptionForm.populate", t);
            throw new ServletException("SubscriptionForm.populate", t);
        }
//System.out.println("33333333333333333333333333333333");

	// Report any errors we have discovered back to the original form
	if (!errors.empty()) {
	    saveErrors(request, errors);
	    return (new ActionForward(mapping.getInput()));
	}

	// Forward control to the specified success URI
System.out.println("mapping.findForward(\"success\")=" + mapping.findForward("success"));
	return (mapping.findForward("success"));

    }


}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -