当前位置: 首页>>代码示例>>Java>>正文


Java DataObject.setSuperClassName方法代码示例

本文整理汇总了Java中org.kie.workbench.common.services.datamodeller.core.DataObject.setSuperClassName方法的典型用法代码示例。如果您正苦于以下问题:Java DataObject.setSuperClassName方法的具体用法?Java DataObject.setSuperClassName怎么用?Java DataObject.setSuperClassName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kie.workbench.common.services.datamodeller.core.DataObject的用法示例。


在下文中一共展示了DataObject.setSuperClassName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createExpectedExternalClasses

import org.kie.workbench.common.services.datamodeller.core.DataObject; //导入方法依赖的package包/类
private List<DataObject> createExpectedExternalClasses() {
    List<DataObject> result = new ArrayList<>();

    DataObject dataObject1 = new DataObjectImpl(TEST_PACKAGE, "ExternalPojo1");
    dataObject1.setSuperClassName(Object.class.getName());
    dataObject1.addProperty("field1", String.class.getName());
    dataObject1.addProperty("field2", String.class.getName());
    result.add(dataObject1);

    DataObject dataObject2 = new DataObjectImpl(TEST_PACKAGE, "ExternalPojo2");
    dataObject2.setSuperClassName(Object.class.getName());
    dataObject2.addProperty("field3", String.class.getName());
    dataObject2.addProperty("field4", String.class.getName());
    result.add(dataObject2);

    return result;
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:18,代码来源:ModuleDataModelOracleUtilsTest.java

示例2: createTestObject1

import org.kie.workbench.common.services.datamodeller.core.DataObject; //导入方法依赖的package包/类
public static DataObject createTestObject1() {

        //set general properties and annotations.
        DataObject dataObject = new DataObjectImpl("org.test", "TestObject1");
        dataObject.setSuperClassName("java.lang.Object");
        dataObject.addAnnotation(createAnnotation(Label.class, new Pair<String, Object>("value", "TestObject1Label")));
        dataObject.addAnnotation(createAnnotation(Description.class, new Pair<String, Object>("value", "TestObject1Description")));

        //set annotations for drools & jbpm domain tests.
        dataObject.addAnnotation(createAnnotation(TypeSafe.class, new Pair<String, Object>("value", true)));
        dataObject.addAnnotation(createAnnotation(PropertyReactive.class));
        dataObject.addAnnotation(createAnnotation(Role.class, new Pair<String, Object>("value", Role.Type.EVENT.name())));
        dataObject.addAnnotation(createAnnotation(Timestamp.class, new Pair<String, Object>("value", "field2")));
        dataObject.addAnnotation(createAnnotation(Duration.class, new Pair<String, Object>("value", "field3")));
        dataObject.addAnnotation(createAnnotation(Expires.class, new Pair<String, Object>("value", "1h")));
        dataObject.addAnnotation(createAnnotation(XmlRootElement.class));

        //add fields
        ObjectProperty field1 = dataObject.addProperty("field1", Integer.class.getName());
        field1.addAnnotation(createAnnotation(Label.class, new Pair<String, Object>("value", "Field1Label")));
        field1.addAnnotation(createAnnotation(Description.class, new Pair<String, Object>("value", "Field1Description")));

        //set annotations for drools & jbpm domain tests
        field1.addAnnotation(createAnnotation(Position.class, new Pair<String, Object>("value", 0)));
        field1.addAnnotation(createAnnotation(Key.class));

        ObjectProperty field2 = dataObject.addProperty("field2", Integer.class.getName());
        field2.addAnnotation(createAnnotation(Label.class, new Pair<String, Object>("value", "Field2Label")));
        field2.addAnnotation(createAnnotation(Description.class, new Pair<String, Object>("value", "Field2Description")));

        ObjectProperty field3 = dataObject.addProperty("field3", Long.class.getName());
        field1.addAnnotation(createAnnotation(Label.class, new Pair<String, Object>("value", "Field3Label")));
        field1.addAnnotation(createAnnotation(Description.class, new Pair<String, Object>("value", "Field3Description")));

        return dataObject;
    }
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:37,代码来源:DataModelerEditorsTestHelper.java

示例3: createDataObject

import org.kie.workbench.common.services.datamodeller.core.DataObject; //导入方法依赖的package包/类
private DataObject createDataObject(String packageName,
                                    String name,
                                    String superClassName) {
    DataObject dataObject = new DataObjectImpl(packageName,
                                               name);
    dataObject.setSuperClassName(superClassName);
    return dataObject;
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:9,代码来源:JavaRoasterModelDriverTest.java

示例4: makeNewJavaTypes

import org.kie.workbench.common.services.datamodeller.core.DataObject; //导入方法依赖的package包/类
private void makeNewJavaTypes(final Path context,
                              final List<String> declaredTypes,
                              final ConversionResult result) {
    if (declaredTypes == null || declaredTypes.isEmpty()) {
        return;
    }

    final KieModule module = moduleService.resolveModule(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(packageName,
                                                             factMetaModel.getName());
            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;
                ObjectProperty property = new ObjectPropertyImpl(fieldName,
                                                                 fieldType,
                                                                 isMultiple);

                //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,
                                  module);
    }
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:48,代码来源:DecisionTableXLSToDecisionTableGuidedConverter.java

示例5: createDataObject

import org.kie.workbench.common.services.datamodeller.core.DataObject; //导入方法依赖的package包/类
public DataObject createDataObject( String packageName, String name, String superClassName ) {
    DataObject dataObject = new DataObjectImpl( packageName, name );
    dataObject.setSuperClassName( superClassName );
    return dataObject;
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:6,代码来源:DataModelTestUtil.java

示例6: addDataObjectType

import org.kie.workbench.common.services.datamodeller.core.DataObject; //导入方法依赖的package包/类
private static void addDataObjectType(DataModel dataModel,
                                      ModuleDataModelOracle oracleDataModel,
                                      String factType,
                                      ClassMetadata classMetadata) throws ModelDriverException {

    String superClass = DataModelOracleUtilities.getSuperType(oracleDataModel,
                                                              factType);
    Visibility visibility = DriverUtils.buildVisibility(classMetadata.getModifiers());
    DataObject dataObject;

    logger.debug("Adding dataObjectType: " + factType + ", to dataModel: " + dataModel +
                         ", from oracleDataModel: " + oracleDataModel);

    dataObject = dataModel.addDataObject(factType,
                                         visibility,
                                         Modifier.isAbstract(classMetadata.getModifiers()),
                                         Modifier.isFinal(classMetadata.getModifiers()),
                                         ObjectSource.DEPENDENCY);

    dataObject.setSuperClassName(superClass);

    Map<String, ModelField[]> fields = oracleDataModel.getModuleModelFields();
    if (fields != null) {
        ModelField[] factFields = fields.get(factType);
        ModelField field;

        if (factFields != null && factFields.length > 0) {
            for (int j = 0; j < factFields.length; j++) {
                field = factFields[j];
                if (isLoadableField(field)) {

                    if (field.getType().equals("Collection")) {
                        //read the correct bag and item classes.
                        String bag = DataModelOracleUtilities.getFieldClassName(oracleDataModel,
                                                                                factType,
                                                                                field.getName());
                        String itemsClass = DataModelOracleUtilities.getParametricFieldType(oracleDataModel,
                                                                                            factType,
                                                                                            field.getName());
                        if (itemsClass == null) {
                            //if we don't know the items class, the property will be managed as a simple property.
                            dataObject.addProperty(field.getName(),
                                                   bag);
                        } else {
                            dataObject.addProperty(field.getName(),
                                                   itemsClass,
                                                   true,
                                                   bag);
                        }
                    } else {
                        dataObject.addProperty(field.getName(),
                                               field.getClassName());
                    }
                }
            }
        }
    } else {
        logger.debug("No fields found for factTye: " + factType);
    }
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:61,代码来源:ModuleDataModelOracleUtils.java

示例7: addFactType

import org.kie.workbench.common.services.datamodeller.core.DataObject; //导入方法依赖的package包/类
private void addFactType(DataModel dataModel,
                         ModuleDataModelOracle oracleDataModel,
                         String factType,
                         ObjectSource source,
                         ClassLoader classLoader) throws ModelDriverException {

    String packageName = NamingUtils.extractPackageName(factType);
    String className = NamingUtils.extractClassName(factType);
    String superClass = DataModelOracleUtilities.getSuperType(oracleDataModel, factType);
    DataObject dataObject;

    logger.debug("Adding factType: " + factType + ", to dataModel: " + dataModel + ", from oracleDataModel: " + oracleDataModel);
    ClassMetadata classMetadata = readClassMetadata(factType, classLoader);

    if (classMetadata != null && !classMetadata.isMemberClass() && !classMetadata.isAnonymousClass() && !classMetadata.isLocalClass()) {

        Visibility visibility = DriverUtils.buildVisibility(classMetadata.getModifiers());
        dataObject = dataModel.addDataObject(factType, visibility, Modifier.isAbstract(classMetadata.getModifiers()), Modifier.isFinal(classMetadata.getModifiers()), source);
        dataObject.setSuperClassName(superClass);

        //process type annotations
        Set<Annotation> typeAnnotations = DataModelOracleUtilities.getTypeAnnotations(oracleDataModel,
                                                                                      factType);
        if (typeAnnotations != null) {
            for (Annotation annotation : typeAnnotations) {
                addFactTypeAnnotation(dataObject, annotation);
            }
        }

        Map<String, ModelField[]> fields = oracleDataModel.getModuleModelFields();
        if (fields != null) {
            ModelField[] factFields = fields.get(factType);
            ModelField field;
            ObjectProperty property;
            Map<String, Set<Annotation>> typeFieldsAnnotations = DataModelOracleUtilities.getTypeFieldsAnnotations(oracleDataModel,
                                                                                                                   factType);
            Set<Annotation> fieldAnnotations;

            if (factFields != null && factFields.length > 0) {
                for (int j = 0; j < factFields.length; j++) {
                    field = factFields[j];
                    if (isLoadableField(field)) {

                        if (field.getType().equals("Collection")) {
                            //particular processing for collection types
                            //read the correct bag and item classes.
                            String bag = DataModelOracleUtilities.getFieldClassName(oracleDataModel,
                                                                                    factType,
                                                                                    field.getName());
                            String itemsClass = DataModelOracleUtilities.getParametricFieldType(oracleDataModel,
                                                                                                factType,
                                                                                                field.getName());
                            if (itemsClass == null) {
                                //if we don't know the items class, the property will be managed as a simple property.
                                property = dataObject.addProperty(field.getName(), bag);
                            } else {
                                property = dataObject.addProperty(field.getName(), itemsClass, true, bag);
                            }
                        } else {
                            property = dataObject.addProperty(field.getName(), getFieldType(oracleDataModel, packageName, field.getClassName()));
                        }

                        //process property annotations
                        if (typeFieldsAnnotations != null && (fieldAnnotations = typeFieldsAnnotations.get(field.getName())) != null) {
                            for (Annotation fieldAnnotation : fieldAnnotations) {
                                addFieldAnnotation(dataObject, property, fieldAnnotation);
                            }
                        }
                    }
                }
            }
        } else {
            logger.debug("No fields for factTye: " + factType);
        }
    }
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:77,代码来源:DataModelOracleModelDriver.java


注:本文中的org.kie.workbench.common.services.datamodeller.core.DataObject.setSuperClassName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。