Creates the typefor embeddables.

@param compositeEmbeddables
the composite embeddables
437265
private void createTypeforEmbeddables(List compositeEmbeddables)
    {
        if (!createdPuEmbeddables.contains(puMetadata.getPersistenceUnitName()))
        {
            CQLTranslator translator = new CQLTranslator();

            Map<String, String> embNametoUDTQuery = new HashMap<String, String>();
            Map<String, List<String>> embNametoDependentList = new HashMap<String, List<String>>();

            MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
                    puMetadata.getPersistenceUnitName());

            Iterator iter = metaModel.getEmbeddables().iterator();
            while (iter.hasNext())
            {
                List<String> childEmb = new ArrayList<String>();

                String typeQuery = CQLTranslator.CREATE_TYPE;
                EmbeddableType embeddedColumn = (EmbeddableType) iter.next();
                if (!embeddedColumn.getPersistenceType().equals(PersistenceType.EMBEDDABLE)
                        || compositeEmbeddables.contains(embeddedColumn.getJavaType().getSimpleName()))
                {
                    continue;
                }

                typeQuery = StringUtils.replace(typeQuery, CQLTranslator.TYPE,
                        translator.ensureCase(new StringBuilder(), embeddedColumn.getJavaType().getSimpleName(), false)
                                .toString());

                StringBuilder typeQueryBuilder = new StringBuilder();

                for (Object column : embeddedColumn.getAttributes())
                {

                    Attribute columnAttribute = (Attribute) column;
                    Field f = (Field) columnAttribute.getJavaMember();

                    if (columnAttribute.getJavaType().isAnnotationPresent(Embeddable.class))
                    {
                        // handle embeddable
                        String cqlType = CQLTranslator.FROZEN + Constants.STR_LT + Constants.ESCAPE_QUOTE
                                + columnAttribute.getJavaType().getSimpleName() + Constants.ESCAPE_QUOTE
                                + Constants.STR_GT;
                        translator.appendColumnName(typeQueryBuilder, columnAttribute.getName(), cqlType);
                        typeQueryBuilder.append(Constants.SPACE_COMMA);
                        childEmb.add(columnAttribute.getJavaType().getSimpleName());
                    }
                    else if (columnAttribute.isCollection())
                    {
                        // handle element collection with embeddables
                        handleElementCollectionAttribute(translator, columnAttribute, typeQueryBuilder);
                        if (!MetadataUtils.isBasicElementCollectionField((Field) columnAttribute.getJavaMember()))
                        {
                            childEmb.add(((AbstractAttribute) columnAttribute).getBindableJavaType().getSimpleName());
                        }

                    }
                    else
                    {
                        String cqlType = null;
                        String dataType = CassandraValidationClassMapper.getValidationClass(f.getType(), true);
                        cqlType = translator.getCQLType(dataType);
                        // check for JPA names
                        translator.appendColumnName(typeQueryBuilder,
                                ((AbstractAttribute) columnAttribute).getJPAColumnName(), cqlType);
                        typeQueryBuilder.append(Constants.SPACE_COMMA);

                    }

                }
                typeQueryBuilder = replaceColumnsAndStripLastChar(typeQuery, typeQueryBuilder);
                typeQueryBuilder.append(CQLTranslator.CLOSE_BRACKET);
                embNametoUDTQuery.put(embeddedColumn.getJavaType().getSimpleName(), typeQueryBuilder.toString());
                embNametoDependentList.put(embeddedColumn.getJavaType().getSimpleName(), childEmb);
                // run query final

            }
            postProcessEmbedded(embNametoUDTQuery, embNametoDependentList);
            createdPuEmbeddables.add(puMetadata.getPersistenceUnitName());
        }
    }
412880
public void setFindingTypes(java.util.Collection<String> findingTypes) {
        if (findingTypes == null) {
            this.findingTypes = null;
            return;
        }

        this.findingTypes = new java.util.ArrayList<String>(findingTypes);
    }
396261
private void addEmbeddedProperties(ClassMetadata classMetadata, SinglePropertyMetadata propertyMetadata) {
		ClassMetadata nested = new ClassMetadata();
		nested.setPersistentClass(propertyMetadata.getPropertyType());
		visit(nested.getPersistentClass(), nested, new HashSet<String>());
		for (Iterator<String> i = nested.getPropertyNames(); i.hasNext(); ) {
			String propertyName = i.next();
			EmbeddedPropertyMetadata property = new EmbeddedPropertyMetadata(propertyMetadata, nested.getProperty(propertyName));
			doAddProperty(classMetadata, property);
		}
	}
