@Override
public void validateObject(ProjectPath path, Validator validator) {
// check for empty name
DataDomain domain = (DataDomain) path.getObject();
String name = domain.getName();
if (Util.isEmptyString(name)) {
validator.registerError("Unnamed DataDomain.", path);
// no more name assertions
return;
}
Project project = (Project) path.getObjectParent();
if (project == null) {
return;
}
// check for duplicate names in the parent context
Iterator it = project.getChildren().iterator();
while (it.hasNext()) {
DataDomain dom = (DataDomain) it.next();
if (dom == domain) {
continue;
}
if (name.equals(dom.getName())) {
validator.registerError("Duplicate DataDomain name: " + name + ".", path);
return;
}
}
}