Package javax.xml.registry.infomodel

Examples of javax.xml.registry.infomodel.LocalizedString


            name = new Name((String)obj, locale.getLanguage());
          }
          else
           if(obj instanceof LocalizedString)
           {
            LocalizedString ls = (LocalizedString)obj;
            name = new Name(ls.getValue(),ls.getLocale().getLanguage());
           }
            result.add(name);
        }
        return result;
    }
View Full Code Here


         // Define find qualifiers and name patterns
         Collection findQualifiers = new ArrayList();
         findQualifiers.add(FindQualifier.SORT_BY_NAME_ASC);
         Collection namePatterns = new ArrayList();
         String pattern = "%" + bizname + "%";
         LocalizedString ls = blm.createLocalizedString(Locale.getDefault(), pattern);
         namePatterns.add(ls);

         // Find based upon qualifier type and values
         BulkResponse response = bqm.findOrganizations(findQualifiers, namePatterns, null, null, null, null);
View Full Code Here

/**
* @version $Revision$ $Date$
*/
public class LocalizedStringTest extends TestCase {
    public void testEquals() {
        LocalizedString ls1 = new LocalizedStringImpl(Locale.US, "Equal", "UTF-8");
        LocalizedString ls2 = new LocalizedStringImpl(Locale.US, "Equal", "UTF-8");
        assertTrue(ls1.equals(ls2));
        assertTrue(ls2.equals(ls1));
        ls2 = new LocalizedStringImpl(Locale.US, "NotEqual", "UTF-8");
        assertFalse(ls1.equals(ls2));
        assertFalse(ls2.equals(ls1));
        ls2 = new LocalizedStringImpl(Locale.US, "Equal", "US-ASCII");
        assertFalse(ls1.equals(ls2));
        assertFalse(ls2.equals(ls1));
    }
View Full Code Here

        assertFalse(ls1.equals(ls2));
        assertFalse(ls2.equals(ls1));
    }

    public void testNullEquals() {
        LocalizedString ls1 = new LocalizedStringImpl(Locale.US, null, "UTF-8");
        LocalizedString ls2 = new LocalizedStringImpl(Locale.US, null, "UTF-8");
        assertTrue(ls1.equals(ls2));
        assertTrue(ls2.equals(ls1));
        ls2 = new LocalizedStringImpl(Locale.US, "NotEqual", "UTF-8");
        assertFalse(ls1.equals(ls2));
        assertFalse(ls2.equals(ls1));
        ls2 = new LocalizedStringImpl(Locale.US, null, "US-ASCII");
        assertFalse(ls1.equals(ls2));
        assertFalse(ls2.equals(ls1));
    }
View Full Code Here

        assertFalse(ls1.equals(ls2));
        assertFalse(ls2.equals(ls1));
    }

    public void testSetCharsetName() throws JAXRException {
        LocalizedString ls1 = new LocalizedStringImpl(Locale.US, "USA", "UTF-8");
        assertEquals("UTF-8", ls1.getCharsetName());
        ls1.setCharsetName("US-ASCII");
        assertEquals("US-ASCII", ls1.getCharsetName());
        try {
            ls1.setCharsetName(null);
            fail("expected IllegalArgumentException for null charsetName");
        } catch (IllegalArgumentException e) {
            // ok
        }
    }
View Full Code Here

            // ok
        }
    }

    public void testSetLocale() throws JAXRException {
        LocalizedString ls1 = new LocalizedStringImpl(Locale.US, "USA", "UTF-8");
        assertEquals(Locale.US, ls1.getLocale());
        ls1.setLocale(Locale.CANADA);
        assertEquals(Locale.CANADA, ls1.getLocale());
        try {
            ls1.setLocale(null);
            fail("expected IllegalArgumentException for null locale");
        } catch (IllegalArgumentException e) {
            // ok
        }
    }
View Full Code Here

            // ok
        }
    }

    public void testSetValue() throws JAXRException {
        LocalizedString ls1 = new LocalizedStringImpl(Locale.US, "USA", "UTF-8");
        assertEquals("USA", ls1.getValue());
        ls1.setValue("Foo");
        assertEquals("Foo", ls1.getValue());
        ls1.setValue(null);
        assertNull(ls1.getValue());
    }
View Full Code Here

         // Define find qualifiers and name patterns
         Collection findQualifiers = new ArrayList();
         findQualifiers.add(FindQualifier.SORT_BY_NAME_ASC);
         Collection namePatterns = new ArrayList();
         String pattern = "%" + bizname + "%";
         LocalizedString ls = blm.createLocalizedString(Locale.getDefault(), pattern);
         namePatterns.add(ls);

         // Find based upon qualifier type and values
         BulkResponse response = bqm.findOrganizations(findQualifiers, namePatterns, null, null, null, null);
View Full Code Here

                    RegistryObject specificationObject = slink.getSpecificationObject();
          if (specificationObject.getKey() != null && specificationObject.getKey().getId() != null) {
            emptyTInfo.setTModelKey(specificationObject.getKey().getId());
                        if (specificationObject.getDescription()!=null) {
                            for (Object o : specificationObject.getDescription().getLocalizedStrings()) {
                                LocalizedString locDesc = (LocalizedString) o;
                                Description description = objectFactory.createDescription();
                                emptyTInfo.getDescription().add(description);
                                description.setValue(locDesc.getValue());
                                description.setLang(locDesc.getLocale().getLanguage());
                            }
                        }
                        Collection<ExternalLink> externalLinks = slink.getExternalLinks();
                        if (externalLinks!=null && externalLinks.size()>0) {
                            for (ExternalLink link : externalLinks) {
View Full Code Here

    }

    private static void addDescriptions(List<Description> descripions, InternationalString idesc) throws JAXRException {
        if (idesc != null) {
            for (Object o : idesc.getLocalizedStrings()) {
                LocalizedString locName = (LocalizedString) o;
                Description desc = objectFactory.createDescription();
                descripions.add(desc);
                desc.setValue(locName.getValue());
                desc.setLang(locName.getLocale().getLanguage());
            }
        }
    }
View Full Code Here

TOP

Related Classes of javax.xml.registry.infomodel.LocalizedString

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.