當前位置: 首頁>>代碼示例>>Java>>正文


Java DataObject.addProperty方法代碼示例

本文整理匯總了Java中org.kie.workbench.common.services.datamodeller.core.DataObject.addProperty方法的典型用法代碼示例。如果您正苦於以下問題:Java DataObject.addProperty方法的具體用法?Java DataObject.addProperty怎麽用?Java DataObject.addProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.kie.workbench.common.services.datamodeller.core.DataObject的用法示例。


在下文中一共展示了DataObject.addProperty方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createPlanningSolution

import org.kie.workbench.common.services.datamodeller.core.DataObject; //導入方法依賴的package包/類
private DataObject createPlanningSolution() {
    DataObject dataObject = new DataObjectImpl("test",
                                               "TestSolution");

    AnnotationImpl planningSolutionAnnotation = new AnnotationImpl(DriverUtils.buildAnnotationDefinition(PlanningSolution.class));
    dataObject.addAnnotation(planningSolutionAnnotation);

    ObjectProperty scoreObjectProperty = new ObjectPropertyImpl("score",
                                                                BendableScore.class.getName(),
                                                                false);
    dataObject.addProperty(scoreObjectProperty);

    AnnotationImpl planningScoreAnnotation = new AnnotationImpl(DriverUtils.buildAnnotationDefinition(PlanningScore.class));
    planningScoreAnnotation.setValue("bendableHardLevelsSize",
                                     1);
    planningScoreAnnotation.setValue("bendableSoftLevelsSize",
                                     2);
    scoreObjectProperty.addAnnotation(planningScoreAnnotation);

    return dataObject;
}
 
開發者ID:kiegroup,項目名稱:optaplanner-wb,代碼行數:22,代碼來源:ScoreHolderServiceImplTest.java

示例2: execute

import org.kie.workbench.common.services.datamodeller.core.DataObject; //導入方法依賴的package包/類
@Test
public void execute() {
    DataObject dataObject = new DataObjectImpl("org.test",
                                               "TestDataObject");
    dataObject.addProperty(new ObjectPropertyImpl("testProperty",
                                                  Integer.class.getName(),
                                                  false));
    DataModelChangeNotifier notifier = mock(DataModelChangeNotifier.class);
    RemovePropertyCommand command = new RemovePropertyCommand(new DataModelerContext(),
                                                              "source",
                                                              dataObject,
                                                              "testProperty",
                                                              notifier);

    command.execute();

    assertNull(dataObject.getProperty("testProperty"));
    verify(notifier,
           times(1)).notifyChange(any(DataObjectFieldDeletedEvent.class));
}
 
開發者ID:kiegroup,項目名稱:kie-wb-common,代碼行數:21,代碼來源:RemovePropertyCommandTest.java

示例3: testFieldMutatorStringGeneration

import org.kie.workbench.common.services.datamodeller.core.DataObject; //導入方法依賴的package包/類
@Test
public void testFieldMutatorStringGeneration() {

    DataModel dataModel = dataModelOracleDriver.createModel();
    DataObject object = dataModel.addDataObject("com.test.Object1");
    ObjectProperty property = object.addProperty("attribute1", "java.lang.String");

    GenerationContext generationContext = new GenerationContext( dataModel );

    try {
        String result = engine.generateFieldSetterString(generationContext, property);
        assertEquals( results.getProperty( "testFieldMutatorStringGeneration" ), result );
    } catch ( Exception e ) {
        e.printStackTrace();
    }
}
 
開發者ID:kiegroup,項目名稱:kie-wb-common,代碼行數:17,代碼來源:GenerationEngineTest.java

示例4: getLineDataObject

import org.kie.workbench.common.services.datamodeller.core.DataObject; //導入方法依賴的package包/類
protected DataObject getLineDataObject() {
    DataObject expense = new DataObjectImpl(Line.class.getPackage().toString(),
                                            Line.class.getSimpleName());

    expense.addProperty("id",
                        Long.class.getName(),
                        false,
                        null);
    expense.addProperty("date",
                        Date.class.getName(),
                        false,
                        null);
    expense.addProperty("product",
                        String.class.getName(),
                        false,
                        null);
    expense.addProperty("price",
                        Double.class.getName(),
                        false,
                        null);
    return expense;
}
 
開發者ID:kiegroup,項目名稱:kie-wb-common,代碼行數:23,代碼來源:NestedFormsBPMNVFSFormDefinitionGeneratorServiceTest.java

示例5: getClientDataObject

