Example usage for javax.xml.registry.infomodel LocalizedString setLocale

List of usage examples for javax.xml.registry.infomodel LocalizedString setLocale

Introduction

In this page you can find the example usage for javax.xml.registry.infomodel LocalizedString setLocale.

Prototype

void setLocale(Locale locale) throws JAXRException;

Source Link

Document

Set the Locale for this object.

Usage

From source file:it.cnr.icar.eric.client.xml.registry.infomodel.InternationalStringImpl.java

/**
 * Convenience method to directly set a value to a Localized String.
 * //from   ww w  .  j  a  va  2  s.c o m
 * If <code>value</code> is null and LocalizedString exists for <code>locale</code>,
 * LocalizedString will be removed from this InternationalString.
 *
 * If <code>value</code> is not null and LocalizedString does not exists for
 * <code>locale</code>, it will be created with <code>value</code>. Otherwise
 * value will be simply set.
 *
 * InternationalString will be flagged as modified if any operation takes place.
 *
 * @param locale Locale for Localized String.
 * @param val New value for Localized String.
 * @throws JAXRException
 */
public void setValue(Locale locale, String val) throws JAXRException {
    LocalizedString ls = localizedStringMap.get(getKey(locale, LocalizedStringImpl.DEFAULT_CHARSET_NAME));

    if (ls != null && val != null) {
        ls.setValue(val);
    } else if (ls != null && val == null) {
        removeLocalizedString(ls);
    } else if (val != null && val.length() > 0) {
        ls = new LocalizedStringImpl(null);
        ls.setLocale(locale);
        ls.setValue(val);
        addLocalizedString(ls);
    }
}

From source file:it.cnr.icar.eric.client.xml.registry.LifeCycleManagerImpl.java

/**
 * Create a InternationalString instance using the specified parameters.
 * /*  w  w w.  ja va2  s. c om*/
 * 
 * <p>
 * <DL>
 * <DT><B>Capability Level: 0 </B>
 * </DL>
 * 
 */
public InternationalString createInternationalString(Locale l, String s) throws JAXRException {
    InternationalString is = new InternationalStringImpl(this);
    if (s != null) {
        LocalizedString ls = new LocalizedStringImpl(this);
        ls.setLocale(l);
        ls.setValue(s);
        is.addLocalizedString(ls);
    }

    return is;
}