Package org.ametys.plugins.skincommons
Class AbstractCommonSkinDAO
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.skincommons.AbstractCommonSkinDAO
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
public abstract class AbstractCommonSkinDAO
extends AbstractLogEnabled
implements Serviceable, Component
DAO for skin edition.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SkinLockManager
The lock managerprotected SiteManager
The site managerprotected SkinEditionHelper
The skin helperprotected SkinsManager
The skin managerprotected UserManager
The user managerprotected CurrentUserProvider
The current user provider -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncancelChanges
(String skinName, boolean workVersion, String toolId) Cancel the current modification to the skincheckUnsaveModifications
(String skinName) Check if there is unsaved or uncomitted changesprotected abstract void
checkUserRight
(String skinName) Check user rights and throwsAccessDeniedException
if it is not authorizedclearModifications
(String skinName, boolean workVersion) Revert changes and back to last work version or to current skincommitChanges
(String skinName, boolean quit) Commit the changes made to the skinGet lock informations on a skingetPreviewURI
(String siteName, String lang) Get the URI to preview a sitegetSkinModel
(String siteName, String skinName, String mode) Get the model for the skinsaveChanges
(String skinName, boolean quit) Save the current skin into the skin work foldervoid
service
(ServiceManager smanager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
_siteManager
The site manager -
_skinHelper
The skin helper -
_lockManager
The lock manager -
_userProvider
The current user provider -
_userManager
The user manager -
_skinsManager
The skin manager
-
-
Constructor Details
-
AbstractCommonSkinDAO
public AbstractCommonSkinDAO()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getPreviewURI
Get the URI to preview a site- Parameters:
siteName
- the site namelang
- the site langage- Returns:
- The uri
-
checkUnsaveModifications
Check if there is unsaved or uncomitted changes- Parameters:
skinName
- The skin name- Returns:
- The result
- Throws:
IOException
- if an error occurs while manipulating files
-
saveChanges
Save the current skin into the skin work folder- Parameters:
skinName
- The name of the skinquit
- True if the temp directory can be removed- Returns:
- The name of the skin
- Throws:
IOException
- if an error occurs while manipulating files
-
checkUserRight
Check user rights and throwsAccessDeniedException
if it is not authorized- Parameters:
skinName
- the skin name
-
commitChanges
Commit the changes made to the skin- Parameters:
skinName
- the name of the skinquit
- True to remove the temporary directory- Returns:
- A map with information
- Throws:
Exception
- if an error occurs when committing the skin changes
-
cancelChanges
public Map<String,Object> cancelChanges(String skinName, boolean workVersion, String toolId) throws IOException Cancel the current modification to the skin- Parameters:
skinName
- The name of the skinworkVersion
- True it is the work version, false for the temp versiontoolId
- the id of the tool- Returns:
- True if some changes were canceled
- Throws:
IOException
- if an error occurs while manipulating files
-
getSkinModel
Get the model for the skin- Parameters:
siteName
- the site name. Can be null if skinName is not null.skinName
- the skin name. Can be null if siteName is not null.mode
- the edition mode. Can be null.- Returns:
- the model's name or null if there is no model for this skin
-
getLock
Get lock informations on a skin- Parameters:
siteName
- the site name. Can be null if skinName is not null.skinName
- the skin name. Can be null if siteName is not null.- Returns:
- Informations about the lock
- Throws:
IOException
- if an error occurs
-
clearModifications
public Map<String,Object> clearModifications(String skinName, boolean workVersion) throws IOException Revert changes and back to last work version or to current skin- Parameters:
skinName
- The skin nameworkVersion
- true to get back the work version- Returns:
- The skin name in case of success or lock infos if the skin is locked.
- Throws:
IOException
- if an error occurs
-