Search in sources :

Example 1 with Collections

use of org.jbei.ice.lib.folder.collection.Collections in project ice by JBEI.

the class CollectionResource method getCollectionStats.

/**
     * Retrieve the statistics (counts) of all the collections for the specified user
     */
@GET
@Path("/counts")
@Produces(MediaType.APPLICATION_JSON)
public Response getCollectionStats() {
    String userId = super.requireUserId();
    Collections collections = new Collections(userId);
    return super.respond(collections.getAllCounts());
}
Also used : Collections(org.jbei.ice.lib.folder.collection.Collections)

Example 2 with Collections

use of org.jbei.ice.lib.folder.collection.Collections in project ice by JBEI.

the class RemoteAccessTest method testAdd.

@Test
public void testAdd() throws Exception {
    Account account = AccountCreator.createTestAccount("RemoteAccessTest.testAdd", false);
    RemoteAccess remoteAccess = new RemoteAccess();
    RemotePartner partner = new RemotePartner();
    partner.setUrl("registry.jbei.org");
    partner = DAOFactory.getRemotePartnerDAO().create(partner);
    // create permission to share with this user
    AccessPermission permission = new AccessPermission();
    AccountTransfer accountTransfer = new AccountTransfer();
    accountTransfer.setEmail("I wanna share from far away");
    permission.setAccount(accountTransfer);
    permission.setDisplay("Folder Name");
    permission.setUserId(account.getEmail());
    permission.setType(AccessPermission.Type.READ_FOLDER);
    permission.setSecret("supersekrit");
    remoteAccess.add(partner.toDataTransferObject(), permission);
    Collections collections = new Collections(account.getEmail());
    List<FolderDetails> subFolders = collections.getSubFolders(CollectionType.SHARED);
    Assert.assertEquals(1, subFolders.size());
}
Also used : Account(org.jbei.ice.storage.model.Account) RemotePartner(org.jbei.ice.storage.model.RemotePartner) AccessPermission(org.jbei.ice.lib.dto.access.AccessPermission) FolderDetails(org.jbei.ice.lib.dto.folder.FolderDetails) Collections(org.jbei.ice.lib.folder.collection.Collections) AccountTransfer(org.jbei.ice.lib.account.AccountTransfer) Test(org.junit.Test)

Aggregations

Collections (org.jbei.ice.lib.folder.collection.Collections)2 AccountTransfer (org.jbei.ice.lib.account.AccountTransfer)1 AccessPermission (org.jbei.ice.lib.dto.access.AccessPermission)1 FolderDetails (org.jbei.ice.lib.dto.folder.FolderDetails)1 Account (org.jbei.ice.storage.model.Account)1 RemotePartner (org.jbei.ice.storage.model.RemotePartner)1 Test (org.junit.Test)1