Changeset 5591


Ignore:
Timestamp:
08/21/14 15:24:24 (10 years ago)
Author:
Twan Goosen
Message:

Newly created collection are always private. Updated protocol description to reflect this.

Location:
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/Protocol.txt

    r5512 r5591  
    3939                 description: A virtual collection will be created based on the
    4040                              representation of the virtual collection sent in
    41                               the request body.
     41                              the request body. ID and state, if provided, will be
     42                              ignored so this will always result in a private collection
     43                              with a new identifier.
    4244                 HTTP method: POST
    4345                         URI: $BASE/service/virtualcollections
  • VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/assembly/distribution.xml

    r5588 r5591  
    1515                <include>LICENSE*</include>
    1616                <include>NOTICE*</include>
     17                <include>Protocol.txt</include>
    1718            </includes>
    1819        </fileSet>
  • VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/VirtualCollectionRegistry.java

    r5543 r5591  
    102102    }
    103103
     104    /**
     105     * Will store the specified collection; it will also set the owner according
     106     * to the specified principal and set its state to
     107     * {@link VirtualCollection.State#PRIVATE}
     108     *
     109     * @param principal owner principal
     110     * @param vc collection to store
     111     * @return identifier of the persisted collection
     112     * @throws VirtualCollectionRegistryException
     113     */
    104114    public long createVirtualCollection(Principal principal,
    105115            VirtualCollection vc) throws VirtualCollectionRegistryException {
     
    124134                em.persist(user);
    125135            }
     136            vc.setOwner(user);
     137
     138            // force new collection to be private
     139            vc.setState(VirtualCollection.State.PRIVATE);
    126140
    127141            // store virtual collection
    128             vc.setOwner(user);
    129142            logger.debug("persisting new virtual collection", vc.getId());
    130143            em.persist(vc);
     
    685698        });
    686699    }
    687    
     700
    688701    private boolean isAllowedToModify(Principal principal, VirtualCollection c) {
    689702        // admin and owner are allowed to modify collections
Note: See TracChangeset for help on using the changeset viewer.