當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。