240188
protected void createLabels(Composite parent)
	{
		Composite labelComposite = createComposite(parent, 2);
		try
		{
			String typeName = ((IVdmBreakpoint) getElement()).getMessage();
			if (typeName != null)
			{
				String s = getTypeName(typeName);
				createLabel(labelComposite, "Filename:");
				Text text = SWTFactory.createText(labelComposite, SWT.READ_ONLY, 1, 1);
				text.setText(s);
				text.setBackground(parent.getBackground());
			}
			createTypeSpecificLabels(labelComposite);
		} catch (CoreException ce)
		{
			// JDIDebugUIPlugin.log(ce);
		}
	}
1267307
private static Set<TypeMirror> nonPrivateDeclaredTypes(Types typeUtils, TypeMirror type) {
    if (type == null) {
      return new TypeMirrorSet();
    } else {
      Set<TypeMirror> declared = new TypeMirrorSet();
      declared.add(type);
      List<TypeElement> nestedTypes =
          ElementFilter.typesIn(typeUtils.asElement(type).getEnclosedElements());
      for (TypeElement nestedType : nestedTypes) {
        if (!nestedType.getModifiers().contains(PRIVATE)) {
          declared.add(nestedType.asType());
        }
      }
      for (TypeMirror supertype : typeUtils.directSupertypes(type)) {
        declared.addAll(nonPrivateDeclaredTypes(typeUtils, supertype));
      }
      return declared;
    }
  }
183748
@Override
	public BundlePathMapping build(List<String> strPathMappings) {

		BundlePathMapping bundlePathMapping = new BundlePathMapping(bundle);
		for (JoinableResourceBundle child : ((CompositeResourceBundle) bundle).getChildBundles()) {
			if (!child.getInclusionPattern().isIncludeOnlyOnDebug()) {
				bundlePathMapping.getItemPathList().addAll(child.getItemPathList());
				addFilePathMapping(bundlePathMapping, child.getItemPathList());
			}

			if (!child.getInclusionPattern().isExcludeOnDebug()) {
				bundlePathMapping.getItemDebugPathList().addAll(child.getItemDebugPathList());
				addFilePathMapping(bundlePathMapping, child.getItemDebugPathList());
			}
			bundlePathMapping.getLicensesPathList().addAll(child.getLicensesPathList());
			addFilePathMapping(bundlePathMapping, child.getLicensesPathList());
		}
		return bundlePathMapping;
	}
227925
public Embeddable<EntityMappings<T>> getOrCreateEmbeddable()
   {
      List<Node> nodeList = childNode.get("embeddable");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new EmbeddableImpl<EntityMappings<T>>(this, "embeddable", childNode, nodeList.get(0));
      }
      return createEmbeddable();
   }
410606
public static String prepareCompositeKey(final SingularAttribute attribute, final MetamodelImpl metaModel,
            final Object compositeKey)
    {
        Field[] fields = attribute.getBindableJavaType().getDeclaredFields();
        EmbeddableType embeddable = metaModel.embeddable(attribute.getBindableJavaType());
        StringBuilder stringBuilder = new StringBuilder();

        try
        {
            for (Field f : fields)
            {
                if (!ReflectUtils.isTransientOrStatic(f))
                {
                    if (metaModel.isEmbeddable(((AbstractAttribute) embeddable.getAttribute(f.getName()))
                            .getBindableJavaType()))
                    {
                        f.setAccessible(true);
                        stringBuilder.append(
                                prepareCompositeKey((SingularAttribute) embeddable.getAttribute(f.getName()),
                                        metaModel, f.get(compositeKey))).append(LUCENE_COMPOSITE_KEY_SEPERATOR);
                    }
                    else
                    {
                        String fieldValue = PropertyAccessorHelper.getString(compositeKey, f);
                        fieldValue = fieldValue.replaceAll("[^a-zA-Z0-9]", "_");

                        stringBuilder.append(fieldValue);
                        stringBuilder.append(LUCENE_COMPOSITE_KEY_SEPERATOR);
                    }
                }
            }
        }
        catch (IllegalAccessException e)
        {
            logger.error(e.getMessage());
        }
        catch (IllegalArgumentException e)
        {
            logger.error("Error during prepare composite key, Caused by {}.", e);
            throw new PersistenceException(e);
        }

        if (stringBuilder.length() > 0)
        {
            stringBuilder.deleteCharAt(stringBuilder.lastIndexOf(LUCENE_COMPOSITE_KEY_SEPERATOR));
        }
        return stringBuilder.toString();
    }
