Search in sources :

Example 1 with Types

use of org.whole.lang.xsd.mapping.model.Types in project whole by wholeplatform.

the class CompiledMappingStrategy method getUnionEntityMappings.

public Collection<EntityDescriptor<?>> getUnionEntityMappings(EntityDescriptor<?> context) {
    // TODO optimize
    String contextURI = unparseEntityDescriptor(context);
    AbstractPatternFilterIterator<UnionMapping> i2 = IteratorFactory.<UnionMapping>childMatcherIterator().withPattern(UnionMapping);
    i2.reset(strategy.getMappings());
    for (UnionMapping mapping : i2) if (contextURI.equals(mapping.getContextEntityType().getValue())) {
        Types unionTypes = mapping.getUnionTypes();
        int size = unionTypes.wSize();
        List<EntityDescriptor<?>> list = new ArrayList<EntityDescriptor<?>>(size);
        for (int i = 0; i < size; i++) list.add(parseEntityDescriptor(unionTypes.wGet(i).wStringValue()));
        return list;
    }
    return Collections.emptyList();
}
Also used : Types(org.whole.lang.xsd.mapping.model.Types) SchemaDataTypes(org.whole.lang.xsd.parsers.SchemaDataTypes) EntityDescriptor(org.whole.lang.reflect.EntityDescriptor) ArrayList(java.util.ArrayList) List(java.util.List) UnionMapping(org.whole.lang.xsd.mapping.model.UnionMapping)

Example 2 with Types

use of org.whole.lang.xsd.mapping.model.Types in project whole by wholeplatform.

the class CompiledMappingStrategy method isMixedType.

public boolean isMixedType(EntityDescriptor<?> ed) {
    if (mixedTypes == null) {
        mixedTypes = new HashSet<EntityDescriptor<?>>();
        Types uris = strategy.getMixedTypes();
        for (int i = 0, size = uris.wSize(); i < size; i++) mixedTypes.add(parseEntityDescriptor(uris.wGet(i).wStringValue()));
    }
    return mixedTypes.contains(ed);
}
Also used : EntityDescriptor(org.whole.lang.reflect.EntityDescriptor) Types(org.whole.lang.xsd.mapping.model.Types) SchemaDataTypes(org.whole.lang.xsd.parsers.SchemaDataTypes)

Aggregations

EntityDescriptor (org.whole.lang.reflect.EntityDescriptor)2 Types (org.whole.lang.xsd.mapping.model.Types)2 SchemaDataTypes (org.whole.lang.xsd.parsers.SchemaDataTypes)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 UnionMapping (org.whole.lang.xsd.mapping.model.UnionMapping)1