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

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

Introduction

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

Prototype

void setValue(String value) throws JAXRException;

Source Link

Document

Set the String value for the specified 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  w  w  w. j a  v a2s  . co  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.ui.thin.RegistryObjectBean.java

public void setDescription(String desc) {
    try {//w w  w.j a v a  2  s  . com
        InternationalStringImpl is = ((InternationalStringImpl) registryObject.getDescription());
        Locale locale = RegistryBrowser.getInstance().getUserPreferencesBean().getContentLocale();
        String clstValue = is.getClosestValue(locale);
        String curValue = is.getValue(locale);
        if ((null == curValue && !desc.equals("") && !desc.equals(clstValue))
                || (!(null == curValue && desc.equals("")) && !desc.equals(curValue))) {
            LocalizedString ls = (is).getLocalizedString(locale, null);
            if (ls == null) {
                ls = RegistryBrowser.getBLCM().createLocalizedString(locale, desc);
                is.addLocalizedString(ls);
            } else {
                ls.setValue(desc);
            }
            registryObject.setDescription(is);
        }
    } catch (Exception ex) {
        log.error(WebUIResourceBundle.getInstance().getString("message.ErrorInSettingDescription"), ex);
    }
}

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

public void setName(String newIS) {
    try {//from   www  . ja v  a2s  .c  om
        InternationalStringImpl is = ((InternationalStringImpl) registryObject.getName());
        Locale locale = RegistryBrowser.getInstance().getUserPreferencesBean().getContentLocale();
        String clstValue = is.getClosestValue(locale);
        String curValue = is.getValue(locale);
        if ((null == curValue && !newIS.equals("") && !newIS.equals(clstValue))
                || (!(null == curValue && newIS.equals("")) && !newIS.equals(curValue))) {
            LocalizedString ls = (is).getLocalizedString(locale, null);
            if (ls == null) {
                ls = RegistryBrowser.getBLCM().createLocalizedString(locale, newIS);
                is.addLocalizedString(ls);
            } else {
                ls.setValue(newIS);
            }
            registryObject.setName(is);
        }
    } catch (Exception ex) {
        log.error(WebUIResourceBundle.getInstance().getString("message.ErrorInSettingName"), ex);
    }
}

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

/**
 * Create a InternationalString instance using the specified parameters.
 * /*from   w  ww .  j a v a2s.com*/
 * 
 * <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;
}