Search in sources :

Example 1 with ToptionImpl

use of org.eclipse.kapua.commons.configuration.metatype.ToptionImpl in project kapua by eclipse.

the class TranslatorAppConfigurationKapuaKura method translate.

private KapuaTocd translate(KapuaTocd kapuaDefinition) {
    TocdImpl definition = new TocdImpl();
    definition.setId(kapuaDefinition.getId());
    definition.setName(kapuaDefinition.getName());
    definition.setDescription(kapuaDefinition.getDescription());
    for (KapuaTad kapuaAd : kapuaDefinition.getAD()) {
        TadImpl ad = new TadImpl();
        ad.setCardinality(kapuaAd.getCardinality());
        ad.setDefault(ad.getDefault());
        ad.setDescription(kapuaAd.getDescription());
        ad.setId(kapuaAd.getId());
        ad.setMax(kapuaAd.getMax());
        ad.setMin(kapuaAd.getMin());
        ad.setName(kapuaAd.getName());
        ad.setType(kapuaAd.getType());
        ad.setRequired(kapuaAd.isRequired());
        for (KapuaToption kuraToption : kapuaAd.getOption()) {
            ToptionImpl kapuaToption = new ToptionImpl();
            kapuaToption.setLabel(kuraToption.getLabel());
            kapuaToption.setValue(kuraToption.getValue());
            ad.addOption(kapuaToption);
        }
        for (Entry<QName, String> entry : kapuaAd.getOtherAttributes().entrySet()) {
            ad.putOtherAttribute(entry.getKey(), entry.getValue());
        }
        definition.addAD(ad);
    }
    for (KapuaTicon kapuaIcon : kapuaDefinition.getIcon()) {
        KapuaTicon icon = new TiconImpl();
        icon.setResource(kapuaIcon.getResource());
        icon.setSize(kapuaIcon.getSize());
        definition.addIcon(icon);
    }
    for (Object kapuaAny : kapuaDefinition.getAny()) {
        definition.addAny(kapuaAny);
    }
    for (Entry<QName, String> entry : kapuaDefinition.getOtherAttributes().entrySet()) {
        definition.putOtherAttribute(entry.getKey(), entry.getValue());
    }
    return definition;
}
Also used : KapuaTad(org.eclipse.kapua.model.config.metatype.KapuaTad) KapuaToption(org.eclipse.kapua.model.config.metatype.KapuaToption) TadImpl(org.eclipse.kapua.commons.configuration.metatype.TadImpl) KapuaTicon(org.eclipse.kapua.model.config.metatype.KapuaTicon) TocdImpl(org.eclipse.kapua.commons.configuration.metatype.TocdImpl) QName(javax.xml.namespace.QName) ToptionImpl(org.eclipse.kapua.commons.configuration.metatype.ToptionImpl) TiconImpl(org.eclipse.kapua.commons.configuration.metatype.TiconImpl)

Example 2 with ToptionImpl

use of org.eclipse.kapua.commons.configuration.metatype.ToptionImpl in project kapua by eclipse.

the class TranslatorAppConfigurationKuraKapua method translate.

private KapuaTocd translate(KapuaTocd kuraDefinition) {
    TocdImpl definition = new TocdImpl();
    definition.setId(kuraDefinition.getId());
    definition.setName(kuraDefinition.getName());
    definition.setDescription(kuraDefinition.getDescription());
    for (KapuaTad kuraAd : kuraDefinition.getAD()) {
        TadImpl ad = new TadImpl();
        ad.setCardinality(kuraAd.getCardinality());
        ad.setDefault(ad.getDefault());
        ad.setDescription(kuraAd.getDescription());
        ad.setId(kuraAd.getId());
        ad.setMax(kuraAd.getMax());
        ad.setMin(kuraAd.getMin());
        ad.setName(kuraAd.getName());
        ad.setType(kuraAd.getType());
        ad.setRequired(kuraAd.isRequired());
        for (KapuaToption kuraToption : kuraAd.getOption()) {
            ToptionImpl kapuaToption = new ToptionImpl();
            kapuaToption.setLabel(kuraToption.getLabel());
            kapuaToption.setValue(kuraToption.getValue());
            ad.addOption(kapuaToption);
        }
        for (Entry<QName, String> entry : kuraAd.getOtherAttributes().entrySet()) {
            ad.putOtherAttribute(entry.getKey(), entry.getValue());
        }
        definition.addAD(ad);
    }
    for (KapuaTicon kuraIcon : kuraDefinition.getIcon()) {
        KapuaTicon icon = new TiconImpl();
        icon.setResource(kuraIcon.getResource());
        icon.setSize(kuraIcon.getSize());
        definition.addIcon(icon);
    }
    for (Object kuraAny : kuraDefinition.getAny()) {
        definition.addAny(kuraAny);
    }
    for (Entry<QName, String> entry : kuraDefinition.getOtherAttributes().entrySet()) {
        definition.putOtherAttribute(entry.getKey(), entry.getValue());
    }
    return definition;
}
Also used : KapuaTad(org.eclipse.kapua.model.config.metatype.KapuaTad) KapuaToption(org.eclipse.kapua.model.config.metatype.KapuaToption) TadImpl(org.eclipse.kapua.commons.configuration.metatype.TadImpl) KapuaTicon(org.eclipse.kapua.model.config.metatype.KapuaTicon) TocdImpl(org.eclipse.kapua.commons.configuration.metatype.TocdImpl) QName(javax.xml.namespace.QName) ToptionImpl(org.eclipse.kapua.commons.configuration.metatype.ToptionImpl) TiconImpl(org.eclipse.kapua.commons.configuration.metatype.TiconImpl)

Aggregations

QName (javax.xml.namespace.QName)2 TadImpl (org.eclipse.kapua.commons.configuration.metatype.TadImpl)2 TiconImpl (org.eclipse.kapua.commons.configuration.metatype.TiconImpl)2 TocdImpl (org.eclipse.kapua.commons.configuration.metatype.TocdImpl)2 ToptionImpl (org.eclipse.kapua.commons.configuration.metatype.ToptionImpl)2 KapuaTad (org.eclipse.kapua.model.config.metatype.KapuaTad)2 KapuaTicon (org.eclipse.kapua.model.config.metatype.KapuaTicon)2 KapuaToption (org.eclipse.kapua.model.config.metatype.KapuaToption)2