Class CmsCopy


  • public class CmsCopy
    extends CmsMultiDialog
    Provides methods for the copy resources dialog.

    The following files use this class:

    • /commons/copy.jsp

    Since:
    6.0.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int ACTION_COPY
      Value for the action: copy the resource.
      static java.lang.String DIALOG_TYPE
      The dialog type.
      static java.lang.String PARAM_KEEPRIGHTS
      Request parameter name for the keep rights flag.
      static java.lang.String PARAM_OVERWRITE
      Request parameter name for the overwrite flag.
      • Fields inherited from class org.opencms.workplace.CmsDialog

        ACTION_CANCEL, ACTION_CLOSEPOPUP, ACTION_CLOSEPOPUP_SAVE, ACTION_CONFIRMED, ACTION_CONTINUE, ACTION_DEFAULT, ACTION_LOCKS_CONFIRMED, ACTION_OK, ACTION_REPORT_BEGIN, ACTION_REPORT_END, ACTION_REPORT_UPDATE, ACTION_SET, ACTION_WAIT, ATTRIBUTE_THROWABLE, BUTTON_ADVANCED, BUTTON_BACK, BUTTON_CANCEL, BUTTON_CLOSE, BUTTON_CONTINUE, BUTTON_DETAILS, BUTTON_DISCARD, BUTTON_EDIT, BUTTON_OK, BUTTON_OK_NO_SUBMIT, BUTTON_SET, DIALOG_BACK, DIALOG_CANCEL, DIALOG_CONFIRMED, DIALOG_CONTINUE, DIALOG_INITIAL, DIALOG_LOCKS_CONFIRMED, DIALOG_OK, DIALOG_SET, DIALOG_WAIT, PARAM_ACTION, PARAM_ACTION_VALUE_FOR_CHANGED_INDEX, PARAM_CLOSELINK, PARAM_DIALOGTYPE, PARAM_ERRORSTACK, PARAM_FILE, PARAM_FRAMENAME, PARAM_ISPOPUP, PARAM_LOCK, PARAM_MESSAGE, PARAM_ORIGINALPARAMS, PARAM_PREACTIONDONE, PARAM_REDIRECT, PARAM_RESOURCE, PARAM_TARGET, PARAM_THREAD, PARAM_THREAD_HASNEXT, PARAM_TITLE, REPORT_BEGIN, REPORT_END, REPORT_UPDATE
      • Fields inherited from class org.opencms.workplace.tools.CmsToolDialog

        PARAM_ADMIN_PROJECT, PARAM_BASE, PARAM_FORCE, PARAM_PATH, PARAM_ROOT, PARAM_STYLE, STYLE_NEW
      • Fields inherited from class org.opencms.workplace.CmsWorkplace

        DEBUG, DEFAULT_DATE_STRING, DEFAULT_LANGUAGE, DEFAULT_LOCALE, DIALOG_PATH_COMMON, FILE_DIALOG_CLOSE, FILE_DIALOG_SCREEN_CONFIRM, FILE_DIALOG_SCREEN_ERROR, FILE_DIALOG_SCREEN_ERRORPAGE, FILE_DIALOG_SCREEN_WAIT, FILE_EXPLORER_FILELIST, FILE_REPORT_OUTPUT, HTML_END, HTML_START, INPUT_DEFAULT, INPUT_NONE, JSP_WORKPLACE_URI, PARAM_DIRECTPUBLISH, PARAM_MODELFILE, PARAM_NEWRESOURCETYPE, PARAM_PUBLISHSIBLINGS, PARAM_RELATEDRESOURCES, PARAM_RESOURCELIST, PARAM_SUBRESOURCES, PARAM_WP_EXPLORER_RESOURCE, PARAM_WP_PROJECT, PARAM_WP_SITE, PARAM_WP_START, PARAM_WP_VIEW, PATH_DIALOGS, PATH_WORKPLACE, REQUEST_ATTRIBUTE_MULTIPART, REQUEST_ATTRIBUTE_RELOADTREE, RES_PATH_FILETYPES, RFS_PATH_RESOURCES, SESSION_WORKPLACE_CLASS, VFS_DIR_DEFAULTBODIES, VFS_DIR_TEMPLATES, VFS_PATH_COMMONS, VFS_PATH_EDITORS, VFS_PATH_GALLERIES, VFS_PATH_LOCALES, VFS_PATH_MODELDIALOG, VFS_PATH_MODULES, VFS_PATH_NEWRESOURCEDIALOG, VFS_PATH_RESOURCES, VFS_PATH_SITES, VFS_PATH_SYSTEM, VFS_PATH_VIEWS, VFS_PATH_WORKPLACE, VIEW_ADMIN, VIEW_DIRECT_EDIT, VIEW_EXPLORER, VIEW_GALLERY, VIEW_LIST, VIEW_WORKPLACE
    • Constructor Summary

      Constructors 
      Constructor Description
      CmsCopy​(javax.servlet.jsp.PageContext context, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
      Public constructor with JSP variables.
      CmsCopy​(org.opencms.jsp.CmsJspActionElement jsp)
      Public constructor with JSP action element.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void actionCopy()
      Performs the copy action, will be called by the JSP page.
      java.lang.String buildRadioCopyMode()
      Builds the input radio buttons to select between preserving links or creating new resources when copying.
      java.lang.String getParamCopymode()
      Returns the value of the copymode parameter.
      java.lang.String getParamKeeprights()
      Returns the value of the keeprights parameter.
      java.lang.String getParamOverwrite()
      Returns the value of the overwrite parameter.
      java.lang.String getParamTarget()
      Returns the value of the target parameter, or null if this parameter was not provided.
      protected void initWorkplaceRequestValues​(org.opencms.workplace.CmsWorkplaceSettings settings, javax.servlet.http.HttpServletRequest request)  
      protected boolean performDialogOperation()
      Performs the resource copying.
      protected void performSingleCopyOperation​(java.lang.String source, java.lang.String target, java.lang.String sitePrefix, org.opencms.file.CmsResource.CmsResourceCopyMode copyMode, boolean overwrite)
      Performs the copy operation for a single VFS resource.
      void setParamCopymode​(java.lang.String value)
      Sets the value of the copymode parameter.
      void setParamKeeprights​(java.lang.String value)
      Sets the value of the "keeprights" parameter.
      void setParamOverwrite​(java.lang.String paramOverwrite)
      Sets the value of the overwrite parameter.
      void setParamTarget​(java.lang.String value)
      Sets the value of the target parameter.
      • Methods inherited from class org.opencms.workplace.CmsDialog

        actionCloseDialog, appendDelimiter, buildAjaxResultContainer, buildAjaxWaitMessage, buildLockAdditionalOptions, buildLockConfirmationMessageJS, checkResourcePermissions, computeCurrentFolder, dialog, dialogBlock, dialogBlockEnd, dialogBlockStart, dialogButtonRow, dialogButtonRowEnd, dialogButtonRowStart, dialogButtons, dialogButtonsClose, dialogButtonsClose, dialogButtonsCloseDetails, dialogButtonsHtml, dialogButtonsOk, dialogButtonsOk, dialogButtonsOkCancel, dialogButtonsOkCancel, dialogButtonsOkCancelAdvanced, dialogButtonsSetOkCancel, dialogContent, dialogContentEnd, dialogContentStart, dialogEnd, dialogHead, dialogHorizontalSpacer, dialogLockButtons, dialogRow, dialogRowEnd, dialogRowStart, dialogScriptSubmit, dialogSeparator, dialogSpacer, dialogStart, dialogStart, dialogSubheadline, dialogToggleStart, dialogWhiteBox, dialogWhiteBoxEnd, dialogWhiteBoxStart, getAction, getAdministrationBackLink, getCancelAction, getDialogRealUri, getDialogUri, getOnlineHelpUriCustom, getParamAction, getParamCloseLink, getParamDialogtype, getParamFramename, getParamIsPopup, getParamMessage, getParamOriginalParams, getParamPreActionDone, getParamRedirect, getParamResource, getParamTitle, getState, hasCorrectLockstate, hasSiblings, htmlStart, htmlStart, htmlStart, htmlStartStyle, includeErrorpage, initCmsDialog, isPopup, isPreEditor, openLaunchpad, openWorkplaceLink, pageHtml, pageHtml, setAction, setOnlineHelpUriCustom, setParamAction, setParamCloseLink, setParamDialogtype, setParamFramename, setParamIsPopup, setParamMessage, setParamOriginalParams, setParamPreActionDone, setParamRedirect, setParamTitle
      • Methods inherited from class org.opencms.workplace.tools.CmsToolDialog

        computeUpLevelLink, dialogTitle, getAdminTool, getCurrentToolPath, getParamBase, getParamForce, getParamPath, getParamRoot, getParamStyle, getParentPath, getToolManager, iconsBlockArea, iconsBlockAreaEnd, iconsBlockAreaStart, initAdminTool, pageBody, pageHtmlStyle, setParamBase, setParamForce, setParamPath, setParamRoot, setParamStyle, useNewStyle
      • Methods inherited from class org.opencms.workplace.CmsWorkplace

        addMessages, addMessages, allParamsAsHidden, allParamsAsRequest, allParamValues, bodyEnd, bodyStart, bodyStart, buildSelect, buildSelect, button, button, buttonBar, buttonBar, buttonBarHorizontalLine, buttonBarLabel, buttonBarLabel, buttonBarLine, buttonBarLineSpacer, buttonBarSeparator, buttonBarSpacer, buttonBarStartTab, canEditPermissionsForRoles, checkLock, checkLock, checkRole, decodeParamValue, fillParamValues, fillParamValues, generateCssStyle, generatePageEndExtended, generatePageEndSimple, generatePageStartExtended, generatePageStartSimple, getBroadcastMessageString, getCms, getEncoding, getExplorerFileListFullUri, getFrameSource, getJsp, getLocale, getMacroResolver, getMessages, getMultiPartFileItems, getParameterMap, getResourceUri, getResourceUri, getSession, getSettings, getSkinUri, getStartSiteRoot, getStartSiteRoot, getStaticResourceUri, getStaticResourceUri, getStyleUri, getStyleUri, getStyleUri, getTemporaryFileName, getWorkplaceExplorerLink, getWorkplaceExplorerLink, getWorkplaceSettings, htmlEnd, initMessages, initSettings, initTimeWarp, initUserSettings, initWorkplaceMembers, initWorkplaceMembers, initWorkplaceSettings, isForwarded, isHelpEnabled, isSubElement, isTemporaryFile, key, key, keyDefault, nullToEmpty, paramsAsHidden, paramsAsHidden, paramsAsParameterMap, paramsAsRequest, paramValues, resolveMacros, sendCmsRedirect, sendForward, setForwarded, shortKey, substituteSiteTitle, substituteSiteTitleStatic, switchToCurrentProject, switchToTempProject, updateUserPreferences
      • Methods inherited from class java.lang.Object

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

      • CmsCopy

        public CmsCopy​(org.opencms.jsp.CmsJspActionElement jsp)
        Public constructor with JSP action element.

        Parameters:
        jsp - an initialized JSP action element
      • CmsCopy

        public CmsCopy​(javax.servlet.jsp.PageContext context,
                       javax.servlet.http.HttpServletRequest req,
                       javax.servlet.http.HttpServletResponse res)
        Public constructor with JSP variables.

        Parameters:
        context - the JSP page context
        req - the JSP request
        res - the JSP response
    • Method Detail

      • actionCopy

        public void actionCopy()
                        throws javax.servlet.jsp.JspException
        Performs the copy action, will be called by the JSP page.

        Throws:
        javax.servlet.jsp.JspException - if problems including sub-elements occur
      • buildRadioCopyMode

        public java.lang.String buildRadioCopyMode()
        Builds the input radio buttons to select between preserving links or creating new resources when copying.

        Returns:
        the HTML code for the radio buttons
      • getParamCopymode

        public java.lang.String getParamCopymode()
        Returns the value of the copymode parameter.

        Returns:
        the value of the copymode parameter
      • getParamKeeprights

        public java.lang.String getParamKeeprights()
        Returns the value of the keeprights parameter.

        Returns:
        the value of the keeprights parameter
      • getParamOverwrite

        public java.lang.String getParamOverwrite()
        Returns the value of the overwrite parameter.

        Returns:
        the value of the overwrite parameter
      • getParamTarget

        public java.lang.String getParamTarget()
        Returns the value of the target parameter, or null if this parameter was not provided.

        The target parameter selects the target name of the operation.

        Returns:
        the value of the target parameter
      • setParamCopymode

        public void setParamCopymode​(java.lang.String value)
        Sets the value of the copymode parameter.

        Parameters:
        value - the value of the copymode parameter
      • setParamKeeprights

        public void setParamKeeprights​(java.lang.String value)
        Sets the value of the "keeprights" parameter.

        Parameters:
        value - the value of the "keeprights" parameter
      • setParamOverwrite

        public void setParamOverwrite​(java.lang.String paramOverwrite)
        Sets the value of the overwrite parameter.

        Parameters:
        paramOverwrite - the value of the overwrite parameter
      • setParamTarget

        public void setParamTarget​(java.lang.String value)
        Sets the value of the target parameter.

        Parameters:
        value - the value to set
      • initWorkplaceRequestValues

        protected void initWorkplaceRequestValues​(org.opencms.workplace.CmsWorkplaceSettings settings,
                                                  javax.servlet.http.HttpServletRequest request)
        Overrides:
        initWorkplaceRequestValues in class org.opencms.workplace.CmsDialog
        See Also:
        CmsWorkplace.initWorkplaceRequestValues(org.opencms.workplace.CmsWorkplaceSettings, javax.servlet.http.HttpServletRequest)
      • performDialogOperation

        protected boolean performDialogOperation()
                                          throws org.opencms.main.CmsException
        Performs the resource copying.

        Specified by:
        performDialogOperation in class CmsMultiDialog
        Returns:
        true, if the resource was copied, otherwise false
        Throws:
        org.opencms.main.CmsException - if copying is not successful
      • performSingleCopyOperation

        protected void performSingleCopyOperation​(java.lang.String source,
                                                  java.lang.String target,
                                                  java.lang.String sitePrefix,
                                                  org.opencms.file.CmsResource.CmsResourceCopyMode copyMode,
                                                  boolean overwrite)
                                           throws org.opencms.main.CmsException
        Performs the copy operation for a single VFS resource.

        Parameters:
        source - the source VFS path
        target - the target VFS path
        sitePrefix - the site prefix
        copyMode - the copy mode for siblings
        overwrite - the overwrite flag
        Throws:
        org.opencms.main.CmsException - if copying the resource fails