Package org.ametys.web.alias
Class AliasDAO
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.web.alias.AliasDAO
-
- All Implemented Interfaces:
Component,LogEnabled,Serviceable
public class AliasDAO extends AbstractLogEnabled implements Component, Serviceable
Class managingAliascreation, modification, deletion and moving
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_ALIAS_NAMEThe alias default namestatic PatternPAGE_PATTERNThe PAGE patternstatic StringROLEThe component's rolestatic PatternTARGET_URL_PATTERNThe URL pattern ...static PatternURL_PATTERNThe URL pattern
-
Constructor Summary
Constructors Constructor Description AliasDAO()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,Object>alias2Json(DefaultAlias alias)Represent anAliasin JSONMap<String,String>createAlias(String type, String url, String target, String siteName, String dateStr)Create an aliasMap<String,String>deleteAlias(List<String> ids)Delete an aliasMap<String,Object>getAlias(String id)Get an aliasMap<String,Object>moveAlias(String id, String role)Move an aliasvoidservice(ServiceManager smanager)Map<String,String>updateAlias(String id, String type, String url, String target, String siteName, String dateStr)Update an alias-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
PAGE_PATTERN
public static final Pattern PAGE_PATTERN
The PAGE pattern
-
URL_PATTERN
public static final Pattern URL_PATTERN
The URL pattern
-
TARGET_URL_PATTERN
public static final Pattern TARGET_URL_PATTERN
The URL pattern ... Copy of the regexp in Ametys.plugins.web.alias.AliasActions.js#_delayedInitialize
-
DEFAULT_ALIAS_NAME
public static final String DEFAULT_ALIAS_NAME
The alias default name- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AliasDAO
public AliasDAO()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
getAlias
public Map<String,Object> getAlias(String id)
Get an alias- Parameters:
id- the id of the alias to get- Returns:
- the JSON representation of the alias
-
createAlias
public Map<String,String> createAlias(String type, String url, String target, String siteName, String dateStr)
Create an alias- Parameters:
type- the type (page or url)url- the origin urltarget- the target urlsiteName- the site's namedateStr- the optional expiration date of the alias- Returns:
- a map
-
updateAlias
public Map<String,String> updateAlias(String id, String type, String url, String target, String siteName, String dateStr)
Update an alias- Parameters:
id- the id of the alias to updatetype- the type (page or url)url- the origin urltarget- the target urlsiteName- the site's namedateStr- the optional expiration date of the alias- Returns:
- a map
-
deleteAlias
public Map<String,String> deleteAlias(List<String> ids)
Delete an alias- Parameters:
ids- the list of ids of aliases to delete- Returns:
- a map
-
moveAlias
public Map<String,Object> moveAlias(String id, String role) throws RepositoryException
Move an alias- Parameters:
id- the id of the alias to moverole- the action to perform- Returns:
- an empty map
- Throws:
RepositoryException- if an error occurs
-
alias2Json
public Map<String,Object> alias2Json(DefaultAlias alias)
Represent anAliasin JSON- Parameters:
alias- The alias- Returns:
- the alias in JSON
-
-