public boolean isUniqueRootTemplateNameConstraint() {
if (getParent() != null) {
return true;
}
IOrderElementTemplateDAO orderElementTemplateDAO = Registry
.getOrderElementTemplateDAO();
if (isNewObject()) {
return !orderElementTemplateDAO
.existsRootByNameAnotherTransaction(this);
} else {
try {
OrderElementTemplate template = orderElementTemplateDAO
.findUniqueRootByName(getName());
return template.getId().equals(getId());
} catch (InstanceNotFoundException e) {
return true;
}