Package org.eclipse.persistence.sdo.helper

Examples of org.eclipse.persistence.sdo.helper.ListWrapper


        }

        if (property.isMany()) {
            List listValue;
            if (null == value) {
                listValue = new ListWrapper(this, property);
            } else {
                try {
                    listValue = (List) value;
                } catch(ClassCastException e) {
                    throw new IllegalArgumentException("Properties with isMany = true can only be set on list values.");               
                }
            }
            if (property.isContainment() || isContainedByDataGraph(property)) {
                for(Object next: listValue) {
                    if(next instanceof SDODataObject) {
                        if (parentContains((SDODataObject) next)) {
                            throw new IllegalArgumentException("Circular reference.");
                        }
                    }
                }
            }

            ListWrapper oldValueListWrapper = (ListWrapper) oldValue;
            // 20060529: v33: Move clear() out of ListWrapper.addAll()
            // handle clearing of elements which also calls removeContainment(prop) outside of addAll()
            oldValueListWrapper.clear(updateSequence);
            // handle updateContainment and sequences inside addAll()
            oldValueListWrapper.addAll((Collection)value, updateSequence);// for non-default Pluggable impl this function is not required
        } else {
            if (property.isContainment() || isContainedByDataGraph(property)) {
                if (parentContains(value)) {
                    throw new IllegalArgumentException("Circular reference.");
                }
View Full Code Here


        if ((value != null) && value instanceof List) {
            return (List)value;
        }

        // get a default empty list
        List theList = new ListWrapper(this, property);
        if (getType().isOpen() && property.isOpenContent()) {
            addOpenContentProperty(property);
        }

        // set the property to a default empty list
View Full Code Here

     * @param property
     */
  public void unsetPropertyInternal(DataObject dataObject, Property property) {
        ValueStore vs = (ValueStore)originalValueStores.get(dataObject);
        if (property.isMany()) {                     
            ListWrapper currentValue = (ListWrapper)dataObject.getList(property);           
            originalElements.put(currentValue, new ArrayList());
            if (property.isOpenContent()) {
                vs.unsetOpenContentProperty(property);               
            } else {
                vs.unsetDeclaredProperty(((SDOProperty)property).getIndexInType());
View Full Code Here

                return new JAXBListWrapper(this, declaredProperty);
            } else {
                return value;
            }
        } else if (declaredProperty.isMany()) {
            ListWrapper listWrapper = listWrappers.get(declaredProperty);
            if (null != listWrapper) {
                return listWrapper;
            }
            listWrapper = new JAXBListWrapper(this, declaredProperty);
            listWrappers.put(declaredProperty, listWrapper);
View Full Code Here

                }
            }
            mapping.setAttributeValueInObject(entity, newValue);
        } else if (declaredProperty.isMany()) {
            // Get a ListWrapper and set it's current elements
            ListWrapper listWrapper = (ListWrapper) getDeclaredProperty(propertyIndex);
            listWrapper.setCurrentElements((List) newValue);
        } else {
            // OLD VALUE
            if (mapping.isAbstractCompositeObjectMapping()) {
                XMLCompositeObjectMapping compositeMapping = (XMLCompositeObjectMapping) mapping;
                if (oldValue != null && compositeMapping.getContainerAccessor() != null) {
View Full Code Here

        if (property != null && property.isOpenContent() && dataObject.getType().isOpen()) {
            dataObject.addOpenContentProperty(property);
        }
        // Update the data object
        if (property.isMany()) {
            ListWrapper listWrapper = (ListWrapper) dataObject.getList(property);
            if (value instanceof List) {
                // iterate list
                for (Iterator i = ((List) value).iterator(); i.hasNext();) {
                    // add a setting to the end of the sequence
                    Object aValue = i.next();
                    Setting setting = convertToSetting(property, aValue);
                    valuesToSettings.put(new Key(property, aValue), setting);
                    settings.add(index++, setting);
                    // no need to check updateContainment flag -
                    // ListWrapper.add() will not pass an entire List here
                    listWrapper.add(aValue, false);
                }
            } else {
                // set individual list item
                // add a setting to the end of the sequence
                Setting setting = convertToSetting(property, value);
                valuesToSettings.put(new Key(property, value), setting);
                settings.add(index, setting);
                int listIdx = getIndexInList(property, value);
                if (listIdx != -1) {
                    listWrapper.add(listIdx, value, false);
                } else {
                    listWrapper.add(value, false);
                }
            }
        } else {
            dataObject.setPropertyInternal((SDOProperty) property, value, false);
            // Update the settings
View Full Code Here

            }
            if (value instanceof XMLRoot) {
                value = ((XMLRoot) value).getObject();
            }
            if (property.isMany()) {
                ListWrapper listWrapper = (ListWrapper) dataObject.getList(property);
                listWrapper.add(value, false);
            } else {
                dataObject.setPropertyInternal((SDOProperty) property, value, false);
            }
            return true;
        }
View Full Code Here

        Setting setting = settings.remove(fromIndex);
        settings.add(toIndex, setting);

        Property prop = getProperty(setting);
        if (prop != null && prop.isMany()) {
            ListWrapper lw = (ListWrapper) dataObject.getList(prop);
            Object value = getValue(setting);
            int currentIndexInLw = lw.indexOf(value);
            lw.remove(currentIndexInLw, false);
            int newIndexInLw = getIndexInList(prop, value);
            lw.add(newIndexInLw, value, false);
        }
    }
View Full Code Here

            } else {
                property = dataObject.getInstanceProperty(mapping.getAttributeName());
                valuesToSettings.remove(new Key(property, setting.getValue()));
            }
            if (property.isMany()) {
                ListWrapper listWrapper = (ListWrapper) dataObject.getList(property);
                listWrapper.remove(setting.getValue(), false, false);
            } else {
                dataObject.unset(property, false, false);
            }
        } else if (setting.getName() != null && setting.getName().equals(TEXT_XPATH)) {
            // Handle "text()"
View Full Code Here

        Property property = getProperty(setting);
        Object oldValue = setting.getValue();

        if (property.isMany()) {
            ListWrapper listValue = (ListWrapper) dataObject.getList(property);
            int valueIndex = listValue.indexOf(oldValue);
            listValue.remove(oldValue, property.isContainment(), false);
            listValue.add(valueIndex, value, false);
            setting.setValue(value, false);
        } else {
            if (dataObject.isSet(property)) {
                updateSettingWithoutModifyingDataObject(property, dataObject.get(property), value);
                setting.setValue(value);
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.sdo.helper.ListWrapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.