889146
@NonNull
  public SelfT addTypeCodecs(@NonNull TypeCodec<?>... typeCodecs) {
    Collections.addAll(this.typeCodecs, typeCodecs);
    return self;
  }
1039204
public void setSupportedRealtimeInferenceInstanceTypes(java.util.Collection<String> supportedRealtimeInferenceInstanceTypes) {
        if (supportedRealtimeInferenceInstanceTypes == null) {
            this.supportedRealtimeInferenceInstanceTypes = null;
            return;
        }

        this.supportedRealtimeInferenceInstanceTypes = new java.util.ArrayList<String>(supportedRealtimeInferenceInstanceTypes);
    }
1301340
private static void createLanguageAliases(TypeSpec.Builder type, Map<String, String> languageAliases) {
    MethodSpec.Builder method = MethodSpec.methodBuilder("registerLanguageAliases")
        .addModifiers(PRIVATE, STATIC);
    
    for (Map.Entry<String, String> entry : languageAliases.entrySet()) {
      method.addStatement("addLanguageAlias($S, $S)", 
          entry.getKey(), entry.getValue());
    }
    
    type.addMethod(method.build());
  }
964977
public void setThingTypes(java.util.Collection<ThingTypeDefinition> thingTypes) {
        if (thingTypes == null) {
            this.thingTypes = null;
            return;
        }

        this.thingTypes = new java.util.ArrayList<ThingTypeDefinition>(thingTypes);
    }
425061
private static void appendDeclaringTypes(TypeReference typeRef, char innerClassDelimiter,
      StringBuilder sb) {
    TypeReference declaringType = typeRef.getDeclaringType();
    if (declaringType != null) {
      appendDeclaringTypes(declaringType, innerClassDelimiter, sb);
      sb.append(declaringType.getSimpleName());
      sb.append(innerClassDelimiter);
    }
  }
1000545
private static void getContainedGenericTypes(CompositeType<?> typeInfo, List<GenericTypeInfo<?>> target) {
		for (int i = 0; i < typeInfo.getArity(); i++) {
			TypeInformation<?> type = typeInfo.getTypeAt(i);
			if (type instanceof CompositeType) {
				getContainedGenericTypes((CompositeType<?>) type, target);
			} else if (type instanceof GenericTypeInfo) {
				if (!target.contains(type)) {
					target.add((GenericTypeInfo<?>) type);
				}
			}
		}
	}
367386
@SuppressWarnings("static-method")
	protected ExtraLanguageTypeConverter createTypeConverterInstance(
			IExtraLanguageConversionInitializer initializer,
			IExtraLanguageGeneratorContext context) {
		return new ExtraLanguageTypeConverter(initializer, context);
	}
