File | Line |
---|
uk/ac/ebi/intenz/webapp/controller/search/SearchProposedAction.java | 76 |
uk/ac/ebi/intenz/webapp/controller/search/SearchSuggestedAction.java | 76 |
EnzymeEntry enzymeEntry = (EnzymeEntry) proposedList.get(iii);
GhostEnzymeDTO ghostEnzymeDTO = new GhostEnzymeDTO();
ghostEnzymeDTO.setEnzymeId(enzymeEntry.getId().toString());
ghostEnzymeDTO.setEc(enzymeEntry.getEc().toString());
List commonNames = enzymeEntry.getCommonNames();
for (int jjj = 0; jjj < commonNames.size(); jjj++) {
EnzymeName commonName = (EnzymeName) commonNames.get(jjj);
if (commonName.getView().isInIntEnzView()) {
ghostEnzymeDTO.setName(encoding.xml2Display(commonName.getName(), encodingType));
break;
}
}
ghostEnzymeDTO.setSource(enzymeEntry.getSource().toString());
ghostEnzymeDTO.setStatus(enzymeEntry.getStatus().toString());
final HistoryEvent latestHistoryEventOfRoot = enzymeEntry.getHistory().getLatestHistoryEventOfRoot();
ghostEnzymeDTO.setEventClass(latestHistoryEventOfRoot.getEventClass().toString());
// Check whether this node has been transferred (set event class to 'TRA') or
// if it is the new enzyme in a transfer process (set event class NOT to 'TRA' but 'NEW').
if (latestHistoryEventOfRoot.getEventClass() == EventConstant.TRANSFER &&
!enzymeEntry.getHistory().isTransferredRootNode())
ghostEnzymeDTO.setEventClass(EventConstant.CREATION.toString());
ghostEnzymeDTO.setEventNote(IntEnzUtilities.linkMarkedEC(enzymeEntry.getHistory().getLatestHistoryEventOfRoot().getNote(), true));
ghostEntryList.add(ghostEnzymeDTO);
}
return ghostEntryList;
}
} |
File | Line |
---|
uk/ac/ebi/intenz/webapp/controller/helper/dtoinit/PopulateSubSubclassDTOAction.java | 78 |
uk/ac/ebi/intenz/webapp/controller/search/SearchProposedAction.java | 76 |
uk/ac/ebi/intenz/webapp/controller/search/SearchSuggestedAction.java | 76 |
EnzymeEntry enzymeEntry = (EnzymeEntry) enzymeEntries.get(iii);
GhostEnzymeDTO ghostEnzymeDTO = new GhostEnzymeDTO();
ghostEnzymeDTO.setEnzymeId(enzymeEntry.getId().toString());
ghostEnzymeDTO.setEc(enzymeEntry.getEc().toString());
List commonNames = enzymeEntry.getCommonNames();
for (int jjj = 0; jjj < commonNames.size(); jjj++) {
EnzymeName commonName = (EnzymeName) commonNames.get(jjj);
if (commonName.getView().isInIntEnzView()) {
ghostEnzymeDTO.setName(encoding.xml2Display(commonName.getName(), encodingType));
break;
}
}
ghostEnzymeDTO.setSource(enzymeEntry.getSource().toString());
ghostEnzymeDTO.setStatus(enzymeEntry.getStatus().toString());
final HistoryEvent latestHistoryEventOfRoot = enzymeEntry.getHistory().getLatestHistoryEventOfRoot();
ghostEnzymeDTO.setEventClass(latestHistoryEventOfRoot.getEventClass().toString());
// Check whether this node has been transferred (set event class to 'TRA') or
// if it is the new enzyme in a transfer process (set event class NOT to 'TRA' but 'NEW').
if (latestHistoryEventOfRoot.getEventClass() == EventConstant.TRANSFER &&
!enzymeEntry.getHistory().isTransferredRootNode())
ghostEnzymeDTO.setEventClass(EventConstant.CREATION.toString());
ghostEnzymeDTO.setEventNote(IntEnzUtilities.linkMarkedEC(enzymeEntry.getHistory().getLatestHistoryEventOfRoot().getNote(), true)); |
File | Line |
---|
uk/ac/ebi/intenz/webapp/dtos/EnzymeDTO.java | 963 |
uk/ac/ebi/intenz/webapp/utilities/IntEnzValidations.java | 333 |
errors.add("links", error);
}
}
if (enzymeLinkDTO.getDatabaseName().equals(XrefDatabaseConstant.MEROPS.getDisplayName())) {
try {
URL url = new URL(enzymeLinkDTO.getUrl());
URLConnection connection = url.openConnection();
connection.connect();
} catch (IOException e) {
ActionMessage message = new ActionMessage("errors.form.link.invalidMeropsUrl");
errors.add("links", message);
}
}
if (enzymeLinkDTO.getDatabaseName().equals(XrefDatabaseConstant.MIM.getDisplayName())) {
if (enzymeLinkDTO.getAccession() == null || enzymeLinkDTO.getAccession().equals("") ||
enzymeLinkDTO.getName() == null || enzymeLinkDTO.getName().equals("")) {
ActionMessage message = new ActionMessage("errors.form.link.MimIncomplete");
errors.add("links", message);
}
}
if (enzymeLinkDTO.getDatabaseName().equals(XrefDatabaseConstant.PROSITE.getDisplayName())) {
if (enzymeLinkDTO.getAccession() == null || enzymeLinkDTO.getAccession().equals("")) {
ActionMessage message = new ActionMessage("errors.form.link.invalidPrositeValue");
errors.add("links", message);
} else { |
File | Line |
---|
uk/ac/ebi/intenz/webapp/dtos/EnzymeDTO.java | 988 |
uk/ac/ebi/intenz/webapp/utilities/IntEnzValidations.java | 356 |
enzymeLinkDTO.setUrl(XrefDatabaseConstant.PROSITE.getUrl() + enzymeLinkDTO.getAccession());
}
}
if (enzymeLinkDTO.getDatabaseName().equals(XrefDatabaseConstant.DIAGRAM.getDisplayName())) {
if (enzymeLinkDTO.getName() == null || enzymeLinkDTO.getName().equals("")) {
ActionMessage message = new ActionMessage("errors.form.link.invalidDiagramName");
errors.add("links", message);
}
try {
URL url = new URL(enzymeLinkDTO.getUrl());
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("www-proxy.ebi.ac.uk", 8080));
HttpURLConnection connection = (HttpURLConnection) url.openConnection(proxy);
if (connection.getResponseCode() != HttpURLConnection.HTTP_OK){
ActionMessage message = new ActionMessage("errors.form.link.invalidDiagramUrl");
errors.add("links", message);
}
} catch (IOException e) {
ActionMessage message = new ActionMessage("errors.form.link.invalidDiagramUrl");
errors.add("links", message);
}
}
}
}
/**
* Validates the list of UniProt links.
* <p/>
* NB: UniProt links are generated automatically and do not contain any empty or duplicated values.
* <p/>
* <ol>
* <li>checks the link independently from the others (using its <code>validate()</code> method)</li>
* </ol>
*
* @param errors Stores errors.
* @param mapping Action mapping object.
* @param request Request object.
*/
private void validateUniProtLinks(ActionErrors errors, ActionMapping mapping, HttpServletRequest request) { |
File | Line |
---|
uk/ac/ebi/intenz/webapp/controller/modification/AmendEntryAction.java | 95 |
uk/ac/ebi/intenz/webapp/controller/modification/AmendEntryUpdateAction.java | 76 |
uk/ac/ebi/intenz/webapp/controller/modification/CreateEntryUpdateAction.java | 75 |
LOGGER.info("Amend event finished.");
} catch (SQLException e){
con.rollback();
throw e;
} catch (EcException e) {
errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("errors.application.ec.invalid", enzymeDTO.getTransferredEc()));
saveErrors(request, errors);
keepToken(request);
return mapping.getInputForward();
} catch (DeregisterException e) {
LOGGER.error(e.getMessage());
throw e;
} finally { // release lock
els.releaseLock(enzymeDTO.getId());
LOGGER.info("Lock of EC " + enzymeDTO.getEc() + " (ID: " + enzymeDTO.getEc() + " released.");
}
// Forward to 'searchEc' Action to show both entries.
LOGGER.info("Searching for EC " + enzymeDTO.getEc());
EcSearchForm ecSearchForm = new EcSearchForm();
ecSearchForm.setEc(enzymeDTO.getEc());
request.setAttribute("ecSearchForm", ecSearchForm);
return mapping.findForward(SEARCH_BY_EC_ACTION_FWD);
}
} |
File | Line |
---|
uk/ac/ebi/intenz/webapp/dtos/EnzymeDTO.java | 1144 |
uk/ac/ebi/intenz/webapp/utilities/IntEnzValidations.java | 404 |
private void removeLinkDuplicates() {
assert links != null : "Parameter 'links' must not be null.";
Set databaseNames = new HashSet();
Set checkedLinks = new HashSet();
for (int iii = 0; iii < links.size(); iii++) {
EnzymeLinkDTO enzymeLinkDTO = (EnzymeLinkDTO) links.get(iii);
if (databaseNames.contains(enzymeLinkDTO.getDatabaseName())) {
// If the given name is a valid xref name and it is a unique xref then remove it from the list.
if (XrefDatabaseConstant.isUniqueXrefDatabaseName(enzymeLinkDTO.getDatabaseName())) {
links.remove(enzymeLinkDTO);
} else { // Remove xref only if all xref values are the same.
for (Iterator it = checkedLinks.iterator(); it.hasNext();) {
EnzymeLinkDTO checkedLink = (EnzymeLinkDTO) it.next();
if (checkedLink.equals(enzymeLinkDTO)) links.remove(enzymeLinkDTO);
}
}
} else {
databaseNames.add(enzymeLinkDTO.getDatabaseName());
checkedLinks.add(enzymeLinkDTO);
}
}
}
private void removeDuplicates(List list) { |
File | Line |
---|
uk/ac/ebi/intenz/webapp/controller/modification/CreateEntryUpdateAction.java | 35 |
uk/ac/ebi/intenz/webapp/controller/modification/TransferEntryUpdateAction.java | 44 |
private final static String SEARCH_BY_EC_ACTION_FWD = "searchEc";
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
// Do standard checks in the parent's execute method.
ActionForward forward = super.execute(mapping, form, request, response);
if (forward != null) return forward;
ActionMessages errors = new ActionMessages();
EnzymeDTO enzymeDTO = (EnzymeDTO) form;
// Validate the entry's lists.
// IntEnzValidations.validateEnzymeDTOLists(enzymeDTO, errors);
// if (!errors.isEmpty()) {
// saveErrors(request, errors);
// return mapping.getInputForward();
// }
Connection con = (Connection) request.getSession().getAttribute("connection");
EntryLockSingleton els = (EntryLockSingleton) request.getSession().getServletContext().getAttribute("entryLock");
UnitOfWork unitOfWork = (UnitOfWork) request.getSession().getAttribute("uow");
try {
// Set the standard remark in the audit tables.
AuditPackageMapper auditPackageMapper = new AuditPackageMapper();
auditPackageMapper.setRemark(AuditPackageMapper.STANDARD_REMARK, con);
// Commit
LOGGER.info("Committing form data.");
unitOfWork.commit(enzymeDTO, con);
LOGGER.info("Data subimtted");
// Store event.
if (!enzymeDTO.getStatusCode().equals(Status.PRELIMINARY.getCode())){ |
File | Line |
---|
uk/ac/ebi/intenz/webapp/controller/helper/forwards/ModifyEnzymeFWDAction.java | 41 |
uk/ac/ebi/intenz/webapp/controller/modification/CurationAction.java | 36 |
Long enzymeId = new Long(enzymeDTO.getId());
// Check if the current entry is still valid.
if (request.getParameter(Constants.TOKEN_KEY) != null && !ControlFlowToken.isValid(request)) {
Map tokenHashtable = (Map) request.getSession().getAttribute("tokenHashtable");
LOGGER.debug("Entry with ID " + enzymeId + " is being discarded ...");
enzymeId = (Long) tokenHashtable.get(request.getParameter(Constants.TOKEN_KEY));
LOGGER.debug("... entry with ID " + enzymeId + " will be loaded instead.");
// Store a message to inform the user about the reload.
errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("errors.application.entry.reloaded.noec"));
saveErrors(request, errors);
// Set view where to forward to after the entry has been reloaded.
ActionForward forward = mapping.findForward(SEARCH_BY_ID_ACTION_FWD);
StringBuffer path = new StringBuffer(forward.getPath());
boolean isQuery = (path.indexOf("?") > -1);
if (isQuery) {
path.append("&view=INTENZ&reload=true&id="); |
File | Line |
---|
uk/ac/ebi/intenz/webapp/controller/helper/dtoinit/PopulateEnzymeListDTOAction.java | 67 |
uk/ac/ebi/intenz/webapp/controller/helper/dtoinit/PopulateSubSubclassDTOAction.java | 78 |
uk/ac/ebi/intenz/webapp/controller/search/SearchProposedAction.java | 76 |
uk/ac/ebi/intenz/webapp/controller/search/SearchSuggestedAction.java | 76 |
EnzymeEntry enzymeEntry = (EnzymeEntry) result.get(iii);
GhostEnzymeDTO ghostEnzymeDTO = new GhostEnzymeDTO();
ghostEnzymeDTO.setEnzymeId(enzymeEntry.getId().toString());
ghostEnzymeDTO.setEc(enzymeEntry.getEc().toString());
List commonNames = enzymeEntry.getCommonNames();
for (int jjj = 0; jjj < commonNames.size(); jjj++) {
EnzymeName commonName = (EnzymeName) commonNames.get(jjj);
if(commonName.getView().isInIntEnzView()) {
ghostEnzymeDTO.setName(encoding.xml2Display(commonName.getName(), encodingType));
break;
}
}
ghostEnzymeDTO.setSource(enzymeEntry.getSource().toString());
ghostEnzymeDTO.setStatus(enzymeEntry.getStatus().toString()); |
File | Line |
---|
uk/ac/ebi/intenz/webapp/controller/modification/AmendEntryUpdateAction.java | 38 |
uk/ac/ebi/intenz/webapp/controller/modification/CreateEntryUpdateAction.java | 37 |
uk/ac/ebi/intenz/webapp/controller/modification/TransferEntryUpdateAction.java | 46 |
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
// Do standard checks in the parent's execute method.
ActionForward forward = super.execute(mapping, form, request, response);
if (forward != null) return forward;
ActionMessages errors = new ActionMessages();
EnzymeDTO enzymeDTO = (EnzymeDTO) form;
// Validate the entry's lists.
// IntEnzValidations.validateEnzymeDTOLists(enzymeDTO, errors);
// if (!errors.isEmpty()) {
// saveErrors(request, errors);
// return mapping.getInputForward();
// }
Connection con = (Connection) request.getSession().getAttribute("connection");
EntryLockSingleton els = (EntryLockSingleton) request.getSession().getServletContext().getAttribute("entryLock");
UnitOfWork unitOfWork = (UnitOfWork) request.getSession().getAttribute("uow");
try {
// Set the standard remark in the audit tables.
AuditPackageMapper auditPackageMapper = new AuditPackageMapper();
auditPackageMapper.setRemark(AuditPackageMapper.STANDARD_REMARK, con); |
File | Line |
---|
uk/ac/ebi/intenz/webapp/controller/modification/DeleteEntryAction.java | 38 |
uk/ac/ebi/intenz/webapp/controller/modification/DeleteEntryUpdateAction.java | 31 |
private final static String SEARCH_BY_EC_ACTION_FWD = "searchEc";
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
// Do standard checks in the parent's execute method.
ActionForward forward = super.execute(mapping, form, request, response);
if (forward != null) return forward;
EnzymeDTO enzymeDTO = (EnzymeDTO) form;
// EnzymeDTO enzymeDTO = (EnzymeDTO) request.getSession().getAttribute("enzymeDTO");
Long enzymeId = new Long(enzymeDTO.getId());
Connection con = (Connection) request.getSession().getAttribute("connection");
EntryLockSingleton els = (EntryLockSingleton) request.getSession().getServletContext().getAttribute("entryLock"); |