import org.kie.workbench.common.services.datamodeller.core.DataObject; //導入方法依賴的package包/類
protected DataObject getClientDataObject() {
    DataObject client = new DataObjectImpl(Client.class.getPackage().toString(),
                                           Client.class.getSimpleName());

    client.addProperty("id",
                       Long.class.getName(),
                       false,
                       null);
    client.addProperty("name",
                       String.class.getName(),
                       false,
                       null);
    client.addProperty("lastName",
                       String.class.getName(),
                       false,
                       null);
    return client;
}
 
開發者ID:kiegroup,項目名稱:kie-wb-common,代碼行數:19,代碼來源:NestedFormsBPMNVFSFormDefinitionGeneratorServiceTest.java

示例6: 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

示例7: getExpenseDataObject

import org.kie.workbench.common.services.datamodeller.core.DataObject; //導入方法依賴的package包/類
protected DataObject getExpenseDataObject() {
    DataObject expense = new DataObjectImpl(Expense.class.getPackage().toString(),
                                            Expense.class.getSimpleName());

    expense.addProperty("id",
                        Long.class.getName(),
                        false,
                        null);
    expense.addProperty("date",
                        Date.class.getName(),
                        false,
                        null);
    expense.addProperty("client",
                        Client.class.getName(),
                        false,
                        null);
    expense.addProperty("lines",
                        Line.class.getName(),
                        true,
                        List.class.getName());
    return expense;
}
 
開發者ID:kiegroup,項目名稱:kie-wb-common,代碼行數:23,代碼來源:NestedFormsBPMNVFSFormDefinitionGeneratorServiceTest.java

示例8: testMaxFieldsForConstructorsStringGeneration1

import org.kie.workbench.common.services.datamodeller.core.DataObject; //導入方法依賴的package包/類
@Test
public void testMaxFieldsForConstructorsStringGeneration1() {

    DataModel dataModel = dataModelOracleDriver.createModel();
    DataObject object1 = dataModel.addDataObject("com.test.MaxFieldsForConstructor1");

    ObjectProperty prop1;
    //The constructor for this data object should be generated, since we don't reach the limit.
    for (int i = 0; i < GenerationTools.MAX_FIELDS_FOR_DEFAULT_CONSTRUCTOR-1; i++) {
        prop1 = object1.addProperty("attribute"+normalize(i), "java.lang.String");
        ((ObjectPropertyImpl)prop1).setFileOrder( i );
    }

    GenerationContext generationContext = new GenerationContext( dataModel );

    try {
        String result = engine.generateAllConstructorsString(generationContext, object1);
        assertEquals( results.getProperty( "testMaxFieldsForConstructorsStringGeneration1" ), result );
    } catch ( Exception e ) {
        e.printStackTrace();
    }
}
 
開發者ID:kiegroup,項目名稱:kie-wb-common,代碼行數:23,代碼來源:GenerationEngineTest.java

示例9: addProperty

import org.kie.workbench.common.services.datamodeller.core.DataObject; //導入方法依賴的package包/類
protected ObjectProperty addProperty(DataObject dataObject,
                                     String propertyName,
                                     String className,
                                     boolean multiple,
                                     boolean withLabels) {

    ObjectProperty property = dataObject.addProperty(propertyName,
                                                     className,
                                                     multiple);

    if (withLabels) {
        Annotation labelAnnotation = new AnnotationImpl(new AnnotationDefinitionImpl(MainDomainAnnotations.LABEL_ANNOTATION));
        labelAnnotation.setValue(MainDomainAnnotations.VALUE_PARAM,
                                 LABEL_SUFFIX + propertyName);
        property.addAnnotation(labelAnnotation);
    }

    return property;
}
 
開發者ID:kiegroup,項目名稱:kie-wb-common,代碼行數:20,代碼來源:AbstractDataObjectTest.java

示例10: testFieldStringGeneration

import org.kie.workbench.common.services.datamodeller.core.DataObject; //導入方法依賴的package包/類
@Test
public void testFieldStringGeneration() {

    DataModel dataModel = dataModelOracleDriver.createModel();
    DataObject object = dataModel.addDataObject("com.test.Object1");
    ObjectProperty property = object.addProperty("attribute1", "java.lang.String");

    GenerationContext generationContext = new GenerationContext( dataModel );

    try {
        String result = engine.generateFieldString(generationContext, property);
        assertEquals( results.getProperty( "testFieldStringGeneration" ), result );
    } catch ( Exception e ) {
        e.printStackTrace();
    }
}
 
開發者ID:kiegroup,項目名稱:kie-wb-common,代碼行數:17,代碼來源:GenerationEngineTest.java

示例11: loadDataObjectWithBendableScoreType

