} else if (size == 1) {
// single component in compositor, first try to convert compositor to singleton
OpenAttrBase grandchild = (OpenAttrBase)compositor.getParticleList().get(0);
IArity particle = (IArity)grandchild;
if (SchemaUtils.isRepeated(compositor)) {
if (!SchemaUtils.isRepeated(particle)) {
// repeated compositor with non-repeated particle, so pass repeat to particle
if (s_logger.isDebugEnabled()) {
s_logger.debug(lead + "passing repeat from compositor " +
SchemaUtils.componentPath(childcomp) + " to only child " +
SchemaUtils.describeComponent(grandchild));
}
particle.setMaxOccurs(compositor.getMaxOccurs());
((ComponentExtension)grandchild.getExtension()).setRepeated(true);
compositor.setMaxOccurs(null);
((ComponentExtension)compositor.getExtension()).setRepeated(false);
} else if ((compositor.getMaxOccurs().isUnbounded() &&
particle.getMaxOccurs().isUnbounded())) {
// unbounded compositor with unbounded particle, just wipe repeat from compositor
if (s_logger.isDebugEnabled()) {
s_logger.debug(lead + "clearing unbounded from compositor " +
SchemaUtils.componentPath(childcomp) + " with unbounded only child " +
SchemaUtils.describeComponent(grandchild));
}
compositor.setMaxOccurs(null);
((ComponentExtension)compositor.getExtension()).setRepeated(false);
}
}
if (SchemaUtils.isOptional(compositor)) {
if (SchemaUtils.isOptional(particle)) {
// optional compositor with optional particle, just wipe optional from compositor
if (s_logger.isDebugEnabled()) {
s_logger.debug(lead + "clearing optional from compositor " +
SchemaUtils.componentPath(childcomp) + " with optional only child " +
SchemaUtils.describeComponent(grandchild));
}
compositor.setMinOccurs(null);
((ComponentExtension)compositor.getExtension()).setOptional(false);
} else if (Count.isCountEqual(1, particle.getMinOccurs())) {
// optional compositor with required particle, so pass optional to particle
if (s_logger.isDebugEnabled()) {
s_logger.debug(lead + "passing optional from compositor " +
SchemaUtils.componentPath(childcomp) + " to required only child " +
SchemaUtils.describeComponent(grandchild));
}
particle.setMinOccurs(Count.COUNT_ZERO);
((ComponentExtension)grandchild.getExtension()).setOptional(true);
compositor.setMinOccurs(null);
((ComponentExtension)compositor.getExtension()).setOptional(false);
}