001    /**
002     * Copyright 2005-2013 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.rice.kns.web.struts.form.pojo;
017    
018    import javax.servlet.http.HttpServletRequest;
019    import java.util.Map;
020    import java.util.Set;
021    
022    /**
023     * begin Kuali Foundation modification
024     * This interface defines methods that Pojo Forms must provide.
025     * end Kuali Foundation modification
026     */
027    // Kuali Foundation modification: original name: SLForm
028    public interface PojoForm {
029        public void populate(HttpServletRequest request);
030    
031        // begin Kuali Foundation modification
032        // cachedActionErrors() method removed
033        public void postprocessRequestParameters(Map requestParameters);
034        // end Kuali Foundation modification
035    
036        public Map getUnconvertedValues();
037    
038        public Object formatValue(Object value, String keypath, Class type);
039    
040        // begin Kuali Foundation modification
041        public void processValidationFail();
042        
043        Set<String> getRequiredNonEditableProperties();
044        
045        void registerEditableProperty(String editablePropertyName);
046        
047        /**
048         * Reinitializes the form to allow it to register the editable properties of the currently processing request.
049         */
050        void clearEditablePropertyInformation();
051    
052        Set<String> getEditableProperties();
053        
054        /**
055         * 
056         * This method adds the required property names, that are not directly editable by user on the html page, to a list, regardless of the context
057         * in which they appear.  Request parameter names corresponding to these properties
058         * will be populated into the form. 
059         *
060         */
061        void addRequiredNonEditableProperties();
062        
063        /**
064         * Sets the value of the "scope" attribute for the Struts action mapping corresponding to this form instance.  Note that this
065         * method name is NOT in the syntax of the conventional POJO setter; this is to prevent clients from maliciously altering the value
066         * of this parameter
067         * 
068         * @param scope
069         */
070        public void registerStrutsActionMappingScope(String scope);
071        
072       
073        public void registerIsNewForm(boolean isNewForm);
074        
075        public boolean getIsNewForm();
076        
077        
078        /**
079             * Returns whether a request parameter should be populated as a property of the form, assuming that the request parameter name
080             * corresponds to a property on the form.  This method makes no determination whether the request parameter is a property of the form, but rather
081             * from a security perspective, whether the framework should attempt to set the form property with the same name as the request parameter. 
082             * 
083             * @param requestParameterName the name of the request parameter
084             * @param request the HTTP request
085             * @return whether the parameter should be 
086             */
087            public boolean shouldPropertyBePopulatedInForm(String requestParameterName, HttpServletRequest request);
088            
089            /**
090             * Returns a set of methodToCalls for which the system will bypass the session.  The return value of this method may depend ONLY upon the
091             * type of the class implementing it.  Each instance of an implementation of this interface
092             * must return the same result.  More formally, for 2 instances of this interfaces a1 and a2, if a1.getClass().equals(a2.getClass()), then
093             * a1.getMethodToCallsToBypassSessionRetrievalForGETRequests().equals(a2.getMethodToCallsToBypassSessionRetrievalForGETRequests())
094             * 
095             * NOTE: read Javadoc of {@link PojoFormBase#getMethodToCallsToBypassSessionRetrievalForGETRequests()} for important implementation details.
096             * 
097             * @return
098             */
099            public Set<String> getMethodToCallsToBypassSessionRetrievalForGETRequests();
100            
101            /**
102         * Sets the editable properties guid for this form
103         * @param guid the key to the editable properties for this form
104         */
105        public abstract void setPopulateEditablePropertiesGuid(String guid);
106        
107        /**
108         * Sets the guid associated with the edited properties associated with the action
109         * 
110         * @param guid the guid of the action editable properties
111         */
112        public abstract void setActionEditablePropertiesGuid(String guid);
113        // end Kuali Foundation modification
114    
115    }