import org.kie.workbench.common.services.datamodeller.core.DataObject; //導入方法依賴的package包/類
@Test
public void loadDataObjectWithBendableScoreType() {
    PlannerDataObjectEditor objectEditor = createObjectEditor();

    DataObject dataObject = context.getDataObject();

    dataObject.addAnnotation(DataModelerEditorsTestHelper.createAnnotation(PlanningSolution.class,
                                                                           null,
                                                                           null));

    ObjectProperty scoreObjectProperty = new ObjectPropertyImpl("score",
                                                                BendableScore.class.getName(),
                                                                false);
    dataObject.addProperty(scoreObjectProperty);

    scoreObjectProperty.addAnnotation(DataModelerEditorsTestHelper.createAnnotation(PlanningScore.class,
                                                                                    new Pair("bendableHardLevelsSize",
                                                                                             5),
                                                                                    new Pair("bendableSoftLevelsSize",
                                                                                             10)));
    scoreObjectProperty.addAnnotation(DataModelerEditorsTestHelper.createAnnotation(Generated.class,
                                                                                    null,
                                                                                    null));

    objectEditor.onContextChange(context);

    verify(view,
           times(1)).setPlanningSolutionBendableScoreHardLevelsSize(5);
    verify(view,
           times(1)).setPlanningSolutionBendableScoreSoftLevelsSize(10);
}
 
開發者ID:kiegroup,項目名稱:optaplanner-wb,代碼行數:32,代碼來源:PlannerDataObjectEditorTest.java

示例12: planningSolutionSettings

import org.kie.workbench.common.services.datamodeller.core.DataObject; //導入方法依賴的package包/類
@Test
public void planningSolutionSettings() {

    PlannerDataObjectFieldEditor fieldEditor = createFieldEditor();

    //first configure the DataObject as a PlanningSolution
    DataObject dataObject = context.getDataObject();
    dataObject.addAnnotation(new AnnotationImpl(context.getAnnotationDefinition(PlanningSolution.class.getName())));
    dataObject.addProperty("score",
                           HardSoftScore.class.getName());

    ObjectProperty field1 = dataObject.getProperty("field1");
    //emulates the selection of field1
    context.setObjectProperty(field1);

    //The domain editors typically reacts upon DataModelerContext changes.
    //when the context changes the editor will typically be reloaded.
    fieldEditor.onContextChange(context);

    when(view.getValueRangeProviderValue()).thenReturn(true);
    when(view.getValueRangeProviderIdValue()).thenReturn("valueRangeProviderIdValue");

    //emulate the user input
    fieldEditor.onValueRangeProviderChange();
    fieldEditor.onValueRangeProviderIdChange();

    assertNotNull(field1.getAnnotation(ValueRangeProvider.class.getName()));
    assertEquals("valueRangeProviderIdValue",
                 AnnotationValueHandler.getStringValue(field1,
                                                       ValueRangeProvider.class.getName(),
                                                       "id"));
}
 
開發者ID:kiegroup,項目名稱:optaplanner-wb,代碼行數:33,代碼來源:PlannerDataObjectFieldEditorTest.java

示例13: extractScoreTypeFqn

import org.kie.workbench.common.services.datamodeller.core.DataObject; //導入方法依賴的package包/類
@Test
public void extractScoreTypeFqn() {
    DataObject dataObject = new DataObjectImpl("test",
                                               "Test");
    dataObject.addAnnotation(new AnnotationImpl(DriverUtils.buildAnnotationDefinition(PlanningSolution.class)));
    dataObject.addProperty("score",
                           HardSoftScore.class.getName());

    String result = scoreHolderUtils.extractScoreTypeFqn(dataObject);

    assertEquals(HardSoftScore.class.getName(),
                 result);
}
 
開發者ID:kiegroup,項目名稱:optaplanner-wb,代碼行數:14,代碼來源:ScoreHolderUtilsTest.java

示例14: createDataObject

import org.kie.workbench.common.services.datamodeller.core.DataObject; //導入方法依賴的package包/類
private DataObject createDataObject(Class<? extends Score> scoreClass) {
    DataObject dataObject = new DataObjectImpl("test",
                                               "Test");
    if (scoreClass != null) {
        dataObject.addAnnotation(new AnnotationImpl(DriverUtils.buildAnnotationDefinition(PlanningSolution.class)));
        dataObject.addProperty("score",
                               scoreClass.getName());
    }
    return dataObject;
}
 
開發者ID:kiegroup,項目名稱:optaplanner-wb,代碼行數:11,代碼來源:PlanningSolutionScoreHolderSaveValidatorTest.java

示例15: 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


注:本文中的org.kie.workbench.common.services.datamodeller.core.DataObject.addProperty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。