KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > service > cmr > search > CategoryService


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.service.cmr.search;
18
19 import java.util.Collection JavaDoc;
20
21 import org.alfresco.service.cmr.repository.ChildAssociationRef;
22 import org.alfresco.service.cmr.repository.NodeRef;
23 import org.alfresco.service.cmr.repository.StoreRef;
24 import org.alfresco.service.namespace.QName;
25
26 /**
27  * Category Service
28  *
29  * The service for querying and creating categories.
30  * All other management can be carried out using the node service.
31  *
32  * Classification - the groupings of categories. There is a one-to-one mapping with aspects. For example, Region.
33  * Root Category - the top level categories in a classification. For example, Northern Europe
34  * Category - any other category below a root category
35  *
36  * @author Andy Hind
37  *
38  */

39 public interface CategoryService
40 {
41     /**
42      * Enumeration for navigation control.
43      *
44      * MEMBERS - get only category members (the things that have been classified in a category, not the sub categories)
45      * SUB_CATEGORIES - get sub categories only, not the things that hyave been classified.
46      * ALL - get both of the above
47      */

48     public enum Mode {MEMBERS, SUB_CATEGORIES, ALL};
49     
50     /**
51      * Depth from which to get nodes.
52      *
53      * IMMEDIATE - only immediate sub categories or members
54      * ANY - find subcategories or members at any level
55      */

56     public enum Depth {IMMEDIATE, ANY};
57
58     /**
59      * Get the children of a given category node
60      *
61      * @param categoryRef - the category node
62      * @param mode - the enumeration mode for what to recover
63      * @param depth - the enumeration depth for what level to recover
64      * @return a collection of all the nodes found identified by their ChildAssocRef's
65      */

66     public Collection JavaDoc<ChildAssociationRef> getChildren(NodeRef categoryRef, Mode mode, Depth depth );
67
68     /**
69      * Get a list of all the categories appropriate for a given property.
70      * The full list of categories that may be assigned for this aspect.
71      *
72      * @param aspectQName
73      * @param depth - the enumeration depth for what level to recover
74      * @return a collection of all the nodes found identified by their ChildAssocRef's
75      */

76     public Collection JavaDoc<ChildAssociationRef> getCategories(StoreRef storeRef, QName aspectQName, Depth depth );
77
78     /**
79      * Get all the classification entries
80      *
81      * @return
82      */

83     public Collection JavaDoc<ChildAssociationRef> getClassifications(StoreRef storeRef);
84
85     /**
86      * Get the root categories for an aspect/classification
87      *
88      * @param storeRef
89      * @param aspectName
90      * @return
91      */

92     public Collection JavaDoc<ChildAssociationRef> getRootCategories(StoreRef storeRef, QName aspectName);
93     
94     /**
95      * Get all the types that represent categories
96      *
97      * @return
98      */

99     public Collection JavaDoc<QName> getClassificationAspects();
100
101     /**
102      * Create a new category.
103      *
104      * This will extend the category types in the data dictionary
105      * All it needs is the type name and the attribute in which to store noderefs to categories.
106      *
107      * @param aspectName
108      * @param attributeName
109      */

110     public NodeRef createClassifiction(StoreRef storeRef, QName aspectName, String JavaDoc attributeName);
111     
112     /**
113      * Create a new root category in the given classification
114      *
115      * @param storeRef
116      * @param aspectName
117      * @param name
118      * @return
119      */

120     public NodeRef createRootCategory(StoreRef storeRef, QName aspectName, String JavaDoc name);
121     
122     /**
123      * Create a new category.
124      *
125      * @param parent
126      * @param name
127      * @return
128      */

129     public NodeRef createCategory(NodeRef parent, String JavaDoc name);
130     
131     /**
132      * Delete a classification
133      *
134      * @param storeRef
135      * @param aspectName
136      */

137     public void deleteClassification(StoreRef storeRef, QName aspectName);
138     
139     /**
140      * Delete a category
141      *
142      * @param nodeRef
143      */

144     public void deleteCategory(NodeRef nodeRef);
145 }
146
Popular Tags