Search in sources :

Example 16 with AccountTransfer

use of org.jbei.ice.lib.account.AccountTransfer in project ice by JBEI.

the class RemoteClientModel method toDataTransferObject.

@Override
public RemoteUser toDataTransferObject() {
    RemoteUser remoteUser = new RemoteUser();
    RegistryPartner partner = new RegistryPartner();
    partner.setId(remotePartner.getId());
    partner.setUrl(remotePartner.getUrl());
    partner.setName(remotePartner.getName());
    remoteUser.setPartner(partner);
    AccountTransfer accountTransfer = new AccountTransfer();
    accountTransfer.setEmail(email);
    remoteUser.setUser(accountTransfer);
    return remoteUser;
}
Also used : RemoteUser(org.jbei.ice.lib.dto.web.RemoteUser) RegistryPartner(org.jbei.ice.lib.dto.web.RegistryPartner) AccountTransfer(org.jbei.ice.lib.account.AccountTransfer)

Example 17 with AccountTransfer

use of org.jbei.ice.lib.account.AccountTransfer in project ice by JBEI.

the class PartTraceSequences method getTraces.

public Results<TraceSequenceAnalysis> getTraces(int start, int limit) {
    entryAuthorization.expectRead(userId, entry);
    List<TraceSequence> sequences = dao.getByEntry(entry, start, limit);
    Results<TraceSequenceAnalysis> results = new Results<>();
    if (sequences == null)
        return results;
    for (TraceSequence traceSequence : sequences) {
        TraceSequenceAnalysis analysis = traceSequence.toDataTransferObject();
        AccountTransfer accountTransfer = new AccountTransfer();
        String depositor = traceSequence.getDepositor();
        boolean canEdit = canEdit(userId, depositor, entry);
        analysis.setCanEdit(canEdit);
        Account account = DAOFactory.getAccountDAO().getByEmail(traceSequence.getDepositor());
        if (account != null) {
            accountTransfer.setFirstName(account.getFirstName());
            accountTransfer.setLastName(account.getLastName());
            accountTransfer.setEmail(account.getEmail());
            accountTransfer.setId(account.getId());
        }
        analysis.setDepositor(accountTransfer);
        results.getData().add(analysis);
    }
    // get count
    int count = dao.getCountByEntry(entry);
    results.setResultCount(count);
    return results;
}
Also used : TraceSequenceAnalysis(org.jbei.ice.lib.dto.entry.TraceSequenceAnalysis) Results(org.jbei.ice.lib.dto.common.Results) AccountTransfer(org.jbei.ice.lib.account.AccountTransfer)

Example 18 with AccountTransfer

use of org.jbei.ice.lib.account.AccountTransfer in project ice by JBEI.

the class SampleService method setAccountInfo.

private void setAccountInfo(PartSample partSample, String email) {
    Account account = accountDAO.getByEmail(email);
    if (account != null)
        partSample.setDepositor(account.toDataTransferObject());
    else {
        AccountTransfer accountTransfer = new AccountTransfer();
        accountTransfer.setEmail(email);
        partSample.setDepositor(accountTransfer);
    }
}
Also used : AccountTransfer(org.jbei.ice.lib.account.AccountTransfer)

Example 19 with AccountTransfer

use of org.jbei.ice.lib.account.AccountTransfer in project ice by JBEI.

the class RemoteUsers method get.

public RemoteUser get(long partnerId, String email) {
    RemotePartnerDAO remotePartnerDAO = DAOFactory.getRemotePartnerDAO();
    RemotePartner remotePartner = remotePartnerDAO.get(partnerId);
    if (remotePartner == null)
        return null;
    RemoteContact remoteContact = new RemoteContact();
    AccountTransfer accountTransfer = remoteContact.getUser(remotePartner.getUrl(), email, remotePartner.getApiKey());
    if (accountTransfer == null)
        return null;
    RemoteUser remoteUser = new RemoteUser();
    remoteUser.setPartner(remotePartner.toDataTransferObject());
    remoteUser.setUser(accountTransfer);
    return remoteUser;
}
Also used : RemotePartnerDAO(org.jbei.ice.storage.hibernate.dao.RemotePartnerDAO) RemoteContact(org.jbei.ice.lib.net.RemoteContact) RemotePartner(org.jbei.ice.storage.model.RemotePartner) AccountTransfer(org.jbei.ice.lib.account.AccountTransfer)

