| ... | |
| /** | |
| * Rule to check the name of the variable. | |
| */ | |
| @ARule( | |
| author = "michal.chmielewski@oracle.com", | |
| date = "9/14/2006", | |
| desc = "Checks that variable NCName further does not contain a period (.) in the name.", | |
| sa = 24 | |
| ) | |
| public void rule_CheckName_1 () { | |
| // Must be a valid NCName ... | |
| mChecks.checkNCName(mNode, ncName, AT_NAME ); | |
| IProblem problem ; | |
| // ... and not contain a . | |
| if (ncName.indexOf('.') >= 0) { | |
| problem = createError(); | |
| problem.setAttribute(IProblem.CONTEXT, AT_NAME); | |
| problem.fill("BPELC_VARIABLE__NO_DOT", //$NON-NLS-1$ | |
| ncName); | |
| } | |
| } | |
| /** | |
| * Rule to check the type of the variable. | |
| * | |
| * It can be either: | |
| * 1) MessageType | |
| * 2) Element | |
| * 3) Type | |
| * | |
| * Only one must be defined, more then one cannot be defined. | |
| * | |
| */ | |
| @ARule( | |
| author = "michal.chmielewski@oracle.com", | |
| date = "9/14/2006", | |
| desc = "Variable type specification (either element, messaageType, or type).", | |
| sa = 25 | |
| ) | |
| public void rule_CheckType_2 () { | |
| int typeCount = 0; | |
| IProblem problem; | |
| // Check messageType | |
| String messageType = mNode.getAttribute(AT_MESSAGE_TYPE); | |
| if (messageType != null) { | |
| typeCount += 1; | |
| fMessageTypeNode = mModelQuery.lookup(mNode, | |
| IModelQuery.LookupNode.MESSAGE_TYPE, | |
| messageType); | |
| } | |
| // Check element | |
| String element = mNode.getAttribute(AT_ELEMENT); | |
| if (element != null) { | |
| typeCount += 1; | |
| fElementNode = mModelQuery.lookup(mNode, | |
| IModelQuery.LookupNode.XSD_ELEMENT, | |
| element ); | |
| } | |
| // Check Type (XMLType) | |
| String type = mNode.getAttribute ( AT_TYPE ); | |
| if (type != null) { | |
| typeCount += 1; | |
| fTypeNode = mModelQuery.lookup(mNode, | |
| IModelQuery.LookupNode.XSD_TYPE, | |
| type ); | |
| } | |
| // Missing and too many types | |
| if (typeCount == 0) { | |
| problem = createError( ); | |
| problem.setAttribute(IProblem.CONTEXT, AT_TYPE); | |
| problem.fill( "BPELC_VARIABLE__NO_TYPE", ncName); //$NON-NLS-1$ | |
| } else if (typeCount > 1) { | |
| problem = createError( ); | |
| problem.setAttribute(IProblem.CONTEXT, AT_TYPE); | |
| problem.fill( "BPELC_VARIABLE__NO_TYPE", ncName); //$NON-NLS-1$ | |
| } | |
| } | |
| /** | |
| * Check message type node | |
| */ | |
| @ARule( | |
| sa = 10, | |
| desc = "Make sure that Message Type is visible from the import(s)", | |
| author = "michal.chmielewski@oracle.com", | |
| date = "01/25/2007" | |
| ) | |
| public void rule_CheckMessageTypeNode_4 () { | |
| if (fMessageTypeNode == null) { | |
| return ; | |
| } | |
| mChecks.checkAttributeNode (mNode, fMessageTypeNode, AT_MESSAGE_TYPE, KIND_NODE ); | |
| setValue("type",fMessageTypeNode); | |
| } | |
| ... |