source: ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/PublishAction.java @ 5549

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

Added group service. Tested via the tomcat on loclahots (test URI and postman), old unit tests are adjusted and work well. Todo: retest on localhost tomcat, look at run-time exceptions, add new unit tests, adjust front-end

File size: 937 bytes
Line 
1package clarin.cmdi.componentregistry.rest;
2
3import java.security.Principal;
4
5import clarin.cmdi.componentregistry.ComponentRegistry;
6import clarin.cmdi.componentregistry.ItemNotFoundException;
7import clarin.cmdi.componentregistry.UserUnauthorizedException;
8import clarin.cmdi.componentregistry.components.CMDComponentSpec;
9import clarin.cmdi.componentregistry.model.BaseDescription;
10import clarin.cmdi.componentregistry.model.RegisterResponse;
11
12public class PublishAction implements RegisterAction {
13   
14    private final Principal principal;
15
16    public PublishAction(Principal principal) {
17        this.principal = principal;
18    }
19
20    @Override
21    public int execute(BaseDescription desc, CMDComponentSpec spec, RegisterResponse response, ComponentRegistry registry) throws UserUnauthorizedException, ItemNotFoundException{
22        response.setIsInUserSpace(false);
23        return registry.publish(desc, spec, principal);
24    }
25}
Note: See TracBrowser for help on using the repository browser.