List of usage examples for javax.xml.registry.infomodel Organization getServices
Collection getServices() throws JAXRException;
From source file:JAXRQuery.java
/** * Searches for organizations containing a string and * displays data about them./*from w w w . java 2 s . c o m*/ * * @param qString the string argument */ public void executeQuery(String qString) { RegistryService rs = null; BusinessQueryManager bqm = null; try { // Get registry service and query manager rs = connection.getRegistryService(); bqm = rs.getBusinessQueryManager(); System.out.println("Got registry service and query manager"); // Define find qualifiers and name patterns Collection<String> findQualifiers = new ArrayList<String>(); findQualifiers.add(SORT_BY_NAME_DESC); Collection<String> namePatterns = new ArrayList<String>(); namePatterns.add("%" + qString + "%"); // Find orgs with names that contain qString BulkResponse response = bqm.findOrganizations(findQualifiers, namePatterns, null, null, null, null); Collection orgs = response.getCollection(); // Display information about the organizations found int numOrgs = 0; if (orgs.isEmpty()) { System.out.println("No organizations found"); } else { for (Object o : orgs) { numOrgs++; Organization org = (Organization) o; System.out.println("Org name: " + getName(org)); System.out.println("Org description: " + getDescription(org)); System.out.println("Org key id: " + getKey(org)); // Display primary contact information User pc = org.getPrimaryContact(); if (pc != null) { PersonName pcName = pc.getPersonName(); System.out.println(" Contact name: " + pcName.getFullName()); Collection phNums = pc.getTelephoneNumbers(null); for (Object n : phNums) { TelephoneNumber num = (TelephoneNumber) n; System.out.println(" Phone number: " + num.getNumber()); } Collection eAddrs = pc.getEmailAddresses(); for (Object a : eAddrs) { EmailAddress eAd = (EmailAddress) a; System.out.println(" Email address: " + eAd.getAddress()); } } // Display service and binding information Collection services = org.getServices(); for (Object s : services) { Service svc = (Service) s; System.out.println(" Service name: " + getName(svc)); System.out.println(" Service description: " + getDescription(svc)); Collection serviceBindings = svc.getServiceBindings(); for (Object b : serviceBindings) { ServiceBinding sb = (ServiceBinding) b; System.out.println(" Binding description: " + getDescription(sb)); System.out.println(" Access URI: " + sb.getAccessURI()); } } // Print spacer between organizations System.out.println(" --- "); } } System.out.println("Found " + numOrgs + " organization(s)"); } catch (Exception e) { e.printStackTrace(); } finally { // At end, close connection to registry if (connection != null) { try { connection.close(); } catch (JAXRException je) { } } } }
From source file:it.cnr.icar.eric.client.ui.swing.graph.JBGraph.java
/** * DOCUMENT ME!/*from ww w. j av a 2s. com*/ * * @param cell DOCUMENT ME! * @param org DOCUMENT ME! * * @return DOCUMENT ME! */ private ArrayList<DefaultGraphCell> showRelatedObjects(JBGraphCell cell, Organization org) { ArrayList<DefaultGraphCell> relatedCells = new ArrayList<DefaultGraphCell>(); if (org == null) { return relatedCells; } try { //services Collection<?> services = org.getServices(); DefaultGraphCell groupCell = createGroupFromObjectCollection(services); if (groupCell != null) { connectCells(cell, groupCell, "services", false); relatedCells.add(groupCell); } //parent Organization try { Organization parentOrg = org.getParentOrganization(); if (parentOrg != null) { JBGraphCell newCell = addRelatedObject(cell, parentOrg, new Rectangle(0, 0, 50, 50), "parent Organization", false); relatedCells.add(newCell); } } catch (UnsupportedCapabilityException e) { } //children Organizations try { Collection<?> children = org.getChildOrganizations(); groupCell = createGroupFromObjectCollection(children); if (groupCell != null) { connectCells(cell, groupCell, "parent Organization", true); relatedCells.add(groupCell); } } catch (UnsupportedCapabilityException e) { } //users Collection<?> users = org.getUsers(); groupCell = createGroupFromObjectCollection(users); if (groupCell != null) { connectCells(cell, groupCell, "users", false); relatedCells.add(groupCell); } //Primary contact /* User primContact = org.getPrimaryContact(); JBGraphCell primContactCell = (JBGraphCell)registryObjectToCellMap.get(primContact); if (primContactCell != null) { connectCells(cell, primContactCell, "primary contact", false); relatedCells.add(primContactCell); } */ } catch (JAXRException e) { RegistryBrowser.displayError(e); } return relatedCells; }
From source file:JAXRQueryPostal.java
/** * Searches for organizations containing a string and * displays data about them, including the postal address in * either the JAXR PostalAddress format or the Slot format. */*from w w w. j a v a2 s . co m*/ * @param qString the string argument */ public void executeQuery(String qString) { RegistryService rs = null; BusinessQueryManager bqm = null; try { // Get registry service and query manager rs = connection.getRegistryService(); bqm = rs.getBusinessQueryManager(); System.out.println("Got registry service and " + "query manager"); // Define find qualifiers and name patterns Collection<String> findQualifiers = new ArrayList<String>(); findQualifiers.add(SORT_BY_NAME_DESC); Collection<String> namePatterns = new ArrayList<String>(); namePatterns.add("%" + qString + "%"); // Find using the name BulkResponse response = bqm.findOrganizations(findQualifiers, namePatterns, null, null, null, null); Collection orgs = response.getCollection(); // Display information about the organizations found for (Object o : orgs) { Organization org = (Organization) o; System.out.println("Org name: " + getName(org)); System.out.println("Org description: " + getDescription(org)); System.out.println("Org key id: " + getKey(org)); // Display primary contact information User pc = org.getPrimaryContact(); if (pc != null) { PersonName pcName = pc.getPersonName(); System.out.println(" Contact name: " + pcName.getFullName()); Collection phNums = pc.getTelephoneNumbers(null); for (Object n : phNums) { TelephoneNumber num = (TelephoneNumber) n; System.out.println(" Phone number: " + num.getNumber()); } Collection eAddrs = pc.getEmailAddresses(); for (Object a : eAddrs) { EmailAddress eAd = (EmailAddress) a; System.out.println(" Email Address: " + eAd.getAddress()); } // Display postal addresses // using PostalAddress methods Collection pAddrs = pc.getPostalAddresses(); for (Object pa : pAddrs) { PostalAddress pAd = (PostalAddress) pa; System.out.println(" Postal Address (PostalAddress methods):\n " + pAd.getStreetNumber() + " " + pAd.getStreet() + "\n " + pAd.getCity() + ", " + pAd.getStateOrProvince() + " " + pAd.getPostalCode() + "\n " + pAd.getCountry()); } // Display postal addresses // using Slot methods Collection pAddrs2 = pc.getPostalAddresses(); for (Object pa2 : pAddrs2) { PostalAddress pAd = (PostalAddress) pa2; Collection slots = pAd.getSlots(); System.out.println(" Postal Address (Slot methods):"); for (Object s : slots) { Slot slot = (Slot) s; Collection values = slot.getValues(); for (Object v : values) { String line = (String) v; System.out.println(" Line: " + line); } } } } // Display service and binding information Collection services = org.getServices(); for (Object s : services) { Service svc = (Service) s; System.out.println(" Service name: " + getName(svc)); System.out.println(" Service description: " + getDescription(svc)); Collection serviceBindings = svc.getServiceBindings(); for (Object b : serviceBindings) { ServiceBinding sb = (ServiceBinding) b; System.out.println(" Binding " + "Description: " + getDescription(sb)); System.out.println(" Access URI: " + sb.getAccessURI()); } } // Print spacer between organizations System.out.println(" --- "); } } catch (Exception e) { e.printStackTrace(); } finally { // At end, close connection to registry if (connection != null) { try { connection.close(); } catch (JAXRException je) { } } } }
From source file:org.apache.ws.scout.util.ScoutJaxrUddiHelper.java
public static BusinessEntity getBusinessEntityFromJAXROrg(Organization organization) throws JAXRException { BusinessEntity biz = objectFactory.createBusinessEntity(); BusinessServices bss = objectFactory.createBusinessServices(); BusinessService[] barr = new BusinessService[0]; try {/*from ww w. j ava2s. c o m*/ // It may just be an update Key key = organization.getKey(); if (key != null && key.getId() != null) { biz.setBusinessKey(key.getId()); } else { biz.setBusinessKey(""); } // Lets get the Organization attributes at the top level InternationalString iname = organization.getName(); if (iname != null) { addNames(biz.getName(), iname); } InternationalString idesc = organization.getDescription(); addDescriptions(biz.getDescription(), idesc); if (organization.getPrimaryContact() != null && organization.getPrimaryContact().getPersonName() != null && organization.getPrimaryContact().getPersonName().getFullName() != null) { biz.setAuthorizedName(organization.getPrimaryContact().getPersonName().getFullName()); } Collection<Service> s = organization.getServices(); log.debug("?Org has services=" + s.isEmpty()); barr = new BusinessService[s.size()]; Iterator<Service> iter = s.iterator(); int barrPos = 0; while (iter.hasNext()) { BusinessService bs = ScoutJaxrUddiHelper.getBusinessServiceFromJAXRService((Service) iter.next()); barr[barrPos] = bs; barrPos++; } /* * map users : JAXR has concept of 'primary contact', which is a * special designation for one of the users, and D6.1 seems to say * that the first UDDI user is the primary contact */ Contacts cts = objectFactory.createContacts(); Contact[] carr = new Contact[0]; User primaryContact = organization.getPrimaryContact(); Collection<User> users = organization.getUsers(); // Expand array to necessary size only (xmlbeans does not like // null items in cases like this) int carrSize = 0; if (primaryContact != null) { carrSize += 1; } // TODO: Clean this up and make it more efficient Iterator<User> it = users.iterator(); while (it.hasNext()) { User u = (User) it.next(); if (u != primaryContact) { carrSize++; } } carr = new Contact[carrSize]; /* * first do primary, and then filter that out in the loop */ if (primaryContact != null) { Contact ct = getContactFromJAXRUser(primaryContact); carr[0] = ct; } it = users.iterator(); int carrPos = 1; while (it.hasNext()) { User u = (User) it.next(); if (u != primaryContact) { Contact ct = getContactFromJAXRUser(u); carr[carrPos] = ct; carrPos++; } } bss.getBusinessService().addAll(Arrays.asList(barr)); if (carr.length > 0) { cts.getContact().addAll(Arrays.asList(carr)); biz.setContacts(cts); } biz.setBusinessServices(bss); // External Links Iterator<ExternalLink> exiter = organization.getExternalLinks().iterator(); DiscoveryURLs emptyDUs = null; boolean first = true; while (exiter.hasNext()) { ExternalLink link = (ExternalLink) exiter.next(); /** Note: jUDDI adds its own discoverURL as the businessEntity* */ if (first) { emptyDUs = objectFactory.createDiscoveryURLs(); biz.setDiscoveryURLs(emptyDUs); first = false; } DiscoveryURL emptyDU = objectFactory.createDiscoveryURL(); emptyDUs.getDiscoveryURL().add(emptyDU); emptyDU.setUseType("businessEntityExt"); if (link.getExternalURI() != null) { emptyDU.setValue(link.getExternalURI()); } } IdentifierBag idBag = getIdentifierBagFromExternalIdentifiers(organization.getExternalIdentifiers()); if (idBag != null) { biz.setIdentifierBag(idBag); } CategoryBag catBag = getCategoryBagFromClassifications(organization.getClassifications()); if (catBag != null) { biz.setCategoryBag(catBag); } } catch (Exception ud) { throw new JAXRException("Apache JAXR Impl:", ud); } return biz; }
From source file:org.apache.ws.scout.util.ScoutJaxrUddiV3Helper.java
public static BusinessEntity getBusinessEntityFromJAXROrg(Organization organization) throws JAXRException { BusinessEntity biz = objectFactory.createBusinessEntity(); BusinessServices bss = objectFactory.createBusinessServices(); BusinessService[] barr = new BusinessService[0]; try {/* w w w . j av a 2 s. c om*/ // It may just be an update Key key = organization.getKey(); if (key != null && key.getId() != null) { biz.setBusinessKey(key.getId()); } else { biz.setBusinessKey(""); } // Lets get the Organization attributes at the top level InternationalString iname = organization.getName(); if (iname != null) { addNames(biz.getName(), iname); } InternationalString idesc = organization.getDescription(); addDescriptions(biz.getDescription(), idesc); if (organization.getPrimaryContact() != null && organization.getPrimaryContact().getPersonName() != null && organization.getPrimaryContact().getPersonName().getFullName() != null) { //biz.setAuthorizedName(organization.getPrimaryContact().getPersonName() // .getFullName()); } Collection<Service> s = organization.getServices(); log.debug("?Org has services=" + s.isEmpty()); barr = new BusinessService[s.size()]; Iterator<Service> iter = s.iterator(); int barrPos = 0; while (iter.hasNext()) { BusinessService bs = ScoutJaxrUddiV3Helper.getBusinessServiceFromJAXRService((Service) iter.next()); barr[barrPos] = bs; barrPos++; } /* * map users : JAXR has concept of 'primary contact', which is a * special designation for one of the users, and D6.1 seems to say * that the first UDDI user is the primary contact */ Contacts cts = objectFactory.createContacts(); Contact[] carr = new Contact[0]; User primaryContact = organization.getPrimaryContact(); Collection<User> users = organization.getUsers(); // Expand array to necessary size only (xmlbeans does not like // null items in cases like this) int carrSize = 0; if (primaryContact != null) { carrSize += 1; } // TODO: Clean this up and make it more efficient Iterator<User> it = users.iterator(); while (it.hasNext()) { User u = (User) it.next(); if (u != primaryContact) { carrSize++; } } carr = new Contact[carrSize]; /* * first do primary, and then filter that out in the loop */ if (primaryContact != null) { Contact ct = getContactFromJAXRUser(primaryContact); carr[0] = ct; } it = users.iterator(); int carrPos = 1; while (it.hasNext()) { User u = (User) it.next(); if (u != primaryContact) { Contact ct = getContactFromJAXRUser(u); carr[carrPos] = ct; carrPos++; } } bss.getBusinessService().addAll(Arrays.asList(barr)); if (carr.length > 0) { cts.getContact().addAll(Arrays.asList(carr)); biz.setContacts(cts); } biz.setBusinessServices(bss); // External Links Iterator<ExternalLink> exiter = organization.getExternalLinks().iterator(); DiscoveryURLs emptyDUs = null; boolean first = true; while (exiter.hasNext()) { ExternalLink link = (ExternalLink) exiter.next(); /** Note: jUDDI adds its own discoverURL as the businessEntity* */ if (first) { emptyDUs = objectFactory.createDiscoveryURLs(); biz.setDiscoveryURLs(emptyDUs); first = false; } DiscoveryURL emptyDU = objectFactory.createDiscoveryURL(); emptyDUs.getDiscoveryURL().add(emptyDU); emptyDU.setUseType("businessEntityExt"); if (link.getExternalURI() != null) { emptyDU.setValue(link.getExternalURI()); } } IdentifierBag idBag = getIdentifierBagFromExternalIdentifiers(organization.getExternalIdentifiers()); if (idBag != null) { biz.setIdentifierBag(idBag); } CategoryBag catBag = getCategoryBagFromClassifications(organization.getClassifications()); if (catBag != null) { biz.setCategoryBag(catBag); } } catch (Exception ud) { throw new JAXRException("Apache JAXR Impl:", ud); } return biz; }