use of com.liferay.ide.portlet.core.model.QName in project liferay-ide by liferay.
the class NameOrQnameValidationService method compute.
@Override
public Status compute() {
Element element = context(Element.class);
String elementLabel = element.type().getLabel(false, CapitalizationType.FIRST_WORD_ONLY, false);
QName iqName = null;
String name = null;
String nsURI = null;
String localPart = null;
if (element instanceof QName) {
iqName = (QName) element;
nsURI = iqName.getNamespaceURI().text(false);
localPart = iqName.getLocalPart().text(false);
}
if (isEmptyOrNull(name) && isEmptyOrNull(nsURI) && isEmptyOrNull(localPart)) {
return Status.createErrorStatus(Resources.bind(Resources.message, elementLabel));
} else if (isEmptyOrNull(name) && (isEmptyOrNull(nsURI) || isEmptyOrNull(localPart))) {
return Status.createErrorStatus(Resources.bind(Resources.invalidQname, elementLabel));
}
return Status.createOkStatus();
}