public class LinkDAO extends AbstractLogEnabled implements Serviceable, Component, Contextualizable
Link| Modifier and Type | Field and Description |
|---|---|
private Context |
_cocoonContext |
private Context |
_context |
private CurrentUserProvider |
_currentUserProvider |
private DirectoryHelper |
_directoryHelper |
private DynamicInformationProviderExtensionPoint |
_dynamicInfoExtensionPoint |
private static GroupManager |
_groupManager |
private JSONUtils |
_jsonUtils |
private ObservationManager |
_observationManager |
private AmetysObjectResolver |
_resolver |
private SiteConfigurationExtensionPoint |
_siteConfEP |
private SiteManager |
_siteManager |
private UploadManager |
_uploadManager |
private UserHelper |
_userHelper |
private static UserManager |
_userManager |
static String |
ROLE
Avalon Role
|
| Constructor and Description |
|---|
LinkDAO() |
| Modifier and Type | Method and Description |
|---|---|
protected DefaultLink |
_createLink(String name,
ModifiableTraversableAmetysObject rootNode)
Create the link object.
|
private void |
_moveDown(DefaultLink link)
Move link after its following
|
private void |
_moveFirst(DefaultLink link)
Move link the first position
|
private void |
_moveLast(DefaultLink link)
Move link to the last position.
|
private void |
_moveUp(DefaultLink link)
Move link before its preceding
|
private void |
_setLinkValues(Link link,
Map<String,Object> values) |
private void |
_setPicture(Link link,
String valueAsStr) |
private void |
_setRestrictions(Link link,
boolean grantAnyUser,
String grantedUsersAsString,
String grantedGroupsAsString) |
private void |
_setThemes(Link link,
List<String> themes) |
private void |
_setValues(Link link,
Map<String,Object> values) |
protected boolean |
_urlExists(String url,
String internalUrl,
String siteName,
String language)
Test if a link with the specified url or internal url exists in the directory.
|
protected boolean |
_urlExistsForUser(String url,
String internalUrl,
String siteName,
String language,
UserIdentity user)
Test if a link with the specified url or internal url exists in the directory for the given user.
|
void |
contextualize(Context context) |
Map<String,Object> |
convertLink2JsonObject(DefaultLink link)
Convert a link to JSON object
|
Map<String,Object> |
createLink(Map<String,Object> parameters)
Create a new link
|
Map<String,Object> |
createUserLink(Map<String,Object> parameters)
Create a new user link
|
List<String> |
deleteLinks(List<String> ids)
Delete one or multiples links
|
List<Map<String,Object>> |
getDynamicInformationProviders()
Returns the list of providers of dynamic information as json object
|
Map<String,Object> |
getLink(String id)
Get the JSON object representing a link
|
List<Map<String,Object>> |
getLinks(List<String> linkIds)
Get links infos
|
boolean |
isInternalURLAllowed(String siteName)
Determines if the restriction IP parameter is not empty
|
Map<String,Object> |
moveLink(String id,
String role)
Move a link in the list
|
void |
service(ServiceManager manager) |
Map<String,Object> |
updateLink(Map<String,Object> parameters)
Updates a link
|
enableLogging, getLogger, setupLogger, setupLogger, setupLoggerprivate static UserManager _userManager
private static GroupManager _groupManager
private UserHelper _userHelper
private AmetysObjectResolver _resolver
private ObservationManager _observationManager
private SiteManager _siteManager
private CurrentUserProvider _currentUserProvider
private UploadManager _uploadManager
private SiteConfigurationExtensionPoint _siteConfEP
private JSONUtils _jsonUtils
private DirectoryHelper _directoryHelper
private Context _cocoonContext
private DynamicInformationProviderExtensionPoint _dynamicInfoExtensionPoint
public LinkDAO()
public void service(ServiceManager manager) throws ServiceException
service in interface ServiceableServiceExceptionpublic void contextualize(Context context) throws ContextException
contextualize in interface ContextualizableContextExceptionpublic Map<String,Object> createLink(Map<String,Object> parameters)
parameters - a map of the following parameters for the link : siteName, language, url, title, content, url-alternative, picture, picture#type, picture-alternative, themes, grant-any-user, fousers, fogroupspublic Map<String,Object> createUserLink(Map<String,Object> parameters)
parameters - a map of the following parameters for the link : siteName, language, url, title, content, url-alternative, picture, picture#type, picture-alternativepublic Map<String,Object> updateLink(Map<String,Object> parameters)
parameters - a map of the following parameters for the link : siteName, language, id, url, title, content, url-alternative, picture, picture#type, picture-alternative, themes, grant-any-user, fousers, fogroupsprivate void _setValues(Link link, Map<String,Object> values)
private void _setLinkValues(Link link, Map<String,Object> values)
private void _setThemes(Link link, List<String> themes)
private void _setPicture(Link link, String valueAsStr)
private void _setRestrictions(Link link, boolean grantAnyUser, String grantedUsersAsString, String grantedGroupsAsString)
public List<String> deleteLinks(List<String> ids)
ids - a list of links' idspublic Map<String,Object> moveLink(String id, String role) throws RepositoryException
id - the link idrole - the move actionRepositoryException - if a repository error occurs.public Map<String,Object> getLink(String id)
id - the id of linkpublic boolean isInternalURLAllowed(String siteName)
siteName - the site namepublic List<Map<String,Object>> getDynamicInformationProviders()
public Map<String,Object> convertLink2JsonObject(DefaultLink link)
link - the linkpublic List<Map<String,Object>> getLinks(List<String> linkIds)
linkIds - the link idprotected boolean _urlExists(String url, String internalUrl, String siteName, String language) throws AmetysRepositoryException
url - the url to test.internalUrl - the internal url to testsiteName - the site name.language - the language.AmetysRepositoryException - if a repository error occurs.protected boolean _urlExistsForUser(String url, String internalUrl, String siteName, String language, UserIdentity user) throws AmetysRepositoryException
url - the url to test.internalUrl - the internal url to testsiteName - the site name.language - the language.user - The user identityAmetysRepositoryException - if a repository error occurs.protected DefaultLink _createLink(String name, ModifiableTraversableAmetysObject rootNode)
name - the desired link name.rootNode - the links root node.private void _moveFirst(DefaultLink link) throws RepositoryException
link - the link to moveRepositoryException - if an error occurs while exploring the repositoryprivate void _moveDown(DefaultLink link) throws RepositoryException
link - the link to move downRepositoryException - if an error occurs while exploring the repositoryprivate void _moveUp(DefaultLink link) throws RepositoryException
link - the link to move upRepositoryException - if an error occurs while exploring the repositoryprivate void _moveLast(DefaultLink link) throws RepositoryException
link - the link to move upRepositoryException - if an error occurs while exploring the repository