private void collectValidationPointsForPortTypes() { for (QName ptName : portTypeRefNames) { PortType portType = getPortType(ptName); if (portType == null) { vResults.addError(new Message("NO_PORTTYPE", LOG, ptName)); continue; } XNode vPortTypeNode = getXNode(portType); for (Operation operation : getOperations(portType).values()) { XNode vOperationNode = getOperationXNode(vPortTypeNode, operation.getName()); if (operation.getInput() == null) { vResults.addError( new Message("WRONG_MEP", LOG, operation.getName(), portType.getQName())); continue; } javax.wsdl.Message inMsg = operation.getInput().getMessage(); if (inMsg == null) { addWarning( "Operation " + operation.getName() + " in PortType: " + portType.getQName() + " has no input message"); } else { XNode vInMsgNode = getXNode(inMsg); vInMsgNode.setFailurePoint(getInputXNode(vOperationNode, operation.getInput().getName())); vNodes.add(vInMsgNode); messageRefNames.add(inMsg.getQName()); } if (operation.getOutput() != null) { javax.wsdl.Message outMsg = operation.getOutput().getMessage(); if (outMsg == null) { addWarning( "Operation " + operation.getName() + " in PortType: " + portType.getQName() + " has no output message"); } else { XNode vOutMsgNode = getXNode(outMsg); vOutMsgNode.setFailurePoint( getOutputXNode(vOperationNode, operation.getOutput().getName())); vNodes.add(vOutMsgNode); messageRefNames.add(outMsg.getQName()); } } for (Iterator<?> iter = operation.getFaults().values().iterator(); iter.hasNext(); ) { Fault fault = (Fault) iter.next(); javax.wsdl.Message faultMsg = fault.getMessage(); XNode vFaultMsgNode = getXNode(faultMsg); vFaultMsgNode.setFailurePoint(getFaultXNode(vOperationNode, fault.getName())); vNodes.add(vFaultMsgNode); messageRefNames.add(faultMsg.getQName()); } } } }
public boolean isValid() { try { loadServices(); collectValidationPoints(); List<Document> wsdlDocs = getWSDLDocuments(); for (XNode vNode : vNodes) { if (!isExist(wsdlDocs, vNode)) { // System.out.println("Fail: " + vNode.getXPath()); FailureLocation loc = getFailureLocation(wsdlDocs, vNode.getFailurePoint()); vResults.addError( new Message( "FAILED_AT_POINT", LOG, loc.getLocation().getLineNumber(), loc.getLocation().getColumnNumber(), loc.getDocumentURI(), vNode.getPlainText())); } } } catch (Exception e) { this.vResults.addError(e.getMessage()); return false; } return vResults.isSuccessful(); }
@Override public ValidationResult validate(RenderedService entity, ValidationResult result) { SubscriberSession oldSubscriberSession = subscriberDAO.getSubscriberSessionAfterDate( entity.getSubscriberAccount(), entity.getDate()); if (oldSubscriberSession != null) { result.addError("errors.hasSessionAfterDateWithId", entity.getId()); return result; } SubscriberTariff oldSubscriberTariff = subscriberDAO.getSubscriberTariffAfterDate(entity.getSubscriberAccount(), entity.getDate()); if (oldSubscriberTariff != null) { result.addError("errors.hasTariffAfterDateWithId", entity.getId()); return result; } return result; }
private void collectValidationPointsForMessages() { for (QName msgName : messageRefNames) { javax.wsdl.Message message = getMessage(msgName); for (Iterator<?> iter = message.getParts().values().iterator(); iter.hasNext(); ) { Part part = (Part) iter.next(); QName elementName = part.getElementName(); QName typeName = part.getTypeName(); if (elementName == null && typeName == null) { vResults.addError(new Message("PART_NO_TYPES", LOG)); continue; } if (elementName != null && typeName != null) { vResults.addError(new Message("PART_NOT_UNIQUE", LOG)); continue; } if (elementName != null && typeName == null) { boolean valid = validatePartType(elementName.getNamespaceURI(), elementName.getLocalPart(), true); if (!valid) { vResults.addError( new Message( "TYPE_REF_NOT_FOUND", LOG, message.getQName(), part.getName(), elementName)); } } if (typeName != null && elementName == null) { boolean valid = validatePartType(typeName.getNamespaceURI(), typeName.getLocalPart(), false); if (!valid) { vResults.addError( new Message( "TYPE_REF_NOT_FOUND", LOG, message.getQName(), part.getName(), typeName)); } } } } }