Class CmsCoreProvider

  • All Implemented Interfaces:
    com.google.gwt.user.client.rpc.IsSerializable

    public final class CmsCoreProvider
    extends org.opencms.gwt.shared.CmsCoreData
    Client side core data provider.

    Since:
    8.0.0
    See Also:
    CmsGwtActionElement
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.opencms.gwt.shared.CmsCoreData

        org.opencms.gwt.shared.CmsCoreData.AdeContext, org.opencms.gwt.shared.CmsCoreData.ModuleKey, org.opencms.gwt.shared.CmsCoreData.UserInfo
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static org.opencms.gwt.shared.I_CmsAutoBeanFactory AUTO_BEAN_FACTORY
      AutoBean factory instance.
      static java.lang.String VFS_PATH_SYSTEM
      Path to system folder.
      • Fields inherited from class org.opencms.gwt.shared.CmsCoreData

        DICT_NAME, KEY_GWT_BUILDID, m_serverTime, m_userInfo, META_PARAM_MODULE_KEY, PARAM_PATH, PARAM_RETURNCODE
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected CmsCoreProvider()
      Prevent instantiation.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String addSiteRoot​(java.lang.String sitePath)
      Adds the current site root of this context to the given resource name.
      void createUUID​(com.google.gwt.user.client.rpc.AsyncCallback<org.opencms.util.CmsUUID> callback)
      Creates a new CmsUUID.
      void fireEvent​(com.google.web.bindery.event.shared.Event<?> event)
      Fires a client side event.
      static CmsCoreProvider get()
      Returns the client message instance.
      java.lang.String getAdjustedSiteRoot​(java.lang.String siteRoot, java.lang.String resourcename)
      Returns the adjusted site root for a resource using the provided site root as a base.
      long getEstimatedServerTime()
      Returns the approximate time on the server.
      com.google.web.bindery.event.shared.EventBus getEventBus()
      Gets the core event bus.
      java.lang.String getExplorerLink​(java.lang.String sitePath)
      Returns the link to view the given resource in the file explorer.
      CmsUniqueActiveItemContainer getFlyoutMenuContainer()
      Gets the unique active item container which holds a reference to the currently active content element flyout menu.
      org.opencms.util.CmsUUID getLastPageId()
      Gets the page id that was last stored in sessionStorage.
      static java.lang.String getMetaElementContent​(java.lang.String nameToFind)
      Gets the content attribute of a meta tag with a given name.
      void getResourceState​(org.opencms.util.CmsUUID structureId, com.google.gwt.user.client.rpc.AsyncCallback<org.opencms.db.CmsResourceState> callback)
      Fetches the state of a resource from the server.
      java.lang.String getResourceType​(CmsFileInfo file)
      Returns the resource type name for a given filename.
      java.lang.String getResourceTypeIcon​(CmsFileInfo file)
      Returns the resource type name for a given filename.
      static org.opencms.gwt.shared.rpc.I_CmsCoreServiceAsync getService()
      Returns the core service instance.
      static org.opencms.gwt.shared.rpc.I_CmsVfsServiceAsync getVfsService()
      Returns the vfs service instance.
      boolean isIe7()
      Returns if the current user agent is IE7.
      static boolean isTouchOnly()
      Checks if the client is touch-only.
      java.lang.String link​(java.lang.String sitePath)
      Returns an absolute link given a site path.
      void lock​(java.lang.String sitePath, long loadTime, I_CmsSimpleCallback<java.lang.Boolean> callback)
      Locks the given resource with a temporary lock.
      void lock​(org.opencms.util.CmsUUID structureId, long loadTime, I_CmsSimpleCallback<java.lang.Boolean> callback)
      Locks the given resource with a temporary lock.
      void lock​(org.opencms.util.CmsUUID structureId, I_CmsSimpleCallback<java.lang.Boolean> callback)
      Locks the given resource with a temporary lock.
      void lockOrReturnError​(java.lang.String sitePath, long loadTime, I_CmsSimpleCallback<java.lang.String> callback)
      Tries to lock a resource with a given site path and returns an error if the locking fails.
      void lockOrReturnError​(java.lang.String sitePath, I_CmsSimpleCallback<java.lang.String> callback)
      Tries to lock a resource with a given site path and returns an error if the locking fails.
      void lockOrReturnError​(org.opencms.util.CmsUUID structureId, long loadTime, I_CmsSimpleCallback<java.lang.String> callback)
      Tries to lock a resource with a given structure id and returns an error if the locking fails.
      void lockOrReturnError​(org.opencms.util.CmsUUID structureId, I_CmsSimpleCallback<java.lang.String> callback)
      Tries to lock a resource with a given structure id and returns an error if the locking fails.
      java.lang.String removeSiteRoot​(java.lang.String rootPath)
      Removes the current site root prefix from the given root path, that is adjusts the resource name for the current site root.
      void setShowEditorHelp​(boolean show)  
      void substituteLinkForRootPath​(java.lang.String rootPath, I_CmsSimpleCallback<java.lang.String> callback)
      Returns the absolute link to the given root path.
      boolean unlock​(java.lang.String sitePath)
      Unlocks the given resource, synchronously.
      boolean unlock​(org.opencms.util.CmsUUID structureId)
      Unlocks the given resource, synchronously.
      • Methods inherited from class org.opencms.gwt.shared.CmsCoreData

        getAboutLink, getAdeParameters, getCategoryBaseFolder, getContentEditorBacklinkUrl, getContentEditorUrl, getDefaultWorkplaceLink, getEmbeddedDialogsUrl, getExtensionMapping, getFileExplorerLink, getIconMapping, getLocale, getLoginURL, getNavigationUri, getProjectId, getServerTime, getSharedFolder, getSiteRoot, getStructureId, getTinymce, getUploadFileSizeLimit, getUploadRestriction, getUri, getUserInfo, getVfsPrefix, getWorkplaceResourcesPrefix, getWpLanguage, getWpLocale, isHideDisabledGalleryTypes, isKeepAlive, isShowEditorHelp, isToolbarVisible, isUploadDisabled, setTinymce
      • Methods inherited from class java.lang.Object

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

      • CmsCoreProvider

        protected CmsCoreProvider()
                           throws com.google.gwt.user.client.rpc.SerializationException
        Prevent instantiation.

        Throws:
        com.google.gwt.user.client.rpc.SerializationException - if deserialization failed
    • Method Detail

      • get

        public static CmsCoreProvider get()
        Returns the client message instance.

        Returns:
        the client message instance
      • getMetaElementContent

        public static java.lang.String getMetaElementContent​(java.lang.String nameToFind)
        Gets the content attribute of a meta tag with a given name.

        Parameters:
        nameToFind - the name of the meta tag
        Returns:
        the content attribute value of the found meta tag, or null if no meta tag with the given name was found
      • getService

        public static org.opencms.gwt.shared.rpc.I_CmsCoreServiceAsync getService()
        Returns the core service instance.

        Returns:
        the core service instance
      • getVfsService

        public static org.opencms.gwt.shared.rpc.I_CmsVfsServiceAsync getVfsService()
        Returns the vfs service instance.

        Returns:
        the vfs service instance
      • isTouchOnly

        public static boolean isTouchOnly()
        Checks if the client is touch-only.

        This uses media queries, but the touch-only status can also be forcibly turned on with the request parameter __touchOnly=1.

        Returns:
        true if the client is touch-only
      • addSiteRoot

        public java.lang.String addSiteRoot​(java.lang.String sitePath)
        Adds the current site root of this context to the given resource name.

        Parameters:
        sitePath - the resource name
        Returns:
        the translated resource name including site root
        See Also:
        removeSiteRoot(String)
      • createUUID

        public void createUUID​(com.google.gwt.user.client.rpc.AsyncCallback<org.opencms.util.CmsUUID> callback)
        Creates a new CmsUUID.

        Parameters:
        callback - the callback to execute
      • fireEvent

        public void fireEvent​(com.google.web.bindery.event.shared.Event<?> event)
        Fires a client side event.

        Parameters:
        event - the event to fire
      • getAdjustedSiteRoot

        public java.lang.String getAdjustedSiteRoot​(java.lang.String siteRoot,
                                                    java.lang.String resourcename)
        Returns the adjusted site root for a resource using the provided site root as a base.

        Usually, this would be the site root for the current site. However, if a resource from the /system/ folder is requested, this will be the empty String.

        Parameters:
        siteRoot - the site root of the current site
        resourcename - the resource name to get the adjusted site root for
        Returns:
        the adjusted site root for the resource
      • getEstimatedServerTime

        public long getEstimatedServerTime()
        Returns the approximate time on the server.

        Returns:
        the approximate server time
      • getEventBus

        public com.google.web.bindery.event.shared.EventBus getEventBus()
        Gets the core event bus.

        Returns:
        the core event bus
      • getExplorerLink

        public java.lang.String getExplorerLink​(java.lang.String sitePath)
        Returns the link to view the given resource in the file explorer.

        Parameters:
        sitePath - the resource site path
        Returns:
        the link
      • getFlyoutMenuContainer

        public CmsUniqueActiveItemContainer getFlyoutMenuContainer()
        Gets the unique active item container which holds a reference to the currently active content element flyout menu.

        Returns:
        the unique active item container for flyout menus
      • getLastPageId

        public org.opencms.util.CmsUUID getLastPageId()
        Gets the page id that was last stored in sessionStorage.
        Returns:
        the page id that was last stored in session storage
      • getResourceState

        public void getResourceState​(org.opencms.util.CmsUUID structureId,
                                     com.google.gwt.user.client.rpc.AsyncCallback<org.opencms.db.CmsResourceState> callback)
        Fetches the state of a resource from the server.

        Parameters:
        structureId - the structure id of the resource
        callback - the callback which should receive the result
      • getResourceType

        public java.lang.String getResourceType​(CmsFileInfo file)
        Returns the resource type name for a given filename.

        Parameters:
        file - the file info
        Returns:
        the resource type name
      • getResourceTypeIcon

        public java.lang.String getResourceTypeIcon​(CmsFileInfo file)
        Returns the resource type name for a given filename.

        Parameters:
        file - the file info
        Returns:
        the resource type name
      • isIe7

        public boolean isIe7()
        Returns if the current user agent is IE7.

        Returns:
        true if the current user agent is IE7
      • link

        public java.lang.String link​(java.lang.String sitePath)
        Returns an absolute link given a site path.

        Parameters:
        sitePath - the site path
        Returns:
        the absolute link
      • lock

        public void lock​(org.opencms.util.CmsUUID structureId,
                         I_CmsSimpleCallback<java.lang.Boolean> callback)
        Locks the given resource with a temporary lock.

        Parameters:
        structureId - the resource structure id
        callback - the callback to execute
      • lock

        public void lock​(org.opencms.util.CmsUUID structureId,
                         long loadTime,
                         I_CmsSimpleCallback<java.lang.Boolean> callback)
        Locks the given resource with a temporary lock.

        Parameters:
        structureId - the resource structure id
        loadTime - the time when the requested resource was loaded
        callback - the callback to execute
      • lock

        public void lock​(java.lang.String sitePath,
                         long loadTime,
                         I_CmsSimpleCallback<java.lang.Boolean> callback)
        Locks the given resource with a temporary lock.

        Parameters:
        sitePath - the site path of the resource to lock
        loadTime - the time when the requested resource was loaded
        callback - the callback to execute
      • lockOrReturnError

        public void lockOrReturnError​(org.opencms.util.CmsUUID structureId,
                                      I_CmsSimpleCallback<java.lang.String> callback)
        Tries to lock a resource with a given structure id and returns an error if the locking fails.

        Parameters:
        structureId - the structure id of the resource to lock
        callback - the callback to execute
      • lockOrReturnError

        public void lockOrReturnError​(org.opencms.util.CmsUUID structureId,
                                      long loadTime,
                                      I_CmsSimpleCallback<java.lang.String> callback)
        Tries to lock a resource with a given structure id and returns an error if the locking fails.

        Parameters:
        structureId - the structure id of the resource to lock
        loadTime - the time when the requested resource was loaded
        callback - the callback to execute
      • lockOrReturnError

        public void lockOrReturnError​(java.lang.String sitePath,
                                      I_CmsSimpleCallback<java.lang.String> callback)
        Tries to lock a resource with a given site path and returns an error if the locking fails.

        If the resource does not exist yet, the next existing ancestor folder will be checked if it is lockable.

        Parameters:
        sitePath - the site path of the resource to lock
        callback - the callback to execute
      • lockOrReturnError

        public void lockOrReturnError​(java.lang.String sitePath,
                                      long loadTime,
                                      I_CmsSimpleCallback<java.lang.String> callback)
        Tries to lock a resource with a given site path and returns an error if the locking fails.

        If the resource does not exist yet, the next existing ancestor folder will be checked if it is lockable.

        Parameters:
        sitePath - the site path of the resource to lock
        loadTime - the time when the requested resource was loaded
        callback - the callback to execute
      • removeSiteRoot

        public java.lang.String removeSiteRoot​(java.lang.String rootPath)
        Removes the current site root prefix from the given root path, that is adjusts the resource name for the current site root.

        If the resource name does not start with the current site root, it is left untouched.

        Parameters:
        rootPath - the resource name
        Returns:
        the resource name adjusted for the current site root
        See Also:
        addSiteRoot(String)
      • setShowEditorHelp

        public void setShowEditorHelp​(boolean show)
        Overrides:
        setShowEditorHelp in class org.opencms.gwt.shared.CmsCoreData
        See Also:
        CmsCoreData.setShowEditorHelp(boolean)
      • substituteLinkForRootPath

        public void substituteLinkForRootPath​(java.lang.String rootPath,
                                              I_CmsSimpleCallback<java.lang.String> callback)
        Returns the absolute link to the given root path.

        Parameters:
        rootPath - the root path
        callback - the callback to execute
      • unlock

        public boolean unlock​(org.opencms.util.CmsUUID structureId)
        Unlocks the given resource, synchronously.

        Parameters:
        structureId - the resource structure id
        Returns:
        true if succeeded, if not a a warning is already shown to the user
      • unlock

        public boolean unlock​(java.lang.String sitePath)
        Unlocks the given resource, synchronously.

        Parameters:
        sitePath - the resource site path
        Returns:
        true if succeeded, if not a a warning is already shown to the user