Example usage for javax.xml.registry.infomodel TelephoneNumber getCountryCode

List of usage examples for javax.xml.registry.infomodel TelephoneNumber getCountryCode

Introduction

In this page you can find the example usage for javax.xml.registry.infomodel TelephoneNumber getCountryCode.

Prototype

public String getCountryCode() throws JAXRException;

Source Link

Document

Gets the country code.

Usage

From source file:it.cnr.icar.eric.client.ui.thin.RegistryObjectCollectionBean.java

private List<RegistryObjectBean> getTelephoneNumbersSearchResultsBeans(RegistryObjectBean roBean)
        throws ClassNotFoundException, NoSuchMethodException, ExceptionInInitializerError, Exception {
    List<?> telephoneNumbers = roBean.getTelephoneNumbers();
    if (telephoneNumbers == null) {
        return null;
    }//from  www .ja va  2s.  c  o  m
    int numTelephoneNumberObjects = telephoneNumbers.size();
    @SuppressWarnings("unused")
    ArrayList<Object> list = new ArrayList<Object>(numTelephoneNumberObjects);

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

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

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

        header = WebUIResourceBundle.getInstance().getString("Country Code");
        columnValue = telephoneNumber.getCountryCode();
        searchResultValueBeans.add(new SearchResultValueBean(header, columnValue));

        header = WebUIResourceBundle.getInstance().getString("Number");
        columnValue = "(" + telephoneNumber.getAreaCode() + ") " + telephoneNumber.getNumber();
        searchResultValueBeans.add(new SearchResultValueBean(header, columnValue));

        header = WebUIResourceBundle.getInstance().getString("Extension");
        columnValue = telephoneNumber.getExtension();
        searchResultValueBeans.add(new SearchResultValueBean(header, columnValue));

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