View Javadoc
1 /* 2 * $Header: /cvsroot/ebxmlrr/jaxr/src/com/sun/xml/registry/ebxml/infomodel/SlotImpl.java,v 1.11 2003/09/04 04:10:21 doballve Exp $ 3 * 4 * 5 */ 6 7 package com.sun.xml.registry.ebxml.infomodel; 8 9 import javax.xml.registry.*; 10 import javax.xml.registry.infomodel.*; 11 12 import javax.xml.registry.infomodel.*; 13 import java.util.*; 14 15 import org.oasis.ebxml.registry.bindings.rim.SlotType1; 16 import org.oasis.ebxml.registry.bindings.rim.ValueListType; 17 import org.oasis.ebxml.registry.bindings.rim.ValueListTypeItem; 18 19 import com.sun.xml.registry.ebxml.*; 20 import java.util.ArrayList; 21 22 /*** 23 * Class Declaration for Class1 24 * @author <a href="mailto:Farrukh.Najmi@Sun.COM">Farrukh S. Najmi</a> 25 */ 26 public class SlotImpl implements Slot { 27 private String name = null; 28 private String slotType = null; 29 private ArrayList values = new ArrayList(); 30 private ExtensibleObjectImpl parent = null; 31 32 protected LifeCycleManagerImpl lcm = null; 33 34 35 public SlotImpl(LifeCycleManagerImpl lcm) throws JAXRException { 36 this.lcm = lcm; 37 } 38 39 SlotImpl(LifeCycleManagerImpl lcm, SlotType1 ebSlot) 40 throws JAXRException 41 { 42 this.lcm = lcm; 43 44 name = ebSlot.getName(); 45 slotType = ebSlot.getSlotType(); 46 47 ValueListType valList = ebSlot.getValueList(); 48 if (valList != null) { 49 ValueListTypeItem[] vlti = valList.getValueListTypeItem(); 50 for (int i = 0; i < vlti.length; i++) { 51 values.add(vlti[i].getValue()); 52 } 53 } 54 } 55 56 void setParent(ExtensibleObjectImpl _parent) throws InvalidRequestException { 57 if ((_parent != null) && (parent != null) && (_parent != parent)) { 58 throw new InvalidRequestException("Error. Cannot add Slot to object " + _parent + " as it is already added to object " + parent); 59 } 60 parent = _parent; 61 } 62 63 public String getName(){ 64 return name; 65 } 66 67 public void setName(String par1) throws JAXRException { 68 name = par1; 69 if (parent != null) { 70 parent.setModified(true); 71 } 72 } 73 74 public String getSlotType() throws JAXRException { 75 return slotType; 76 } 77 78 public void setSlotType(String par1) throws JAXRException { 79 slotType = par1; 80 if (parent != null) { 81 parent.setModified(true); 82 } 83 } 84 85 public Collection getValues() throws JAXRException { 86 return (ArrayList)(values.clone()); 87 } 88 89 public void setValues(Collection par1) throws JAXRException { 90 values.clear(); 91 values.addAll(par1); 92 if (parent != null) { 93 parent.setModified(true); 94 } 95 } 96 97 void setBindingObject(org.oasis.ebxml.registry.bindings.rim.SlotType1 ebSlot) throws JAXRException { 98 ebSlot.setName(name); 99 ebSlot.setSlotType(slotType); 100 101 org.oasis.ebxml.registry.bindings.rim.ValueList valueList = 102 new org.oasis.ebxml.registry.bindings.rim.ValueList(); 103 Iterator iter = getValues().iterator(); 104 while (iter.hasNext()) { 105 String value = (String)iter.next(); 106 ValueListTypeItem item = new ValueListTypeItem(); 107 item.setValue(value); 108 valueList.addValueListTypeItem(item); 109 } 110 ebSlot.setValueList(valueList); 111 112 } 113 114 protected Object clone() throws CloneNotSupportedException { 115 SlotImpl _clone = null; 116 117 try { 118 new SlotImpl(lcm); 119 _clone.setName(getName()); 120 _clone.setSlotType(getSlotType()); 121 _clone.setValues(getValues()); 122 _clone.setParent(parent); 123 } 124 catch (JAXRException e) { 125 //Cannot happen. 126 e.printStackTrace(); 127 } 128 129 130 return _clone; 131 } 132 133 }

This page was automatically generated by Maven