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

Last change on this file since 5552 was 5552, checked in by olhsha@mpi.nl, 10 years ago

Fixed issued arising after testing on localhost tomcat (completed)

  • Property svn:mime-type set to text/plain
File size: 7.2 KB
Line 
1package clarin.cmdi.componentregistry.rest;
2
3import clarin.cmdi.componentregistry.UserUnauthorizedException;
4import java.io.IOException;
5import java.io.InputStream;
6import java.text.ParseException;
7import java.util.List;
8
9import javax.ws.rs.Path;
10import javax.ws.rs.core.Response;
11import javax.xml.bind.JAXBException;
12
13import org.springframework.transaction.annotation.Transactional;
14
15import clarin.cmdi.componentregistry.AllowedAttributetypesXML;
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 REGISTRY_SPACE_PARAM = "registrySpace";
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(String registrySpace, String groupId)
52                        throws ComponentRegistryException, IOException, UserUnauthorizedException;
53
54        List<ProfileDescription> getRegisteredProfiles(String registrySpace, boolean metadataEditor, String groupId) throws ComponentRegistryException, IOException, UserUnauthorizedException;
55
56        Response getRegisteredComponent(String componentId) throws IOException;
57
58        Response getRegisteredProfile(String profileId) throws IOException;
59       
60        Response getRegisteredComponentRawType(String componentId, String rawType) throws ComponentRegistryException;
61
62       
63//      ComponentRegistry findRegistry(String id,
64//                      RegistryClosure<? extends BaseDescription> clos)
65//                      throws ComponentRegistryException;
66//
67//     
68
69        List<BaseDescription> getComponentUsage(String componentId) throws ComponentRegistryException, IOException;
70
71        List<Comment> getCommentsFromProfile(String profileId) throws ComponentRegistryException, IOException;
72
73        List<Comment> getCommentsFromComponent(String componentId) throws ComponentRegistryException, IOException;
74
75        Comment getSpecifiedCommentFromProfile(String profileId, String commentId) throws ComponentRegistryException, IOException ;
76
77        Comment getSpecifiedCommentFromComponent(String componentId, String commentId) throws ComponentRegistryException, IOException ;
78
79        /**
80         *
81         * Purely helper method for my front-end (FLEX) which only does post/get
82         * requests. The query param is checked and the "proper" method is called.
83         *
84         * @param profileId
85         * @param method
86         * @return
87         */
88        Response manipulateRegisteredProfile(String profileId, String method);
89
90        Response manipulateCommentFromProfile(String profileId, String commentId,
91                        String method);
92
93        Response manipulateCommentFromComponent(String componentId,
94                        String commentId, String method);
95
96        Response publishRegisteredProfile(String profileId, InputStream input,
97                        String name, String description, String group, String domainName);
98
99        Response updateRegisteredProfile(String profileId,
100                        InputStream input, String name, String description, String groupId,
101                        String domainName);
102
103        /**
104         *
105         * Purely helper method for my front-end (FLEX) which van only do post/get
106         * requests. The query param is checked and the "proper" method is called.
107         *
108         * @param componentId
109         * @param method
110         * @return
111         */
112        Response manipulateRegisteredComponent(String componentId, String method);
113
114        Response publishRegisteredComponent(String componentId, InputStream input,
115                        String name, String description, String groupId, String domainName);
116
117        Response updateRegisteredComponent(String componentId,
118                        InputStream input, String name, String description, String groupId,
119                        String domainName);
120
121        Response deleteRegisteredComponent(String componentId);
122
123        Response deleteRegisteredProfile(String profileId);
124
125        Response deleteCommentFromProfile(String profileId, String commentId);
126
127        Response deleteCommentFromComponent(String componentId, String commentId);
128
129        Response getRegisteredProfileRawType(String profileId, String rawType) throws ComponentRegistryException;
130
131        Response registerProfile(InputStream input, String name,
132                        String description, String groupId, String domainName);
133
134        Response registerComponent(InputStream input, String name,
135                        String description, String groupId, String domainName);
136
137        Response registerCommentInComponent(InputStream input, String componentId) throws ComponentRegistryException;
138
139        Response registerCommentInProfile(InputStream input, String profileId) throws ComponentRegistryException;
140
141        Response pingSession();
142
143        /**
144         * @param componentRegistryFactory the componentRegistryFactory to set
145         */
146        void setComponentRegistryFactory(ComponentRegistryFactory componentRegistryFactory);
147
148       
149        Rss getRssComponent(String groupId, String registrySpace, String limit)
150                        throws ComponentRegistryException, ParseException, IOException;
151
152       
153        Rss getRssProfile(String groupId, String registrySpace, String limit)
154                        throws ComponentRegistryException, ParseException, IOException;
155
156       
157        Rss getRssOfCommentsFromProfile(String profileId, String limit) throws ComponentRegistryException,
158                        JAXBException, ParseException, IOException;
159
160       
161        Rss getRssOfCommentsFromComponent(String componentId,
162                        String limit) throws ComponentRegistryException, IOException,
163                        JAXBException, ParseException;
164
165        AllowedAttributetypesXML getAllowedAttributeTypes()
166                        throws ComponentRegistryException, IOException, JAXBException,
167                        ParseException;
168       
169        void setFileNamesFromListToNull(List<CMDComponentType> listofcomponents);
170       
171        /**
172         * Get a list of groups the user is a member of
173         * @return
174         */
175        List<Group> getGroupsTheCurrentUserIsAMemberOf();
176
177        /**
178         * Get a list of groups the item is available to. For all practical reasons, this will return either 0 or 1 groups
179         * @param itemId ID of component or profile. This is not the DB id but the logical ID which is unique across components and profiles
180         * @return List of groups
181         */
182        List<Group> getGroupsTheItemIsAMemberOf(String itemId);
183       
184        /**
185         * Transfer ownership of an item (group/profile) to a group
186         * @param itemId
187         * @param groupId
188         */
189        Response transferItemOwnershipToGroup(String itemId, long groupId) throws IOException;
190       
191        /**
192         * Get any component (public or private) with the specified ID
193         * @param componentId
194         * @return
195         */
196        BaseDescription getBaseDescription(String componentId) throws ComponentRegistryException, IOException;
197
198}
Note: See TracBrowser for help on using the repository browser.