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());
}
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());
}
Aggregations