278368
public Object populateEmbeddedRecursive(ByteBuffer value, List<AbstractType<?>> types, List<FieldIdentifier> fieldNames,
            Object entity, MetamodelImpl metaModel)
    {
        ByteBuffer input = value.duplicate();
        EmbeddableType emb = metaModel.embeddable(entity.getClass());

        for (int i = 0; i < types.size(); i++)
        {

            if (!input.hasRemaining())
                return entity;

            AbstractType<?> type = types.get(i);
            String name = fieldNames.get(i).toString(); 		 // JPA name,
                                                                 // convert to
                                                                 // column name

            Field fieldToSet = null;
            AbstractAttribute attribute = null;
            // change this if possible
            for (Object attr : emb.getAttributes())
            {
                if (((AbstractAttribute) attr).getJPAColumnName().equals(name))
                {
                    attribute = (AbstractAttribute) attr;
                    break;
                }
            }
            fieldToSet = (Field) attribute.getJavaMember();
            Class embeddedClass = attribute.getBindableJavaType();

            int size = input.getInt();
            if (size < 0)
            {
                continue;
            }

            ByteBuffer field = ByteBufferUtil.readBytes(input, size);

            if (type.getClass().getSimpleName().equals("UserType"))
            {
                List<FieldIdentifier> subFieldNames = ((UserType) type).fieldNames();// ok
                List<AbstractType<?>> subfieldTypes = ((UserType) type).fieldTypes();

                // create entity with type_name and populate fields, set entity
                // in parent object after exit
                Object embeddedObjectChild = KunderaCoreUtils.createNewInstance(embeddedClass);

                Object processedEntity = populateEmbeddedRecursive(field, subfieldTypes, subFieldNames,
                        embeddedObjectChild, metaModel);
                PropertyAccessorHelper.set(entity, fieldToSet, processedEntity);
            }
            else
            {
                boolean flag = true;

                if (type.getClass().getSimpleName().equals("MapType"))
                {
                    if (((MapType) type).getValuesType().getClass().getSimpleName().equals("UserType"))
                    {
                        flag = false;
                        // create instance of embedded object (UserType)
                        setElementCollectionMap((MapType) type, field, entity, fieldToSet, metaModel, embeddedClass,
                                false);
                    }
                }
                else if (type.getClass().getSimpleName().equals("ListType"))
                {
                    if (((ListType) type).getElementsType().getClass().getSimpleName().equals("UserType"))
                    {
                        flag = false;
                        setElementCollectionList((ListType) type, field, entity, fieldToSet, metaModel, embeddedClass,
                                false);
                    }
                }
                else if (type.getClass().getSimpleName().equals("SetType"))
                {
                    if (((SetType) type).getElementsType().getClass().getSimpleName().equals("UserType"))
                    {
                        flag = false;
                        setElementCollectionSet((SetType) type, field, entity, fieldToSet, metaModel, embeddedClass,
                                false);
                    }
                }
                if (flag)
                {
                    TypeSerializer serializer = type.getSerializer();
                    serializer.validate(field);

                    Object finalValue = serializer.deserialize(field);
                    if (type.getClass().getSimpleName().equals("UTF8Type"))
                    {
                        PropertyAccessorHelper.set(entity, fieldToSet, ((String) finalValue).getBytes());
                    }
                    else
                    {
                        PropertyAccessorHelper.set(entity, fieldToSet, finalValue);
                    }
                }

            }

        }
        return entity;
    }
1271513
private <X> AbstractManagedType<X> buildManagedType(Class<X> clazz, boolean isIdClass)
    {
        AbstractManagedType<X> managedType = null;
        if (clazz.isAnnotationPresent(Embeddable.class))
        {

            validate(clazz, true);
            if (!embeddables.containsKey(clazz))
            {
                managedType = new DefaultEmbeddableType<X>(clazz, PersistenceType.EMBEDDABLE, getType(
                        clazz.getSuperclass(), isIdClass));
                onDeclaredFields(clazz, managedType);
                embeddables.put(clazz, managedType);
            }
            else
            {
                managedType = (AbstractManagedType<X>) embeddables.get(clazz);
            }

        }
        else if (clazz.isAnnotationPresent(MappedSuperclass.class))
        {

            validate(clazz, false);
            // if (!mappedSuperClassTypes.containsKey(clazz))
            // {
            managedType = new DefaultMappedSuperClass<X>(clazz, PersistenceType.MAPPED_SUPERCLASS,
                    (AbstractIdentifiableType) getType(clazz.getSuperclass(), isIdClass));
            onDeclaredFields(clazz, managedType);
            mappedSuperClassTypes.put(clazz, (MappedSuperclassType<?>) managedType);
            // }
            // else
            // {
            // managedType = (AbstractManagedType<X>)
            // mappedSuperClassTypes.get(clazz);
            // }
        }
        else if (clazz.isAnnotationPresent(Entity.class) || isIdClass)
        {
            if (!managedTypes.containsKey(clazz))
            {
                managedType = new DefaultEntityType<X>(clazz, PersistenceType.ENTITY,
                        (AbstractIdentifiableType) getType(clazz.getSuperclass(), isIdClass));
                // in case of @IdClass, it is a temporary managed type.
                if (!isIdClass)
                {
                    managedTypes.put(clazz, (EntityType<?>) managedType);
                }
            }
            else
            {
                managedType = (AbstractManagedType<X>) managedTypes.get(clazz);
            }
        }

        return managedType;
    }