Package org.ametys.plugins.skincommons
Class CommonSkinDAO
- java.lang.Object
-
- org.ametys.plugins.skincommons.CommonSkinDAO
-
- All Implemented Interfaces:
Component,Serviceable
public class CommonSkinDAO extends Object implements Serviceable, Component
DAO for skin edition.
-
-
Field Summary
Fields Modifier and Type Field Description private static String__TEMP_MODEprivate static String__WORK_MODEprivate SkinLockManager_lockManagerprivate SiteManager_siteManagerprivate SkinEditionHelper_skinHelperprivate SkinsManager_skinManagerprivate UserManager_userManagerprivate CurrentUserProvider_userProvider
-
Constructor Summary
Constructors Constructor Description CommonSkinDAO()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private Map<String,Object>_checkLock(String skinName)private String_getSkinName(String siteName, String skinName)Map<String,Object>cancelChanges(String skinName, boolean workVersion, String toolId)Cancel the current modification to the skinMap<String,Object>checkUnsaveModifications(String skinName)Check if there is unsaved or uncomitted changesMap<String,Object>clearModifications(String skinName, boolean workVersion)Revert changes and back to last work version or to current skinMap<String,Object>commitChanges(String skinName, boolean quit)Commit the changes made to the skinMap<String,Object>getLock(String siteName, String skinName)Get lock informations on a skinStringgetPreviewURI(String siteName, String lang)Get the URI to preview a siteStringgetSkinModel(String siteName, String skinName, String mode)Get the model for the skinMap<String,Object>saveChanges(String skinName, boolean quit)Save the current skin into the skin work foldervoidservice(ServiceManager smanager)
-
-
-
Field Detail
-
__TEMP_MODE
private static final String __TEMP_MODE
- See Also:
- Constant Field Values
-
__WORK_MODE
private static final String __WORK_MODE
- See Also:
- Constant Field Values
-
_siteManager
private SiteManager _siteManager
-
_skinHelper
private SkinEditionHelper _skinHelper
-
_lockManager
private SkinLockManager _lockManager
-
_userProvider
private CurrentUserProvider _userProvider
-
_userManager
private UserManager _userManager
-
_skinManager
private SkinsManager _skinManager
-
-
Constructor Detail
-
CommonSkinDAO
public CommonSkinDAO()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
getPreviewURI
public String getPreviewURI(String siteName, String lang)
Get the URI to preview a site- Parameters:
siteName- the site namelang- the site langage- Returns:
- The uri
-
checkUnsaveModifications
public Map<String,Object> checkUnsaveModifications(String skinName) throws IOException
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
public Map<String,Object> saveChanges(String skinName, boolean quit) throws IOException
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
-
commitChanges
public Map<String,Object> commitChanges(String skinName, boolean quit) throws Exception
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
-
_checkLock
private Map<String,Object> _checkLock(String skinName) throws IOException
- Throws:
IOException
-
getSkinModel
public String getSkinModel(String siteName, String skinName, String mode)
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
-
_getSkinName
private String _getSkinName(String siteName, String skinName)
-
getLock
public Map<String,Object> getLock(String siteName, String skinName) throws IOException
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
-
-