use of commonj.sdo.Property in project metro-jax-ws by eclipse-ee4j.
the class SDOWrapperAccessor method initBuilders.
protected void initBuilders() {
HashMap<Object, PropertySetter> setByQName = new HashMap<>();
HashMap<Object, PropertyGetter> getByQName = new HashMap<>();
HashMap<Object, PropertySetter> setByLocalpart = new HashMap<>();
HashMap<Object, PropertyGetter> getByLocalpart = new HashMap<>();
HashSet<String> elementLocalNames = new HashSet<>();
TypeHelper helper = contextWrapper.getHelperContext().getTypeHelper();
Type type = helper.getType(contentClass);
@SuppressWarnings("unchecked") List<Property> properties = (List<Property>) type.getDeclaredProperties();
for (Property p : properties) {
QName qname = SDOUtils.getPropertyElementName(contextWrapper.getHelperContext(), p);
SDOPropertyBuilder pBuilder = new SDOPropertyBuilder(qname, p.getType().getInstanceClass());
setByQName.put(qname, pBuilder);
getByQName.put(qname, pBuilder);
setByLocalpart.put(qname.getLocalPart(), pBuilder);
getByLocalpart.put(qname.getLocalPart(), pBuilder);
if (elementLocalNames.contains(qname.getLocalPart())) {
elementLocalNameCollision = true;
} else {
elementLocalNames.add(qname.getLocalPart());
}
}
if (elementLocalNameCollision) {
propertySetters = setByQName;
propertyGetters = getByQName;
} else {
propertySetters = setByLocalpart;
propertyGetters = getByLocalpart;
}
}
use of commonj.sdo.Property in project metro-jax-ws by eclipse-ee4j.
the class Xsd2JavaSDOModel method getJavaTypeForElementName.
/**
* return the java type used for the element, only Global elements can be located.
* Containing types are not searched
*/
public String getJavaTypeForElementName(QName qname) {
XSDHelper xsdHelper = context.getXSDHelper();
Property globalProperty = xsdHelper.getGlobalProperty(qname.getNamespaceURI(), qname.getLocalPart(), true);
if (globalProperty == null) {
throw new RuntimeException("Given element with name: " + qname + "is not found.");
}
Type elementType = globalProperty.getType();
if (elementType == null) {
throw new RuntimeException("Given element with name: " + qname + "is not found.");
}
return ((SDOType) elementType).getInstanceClassName();
}
use of commonj.sdo.Property in project eclipselink by eclipse-ee4j.
the class SDODataObject method createDataObject.
@Override
public SDODataObject createDataObject(int propertyIndex, String namespaceURI, String typeName) {
Property aProperty = getInstanceProperty(propertyIndex);
Type aType = aHelperContext.getTypeHelper().getType(namespaceURI, typeName);
return createDataObject(aProperty, aType);
}
use of commonj.sdo.Property in project eclipselink by eclipse-ee4j.
the class SDODataObject method _getOpenContentPropertiesAttributesMap.
public Map _getOpenContentPropertiesAttributesMap() {
Map openContentPropertiesAttrs = new HashMap();
for (int i = 0, size = _getOpenContentPropertiesAttributes().size(); i < size; i++) {
Property next = (Property) _getOpenContentPropertiesAttributes().get(i);
// if uri is null then attributes won't be prefix qualified
QName qname = new QName(((SDOProperty) next).getUri(), next.getName());
openContentPropertiesAttrs.put(qname, get(next));
}
return openContentPropertiesAttrs;
}
use of commonj.sdo.Property in project eclipselink by eclipse-ee4j.
the class SDODataObject method updateDataGraph.
/**
* INTERNAL:
* Recursively set this DataObject's DataGraph
* This function serves as a copy of updateChangeSummaryAndDataGraph() to recursively walk and set the dataGraph.
* that will be run when no recursion occurs in the case that an object (with a changeSummary)
* is set internally to a tree (without a changeSummary).
* Callers: Typically updateContainment (during a set) or delete/detach
* when the current object is internal with its own changeSummary property.
* @param aDataGraph
*/
private void updateDataGraph(DataGraph aDataGraph) {
Iterator iterProperties = getInstanceProperties().iterator();
Property property;
Object object;
Object listContainedObject;
// Add back pointer to containing DataGraph - in preOrder sequence before recursing
setDataGraph(aDataGraph);
// Recurse currentValueStore
while (iterProperties.hasNext()) {
property = (Property) iterProperties.next();
// do not recurse bidirectional currentValueStore that are non-containment
if (property.isContainment() || isContainedByDataGraph(property)) {
object = get(property);
if (object instanceof SDODataObject) {
// DataObject child of this DataObject
((SDODataObject) object).updateDataGraph(aDataGraph);
}
if (object instanceof ListWrapper) {
// ListWrapper child of this DataObject
Iterator anIterator = ((ListWrapper) object).iterator();
while (anIterator.hasNext()) {
listContainedObject = anIterator.next();
if (listContainedObject instanceof SDODataObject) {
((SDODataObject) listContainedObject).updateDataGraph(aDataGraph);
}
}
}
}
}
}
Aggregations