else if (existingType != null && selPropertyTypes.isEmpty() && existingType instanceof ObjectArrayEventType) {
resultEventType = existingType;
return new EvalInsertCoercionObjectArray(resultEventType, eventAdapterService);
}
else if (selPropertyTypes.isEmpty() && eventType instanceof BeanEventType) {
BeanEventType beanEventType = (BeanEventType) eventType;
resultEventType = eventAdapterService.addBeanTypeByName(insertIntoDesc.getEventTypeName(), beanEventType.getUnderlyingType(), false);
}
else {
resultEventType = eventAdapterService.addWrapperType(insertIntoDesc.getEventTypeName(), eventType, selPropertyTypes, false, true);
}
}
if (singleStreamWrapper) {
if (!isRevisionEvent) {
return new EvalInsertWildcardSSWrapper(selectExprContext, resultEventType);
}
else {
return new EvalInsertWildcardSSWrapperRevision(selectExprContext, resultEventType, vaeProcessor);
}
}
if (joinWildcardProcessor == null) {
if (!isRevisionEvent) {
if (resultEventType instanceof WrapperEventType) {
return new EvalInsertWildcardWrapper(selectExprContext, resultEventType);
}
else {
return new EvalInsertWildcardBean(selectExprContext, resultEventType);
}
}
else {
if (exprEvaluators.length == 0) {
return new EvalInsertWildcardRevision(selectExprContext, resultEventType, vaeProcessor);
}
else {
EventType wrappingEventType = eventAdapterService.addWrapperType(insertIntoDesc.getEventTypeName() + "_wrapped", eventType, selPropertyTypes, false, true);
return new EvalInsertWildcardRevisionWrapper(selectExprContext, resultEventType, vaeProcessor, wrappingEventType);
}
}
}
else {
if (!isRevisionEvent) {
return new EvalInsertWildcardJoin(selectExprContext, resultEventType, joinWildcardProcessor);
}
else {
return new EvalInsertWildcardJoinRevision(selectExprContext, resultEventType, joinWildcardProcessor, vaeProcessor);
}
}
}
// not using wildcard
resultEventType = null;
if ((columnNames.length == 1) && (insertIntoDesc.getColumnNames().size() == 0))
{
EventType existingType = eventAdapterService.getExistsTypeByName(insertIntoDesc.getEventTypeName());
if (existingType != null)
{
// check if the existing type and new type are compatible
Object columnOneType = expressionReturnTypes[0];
if (existingType instanceof WrapperEventType)
{
WrapperEventType wrapperType = (WrapperEventType) existingType;
// Map and Object both supported
if (wrapperType.getUnderlyingEventType().getUnderlyingType() == columnOneType)
{
singleColumnWrapOrBeanCoercion = true;
resultEventType = existingType;
}
}
if ((existingType instanceof BeanEventType) && (columnOneType instanceof Class))
{
BeanEventType beanType = (BeanEventType) existingType;
// Map and Object both supported
if (JavaClassHelper.isSubclassOrImplementsInterface((Class) columnOneType, beanType.getUnderlyingType()))
{
singleColumnWrapOrBeanCoercion = true;
resultEventType = existingType;
}
}