Class CmsNewResource


  • public class CmsNewResource
    extends java.lang.Object
    The new resource entry dialog which displays the possible "new actions" for the current user.

    It handles the creation of "simple" resource types like plain or JSP resources.

    The following files use this class:

    • /commons/newresource.jsp

    Since:
    6.0.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int ACTION_NEWFORM
      The value for the resource name form action.
      static int ACTION_SUBMITFORM
      The value for the resource name form submission action.
      static int BUTTON_NEXT
      Constant for the "Next" button in the build button methods.
      static java.lang.String DEFAULT_SUFFIX
      The default suffix.
      static char DELIM_PROPERTYVALUES
      Delimiter for property values, e.g.
      static java.lang.String DIALOG_ADVANCED
      The name for the advanced resource form action.
      static java.lang.String DIALOG_NEWFORM
      The name for the resource form action.
      static java.lang.String DIALOG_SUBMITFORM
      The name for the resource form submission action.
      static java.lang.String DIALOG_TYPE
      The dialog type.
      static java.lang.String LIST_COLUMN_URI
      List column id constant.
      static java.lang.String PARAM_APPENDSUFFIXHTML
      Request parameter name for the append html suffix checkbox.
      static java.lang.String PARAM_CURRENTFOLDER
      Request parameter name for the current folder name.
      static java.lang.String PARAM_NEWFORMURI
      Request parameter name for the new form uri.
      static java.lang.String PARAM_NEWRESOURCEEDITPROPS
      Request parameter name for the new resource edit properties flag.
      static java.lang.String PARAM_NEWRESOURCETYPE
      Request parameter name for the new resource type.
      static java.lang.String PARAM_NEWRESOURCEURI
      Request parameter name for the new resource uri.
      static java.lang.String SESSION_ATTR_ADVANCED
      Session attribute to store advanced mode.
      static java.lang.String SESSION_ATTR_PAGE
      Session attribute to store current page.
      static java.lang.String VALUE_DEFAULT
      The property value for available resource to reset behaviour to default dialog.
    • Constructor Summary

      Constructors 
      Constructor Description
      CmsNewResource()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String computeNewTitleProperty​(java.lang.String name)
      Returns the value for the Title property from the given resource name.
      protected static org.opencms.file.CmsProperty createPropertyObject​(java.lang.String name, java.lang.String value)
      Creates a single property object and sets the value individual or shared depending on the OpenCms settings.
      protected static java.util.List<org.opencms.file.CmsProperty> createResourceProperties​(org.opencms.file.CmsObject cms, java.lang.String resourceName, java.lang.String resTypeName, java.lang.String title)
      Returns the properties to create automatically with the new VFS resource.
      static java.lang.Object getNewResourceHandler​(java.lang.String type, java.lang.String defaultClassName, javax.servlet.jsp.PageContext context, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
      A factory to return handlers to create new resources.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • computeNewTitleProperty

        public static java.lang.String computeNewTitleProperty​(java.lang.String name)
        Returns the value for the Title property from the given resource name.

        Parameters:
        name - the name of the resource
        Returns:
        the value for the Title property from the given resource name
      • getNewResourceHandler

        public static java.lang.Object getNewResourceHandler​(java.lang.String type,
                                                             java.lang.String defaultClassName,
                                                             javax.servlet.jsp.PageContext context,
                                                             javax.servlet.http.HttpServletRequest req,
                                                             javax.servlet.http.HttpServletResponse res)
                                                      throws org.opencms.main.CmsRuntimeException
        A factory to return handlers to create new resources.

        Parameters:
        type - the resource type name to get a new resource handler for, as specified in the explorer type settings
        defaultClassName - a default handler class name, to be used if the handler class specified in the explorer type settings cannot be found
        context - the JSP page context
        req - the JSP request
        res - the JSP response
        Returns:
        a new instance of the handler class
        Throws:
        org.opencms.main.CmsRuntimeException - if something goes wrong
      • createPropertyObject

        protected static org.opencms.file.CmsProperty createPropertyObject​(java.lang.String name,
                                                                           java.lang.String value)
        Creates a single property object and sets the value individual or shared depending on the OpenCms settings.

        Parameters:
        name - the name of the property
        value - the value to set
        Returns:
        an initialized property object
      • createResourceProperties

        protected static java.util.List<org.opencms.file.CmsProperty> createResourceProperties​(org.opencms.file.CmsObject cms,
                                                                                               java.lang.String resourceName,
                                                                                               java.lang.String resTypeName,
                                                                                               java.lang.String title)
        Returns the properties to create automatically with the new VFS resource.

        If configured, the Title and Navigation properties are set on resource creation.

        Parameters:
        cms - the initialized CmsObject
        resourceName - the full resource name
        resTypeName - the name of the resource type
        title - the Title String to use for the property values
        Returns:
        the List of initialized property objects