public String uploadPolicyMindMap() {
if (policyMindMap == null) {
return "";
}
PolicyTree newtree = null;
try {
InputStream istream = new ByteArrayInputStream(policyMindMap.getData().getData());
newtree = new TreeLoader().loadFreeMindPolicyTree(istream);
} catch (Exception e) {
log.error(e.getMessage(),e);
}
if (newtree == null) {
log.error("Cannot upload policy tree.");
FacesMessages.instance().add(FacesMessage.SEVERITY_ERROR, "The uploaded file is not a valid Freemind mindmap. Maybe it is corrupted?");
return null;
}
selectedPlan.getProjectBasis().getPolicyTree().setRoot(newtree.getRoot());
return "";
}