use of com.amalto.workbench.detailtabs.exception.CommitValidationException in project tmdm-studio-se by Talend.
the class ComplexTypeGroupTypeCommitHandler method validateCommit.
@Override
protected void validateCommit() throws CommitValidationException {
if (getCommitedObj().getNewExtends() != null && getCommitedObj().getNewExtends().equals(getCommitedObj().getCurComplexType()))
throw new CommitValidationException(Messages.ComplexTypeXXHandler_CBaseTypeCannotbeItself);
if (Util.getParentTypes(getCommitedObj().getNewExtends()).contains(getCommitedObj().getCurComplexType()))
throw new CommitValidationException(Messages.bind(Messages.ComplexTypeXXHandler_ValidExceptionInfo, getCommitedObj().getNewExtends().getName(), getCommitedObj().getCurComplexType().getName()));
if (!getCommitedObj().isDefaultExtends()) {
XSDCompositor newBaseGroupType = Util.getComplexTypeGroupType(getCommitedObj().getNewExtends());
XSDCompositor newGroupType = getCommitedObj().getNewGroupType();
if (newBaseGroupType != null && newBaseGroupType.equals(XSDCompositor.ALL_LITERAL))
throw new CommitValidationException(Messages.bind(Messages.ComplexTypeXXHandler_ValidExceptionInfo1, getCommitedObj().getNewExtends().getName()));
if (newGroupType != null && newGroupType.equals(XSDCompositor.ALL_LITERAL))
throw new CommitValidationException(Messages.ComplexTypeXXHandler_ValidExceptionInfo2);
if (newBaseGroupType != null && !newBaseGroupType.equals(newGroupType))
throw new CommitValidationException(Messages.bind(Messages.ComplexTypeXXHandler_ValidExceptionInfo3, getCommitedObj().getNewExtends().getName()));
}
}
Aggregations