@PostConstruct
  public void initialiseTypeConversionMetaData() {
    final List<PropertyType> baseTypes = modellerService.getBasePropertyTypes();
    if (baseTypes != null) {
      for (PropertyType type : baseTypes) {
        orderedBaseTypes.put(type.getName(), type.getClassName());
      }
    }

    annotationDefinitions = modellerService.getAnnotationDefinitions();
  }
  private void makeNewJavaTypes(
      final Path context, final List<String> declaredTypes, final ConversionResult result) {
    if (declaredTypes == null || declaredTypes.isEmpty()) {
      return;
    }

    final KieProject project = projectService.resolveProject(context);

    for (String declaredType : declaredTypes) {
      final FactModels factModels = FactModelPersistence.unmarshal(declaredType);
      final String packageName = factModels.getPackageName();
      final DataModel dataModel = new DataModelImpl();

      for (FactMetaModel factMetaModel : factModels.getModels()) {
        final DataObject dataObject = new DataObjectImpl(factMetaModel.getName(), packageName);
        dataObject.setSuperClassName(factMetaModel.getSuperType());
        final List<AnnotationMetaModel> annotationMetaModel = factMetaModel.getAnnotations();
        addAnnotations(dataObject, annotationMetaModel);

        final List<FieldMetaModel> fields = factMetaModel.getFields();

        for (FieldMetaModel fieldMetaModel : fields) {
          final String fieldName = fieldMetaModel.name;
          final String fieldType = fieldMetaModel.type;
          // Guvnor 5.5 (and earlier) does not have MultipleType
          boolean isMultiple = false;
          boolean isBaseType = orderedBaseTypes.containsValue(fieldType);
          ObjectProperty property = new ObjectPropertyImpl(fieldName, fieldType, isMultiple);
          property.setBaseType(isBaseType);

          // field has no annotation in Guvnor 5.5 (and earlier)
          dataObject.addProperty(property);

          result.addMessage(
              "Created Java Type " + getJavaTypeFQCN(dataObject), ConversionMessageType.INFO);
        }

        dataModel.getDataObjects().add(dataObject);
      }

      modellerService.saveModel(dataModel, project);
    }
  }