source: ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/IComponentRegistryRestService.java @ 4135

Last change on this file since 4135 was 4135, checked in by George.Georgovassilis@mpi.nl, 10 years ago

#466: merged from 1.14 branch

  • Property svn:mime-type set to text/plain
File size: 8.8 KB
Line 
1package clarin.cmdi.componentregistry.rest;
2
3import java.io.IOException;
4import java.io.InputStream;
5import java.text.ParseException;
6import java.util.List;
7
8import javax.ws.rs.Path;
9import javax.ws.rs.core.Response;
10import javax.xml.bind.JAXBException;
11
12import org.springframework.transaction.annotation.Transactional;
13
14import clarin.cmdi.componentregistry.AllowedAttributetypesXML;
15import clarin.cmdi.componentregistry.ComponentRegistry;
16import clarin.cmdi.componentregistry.ComponentRegistryException;
17import clarin.cmdi.componentregistry.ComponentRegistryFactory;
18import clarin.cmdi.componentregistry.components.CMDComponentType;
19import clarin.cmdi.componentregistry.model.BaseDescription;
20import clarin.cmdi.componentregistry.model.Comment;
21import clarin.cmdi.componentregistry.model.ComponentDescription;
22import clarin.cmdi.componentregistry.model.Group;
23import clarin.cmdi.componentregistry.model.ProfileDescription;
24import clarin.cmdi.componentregistry.rss.Rss;
25
26import com.sun.jersey.spi.resource.Singleton;
27
28/**
29 *
30 * @author twago@mpi.nl
31 * @author olsha@mpi.nl
32 * @author george.georgovassilis@mpi.nl
33 *
34 */
35@Path("/registry")
36@Singleton
37@Transactional(rollbackFor=Exception.class)
38public interface IComponentRegistryRestService {
39
40        public static final String APPLICATION_BASE_URL_PARAM = "eu.clarin.cmdi.componentregistry.serviceRootUrl";
41        public static final String DATA_FORM_FIELD = "data";
42        public static final String NAME_FORM_FIELD = "name";
43        public static final String DESCRIPTION_FORM_FIELD = "description";
44        public static final String GROUP_FORM_FIELD = "group";
45        public static final String DOMAIN_FORM_FIELD = "domainName";
46        public static final String USERSPACE_PARAM = "userspace";
47        public static final String GROUPID_PARAM = "groupid";
48        public static final String METADATA_EDITOR_PARAM = "mdEditor";
49        public static final String NUMBER_OF_RSSITEMS = "limit";
50
51        List<ComponentDescription> getRegisteredComponents(boolean userspace, String groupId)
52                        throws ComponentRegistryException;
53
54        List<ProfileDescription> getRegisteredProfiles(boolean userspace,
55                        boolean metadataEditor, String groupId) throws ComponentRegistryException;
56
57        Response getRegisteredComponent(String componentId, boolean userspace)
58                        throws ComponentRegistryException;
59
60        Response getRegisteredComponentRawType(String componentId, String rawType);
61
62        ComponentRegistry findRegistry(String id,
63                        RegistryClosure<? extends BaseDescription> clos)
64                        throws ComponentRegistryException;
65
66        Response getRegisteredProfile(String profileId, boolean userspace)
67                        throws ComponentRegistryException;
68
69        List<BaseDescription> getComponentUsage(String componentId,
70                        boolean userspace) throws ComponentRegistryException;
71
72        List<Comment> getCommentsFromProfile(String profileId, boolean userspace)
73                        throws ComponentRegistryException;
74
75        List<Comment> getCommentsFromComponent(String componentId, boolean userspace)
76                        throws ComponentRegistryException;
77
78        Comment getSpecifiedCommentFromProfile(String profileId, String commentId,
79                        boolean userspace) throws ComponentRegistryException;
80
81        Comment getSpecifiedCommentFromComponent(String componentId,
82                        String commentId, boolean userspace)
83                        throws ComponentRegistryException;
84
85        /**
86         *
87         * Purely helper method for my front-end (FLEX) which only does post/get
88         * requests. The query param is checked and the "proper" method is called.
89         *
90         * @param profileId
91         * @param method
92         * @return
93         */
94        Response manipulateRegisteredProfile(String profileId, String method,
95                        boolean userspace);
96
97        Response manipulateCommentFromProfile(String profileId, String commentId,
98                        String method, boolean userspace);
99
100        Response manipulateCommentFromComponent(String componentId,
101                        String commentId, String method, boolean userspace);
102
103        Response publishRegisteredProfile(String profileId, InputStream input,
104                        String name, String description, String group, String domainName);
105
106        Response updateRegisteredProfile(String profileId, boolean userspace,
107                        InputStream input, String name, String description, String group,
108                        String domainName);
109
110        /**
111         *
112         * Purely helper method for my front-end (FLEX) which van only do post/get
113         * requests. The query param is checked and the "proper" method is called.
114         *
115         * @param componentId
116         * @param method
117         * @return
118         */
119        Response manipulateRegisteredComponent(String componentId, String method,
120                        boolean userspace);
121
122        Response publishRegisteredComponent(String componentId, InputStream input,
123                        String name, String description, String group, String domainName);
124
125        Response updateRegisteredComponent(String componentId, boolean userspace,
126                        InputStream input, String name, String description, String group,
127                        String domainName);
128
129        Response deleteRegisteredComponent(String componentId, boolean userspace);
130
131        Response deleteRegisteredProfile(String profileId, boolean userspace);
132
133        Response deleteCommentFromProfile(String profileId, String commentId,
134                        boolean userspace);
135
136        Response deleteCommentFromComponent(String componentId, String commentId,
137                        boolean userspace);
138
139        Response getRegisteredProfileRawType(String profileId, String rawType);
140
141        Response registerProfile(InputStream input, String name,
142                        String description, String group, String domainName,
143                        boolean userspace);
144
145        Response registerComponent(InputStream input, String name,
146                        String description, String group, String domainName,
147                        boolean userspace);
148
149        Response registerCommentInComponent(InputStream input, String componentId,
150                        boolean userspace) throws ComponentRegistryException;
151
152        Response registerCommentInProfile(InputStream input, String profileId,
153                        boolean userspace) throws ComponentRegistryException;
154
155        Response pingSession();
156
157        /**
158         * @param componentRegistryFactory the componentRegistryFactory to set
159         */
160        void setComponentRegistryFactory(
161                        ComponentRegistryFactory componentRegistryFactory);
162
163        /**
164         *
165         * @param userspace if "true" then profiles and components from the user's workspace, otherwise -- public
166         * @param limit the number of items to be displayed
167         * @return rss for the components in the database to which we are currently connected
168         * @throws ComponentRegistryException
169         * @throws ParseException
170         */
171        Rss getRssComponent(boolean userspace, String limit)
172                        throws ComponentRegistryException, ParseException;
173
174        /**
175         *
176         * @param userspace if "true" then profiles and components from the user's workspace, otherwise -- public
177         * @param limit the number of items to be displayed
178         * @return rss for the profiles in the database to which we are currently connected
179         * @throws ComponentRegistryException
180         * @throws ParseException
181         */
182        Rss getRssProfile(boolean userspace, String limit)
183                        throws ComponentRegistryException, ParseException;
184
185        /**
186         *
187         * @param profileId the Id of a profile whose comments are to be rss-ed
188         * @param userspace if "true" then profiles and components from the user's workspace, otherwise -- public
189         * @param limit the number of items to be displayed
190         * @return rss of the comments for a chosen profile
191         * @throws ComponentRegistryException
192         * @throws IOException
193         * @throws JAXBException
194         * @throws ParseException
195         */
196        Rss getRssOfCommentsFromProfile(String profileId, boolean userspace,
197                        String limit) throws ComponentRegistryException, IOException,
198                        JAXBException, ParseException;
199
200        /**
201         *
202         * @param componentId the Id of a component whose comments are to be rss-ed
203         * @param userspace if "true" then profiles and components from the user's workspace, otherwise -- public
204         * @param limit the number of items to be displayed
205         * @return rss of the comments for a chosen component
206         * @throws ComponentRegistryException
207         * @throws IOException
208         * @throws JAXBException
209         * @throws ParseException
210         */
211        Rss getRssOfCommentsFromComponent(String componentId, boolean userspace,
212                        String limit) throws ComponentRegistryException, IOException,
213                        JAXBException, ParseException;
214
215        AllowedAttributetypesXML getAllowedAttributeTypes()
216                        throws ComponentRegistryException, IOException, JAXBException,
217                        ParseException;
218       
219        void setFileNamesFromListToNull(List<CMDComponentType> listofcomponents);
220       
221        /**
222         * Get a list of groups the user is a member of
223         * @return
224         */
225        List<Group> getGroupsTheCurrentUserIsAMemberOf();
226
227        /**
228         * Get a list of groups the item is available to. For all practical reasons, this will return either 0 or 1 groups
229         * @param itemId ID of component or profile. This is not the DB id but the logical ID which is unique across components and profiles
230         * @return List of groups
231         */
232        List<Group> getGroupsTheItemIsAMemberOf(String itemId);
233       
234        /**
235         * Transfer ownership of an item (group/profile) to a group
236         * @param itemId
237         * @param groupId
238         */
239        void transferItemOwnershipToGroup(String itemId, long groupId);
240       
241        /**
242         * Get any component (public or private) with the specified ID
243         * @param componentId
244         * @return
245         */
246        BaseDescription getComponentDescription(String componentId) throws ComponentRegistryException;
247
248}
Note: See TracBrowser for help on using the repository browser.