Example usage for javax.xml.registry.infomodel RegistryObject addSlots

List of usage examples for javax.xml.registry.infomodel RegistryObject addSlots

Introduction

In this page you can find the example usage for javax.xml.registry.infomodel RegistryObject addSlots.

Prototype

void addSlots(Collection slots) throws JAXRException;

Source Link

Document

Adds more Slots to this object.

Usage

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

/**
 * Adds slots specified by slotsMap to RegistryObject ro.
 *
 *//*from   w ww  . j  av  a 2  s.  c o  m*/
public static void addSlotsToRegistryObject(RegistryObject ro, Map<?, ?> slotsMap) throws JAXRException {
    ArrayList<Slot> slots = new ArrayList<Slot>();

    Iterator<?> iter = slotsMap.keySet().iterator();
    while (iter.hasNext()) {
        Object key = iter.next();
        Object slotValue = slotsMap.get(key);

        Slot slot = null;

        //slotValue must either be a String or a Collection of Strings
        if (slotValue instanceof String) {
            slot = ro.getLifeCycleManager().createSlot((String) key, (String) slotValue, (String) null);
        } else if (slotValue instanceof Collection) {
            Collection<?> c = (Collection<?>) slotValue;
            slot = ro.getLifeCycleManager().createSlot((String) key, c, (String) null);
        } else {
            //??throw new IllegalArgumentException(resourceBundle.getString("message.addingParameter",
            //        new String[]{slotValue.getClass().getName()}));
        }
        if (slot != null) {
            slots.add(slot);
        }
    }

    ro.addSlots(slots);
}