private List<Mapping> generateMapping( XSModelGroup modelGroup, int occurrence, MappingContext mc, List<XSElementDeclaration> parentEls, List<XSComplexTypeDefinition> parentCTs ) { List<Mapping> mappings = new ArrayList<Mapping>(); XSObjectList particles = modelGroup.getParticles(); for ( int i = 0; i < particles.getLength(); i++ ) { XSParticle particle = (XSParticle) particles.item( i ); mappings.addAll( generateMapping( particle, occurrence, mc, new ArrayList<XSElementDeclaration>( parentEls ), new ArrayList<XSComplexTypeDefinition>( parentCTs ) ) ); } return mappings; }
private boolean marshalModelGroup(XSParticle particle, boolean declareNs) { XSModelGroup modelGroup = (XSModelGroup)particle.getTerm(); boolean marshalled; switch(modelGroup.getCompositor()) { case XSModelGroup.COMPOSITOR_ALL: marshalled = marshalModelGroupAll(modelGroup.getParticles(), declareNs); break; case XSModelGroup.COMPOSITOR_CHOICE: marshalled = marshalModelGroupChoice(modelGroup.getParticles(), declareNs); break; case XSModelGroup.COMPOSITOR_SEQUENCE: marshalled = marshalModelGroupSequence(modelGroup.getParticles(), declareNs); break; default: throw new IllegalStateException("Unexpected compsitor: " + modelGroup.getCompositor()); } return marshalled; }
return groupBinding; switch(modelGroup.getCompositor()) break; default: throw new JBossXBRuntimeException("Unexpected model group: " + modelGroup.getCompositor()); XSAnnotation annotation = modelGroup.getAnnotation(); if (annotation != null) customizeTerm(annotation, groupBinding, trace);
case MODEL_GROUP: { XSModelGroup modelGroup = (XSModelGroup) term; switch ( modelGroup.getCompositor() ) { case COMPOSITOR_ALL: { LOG.debug( "Unhandled model group: COMPOSITOR_ALL" ); XSObjectList geomChoice = modelGroup.getParticles(); int length = geomChoice.getLength(); Set<GeometryType> allowedTypes = new HashSet<GeometryType>(); XSObjectList sequence = modelGroup.getParticles(); if ( sequence.getLength() != 1 ) { LOG.trace( "Length = '" + sequence.getLength() + "' -> cannot be a geometry property." ); switch ( geomModelGroup.getType() ) { case COMPOSITOR_ALL: { XSObjectList geomChoice = geomModelGroup.getParticles(); int length = geomChoice.getLength(); Set<GeometryType> allowedTypes = new HashSet<GeometryType>();
private boolean isGroupTypeWithMultipleOccurs(XSParticle particle) { if (particle == null) return false; XSTerm term = particle.getTerm(); if (term.getType() != XSConstants.MODEL_GROUP) return false; XSModelGroup group = (XSModelGroup) term; final short compositor = group.getCompositor(); switch(compositor) { case XSModelGroup.COMPOSITOR_CHOICE: case XSModelGroup.COMPOSITOR_SEQUENCE: return particle.getMaxOccurs() > 1 || particle.getMaxOccursUnbounded(); default: return false; } }
break; case XSConstants.MODEL_GROUP: annotations = ((XSModelGroup)sourceComponent).getAnnotations(); break; case XSConstants.MODEL_GROUP_DEFINITION:
switch (((XSModelGroup)component).getCompositor()) { case XSModelGroup.COMPOSITOR_SEQUENCE: return "sequence";
private void addChildElementDecls( final XSParticle particle, final List<XSTerm> propDecls ) { if ( particle != null ) { final XSTerm term = particle.getTerm(); if ( term instanceof XSModelGroup ) { final XSObjectList particles = ( (XSModelGroup) term ).getParticles(); for ( int i = 0; i < particles.getLength(); i++ ) { addChildElementDecls( (XSParticle) particles.item( i ), propDecls ); } } else if ( term instanceof XSWildcard || term instanceof XSElementDeclaration ) { propDecls.add( term ); } else { throw new RuntimeException( "Unhandled term type: " + term.getClass() ); } } }
if ( modelGroup.getCompositor() == COMPOSITOR_SEQUENCE ) { writer.writeStartElement( "sequence" ); } else if ( modelGroup.getCompositor() == COMPOSITOR_CHOICE ) { writer.writeStartElement( "choice" ); } else if ( modelGroup.getCompositor() == COMPOSITOR_ALL ) { writer.writeStartElement( "all" ); XSObjectList particles = modelGroup.getParticles(); for ( int i = 0; i < particles.getLength(); i++ ) { XSParticle particle = (XSParticle) particles.item( i );
private List<XSParticle> getAllElementParticles( XSParticle particle ) { List<XSParticle> particles = new ArrayList<XSParticle>(); XSTerm xsTerm = particle.getTerm(); switch ( xsTerm.getType() ) { case XSConstants.ELEMENT_DECLARATION: particles.add( particle ); break; case XSConstants.MODEL_GROUP: XSModelGroup group = (XSModelGroup) xsTerm; for ( Iterator<XSParticle> itr = group.getParticles().iterator(); itr.hasNext(); ) { XSParticle xsParticle = itr.next(); particles.addAll( getAllElementParticles( xsParticle ) ); } break; default: // ignore wildcard term } return particles; }
case XSConstants.MODEL_GROUP: { XSModelGroup modelGroup = (XSModelGroup) term; switch ( modelGroup.getCompositor() ) { case XSModelGroup.COMPOSITOR_ALL: { LOG.debug( "Unhandled model group: COMPOSITOR_ALL" ); case XSModelGroup.COMPOSITOR_SEQUENCE: { LOG.trace( "Found sequence / choice." ); XSObjectList sequence = modelGroup.getParticles(); if ( sequence.getLength() != 1 ) { LOG.trace( "Length = '" + sequence.getLength() + "' -> cannot be a property declaration." );
private void getPropertyDecls( XSParticle particle, List<XSElementDeclaration> propertyDecls ) { if ( particle != null ) { XSTerm term = particle.getTerm(); if ( term instanceof XSElementDeclaration ) { propertyDecls.add( (XSElementDeclaration) term ); } else if ( term instanceof XSModelGroup ) { XSObjectList particles = ( (XSModelGroup) term ).getParticles(); for ( int i = 0; i < particles.getLength(); i++ ) { getPropertyDecls( (XSParticle) particles.item( i ), propertyDecls ); } } else { LOG.warn( "Unhandled term type: " + term.getClass() ); } } }
XSObjectList objlist = jmg.getParticles(); String end = null; switch (jmg.getCompositor()) XSObjectList olist = ((XSModelGroup)xterm).getParticles(); int lobj = olist != null ? olist.getLength() : 0; for (int k = 0; k < lobj; k++)
private void bindModelGroupParticles(XSModelGroup modelGroup) { XSObjectList particles = modelGroup.getParticles(); for(int i = 0; i < particles.getLength(); ++i) { XSParticle particle = (XSParticle)particles.item(i); bindParticle(particle); } }
if (term instanceof XSModelGroup) { XSModelGroup modelGroup = (XSModelGroup) term; if (modelGroup.getCompositor() == XSModelGroup.COMPOSITOR_SEQUENCE) { XSObjectList particles = modelGroup.getParticles(); int len = particles.getLength(); boolean everyThingIsASimpleType = true;
private void expandRelatedModelGroupComponents(XSModelGroup modelGroup, Vector componentList, String namespace, Hashtable dependencies) { XSObjectList particles = modelGroup.getParticles(); final int length = (particles == null) ? 0 : particles.getLength(); for (int i=0; i<length; i++) { expandRelatedParticleComponents((XSParticle)particles.item(i), componentList, namespace, dependencies); } }
private void addPropertyTypes( List<PropertyType> pts, XSModelGroup modelGroup, int parentMinOccurs, int parentMaxOccurs ) { switch ( modelGroup.getCompositor() ) { case COMPOSITOR_ALL: { LOG.debug( "Encountered 'All' compositor in object type model -- treating as sequence." ); XSObjectList sequence = modelGroup.getParticles(); for ( int i = 0; i < sequence.getLength(); i++ ) { XSParticle particle = (XSParticle) sequence.item( i );
private void setProperties(List properties, XSParticle particle) { XSTerm term = particle.getTerm(); if ((term instanceof XSElementDeclaration)) { properties .add(new XPsviGmlPropertyDefinition(this.model, particle)); } else if ((term instanceof XSModelGroup)) { XSModelGroup modelGroup = (XSModelGroup) term; XSObjectList particles = modelGroup.getParticles(); for (int i = 0; i < particles.getLength(); i++) setProperties(properties, (XSParticle) particles.item(i)); } }
case XSConstants.MODEL_GROUP: { XSModelGroup modelGroup = (XSModelGroup) term; switch ( modelGroup.getCompositor() ) { case XSModelGroup.COMPOSITOR_ALL: { LOG.debug( "Unhandled model group: COMPOSITOR_ALL" ); case XSModelGroup.COMPOSITOR_SEQUENCE: { LOG.trace( "Found sequence / choice." ); XSObjectList sequence = modelGroup.getParticles(); if ( sequence.getLength() != 1 ) { LOG.trace( "Length = '" + sequence.getLength() + "' -> cannot be a feature property." );
private GmlPropertyDefinition getProperty(XSParticle particle, String propertyNamespaceUri, String propertyLocalName) { XSTerm term = particle.getTerm(); if ((term instanceof XSElementDeclaration)) { if ((term.getNamespace().equals(propertyNamespaceUri)) && (term.getName().equals(propertyLocalName))) return new XPsviGmlPropertyDefinition(this.model, particle); } else if ((term instanceof XSModelGroup)) { XSModelGroup modelGroup = (XSModelGroup) term; XSObjectList particles = modelGroup.getParticles(); for (int i = 0; i < particles.getLength(); i++) { GmlPropertyDefinition property = getProperty( (XSParticle) particles.item(i), propertyNamespaceUri, propertyLocalName); if (property != null) { return property; } } } return null; }