Example usage for javax.xml.registry.infomodel PostalAddress getStreetNumber

List of usage examples for javax.xml.registry.infomodel PostalAddress getStreetNumber

Introduction

In this page you can find the example usage for javax.xml.registry.infomodel PostalAddress getStreetNumber.

Prototype

public String getStreetNumber() throws JAXRException;

Source Link

Document

Returns the street number.

Usage

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  www  .  java  2  s .c om*/
     * @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:it.cnr.icar.eric.client.ui.thin.RegistryObjectCollectionBean.java

private List<RegistryObjectBean> getPostalAddressesSearchResultsBeans(RegistryObjectBean roBean)
        throws ClassNotFoundException, NoSuchMethodException, ExceptionInInitializerError, Exception {
    Collection<?> postalAddresses = roBean.getPostalAddresses();
    if (postalAddresses == null) {
        return null;
    }//from   w  ww .j  a v a  2 s.  c o  m
    int numPostalAddressObjects = postalAddresses.size();
    @SuppressWarnings("unused")
    ArrayList<Object> list = new ArrayList<Object>(numPostalAddressObjects);

    Iterator<?> roItr = postalAddresses.iterator();
    if (log.isDebugEnabled()) {
        log.debug("Query results: ");
    }

    String objectType = "PostalAddress";
    int numCols = 2;
    // Replace ObjectType with Id. TODO - formalize this convention
    ArrayList<RegistryObjectBean> roBeans = new ArrayList<RegistryObjectBean>(numPostalAddressObjects);
    for (@SuppressWarnings("unused")
    int i = 0; roItr.hasNext(); i++) {
        PostalAddress postalAddress = (PostalAddress) roItr.next();
        String header = null;
        Object columnValue = null;
        @SuppressWarnings("unused")
        ArrayList<Object> srvbHeader = new ArrayList<Object>(numCols);
        ArrayList<SearchResultValueBean> searchResultValueBeans = new ArrayList<SearchResultValueBean>(numCols);

        header = WebUIResourceBundle.getInstance().getString("Details");
        columnValue = roBean.getId() + "." + postalAddress.hashCode();
        searchResultValueBeans.add(new SearchResultValueBean(header, columnValue));

        header = WebUIResourceBundle.getInstance().getString("Street Number");
        columnValue = postalAddress.getStreetNumber();
        searchResultValueBeans.add(new SearchResultValueBean(header, columnValue));

        header = WebUIResourceBundle.getInstance().getString("Street");
        columnValue = postalAddress.getStreet();
        searchResultValueBeans.add(new SearchResultValueBean(header, columnValue));

        header = WebUIResourceBundle.getInstance().getString("City");
        columnValue = postalAddress.getCity();
        searchResultValueBeans.add(new SearchResultValueBean(header, columnValue));

        RegistryObjectBean srb = new RegistryObjectBean(searchResultValueBeans, roBean.getRegistryObject(),
                objectType, postalAddress, false);
        roBeans.add(srb);
    }
    return roBeans;
}

From source file:org.apache.ws.scout.util.ScoutJaxrUddiHelper.java

/**
 * Get UDDI Address given JAXR Postal Address
 *///from ww  w  .j a v a 2 s  .c  om
public static Address getAddress(PostalAddress postalAddress) throws JAXRException {
    Address address = objectFactory.createAddress();

    AddressLine[] addarr = new AddressLine[6];

    String stnum = postalAddress.getStreetNumber();
    String st = postalAddress.getStreet();
    String city = postalAddress.getCity();
    String country = postalAddress.getCountry();
    String code = postalAddress.getPostalCode();
    String state = postalAddress.getStateOrProvince();

    AddressLine stnumAL = objectFactory.createAddressLine();
    stnumAL.setKeyName("STREET_NUMBER");
    if (stnum != null) {
        stnumAL.setKeyValue(stnum);
    }

    AddressLine stAL = objectFactory.createAddressLine();
    stAL.setKeyName("STREET");
    if (st != null) {
        stAL.setKeyValue(st);
    }

    AddressLine cityAL = objectFactory.createAddressLine();
    cityAL.setKeyName("CITY");
    if (city != null) {
        cityAL.setKeyValue(city);
    }

    AddressLine countryAL = objectFactory.createAddressLine();
    countryAL.setKeyName("COUNTRY");
    if (country != null) {
        countryAL.setKeyValue(country);
    }

    AddressLine codeAL = objectFactory.createAddressLine();
    codeAL.setKeyName("POSTALCODE");
    if (code != null) {
        codeAL.setKeyValue(code);
    }

    AddressLine stateAL = objectFactory.createAddressLine();
    stateAL.setKeyName("STATE");
    if (state != null) {
        stateAL.setKeyValue(state);
    }

    // Add the AddressLine to vector
    addarr[0] = stnumAL;
    addarr[1] = stAL;
    addarr[2] = cityAL;
    addarr[3] = countryAL;
    addarr[4] = codeAL;
    addarr[5] = stateAL;

    address.getAddressLine().addAll(Arrays.asList(addarr));

    return address;
}

From source file:org.apache.ws.scout.util.ScoutJaxrUddiV3Helper.java

/**
 * Get UDDI Address given JAXR Postal Address
 *///from  w  w  w .  j av  a 2 s . c  o  m
public static Address getAddress(PostalAddress postalAddress) throws JAXRException {
    Address address = objectFactory.createAddress();

    AddressLine[] addarr = new AddressLine[7];

    String stnum = postalAddress.getStreetNumber();
    String st = postalAddress.getStreet();
    String city = postalAddress.getCity();
    String country = postalAddress.getCountry();
    String code = postalAddress.getPostalCode();
    String state = postalAddress.getStateOrProvince();
    String type = postalAddress.getType();

    AddressLine stnumAL = objectFactory.createAddressLine();
    stnumAL.setKeyName("STREET_NUMBER");
    if (stnum != null) {
        stnumAL.setKeyValue("STREET_NUMBER");
        stnumAL.setValue(stnum);
    }

    AddressLine stAL = objectFactory.createAddressLine();
    stAL.setKeyName("STREET");
    if (st != null) {
        stAL.setKeyValue("STREET");
        stAL.setValue(st);
    }

    AddressLine cityAL = objectFactory.createAddressLine();
    cityAL.setKeyName("CITY");
    if (city != null) {
        cityAL.setKeyValue("CITY");
        cityAL.setValue(city);
    }

    AddressLine countryAL = objectFactory.createAddressLine();
    countryAL.setKeyName("COUNTRY");
    if (country != null) {
        countryAL.setKeyValue("COUNTRY");
        countryAL.setValue(country);
    }

    AddressLine codeAL = objectFactory.createAddressLine();
    codeAL.setKeyName("POSTALCODE");
    if (code != null) {
        codeAL.setKeyValue("POSTALCODE");
        codeAL.setValue(code);
    }

    AddressLine stateAL = objectFactory.createAddressLine();
    stateAL.setKeyName("STATE");
    if (state != null) {
        stateAL.setKeyValue("STATE");
        stateAL.setValue(state);
    }

    AddressLine typeAL = objectFactory.createAddressLine();
    typeAL.setKeyName("TYPE");
    if (type != null) {
        typeAL.setKeyValue("TYPE");
        typeAL.setValue(type);
    }

    // Add the AddressLine to vector
    addarr[0] = stnumAL;
    addarr[1] = stAL;
    addarr[2] = cityAL;
    addarr[3] = countryAL;
    addarr[4] = codeAL;
    addarr[5] = stateAL;
    addarr[6] = typeAL;

    address.getAddressLine().addAll(Arrays.asList(addarr));

    return address;
}