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