mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Tagging Service: Initial implmentation of the tagging service, including tag scopes
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@9630 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -27,19 +27,68 @@ package org.alfresco.service.cmr.preference;
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.service.Auditable;
|
||||
|
||||
/**
|
||||
* @author Roy Wetherall
|
||||
*/
|
||||
public interface PreferenceService
|
||||
{
|
||||
/**
|
||||
* Get all preferences for a particular user
|
||||
*
|
||||
* @param userName the user name
|
||||
* @return Map<String, Serializable> a map containing the preference values, empty if none
|
||||
*/
|
||||
@Auditable(key = Auditable.Key.ARG_0, parameters = {"userName"})
|
||||
Map<String, Serializable> getPreferences(String userName);
|
||||
|
||||
|
||||
/**
|
||||
* Get the preferences for a particular user.
|
||||
* <p>
|
||||
* If no filter if provided all preferences are returned.
|
||||
* <p>
|
||||
* If a filter is provided it's used to filter the results. For example the filter
|
||||
* "alfresco.myComp" will only return filters that are in the "namespace" alfresco.myComp.
|
||||
*
|
||||
* @param userName the user name
|
||||
* @param preferenceFilter the preference filter
|
||||
* @return Map<String, Serializable> a map containing the preference values, empty if none
|
||||
*/
|
||||
@Auditable(key = Auditable.Key.ARG_0, parameters = {"userName", "preferenceFilter"})
|
||||
Map<String, Serializable> getPreferences(String userName, String preferenceFilter);
|
||||
|
||||
/**
|
||||
* Sets the preference values for a user.
|
||||
* <p>
|
||||
* Values provided overlay those already present.
|
||||
* <p>
|
||||
* Preference value names can be "namespaced" by using package notation. For example
|
||||
* "alfresc.myComp.myValue".
|
||||
*
|
||||
* @param userName the user name
|
||||
* @param preferences the preference values
|
||||
*/
|
||||
@Auditable(key = Auditable.Key.ARG_0, parameters = {"userName", "preferences"})
|
||||
void setPreferences(String userName, Map<String, Serializable> preferences);
|
||||
|
||||
/**
|
||||
* Clears all the preferences for a particular user.
|
||||
*
|
||||
* @param userName the user name
|
||||
*/
|
||||
@Auditable(key = Auditable.Key.ARG_0, parameters = {"userName"})
|
||||
void clearPreferences(String userName);
|
||||
|
||||
|
||||
/**
|
||||
* Clears the preferences for a particular user that match the filter optionally provided.
|
||||
* <p>
|
||||
* If no filter if present then all preferences are cleared.
|
||||
*
|
||||
* @param userName the user name
|
||||
* @param preferenceFilter the preference filter
|
||||
*/
|
||||
@Auditable(key = Auditable.Key.ARG_0, parameters = {"userName", "preferenceFilter"})
|
||||
void clearPreferences(String userName, String preferenceFilter);
|
||||
|
||||
}
|
||||
|
47
source/java/org/alfresco/service/cmr/tagging/TagDetails.java
Normal file
47
source/java/org/alfresco/service/cmr/tagging/TagDetails.java
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.service.cmr.tagging;
|
||||
|
||||
/**
|
||||
* Tag details interface.
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
*/
|
||||
public interface TagDetails extends Comparable<TagDetails>
|
||||
{
|
||||
/**
|
||||
* Get the name of the tag
|
||||
*
|
||||
* @return String tag name
|
||||
*/
|
||||
String getTagName();
|
||||
|
||||
/**
|
||||
* Get the tag count
|
||||
*
|
||||
* @return int tag count
|
||||
*/
|
||||
int getTagCount();
|
||||
}
|
49
source/java/org/alfresco/service/cmr/tagging/TagScope.java
Normal file
49
source/java/org/alfresco/service/cmr/tagging/TagScope.java
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.service.cmr.tagging;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
|
||||
/**
|
||||
* Tag Scope Inteface.
|
||||
*
|
||||
* Represents the roll up of tags within the scope of a node tree.
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
*/
|
||||
public interface TagScope
|
||||
{
|
||||
NodeRef getNodeRef();
|
||||
|
||||
List<TagDetails> getTags();
|
||||
|
||||
List<TagDetails> getTags(int topN);
|
||||
|
||||
TagDetails getTag(String tag);
|
||||
|
||||
boolean isTagInScope(String tag);
|
||||
}
|
135
source/java/org/alfresco/service/cmr/tagging/TaggingService.java
Normal file
135
source/java/org/alfresco/service/cmr/tagging/TaggingService.java
Normal file
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.service.cmr.tagging;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
|
||||
/**
|
||||
* @author Roy Wetherall
|
||||
*/
|
||||
public interface TaggingService
|
||||
{
|
||||
/**
|
||||
* Indicates whether the tag already exists
|
||||
*
|
||||
* @param tag
|
||||
* @return
|
||||
*/
|
||||
boolean isTag(StoreRef storeRef, String tag);
|
||||
|
||||
/**
|
||||
* Get all the tags currently available
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<String> getTags(StoreRef storeRef);
|
||||
|
||||
/**
|
||||
* Create a new tag
|
||||
*
|
||||
* @param tag
|
||||
*/
|
||||
void createTag(StoreRef storeRef, String tag);
|
||||
|
||||
/**
|
||||
* Add a tag to a node. Creating the tag if it does not already exist.
|
||||
*
|
||||
* @param nodeRef
|
||||
* @param tag
|
||||
*/
|
||||
void addTag(NodeRef nodeRef, String tag);
|
||||
|
||||
/**
|
||||
* Remove a tag from a node.
|
||||
*
|
||||
* @param nodeRef
|
||||
* @param tag
|
||||
*/
|
||||
void removeTag(NodeRef nodeRef, String tag);
|
||||
|
||||
/**
|
||||
* Get all the tags on a node
|
||||
*
|
||||
* @param nodeRef
|
||||
* @return
|
||||
*/
|
||||
List<String> getTags(NodeRef nodeRef);
|
||||
|
||||
/**
|
||||
* Adds a tag scope to the specified node
|
||||
*
|
||||
* @param nodeRef node reference
|
||||
*/
|
||||
void addTagScope(NodeRef nodeRef);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param nodeRef
|
||||
*/
|
||||
void removeTagScope(NodeRef nodeRef);
|
||||
|
||||
/**
|
||||
* Finds the 'nearest' tag scope for the specified node.
|
||||
* <p>
|
||||
* The 'nearest' tag scope is discovered by walking up the primary parent path
|
||||
* untill a tag scope is found or the root node is reached.
|
||||
* <p>
|
||||
* If no tag scope if found then a null value is returned.
|
||||
*
|
||||
* @param nodeRef node reference
|
||||
* @return the 'nearest' tag scope or null if none found
|
||||
*/
|
||||
TagScope findTagScope(NodeRef nodeRef);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param nodeRef
|
||||
* @return
|
||||
*/
|
||||
List<TagScope> findAllTagScopes(NodeRef nodeRef);
|
||||
|
||||
/**
|
||||
* Find all nodes that have been tagged with the specified tag.
|
||||
*
|
||||
* @param tag tag name
|
||||
* @return List<NodeRef> list of nodes tagged with specified tag, empty of none found
|
||||
*/
|
||||
List<NodeRef> findTaggedNodes(String tag);
|
||||
|
||||
/**
|
||||
* Find all nodes that have been tagged with the specified tag and reside within
|
||||
* the tag scope.
|
||||
*
|
||||
* @param tag
|
||||
* @param tagScope
|
||||
* @return
|
||||
*/
|
||||
List<NodeRef> findTaggedNodes(String tag, TagScope tagScope);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user