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

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

group identifier is made "groupId" everywhere, referred as a constant PARAM_GROUP

  • Property svn:mime-type set to text/plain
File size: 8.4 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//      ComponentRegistry findRegistry(String id,
63//                      RegistryClosure<? extends BaseDescription> clos)
64//                      throws ComponentRegistryException;
65//
66//     
67    List<BaseDescription> getComponentUsage(String componentId) throws ComponentRegistryException, IOException;
68
69    List<Comment> getCommentsFromProfile(String profileId) throws ComponentRegistryException, IOException;
70
71    List<Comment> getCommentsFromComponent(String componentId) throws ComponentRegistryException, IOException;
72
73    Comment getSpecifiedCommentFromProfile(String profileId, String commentId) throws ComponentRegistryException, IOException;
74
75    Comment getSpecifiedCommentFromComponent(String componentId, String commentId) throws ComponentRegistryException, IOException;
76
77    /**
78     *
79     * Purely helper method for my front-end (FLEX) which only does post/get
80     * requests. The query param is checked and the "proper" method is called.
81     *
82     * @param profileId
83     * @param method
84     * @return
85     */
86    Response manipulateRegisteredProfile(String profileId, String method);
87
88    Response manipulateCommentFromProfile(String profileId, String commentId,
89            String method);
90
91    Response manipulateCommentFromComponent(String componentId,
92            String commentId, String method);
93
94    Response publishRegisteredProfile(String profileId, InputStream input,
95            String name, String description, String group, String domainName);
96
97    Response updateRegisteredProfile(String profileId,
98            InputStream input, String name, String description, String groupId,
99            String domainName);
100
101    /**
102     *
103     * Purely helper method for my front-end (FLEX) which van only do post/get
104     * requests. The query param is checked and the "proper" method is called.
105     *
106     * @param componentId
107     * @param method
108     * @return
109     */
110    Response manipulateRegisteredComponent(String componentId, String method);
111
112    Response publishRegisteredComponent(String componentId, InputStream input,
113            String name, String description, String groupId, String domainName);
114
115    Response updateRegisteredComponent(String componentId,
116            InputStream input, String name, String description, String groupId,
117            String domainName);
118
119    Response deleteRegisteredComponent(String componentId);
120
121    Response deleteRegisteredProfile(String profileId);
122
123    Response deleteCommentFromProfile(String profileId, String commentId);
124
125    Response deleteCommentFromComponent(String componentId, String commentId);
126
127    Response getRegisteredProfileRawType(String profileId, String rawType) throws ComponentRegistryException;
128
129    Response registerProfile(InputStream input, String name,
130            String description, String groupId, String domainName);
131
132    Response registerComponent(InputStream input, String name,
133            String description, String groupId, String domainName);
134
135    Response registerCommentInComponent(InputStream input, String componentId) throws ComponentRegistryException;
136
137    Response registerCommentInProfile(InputStream input, String profileId) throws ComponentRegistryException;
138
139    Response pingSession();
140
141    /**
142     * @param componentRegistryFactory the componentRegistryFactory to set
143     */
144    void setComponentRegistryFactory(ComponentRegistryFactory componentRegistryFactory);
145
146    Rss getRssComponent(String groupId, String registrySpace, String limit)
147            throws ComponentRegistryException, ParseException, IOException;
148
149    Rss getRssProfile(String groupId, String registrySpace, String limit)
150            throws ComponentRegistryException, ParseException, IOException;
151
152    Rss getRssOfCommentsFromProfile(String profileId, String limit) throws ComponentRegistryException,
153            JAXBException, ParseException, IOException;
154
155    Rss getRssOfCommentsFromComponent(String componentId,
156            String limit) throws ComponentRegistryException, IOException,
157            JAXBException, ParseException;
158
159    AllowedAttributetypesXML getAllowedAttributeTypes()
160            throws ComponentRegistryException, IOException, JAXBException,
161            ParseException;
162
163    void setFileNamesFromListToNull(List<CMDComponentType> listofcomponents);
164
165 
166
167    /**
168     * Get any component (public or private) with the specified ID
169     *
170     * @param componentId
171     * @return
172     */
173    BaseDescription getBaseDescription(String componentId) throws ComponentRegistryException, IOException;
174
175    // Group Service
176   
177     /**
178     * Get a list of groups the user is a member of
179     *
180     * @return
181     */
182    List<Group> getGroupsTheCurrentUserIsAMemberOf();
183
184   
185   
186     /**
187     * Get a list of groups the item is available to. For all practical reasons,
188     * this will return either 0 or 1 groups
189     *
190     * @param itemId ID of component or profile. This is not the DB id but the
191     * logical ID which is unique across components and profiles
192     * @return List of groups
193     */
194    List<Group> getGroupsTheItemIsAMemberOf(String itemId);
195
196    /**
197     * Transfer ownership of an item (group/profile) to a group
198     *
199     * @param itemId
200     * @param groupId
201     */
202    Response transferItemOwnershipToGroup(String itemId, long groupId) throws IOException;
203   
204    // (added by Olha)
205   
206    Response createNewGroup(String groupName) throws IOException;
207
208    List<Group> getGroupsOwnedByUser(String pricipalName) throws IOException;
209
210    Response listGroupNames() throws IOException;
211
212    Response isOwner(String groupName) throws IOException;
213
214    Response makeGroupMember(String groupName, String principalName) throws IOException;
215   
216    //Response removeGroupMember(String groupName, String principalName) throws IOException;
217
218    Response listProfiles(String groupId) throws IOException;
219
220    Response listComponents(String groupId) throws IOException;
221
222    Response getGroupNameById(String groupId) throws IOException;
223
224    Response getGroupIdByName(String groupName) throws IOException;
225}
Note: See TracBrowser for help on using the repository browser.