Example 20 with AccountTransfer

use of org.jbei.ice.lib.account.AccountTransfer in project ice by JBEI.

the class BulkUploadController method getPendingImports.

/**
     * Retrieves list of bulk imports that are owned by the system. System ownership is assigned to
     * all bulk imports that are submitted by non-admins and indicates that it is pending approval.
     * <p>Administrative privileges are required for making this call
     *
     * @param userId account for user making request; expected to be an administrator
     * @return list of bulk imports pending verification
     */
public HashMap<String, ArrayList<BulkUploadInfo>> getPendingImports(String userId) {
    // check for admin privileges
    authorization.expectAdmin(userId);
    HashMap<String, ArrayList<BulkUploadInfo>> infoList = new HashMap<>();
    List<BulkUpload> results;
    results = dao.retrieveByStatus(BulkUploadStatus.PENDING_APPROVAL);
    if (results == null || results.isEmpty())
        return infoList;
    for (BulkUpload draft : results) {
        BulkUploadInfo info = new BulkUploadInfo();
        Account draftAccount = draft.getAccount();
        String userEmail = draftAccount.getEmail();
        AccountTransfer accountTransfer = new AccountTransfer();
        accountTransfer.setEmail(userEmail);
        accountTransfer.setFirstName(draftAccount.getFirstName());
        accountTransfer.setLastName(draftAccount.getLastName());
        info.setAccount(accountTransfer);
        info.setId(draft.getId());
        info.setLastUpdate(draft.getLastUpdateTime());
        int count = draft.getContents().size();
        info.setCount(count);
        info.setType(draft.getImportType());
        info.setCreated(draft.getCreationTime());
        info.setName(draft.getName());
        // add to list
        ArrayList<BulkUploadInfo> userList = infoList.get(userEmail);
        if (userList == null) {
            userList = new ArrayList<>();
            infoList.put(userEmail, userList);
        }
        userList.add(info);
    }
    return infoList;
}
Also used : AccountTransfer(org.jbei.ice.lib.account.AccountTransfer)

Aggregations

AccountTransfer (org.jbei.ice.lib.account.AccountTransfer)31 Account (org.jbei.ice.storage.model.Account)10 UserGroup (org.jbei.ice.lib.dto.group.UserGroup)6 RemotePartner (org.jbei.ice.storage.model.RemotePartner)6 RemoteUser (org.jbei.ice.lib.dto.web.RemoteUser)5 AccessPermission (org.jbei.ice.lib.dto.access.AccessPermission)4 FolderDetails (org.jbei.ice.lib.dto.folder.FolderDetails)4 Group (org.jbei.ice.storage.model.Group)4 PermissionException (org.jbei.ice.lib.access.PermissionException)3 Results (org.jbei.ice.lib.dto.common.Results)3 RegistryPartner (org.jbei.ice.lib.dto.web.RegistryPartner)3 Folder (org.jbei.ice.storage.model.Folder)3 Test (org.junit.Test)3 TraceSequenceAnalysis (org.jbei.ice.lib.dto.entry.TraceSequenceAnalysis)2 Message (org.jbei.ice.storage.model.Message)2 RemoteClientModel (org.jbei.ice.storage.model.RemoteClientModel)2 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 RemoteAccess (org.jbei.ice.lib.access.RemoteAccess)1 AccountController (org.jbei.ice.lib.account.AccountController)1