本文整理汇总了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;
}
示例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));
}
示例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();
}
}
示例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;
}
示例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();
}
}
示例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;
}
示例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();
}
}
示例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);
}
示例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"));
}
示例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);
}
示例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;
}
示例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;
}