Map<String, String> referenceMap = new HashMap<String, String>();
referenceMap.put("deleteelementtype", "Delete this particular Tree");
Long treeID = Long.parseLong(request.getParameter("treeid"));
PhyloTree pTree = getPhyloTreeService().findByID(treeID);
/*if (pTree.getStudy() != null) { // It means this tree is tied to analysis step
referenceMap.put("generalmessage", "This PhyloTree is tied to an Analysis Step.");
}*/
for (Analysis analysis : pTree.getStudy().getAnalyses()) {
List<AnalysisStep> analysisStepList = analysis.getAnalysisStepsReadOnly();
for (AnalysisStep analysisStep : analysisStepList) {
List<AnalyzedData> analyzedDataSet = analysisStep.getDataSetReadOnly();
for (AnalyzedData analyzedData : analyzedDataSet) {
if (analyzedData instanceof AnalyzedTree) {
if (pTree.getId() == ((AnalyzedTree) analyzedData).getTree().getId()) {
referenceMap.put("generalmessage", "This PhyloTree is tied to an Analysis Step.");
}
}
}
}
}
referenceMap.put("deleteid", "Tree ID : " + treeID);
referenceMap.put("objectname", "Tree Label : " + pTree.getLabel());
return referenceMap;
}