Search in sources :

Example 1 with ImportImpl

use of com.ibm.wsdl.ImportImpl in project tdi-studio-se by Talend.

the class ServiceDiscoveryHelper method findWsdlImport.

private List<Definition> findWsdlImport(Definition definition, List<Definition> definitions, List<String> locationURIs, List<String> importNSs) {
    if (definitions == null) {
        definitions = new ArrayList<Definition>();
        definitions.add(definition);
    }
    if (locationURIs == null) {
        locationURIs = new ArrayList<String>();
    }
    if (importNSs == null) {
        importNSs = new ArrayList<String>();
    }
    if (definition.getImports() != null && !definition.getImports().isEmpty()) {
        Map imports = definition.getImports();
        for (Object key : imports.keySet()) {
            Vector importsImpl = (Vector) imports.get(key);
            for (int i = 0; i < importsImpl.size(); i++) {
                ImportImpl importImpl = (ImportImpl) importsImpl.get(i);
                if (!locationURIs.contains(importImpl.getLocationURI()) || !importNSs.contains(importImpl.getNamespaceURI())) {
                    locationURIs.add(importImpl.getLocationURI());
                    importNSs.add(importImpl.getNamespaceURI());
                    String importWsdlFileName = "importWsdl" + definitions.size() + ".wsdl";
                    importImpl.setLocationURI(importWsdlFileName);
                    Definition importDef = importImpl.getDefinition();
                    if (importDef != null) {
                        definitions.add(importDef);
                        findWsdlImport(importDef, definitions, locationURIs, importNSs);
                    }
                }
            }
        }
    }
    return definitions;
}
Also used : Definition(javax.wsdl.Definition) ImportImpl(com.ibm.wsdl.ImportImpl) Map(java.util.Map) Vector(java.util.Vector)

Aggregations

ImportImpl (com.ibm.wsdl.ImportImpl)1 Map (java.util.Map)1 Vector (java.util.Vector)1 Definition (javax.wsdl.Definition)1