001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: /*
043: * Created on May 18, 2005
044: *
045: * To change the template for this generated file go to
046: * Window - Preferences - Java - Code Generation - Code and Comments
047: */
048: package org.netbeans.modules.xml.wsdl.ui.actions;
049:
050: import java.util.Collection;
051: import java.util.HashSet;
052: import java.util.Iterator;
053: import java.util.List;
054: import java.util.Set;
055:
056: import javax.xml.namespace.QName;
057:
058: import org.netbeans.api.project.FileOwnerQuery;
059: import org.netbeans.api.project.Project;
060: import org.netbeans.api.project.ProjectInformation;
061: import org.netbeans.api.project.ProjectUtils;
062: import org.netbeans.modules.xml.wsdl.model.Binding;
063: import org.netbeans.modules.xml.wsdl.model.BindingFault;
064: import org.netbeans.modules.xml.wsdl.model.BindingOperation;
065: import org.netbeans.modules.xml.wsdl.model.Definitions;
066: import org.netbeans.modules.xml.wsdl.model.ExtensibilityElement;
067: import org.netbeans.modules.xml.wsdl.model.Fault;
068: import org.netbeans.modules.xml.wsdl.model.Input;
069: import org.netbeans.modules.xml.wsdl.model.Message;
070: import org.netbeans.modules.xml.wsdl.model.Operation;
071: import org.netbeans.modules.xml.wsdl.model.Output;
072: import org.netbeans.modules.xml.wsdl.model.Part;
073: import org.netbeans.modules.xml.wsdl.model.Port;
074: import org.netbeans.modules.xml.wsdl.model.PortType;
075: import org.netbeans.modules.xml.wsdl.model.Service;
076: import org.netbeans.modules.xml.wsdl.model.WSDLComponent;
077: import org.netbeans.modules.xml.wsdl.model.WSDLModel;
078: import org.netbeans.modules.xml.wsdl.ui.netbeans.module.Utility;
079: import org.netbeans.modules.xml.wsdl.ui.netbeans.module.WSDLDataObject;
080: import org.netbeans.modules.xml.xam.dom.AbstractDocumentComponent;
081: import org.openide.util.NbBundle;
082: import org.w3c.dom.Attr;
083: import org.w3c.dom.NamedNodeMap;
084:
085: /**
086: * @author radval
087: *
088: * To change the template for this generated type comment go to
089: * Window - Preferences - Java - Code Generation - Code and Comments
090: */
091: public class NameGenerator {
092:
093: private static NameGenerator mInstance;
094:
095: private static final String MESSAGE_NAME_PREFIX = NbBundle
096: .getMessage(NameGenerator.class,
097: "NameGenerator_MESSAGE_PREFIX");
098:
099: private static final String MESSAGE_PART_NAME_PREFIX = NbBundle
100: .getMessage(NameGenerator.class,
101: "NameGenerator_PART_PREFIX");
102:
103: private static final String PORTTYPE_NAME_PREFIX = NbBundle
104: .getMessage(NameGenerator.class,
105: "NameGenerator_PORTTYPE_PREFIX");
106:
107: private static final String OPERATION_NAME_PREFIX = NbBundle
108: .getMessage(NameGenerator.class,
109: "NameGenerator_OPERATION_PREFIX");
110:
111: private static final String OPERATION_INPUT_NAME_PREFIX = NbBundle
112: .getMessage(NameGenerator.class, "NameGenerator_INPUT");
113:
114: private static final String OPERATION_OUTPUT_NAME_PREFIX = NbBundle
115: .getMessage(NameGenerator.class, "NameGenerator_OUTPUT");
116:
117: private static final String OPERATION_FAULT_NAME_PREFIX = NbBundle
118: .getMessage(NameGenerator.class,
119: "NameGenerator_FAULT_PREFIX");
120:
121: private static final String BINDING_NAME_PREFIX = NbBundle
122: .getMessage(NameGenerator.class,
123: "NameGenerator_BINDING_PREFIX");
124:
125: private static final String BINDING_OPERATION_FAULT_NAME_PREFIX = NbBundle
126: .getMessage(NameGenerator.class,
127: "NameGenerator_BINDING_OPERATION_FAULT_PREFIX");
128:
129: private static final String SERVICE_NAME_PREFIX = NbBundle
130: .getMessage(NameGenerator.class,
131: "NameGenerator_SERVICE_PREFIX");
132:
133: private static final String PORT_NAME_PREFIX = NbBundle.getMessage(
134: NameGenerator.class, "NameGenerator_PORT_PREFIX");
135:
136: private static int counterStart = 1;
137:
138: private NameGenerator() {
139: //singleton constructor
140: }
141:
142: public static NameGenerator getInstance() {
143: if (mInstance == null) {
144: mInstance = new NameGenerator();
145: }
146:
147: return mInstance;
148: }
149:
150: public String generateUniqueMessageName(WSDLModel document) {
151: int counter = counterStart;
152: String messageName = MESSAGE_NAME_PREFIX + counter;
153: while (isMessageExists(messageName, document)) {
154: counter++;
155: messageName = MESSAGE_NAME_PREFIX + counter;
156: }
157:
158: return messageName;
159: }
160:
161: public String generateUniqueInputMessageName(String operationName,
162: WSDLModel document) {
163: int counter = counterStart;
164: String messageNamePrefix = operationName + "Request";
165: String messageName = messageNamePrefix;
166: while (isMessageExists(messageName, document)) {
167: messageName = messageNamePrefix + counter;
168: counter++;
169: }
170:
171: return messageName;
172: }
173:
174: public String generateUniqueOutputMessageName(String operationName,
175: WSDLModel document) {
176: int counter = counterStart;
177: String messageNamePrefix = operationName + "Response";
178: String messageName = messageNamePrefix;
179: while (isMessageExists(messageName, document)) {
180: messageName = messageNamePrefix + counter;
181: counter++;
182: }
183:
184: return messageName;
185: }
186:
187: public String generateUniqueFaultMessageName(String operationName,
188: WSDLModel document) {
189: int counter = counterStart;
190: String messageNamePrefix = operationName + "Fault";
191: String messageName = messageNamePrefix;
192: while (isMessageExists(messageName, document)) {
193: messageName = messageNamePrefix + counter;
194: counter++;
195: }
196:
197: return messageName;
198: }
199:
200: public boolean isMessageExists(String name, WSDLModel document) {
201: boolean exists = false;
202: Collection messages = document.getDefinitions().getMessages();
203:
204: Iterator it = messages.iterator();
205: while (it.hasNext()) {
206: Message message = (Message) it.next();
207: if (name.equals(message.getName())) {
208: exists = true;
209: break;
210: }
211: }
212:
213: return exists;
214: }
215:
216: public String generateUniqueMessagePartName(Message message) {
217: int counter = counterStart;
218: String messagePartName = MESSAGE_PART_NAME_PREFIX + counter;
219:
220: while (isMessagePartExists(messagePartName, message)) {
221: counter++;
222: messagePartName = MESSAGE_PART_NAME_PREFIX + counter;
223: }
224:
225: return messagePartName;
226: }
227:
228: public boolean isMessagePartExists(String name, Message message) {
229: boolean exists = false;
230: Collection parts = message.getParts();
231:
232: Iterator it = parts.iterator();
233: while (it.hasNext()) {
234: Part part = (Part) it.next();
235: if (name.equals(part.getName())) {
236: exists = true;
237: break;
238: }
239: }
240:
241: return exists;
242: }
243:
244: public String generateUniquePortTypeName(WSDLModel document) {
245: int counter = counterStart;
246: String messageName = PORTTYPE_NAME_PREFIX + counter;
247:
248: while (isPortTypeExists(messageName, document)) {
249: counter++;
250: messageName = PORTTYPE_NAME_PREFIX + counter;
251: }
252:
253: return messageName;
254: }
255:
256: public String generateUniquePortTypeName(WSDLModel document,
257: String portTypePrefix) {
258: int counter = counterStart;
259: String portTypeName = portTypePrefix;
260:
261: while (isPortTypeExists(portTypeName, document)) {
262: portTypeName = portTypePrefix + counter;
263: counter++;
264: }
265:
266: return portTypeName;
267: }
268:
269: public boolean isPortTypeExists(String name, WSDLModel document) {
270: boolean exists = false;
271: Collection portTypes = document.getDefinitions().getPortTypes();
272:
273: Iterator it = portTypes.iterator();
274: while (it.hasNext()) {
275: PortType portType = (PortType) it.next();
276: if (name.equals(portType.getName())) {
277: exists = true;
278: break;
279: }
280: }
281:
282: return exists;
283: }
284:
285: public String generateUniqueOperationName(
286: String operationNamePrefix, PortType portType) {
287: int counter = counterStart;
288: String operationName = operationNamePrefix;
289:
290: while (isOperationExists(operationName, portType)) {
291: operationName = operationNamePrefix + counter;
292: counter++;
293: }
294:
295: return operationName;
296: }
297:
298: public String generateUniqueOperationName(PortType portType) {
299: int counter = counterStart;
300: String messageName = OPERATION_NAME_PREFIX + counter;
301: while (isOperationExists(messageName, portType)) {
302: counter++;
303: messageName = OPERATION_NAME_PREFIX + counter;
304: }
305:
306: return messageName;
307: }
308:
309: public boolean isOperationExists(String name, PortType portType) {
310: boolean exists = false;
311: Collection operations = portType.getOperations();
312:
313: Iterator it = operations.iterator();
314: while (it.hasNext()) {
315: Operation operation = (Operation) it.next();
316: if (name.equals(operation.getName())) {
317: exists = true;
318: break;
319: }
320: }
321:
322: return exists;
323: }
324:
325: public String generateUniqueOperationInputName(Operation operation) {
326: Set inputNames = getAllInputs(operation);
327: int counter = counterStart;
328: String operationInputName = OPERATION_INPUT_NAME_PREFIX
329: + counter;
330: while (inputNames.contains(operationInputName)) {
331: counter++;
332: operationInputName = OPERATION_INPUT_NAME_PREFIX + counter;
333: }
334: return operationInputName;
335: }
336:
337: public Set<String> getAllInputs(Operation operation) {
338: Set<String> hashSet = new HashSet<String>();
339: PortType portType = (PortType) operation.getParent();
340: Collection operations = portType.getOperations();
341: if (operations != null) {
342: Iterator operIter = operations.iterator();
343: while (operIter.hasNext()) {
344: Operation oper = (Operation) operIter.next();
345: if (oper.getInput() != null) {
346: hashSet.add(oper.getInput().getName());
347: }
348: }
349: }
350: return hashSet;
351: }
352:
353: public boolean isOperationInputExists(Operation operation) {
354: boolean exists = false;
355:
356: Input operationInput = operation.getInput();
357:
358: if (operationInput != null) {
359: exists = true;
360: }
361: return exists;
362: }
363:
364: public String generateUniqueOperationOutputName(Operation operation) {
365: Set outputNames = getAllOutputs(operation);
366: int counter = counterStart;
367: String operationOutputName = OPERATION_OUTPUT_NAME_PREFIX
368: + counter;
369: while (outputNames.contains(operationOutputName)) {
370: counter++;
371: operationOutputName = OPERATION_OUTPUT_NAME_PREFIX
372: + counter;
373: }
374: return operationOutputName;
375: }
376:
377: public Set<String> getAllOutputs(Operation operation) {
378: Set<String> hashSet = new HashSet<String>();
379: PortType portType = (PortType) operation.getParent();
380: Collection operations = portType.getOperations();
381: if (operations != null) {
382: Iterator operIter = operations.iterator();
383: while (operIter.hasNext()) {
384: Operation oper = (Operation) operIter.next();
385: if (oper.getOutput() != null) {
386: hashSet.add(oper.getOutput().getName());
387: }
388: }
389: }
390: return hashSet;
391: }
392:
393: public boolean isOperationOutputExists(Operation operation) {
394: boolean exists = false;
395: Output operationOutput = operation.getOutput();
396:
397: if (operationOutput != null) {
398: exists = true;
399: }
400: return exists;
401: }
402:
403: public String generateUniqueOperationFaultName(Operation operation) {
404: int counter = counterStart;
405: String messageName = OPERATION_FAULT_NAME_PREFIX + counter;
406: while (isOperationFaultExists(messageName, operation)) {
407: counter++;
408: messageName = OPERATION_FAULT_NAME_PREFIX + counter;
409: }
410:
411: return messageName;
412: }
413:
414: private boolean isOperationFaultExists(String name,
415: Operation operation) {
416: boolean exists = false;
417: Collection faults = operation.getFaults();
418:
419: Iterator it = faults.iterator();
420: while (it.hasNext()) {
421: Fault fault = (Fault) it.next();
422: if (name.equals(fault.getName())) {
423: exists = true;
424: break;
425: }
426: }
427:
428: return exists;
429: }
430:
431: public String generateUniqueBindingName(WSDLModel document) {
432: int counter = counterStart;
433: String messageName = BINDING_NAME_PREFIX + counter;
434: while (isBindingExists(messageName, document)) {
435: counter++;
436: messageName = BINDING_NAME_PREFIX + counter;
437: }
438:
439: return messageName;
440: }
441:
442: public String generateUniqueBindingName(WSDLModel document,
443: String appendage) {
444: int counter = counterStart;
445: String prefix = BINDING_NAME_PREFIX + "_" + appendage;
446: String messageName = prefix + counter;
447: while (isBindingExists(messageName, document)) {
448: counter++;
449: messageName = BINDING_NAME_PREFIX + counter;
450: }
451:
452: return messageName;
453: }
454:
455: public String generateUniqueBindingName(String prefix,
456: WSDLModel document) {
457: if (prefix == null) {
458: return generateUniqueBindingName(document);
459: }
460: int counter = counterStart;
461: String messageName = prefix + counter;
462: while (isBindingExists(messageName, document)) {
463: counter++;
464: messageName = prefix + counter;
465: }
466:
467: return messageName;
468: }
469:
470: public boolean isBindingExists(String name, WSDLModel document) {
471: boolean exists = false;
472: Collection bindings = document.getDefinitions().getBindings();
473:
474: Iterator it = bindings.iterator();
475: while (it.hasNext()) {
476: Binding binding = (Binding) it.next();
477: if (name.equals(binding.getName())) {
478: exists = true;
479: break;
480: }
481: }
482:
483: return exists;
484: }
485:
486: public String generateUniqueBindingOperationFaultName(
487: BindingOperation bo) {
488: int counter = counterStart;
489: String faultName = BINDING_OPERATION_FAULT_NAME_PREFIX
490: + counter;
491: while (isBindingOperationFaultExists(faultName, bo)) {
492: counter++;
493: faultName = BINDING_OPERATION_FAULT_NAME_PREFIX + counter;
494: }
495:
496: return faultName;
497: }
498:
499: public boolean isBindingOperationFaultExists(String name,
500: BindingOperation bo) {
501: boolean exists = false;
502: Collection faults = bo.getBindingFaults();
503:
504: Iterator it = faults.iterator();
505: while (it.hasNext()) {
506: BindingFault bindingFault = (BindingFault) it.next();
507: if (name.equals(bindingFault.getName())) {
508: exists = true;
509: break;
510: }
511: }
512:
513: return exists;
514: }
515:
516: public String generateUniqueServiceName(WSDLModel document) {
517: int counter = counterStart;
518: String messageName = SERVICE_NAME_PREFIX + counter;
519: while (isServiceExists(messageName, document)) {
520: counter++;
521: messageName = SERVICE_NAME_PREFIX + counter;
522: }
523:
524: return messageName;
525: }
526:
527: public boolean isServiceExists(String name, WSDLModel document) {
528: boolean exists = false;
529: Collection services = document.getDefinitions().getServices();
530:
531: Iterator it = services.iterator();
532: while (it.hasNext()) {
533: Service service = (Service) it.next();
534: if (name.equals(service.getName())) {
535: exists = true;
536: break;
537: }
538: }
539:
540: return exists;
541: }
542:
543: public String generateUniqueServicePortName(Service service) {
544: int counter = counterStart;
545: String messageName = PORT_NAME_PREFIX + counter;
546: while (isServicePortExists(messageName, service)) {
547: counter++;
548: messageName = PORT_NAME_PREFIX + counter;
549: }
550:
551: return messageName;
552: }
553:
554: public String generateUniqueServicePortName(String prefix,
555: Service service) {
556: int counter = counterStart;
557: String messageName = prefix + counter;
558: while (isServicePortExists(messageName, service)) {
559: counter++;
560: messageName = prefix + counter;
561: }
562:
563: return messageName;
564: }
565:
566: public boolean isServicePortExists(String name, Service service) {
567: boolean exists = false;
568: Collection ports = service.getPorts();
569:
570: Iterator it = ports.iterator();
571: while (it.hasNext()) {
572: Port port = (Port) it.next();
573: if (name.equals(port.getName())) {
574: exists = true;
575: break;
576: }
577: }
578:
579: return exists;
580: }
581:
582: public String generateNamespacePrefix(
583: String optionalPrefixNameString, WSDLComponent element) {
584: return generateNamespacePrefix(optionalPrefixNameString,
585: element.getModel());
586: }
587:
588: /**
589: * Generate a unique namespace prefix for the given model. This is
590: * the same as generateNamespacePrefix(String, WSDLModel, int) with
591: * a value of zero for the counter parameter.
592: *
593: * @param prefix the desired prefix for the namespace prefix;
594: * if null, a default of "ns" will be used.
595: * @param model model in which to find unique prefix.
596: * @return the unique namespace prefix (e.g. "ns0").
597: */
598: public String generateNamespacePrefix(String prefix, WSDLModel model) {
599: return generateNamespacePrefix(prefix, model, 0);
600: }
601:
602: /**
603: * Generate a unique namespace prefix for the given model.
604: *
605: * @param prefix the desired prefix for the namespace prefix;
606: * if null, a default of "ns" will be used.
607: * @param model model in which to find unique prefix.
608: * @param counter minimum number to use as suffix (results in a
609: * prefix such as "ns" plus the value of counter).
610: * @return the unique namespace prefix (e.g. "ns0").
611: */
612: public String generateNamespacePrefix(String prefix,
613: WSDLModel model, int counter) {
614: if (prefix == null) {
615: prefix = NbBundle.getMessage(NameGenerator.class,
616: "NameGenerator_DEFAULT_PREFIX");
617: }
618: String generated = prefix + counter;
619: while (isPrefixExist(generated, model)) {
620: counter++;
621: generated = prefix + counter;
622: }
623: return generated;
624: }
625:
626: /**
627: * Does the prefix exist in the given model
628: * @param prefix the prefix
629: * @param model the model which needs to be checked
630: * @return true if prefix exists
631: */
632: public boolean isPrefixExist(String prefix, WSDLModel model) {
633: return Utility.getNamespaceURI(prefix, model) != null ? true
634: : false;
635: }
636:
637: public boolean isAttributeExists(String attrQName,
638: WSDLComponent element) {
639: if (attrQName == null) {
640: return false;
641: }
642:
643: boolean result = false;
644:
645: /*XMLAttribute[]*/////.getXmlAttributes();*/
646: NamedNodeMap attrs = ((AbstractDocumentComponent) element)
647: .getPeer().getAttributes();
648: //Collection attrs = element.getChildren(Attribute.class);
649:
650: if (attrs != null) {
651: for (int i = 0; i < attrs.getLength(); i++) {
652: Attr attr = (Attr) attrs.item(i);
653: if (attrQName.equals(attr.getName())) { //TODO:SKINIgetQualifiedName())) {
654: return true;
655: }
656:
657: }
658: }
659:
660: /* TODO:SKINI
661: Map otherAttrMap = element.getOtherAttributes();
662: if(otherAttrMap != null) {
663: if(otherAttrMap.get(attrQName) != null) {
664: result = true;
665: }
666: }*/
667:
668: return result;
669:
670: }
671:
672: public static String createNewTargetNamespace(WSDLModel model,
673: WSDLDataObject dObj) {
674: String targetNamespaceStr = null;
675:
676: StringBuffer targetNamespace = new StringBuffer(
677: "http://localhost/");
678:
679: Project project = FileOwnerQuery
680: .getOwner(dObj.getPrimaryFile());
681: if (project != null) {
682: ProjectInformation pi = ProjectUtils
683: .getInformation(project);
684: if (pi != null) {
685: targetNamespace.append(pi.getDisplayName());
686: targetNamespace.append("/");
687: }
688: }
689:
690: targetNamespace.append(dObj.getName());
691: targetNamespaceStr = targetNamespace.toString();
692:
693: return targetNamespaceStr;
694: }
695:
696: public static String generateUniqueValueForKeyAttribute(
697: WSDLComponent component, String attributeName, QName qname,
698: String prefix) {
699: WSDLComponent parent = component.getParent();
700: HashSet<String> set = new HashSet<String>();
701: List<ExtensibilityElement> list = parent
702: .getExtensibilityElements();
703: if (list != null) {
704: for (ExtensibilityElement element : list) {
705: if (element.getQName().equals(qname)
706: && element != component) {
707: if (element.getAttribute(attributeName) != null) {
708: set.add(element.getAttribute(attributeName));
709: }
710: }
711: }
712: }
713:
714: int counter = counterStart;
715: String messageName = prefix + counter;
716: while (set.contains(messageName)) {
717: counter++;
718: messageName = prefix + counter;
719: }
720:
721: return messageName;
722: }
723:
724: public static String generateUniquePartnerLinkType(
725: String partnerLinkTypeNamePrefix,
726: QName partnerLinkTypeElementQName, WSDLModel document) {
727: int counter = counterStart;
728: String partnerLinkTypeName = null;
729: String prefix = "partnerlinktype";
730: if (partnerLinkTypeNamePrefix == null) {
731: partnerLinkTypeName = prefix + counter;
732: } else {
733: partnerLinkTypeName = prefix = partnerLinkTypeNamePrefix;
734: }
735: while (isParterLinkTypeExists(partnerLinkTypeName,
736: partnerLinkTypeElementQName, document)) {
737: counter++;
738: partnerLinkTypeName = prefix + counter;
739: }
740:
741: return partnerLinkTypeName;
742: }
743:
744: private static boolean isParterLinkTypeExists(
745: String partnerLinkTypeName,
746: QName partnerLinkTypeElementQName, WSDLModel document) {
747: return findExtensibilityElementByQName(partnerLinkTypeName,
748: partnerLinkTypeElementQName, document.getDefinitions()) != null;
749: }
750:
751: private static WSDLComponent findExtensibilityElementByQName(
752: String name, QName elementQName, WSDLComponent component) {
753: if (name == null || elementQName == null
754: || elementQName.getNamespaceURI() == null
755: || elementQName.getLocalPart() == null
756: || component == null) {
757: return null;
758: }
759:
760: List<ExtensibilityElement> elements = component
761: .getExtensibilityElements();
762: Iterator<ExtensibilityElement> it = elements.iterator();
763:
764: while (it.hasNext()) {
765: ExtensibilityElement ee = it.next();
766: QName eeQName = ee.getQName();
767: String eeNamespace = eeQName.getNamespaceURI();
768: String eeLocalPart = eeQName.getLocalPart();
769:
770: if (elementQName.getNamespaceURI().equals(eeNamespace)
771: && elementQName.getLocalPart().equals(eeLocalPart)) {
772: String eeName = ee.getAttribute("name");
773: if (eeName != null && eeName.equals(name)) {
774: return ee;
775: }
776: }
777: }
778:
779: return null;
780: }
781: }
|