public class AliasDAO extends AbstractLogEnabled implements Component, Serviceable
Alias creation, modification, deletion and moving| Modifier and Type | Field and Description |
|---|---|
private AmetysObjectResolver |
_ametysObjectResolver
The Ametys object resolver
|
private SiteManager |
_siteManager
The site manager
|
static String |
DEFAULT_ALIAS_NAME
The alias default name
|
static Pattern |
PAGE_PATTERN
The PAGE pattern
|
static String |
ROLE
The component's role
|
static Pattern |
TARGET_URL_PATTERN
The URL pattern ...
|
static Pattern |
URL_PATTERN
The URL pattern
|
| Constructor and Description |
|---|
AliasDAO() |
| Modifier and Type | Method and Description |
|---|---|
private boolean |
_checkExistence(String siteName,
String url)
Checks the existence of an alias
|
private boolean |
_checkExistence(String id,
String siteName,
String url)
Checks the existence of an alias with same URL
|
private void |
_moveDown(DefaultAlias alias)
Move down.
|
private void |
_moveFirst(DefaultAlias alias)
Move first.
|
private void |
_moveLast(DefaultAlias link)
Move last.
|
private void |
_moveUp(DefaultAlias alias)
Move up.
|
Map<String,Object> |
alias2Json(DefaultAlias alias)
Represent an
Alias in JSON |
Map<String,String> |
createAlias(String type,
String url,
String target,
String siteName,
String dateStr)
Create an alias
|
Map<String,String> |
deleteAlias(List<String> ids)
Delete an alias
|
Map<String,Object> |
getAlias(String id)
Get an alias
|
private boolean |
isValidTargetUrl(String url)
Validates the url
|
private boolean |
isValidUrl(String url)
Validates the url
|
Map<String,Object> |
moveAlias(String id,
String role)
Move an alias
|
void |
service(ServiceManager smanager) |
Map<String,String> |
updateAlias(String id,
String type,
String url,
String target,
String siteName,
String dateStr)
Update an alias
|
enableLogging, getLogger, setupLogger, setupLogger, setupLoggerpublic static final Pattern PAGE_PATTERN
public static final Pattern URL_PATTERN
public static final Pattern TARGET_URL_PATTERN
public static final String DEFAULT_ALIAS_NAME
private AmetysObjectResolver _ametysObjectResolver
private SiteManager _siteManager
public AliasDAO()
public void service(ServiceManager smanager) throws ServiceException
service in interface ServiceableServiceExceptionpublic Map<String,Object> getAlias(String id)
id - the id of the alias to getpublic Map<String,String> createAlias(String type, String url, String target, String siteName, String dateStr)
type - the type (page or url)url - the origin urltarget - the target urlsiteName - the site's namedateStr - the optional expiration date of the aliaspublic Map<String,String> updateAlias(String id, String type, String url, String target, String siteName, String dateStr)
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 aliaspublic Map<String,String> deleteAlias(List<String> ids)
ids - the list of ids of aliases to deletepublic Map<String,Object> moveAlias(String id, String role) throws RepositoryException
id - the id of the alias to moverole - the action to performRepositoryException - if an error occursprivate void _moveFirst(DefaultAlias alias) throws RepositoryException
alias - the alias to moveRepositoryException - if an errors occurs while movingprivate void _moveDown(DefaultAlias alias) throws RepositoryException
alias - the alias to moveRepositoryException - if an errors occurs while movingprivate void _moveUp(DefaultAlias alias) throws RepositoryException
alias - the alias to moveRepositoryException - if an errors occurs while movingprivate void _moveLast(DefaultAlias link) throws RepositoryException
link - the alias to moveRepositoryException - if an errors occurs while movingprivate boolean _checkExistence(String id, String siteName, String url)
id - the aliassiteName - The site nameurl - The alias URLprivate boolean _checkExistence(String siteName, String url)
siteName - The site nameurl - The alias URLprivate boolean isValidUrl(String url)
url - the url to checkprivate boolean isValidTargetUrl(String url)
url - the url to checkpublic Map<String,Object> alias2Json(DefaultAlias alias)
Alias in JSONalias - The alias