Class EditDataHandler

    • Field Detail

      • opCreate

        protected boolean opCreate
      • resultOpCreate

        protected boolean resultOpCreate
      • opUpdate

        protected boolean opUpdate
      • resultOpUpdate

        protected boolean resultOpUpdate
      • opDelete

        protected boolean opDelete
      • resultOpDelete

        protected boolean resultOpDelete
      • opCancel

        protected boolean opCancel
      • opRefresh

        protected boolean opRefresh
      • id

        protected java.lang.String id
      • isDeleteForced

        protected boolean isDeleteForced
    • Constructor Detail

      • EditDataHandler

        public EditDataHandler()
    • Method Detail

      • sendRedirect

        protected void sendRedirect()
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • afterValidation

        protected boolean afterValidation​(boolean result)
                                   throws java.io.IOException
        Overrides:
        afterValidation in class JcmsFormHandler
        Throws:
        java.io.IOException
      • processAction

        public boolean processAction()
                              throws java.io.IOException
        Description copied from class: JcmsFormHandler
        Method to be implemented to check/validate action to be performed and process them.

        Default implementation is to return false. No need to call super method.

        This method may NOT be invoked at all if security validation are not met.

        You must ensure your handler and JSP can work properly without any code invoked in this method.

        Overrides:
        processAction in class JcmsFormHandler
        Returns:
        false if no redirection is needed, true otherwise
        Throws:
        java.io.IOException - IO Exception
      • getControllerContext

        protected java.util.HashMap<java.lang.String,​java.lang.Object> getControllerContext()
        Description copied from class: JcmsFormHandler
        Build a controller context. I.E. add request, response and loggedMember.
        Overrides:
        getControllerContext in class JcmsFormHandler
        Returns:
        the HashMap which contains the context
      • setFields

        public void setFields​(Data data)
        Set the common (Data) fields. This method is also a hook for sub-classed to fill some field (or do anything else) before a create or an update.
        Parameters:
        data - the publication to set the fields
        Since:
        jcms-5.7.1
      • getDataClass

        public abstract java.lang.Class<? extends Data> getDataClass()
      • getAvailableField

        public java.lang.Object getAvailableField​(java.lang.String field)
        Get value of the given field calling getAvailable{field}(). Called by widgets and meta templates See also getEnumValues(String) and getEnumLabels(String, String)
        Parameters:
        field - the field name
        Returns:
        Object return by getAvailable
        Since:
        jcms-9.0.0
      • getTabGroupMaxCount

        public int getTabGroupMaxCount​(java.lang.String tabGroupName)
        Returns the max value of the given tab group from the fields defining this tab group.
        Parameters:
        tabGroupName - Tab group defined in the type
        Returns:
        tab group count
      • getEnumValues

        public java.lang.Object getEnumValues​(java.lang.String field)
        Get enum values of the given field calling clazz.get{field}Values(). Called by widgets and meta templates
        Parameters:
        field - the field name
        Returns:
        Object return by getAvailable
        Since:
        jcms-9.0.0
      • getEnumLabels

        public java.lang.Object getEnumLabels​(java.lang.String field,
                                              java.lang.String userLang)
        Get enum values of the given field calling clazz.get{field}Labels(). Called by widgets and meta templates
        Parameters:
        field - the field name
        userLang - the userLang
        Returns:
        Object return by getAvailable
        Since:
        jcms-9.0.0
      • validateCreateExtension

        protected boolean validateCreateExtension​(Data extendedData)
                                           throws java.io.IOException
        Throws:
        java.io.IOException
      • performCreateExtension

        protected DataExtension performCreateExtension()
                                                throws java.io.IOException
        Throws:
        java.io.IOException
      • validateUpdateExtension

        protected boolean validateUpdateExtension​(DataExtension extension,
                                                  Data extendedData)
                                           throws java.io.IOException
        Throws:
        java.io.IOException
      • performUpdateExtension

        protected DataExtension performUpdateExtension​(DataExtension extension)
                                                throws java.io.IOException
        Throws:
        java.io.IOException
      • validateCancel

        public boolean validateCancel()
      • performCancel

        public boolean performCancel()
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • validateRefresh

        public boolean validateRefresh()
      • performRefresh

        public boolean performRefresh()
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • setOpCreate

        public void setOpCreate​(java.lang.String v)
      • setOpUpdate

        public void setOpUpdate​(java.lang.String v)
      • setOpDelete

        public void setOpDelete​(java.lang.String v)
      • setOpCancel

        public void setOpCancel​(java.lang.String v)
      • setOpRefresh

        public void setOpRefresh​(java.lang.String v)
      • getId

        public java.lang.String getId()
      • setId

        public void setId​(java.lang.String id)
      • setForceDelete

        public void setForceDelete​(java.lang.String v)
      • setExtraKeys

        public void setExtraKeys​(java.lang.String[] extraKeys)
        Convenient methods to update ExtraDataMap from bean
        Parameters:
        extraKeys - the extraKey
        Since:
        jcms-5.7.1
      • setExtraValues

        public void setExtraValues​(java.lang.String[] extraValues)
        Convenient methods to update ExtraDataMap from bean
        Parameters:
        extraValues - the extraValues
        Since:
        jcms-5.7.1
      • getAvailableExtraDataMap

        public java.util.Map<java.lang.String,​java.lang.String> getAvailableExtraDataMap()
        Returns a Map of available extra data. A mix between:
        1. Default extra data
        2. Previous extra data
        3. Submited extra data
        Returns:
        Map of extra data
      • setExtraDBKeys

        public void setExtraDBKeys​(java.lang.String[] extraDBKeys)
        Convenient methods to update ExtraDBDataMap from bean
        Parameters:
        extraDBKeys - the extraDBKey
        Since:
        jcms-6.0
      • setExtraDBValues

        public void setExtraDBValues​(java.lang.String[] extraDBValues)
        Convenient methods to update ExtraDBDataMap from bean
        Parameters:
        extraDBValues - the extraDBValues
        Since:
        jcms-6.0
      • getAvailableExtraDBDataMap

        public java.util.Map<java.lang.String,​java.lang.String> getAvailableExtraDBDataMap()
        Returns a Map of available extra db data. A mix between:
        1. Default extra db data
        2. Previous extra db data
        3. Submited extra db data
        Returns:
        Map of extra db data
        Since:
        jcms-6.0
      • processDataIds

        protected <T extends Data> java.util.List<T> processDataIds​(java.lang.String fieldName,
                                                                    java.lang.String[] ids,
                                                                    java.lang.Class<T> clazz)
        Computes link array to retrieve Data of the given Class. Trim end of the returned List. If link array contains value MultipartRequest.MULTIPART_UPLOAD then instanciate a new FileDocument but do NOT perform create. Handler.validate() should perform Create or Update. Underlaying files are never overrided.
        Type Parameters:
        T - The data type
        Parameters:
        fieldName - the field name
        ids - arrays of ids
        clazz - the class of links
        Returns:
        List a list of Data
        Since:
        jcms-5.7.0
      • processDataIds

        protected <T extends Data> java.util.List<T> processDataIds​(java.lang.String fieldName,
                                                                    java.lang.String[] ids,
                                                                    java.lang.Class<T> clazz,
                                                                    boolean trim)
        Computes link array to retrieve Data of the given Class. optionaly, trims the end of the returned List. If link array contains value MultipartRequest.MULTIPART_UPLOAD then instanciate a new FileDocument but do NOT perform create. Handler.validate() should perform Create or Update. Underlaying files are never overrided.
        Type Parameters:
        T - The data type
        Parameters:
        fieldName - the field name
        ids - arrays of ids
        clazz - the class of links
        trim - if true, trim the end of the returned list.
        Returns:
        List a list of Data
        Since:
        jcms-6.0.0
      • processDataId

        protected Data processDataId​(java.lang.String fieldName,
                                     java.lang.String dataId,
                                     java.lang.Class<? extends Data> clazz)
        Computes given dataid, trim and retrieve associated data. If link contains value MultipartRequest.MULTIPART_UPLOAD then instanciate a new FileDocument but do NOT perform create. Handler.validate() should perform Create or Update. Underlaying files are never overrided. Check the data match the given class.
        Parameters:
        fieldName - The field name
        dataId - the id of the data
        clazz - the class of the data
        Returns:
        Data the updated data
        Since:
        jcms-5.7.0
      • validateUploadedFileDocument

        protected boolean validateUploadedFileDocument​(Data data,
                                                       Member author,
                                                       Workspace ws)
        Performs create on given data if it is a FileDocument that have just been uploaded. This method should be called by EditPublicationHandler#validateBeforeOp()
        Parameters:
        data - the data to work with
        author - the author of the data
        ws - the workspace of the data
        Returns:
        true if ControllerStatus is ok
        Since:
        jcms-5.7.0
        See Also:
        EditPublicationHandler.validateBeforeOp()
      • validateUploadedFileDocument

        protected boolean validateUploadedFileDocument​(Data data,
                                                       java.util.Map dataML,
                                                       Member author,
                                                       Workspace ws)
        Performs create on given data if it is a FileDocument that have just been uploaded. This method should be called by EditPublicationHandler#validateBeforeOp()
        Parameters:
        data - the data to work with
        dataML - the other languages
        author - the author of the data
        ws - the workspace of the data
        Returns:
        true if ControllerStatus is ok
        Since:
        jcms-6.1.3
        See Also:
        EditPublicationHandler.validateBeforeOp()
      • validateUploadedFileDocument

        protected boolean validateUploadedFileDocument​(Data[] datas,
                                                       Member author,
                                                       Workspace ws)
        Performs validate on given array of data if it is a FileDocument that have just been uploaded. This method should be called by EditPublicationHandler#validateBeforeOp()
        Parameters:
        datas - an array of data to work with
        author - the author of the data
        ws - the workspace of the data
        Returns:
        true if ControllerStatus is ok
        Since:
        jcms-5.7.0
        See Also:
        EditPublicationHandler.validateBeforeOp()
      • validateUploadedFileDocument

        protected boolean validateUploadedFileDocument​(Data[] datas,
                                                       java.util.Map dataML,
                                                       Member author,
                                                       Workspace ws)
        Performs create on given data if it is a FileDocument that have just been uploaded. This method should be called by EditPublicationHandler#validateBeforeOp()
        Parameters:
        datas - an array of data to work with
        dataML - the other languages
        author - the author of the data
        ws - the workspace of the data
        Returns:
        true if ControllerStatus is ok
        Since:
        jcms-6.1.3
        See Also:
        EditPublicationHandler.validateBeforeOp()
      • createUploadedFileDocument

        protected boolean createUploadedFileDocument​(Data data,
                                                     Member author,
                                                     Workspace ws)
        Performs create on given data if it is a FileDocument that have just been uploaded. This method should be called by EditPublicationHandler#validateBeforeOp()
        Parameters:
        data - the data to work with
        author - the author of the data
        ws - the workspace of the data
        Returns:
        true if ControllerStatus is ok
        Since:
        jcms-5.7.0
        See Also:
        EditPublicationHandler.validateBeforeOp()
      • createUploadedFileDocument

        protected boolean createUploadedFileDocument​(Data data,
                                                     java.util.Map dataML,
                                                     Member author,
                                                     Workspace ws)
        Performs create on given array of data if it is a FileDocument that have just been uploaded. This method should be called by EditPublicationHandler#validateBeforeOp()
        Parameters:
        data - the data to work with (main language
        dataML - the other languages
        author - the author of the data
        ws - the workspace of the data
        Returns:
        true if ControllerStatus is ok
        Since:
        jcms-6.1.3
        See Also:
        EditPublicationHandler.validateBeforeOp()
      • createUploadedFileDocument

        protected boolean createUploadedFileDocument​(Data[] datas,
                                                     Member author,
                                                     Workspace ws)
        Performs create on given array of data if it is a FileDocument that have just been uploaded. This method should be called by EditPublicationHandler#validateBeforeOp()
        Parameters:
        datas - an array of data to work with
        author - the author of the data
        ws - the workspace of the data
        Returns:
        true if ControllerStatus is ok
        Since:
        jcms-6.1.2
        See Also:
        EditPublicationHandler.validateBeforeOp()
      • createUploadedFileDocument

        protected boolean createUploadedFileDocument​(Data[] datas,
                                                     java.util.Map dataML,
                                                     Member author,
                                                     Workspace ws)
        Performs create on given array of data if it is a FileDocument that have just been uploaded. This method should be called by EditPublicationHandler#validateBeforeOp()
        Parameters:
        datas - an array of data to work with
        dataML - the other languages
        author - the author of the data
        ws - the workspace of the data
        Returns:
        true if ControllerStatus is ok
        Since:
        jcms-6.1.3
        See Also:
        EditPublicationHandler.validateBeforeOp()
      • processMLData

        public Data processMLData​(java.lang.String fieldName,
                                  java.lang.Class clazz,
                                  java.lang.String[] values,
                                  java.util.Map mlMap)
        Process the given ML values (data ids)
        Parameters:
        fieldName - the field name
        clazz - the class
        values - the ids
        mlMap - the mlMap
        Returns:
        the data in the main language
        Since:
        jcms-5.7.0
      • processMLDataArray

        public <T extends DataData[] processMLDataArray​(java.lang.String fieldName,
                                                          java.lang.Class<T> clazz,
                                                          java.lang.String[] values,
                                                          java.util.Map mlMap)
        Process the given ML values (data ids)
        Type Parameters:
        T - The data type
        Parameters:
        fieldName - the field name
        clazz - the class
        values - the ids
        mlMap - the mlMap
        Returns:
        the data array in the main language
        Since:
        jcms-5.7.0
      • getAvailableData

        public Data getAvailableData​(Data data,
                                     Data dataField,
                                     Data field,
                                     java.util.Map mlMap,
                                     java.lang.String lang)
        Generic method to get available ML field for a given data in a given language.
        Parameters:
        data - the object (eg a Publication)
        dataField - the current value of the field (may be null)
        field - the proposed value for this field
        mlMap - the ML map
        lang - the langugage value
        Returns:
        the value for the field of the object in the given language
        Since:
        jcms-5.7.0
      • getAvailableDataArray

        public Data[] getAvailableDataArray​(Data data,
                                            Data[] dataField,
                                            Data[] field,
                                            java.util.Map mlMap,
                                            java.lang.String lang)
        Generic method to get available ML field for a given array of data in a given language.
        Parameters:
        data - the object (eg a Publication)
        dataField - the current value of the field (may be null)
        field - the proposed value for this field
        mlMap - the ML map
        lang - the langugage value
        Returns:
        the value for the field of the object in the given language
        Since:
        jcms-5.7.0
      • isFirstAccess

        public boolean isFirstAccess()
        Returns true if this is the first access to this form (no previous submission).
        Returns:
        true if this is the first access to this form (no previous submission).
        Since:
        jcms-5.7.0
      • handleRestResponse

        protected void handleRestResponse()
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • restValidation

        protected boolean restValidation​(boolean result)
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • getModalRedirect

        public java.lang.String getModalRedirect()
        Description copied from class: JcmsFormHandler
        Get the redirect value to be used in the modals with modalRedirect.jspf and the request attribute 'modal.redirect'.
        Overrides:
        getModalRedirect in class JcmsFormHandler
        Returns:
        redirect value
      • getDeleteRedirect

        public static java.lang.String getDeleteRedirect​(Data data,
                                                         java.util.Locale userLocale)
        Get the redirect value to be used by default in the ctx menus for delete action.

        Returns publication workspace home url if data is a Publication, else returns null.

        Parameters:
        data - the data to be deleted
        userLocale - the user context
        Returns:
        redirect value
        Since:
        jcms-10.0.6