use of commonj.sdo.Property in project eclipselink by eclipse-ee4j.
the class SDODataObject method convertValueAndSet.
/**
* INTERNAL:
*/
private void convertValueAndSet(int propertyIndex, Object originalValue) {
Property property = getInstanceProperty(propertyIndex);
Object convertedValue = aHelperContext.getDataHelper().convert(property, originalValue);
set(property, convertedValue);
}
use of commonj.sdo.Property in project eclipselink by eclipse-ee4j.
the class SDOSequence method add.
@Override
public void add(int index, String propertyName, Object value) {
Property property = dataObject.getInstanceProperty(propertyName);
if (property == null) {
// Property with given name does not exist - create an open content
// property
property = dataObject.defineOpenContentProperty(propertyName, value);
((SDOProperty) property).setMany(true);
}
add(index, property, value);
}
use of commonj.sdo.Property in project eclipselink by eclipse-ee4j.
the class SDOSequence method remove.
private void remove(Setting setting) {
CoreMapping mapping = setting.getMapping();
if (null != mapping) {
Property property = null;
if (null == setting.getName()) {
XMLRoot xmlRoot = (XMLRoot) setting.getValue();
if (null != xmlRoot) {
property = dataObject.getInstanceProperty(xmlRoot.getLocalName());
valuesToSettings.remove(new Key(property, setting.getValue()));
}
} 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()"
dataObject._setModified(true);
}
List<Setting> children = setting.getChildren();
if (null != children) {
int childrenSize = children.size();
for (int x = 0; x < childrenSize; x++) {
remove(children.get(x));
}
}
}
use of commonj.sdo.Property in project eclipselink by eclipse-ee4j.
the class DefaultValueStore method unsetDeclaredProperty.
@Override
public void unsetDeclaredProperty(int propertyIndex) {
Property prop = ((SDODataObject) dataObject).getInstanceProperty(propertyIndex);
if (!prop.isMany()) {
getTypePropertyValues()[propertyIndex] = null;
}
getTypePropertiesIsSetStatus()[propertyIndex] = false;
}
use of commonj.sdo.Property in project eclipselink by eclipse-ee4j.
the class DefaultValueStore method equals.
/**
* Indicates if a given ValueStore is equal to this. The following
* attributes are tested for equality:
* - data object
* - type property values
* - open content property values
* - property isSet values
*/
@Override
public boolean equals(Object obj) {
DefaultValueStore dvs;
try {
dvs = (DefaultValueStore) obj;
} catch (ClassCastException cce) {
return false;
}
// Compare data object
if (dvs.dataObject != this.dataObject) {
return false;
}
// All lists must be the same length
if (dvs.getTypePropertyValues().length != this.getTypePropertyValues().length || dvs.getTypePropertiesIsSetStatus().length != this.getTypePropertiesIsSetStatus().length) {
return false;
}
for (int i = 0; i < dvs.getTypePropertyValues().length; i++) {
// isSet values must be equal
if (dvs.isSetDeclaredProperty(i) != this.isSetDeclaredProperty(i)) {
return false;
}
Object dvsPropVal = dvs.getDeclaredProperty(i);
Object thisPropVal = this.getDeclaredProperty(i);
// Both values need to be null or non-null
if (dvsPropVal == null) {
if (thisPropVal != null) {
return false;
}
// Here both are null so no need to check anything
} else {
if (!(dvsPropVal.equals(thisPropVal))) {
return false;
}
}
}
// Compare open content properties
if (dvs.getOpenContentValues().size() != this.getOpenContentValues().size()) {
return false;
}
Iterator<Property> keyIt = dvs.getOpenContentValues().keySet().iterator();
while (keyIt.hasNext()) {
Property key = keyIt.next();
Object dvsOCVal = dvs.getOpenContentProperty(key);
Object thisOCVal = this.getOpenContentProperty(key);
// Both values need to be null or non-null
if (dvsOCVal == null) {
if (thisOCVal != null) {
return false;
}
// Here both are null so no need to check anything
} else {
if (!(dvsOCVal.equals(thisOCVal))) {
return false;
}
}
}
return true;
}
Aggregations