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


Java ObjectPropertyImpl类代码示例

本文整理汇总了Java中org.kie.workbench.common.services.datamodeller.core.impl.ObjectPropertyImpl的典型用法代码示例。如果您正苦于以下问题:Java ObjectPropertyImpl类的具体用法?Java ObjectPropertyImpl怎么用?Java ObjectPropertyImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ObjectPropertyImpl类属于org.kie.workbench.common.services.datamodeller.core.impl包,在下文中一共展示了ObjectPropertyImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validateIsAPlanningScore

import org.kie.workbench.common.services.datamodeller.core.impl.ObjectPropertyImpl; //导入依赖的package包/类
@Test
public void validateIsAPlanningScore() {
    DataObject dataObject = new DataObjectImpl("test",
                                               "PlanningSolution");
    dataObject.addAnnotation(new AnnotationImpl(DriverUtils.buildAnnotationDefinition(PlanningSolution.class)));

    ObjectProperty objectProperty = new ObjectPropertyImpl("score",
                                                           HardSoftScore.class.getName(),
                                                           false);
    objectProperty.addAnnotation(new AnnotationImpl(DriverUtils.buildAnnotationDefinition(PlanningScore.class)));
    objectProperty.addAnnotation(new AnnotationImpl(DriverUtils.buildAnnotationDefinition(Generated.class)));

    Collection<ValidationMessage> result = deleteValidator.validate(dataObject,
                                                                    objectProperty);
    assertEquals(1,
                 result.size());
    assertTrue(result.iterator().next() instanceof PlanningScoreToBeDeletedMessage);
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:19,代码来源:PlanningScoreDeleteValidatorTest.java

示例2: createPlanningSolution

import org.kie.workbench.common.services.datamodeller.core.impl.ObjectPropertyImpl; //导入依赖的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

示例3: execute

import org.kie.workbench.common.services.datamodeller.core.impl.ObjectPropertyImpl; //导入依赖的package包/类
@Override
public void execute() {

    String oldType = field.getClassName();

    String newType = (String) newValue;

    field.setClassName( newType );
    field.setMultiple( multiple );
    if ( multiple && field.getBag() == null ) {
        field.setBag( ObjectPropertyImpl.DEFAULT_PROPERTY_BAG );
    }

    if ( !getContext().getHelper().isBaseType( newType ) ) {
        getContext().getHelper().dataObjectUnReferenced( oldType, getDataObject().getClassName() );
        getContext().getHelper().dataObjectReferenced( newType, getDataObject().getClassName() );
    }

    notifyFieldChange( ChangeType.FIELD_TYPE_CHANGE, context, source, dataObject, field, null, null, oldType,
            newType );

}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:23,代码来源:FieldTypeChangeCommand.java

示例4: execute

import org.kie.workbench.common.services.datamodeller.core.impl.ObjectPropertyImpl; //导入依赖的package包/类
@Override
public void execute() {

    boolean multiple = isMultiple && !getContext().getHelper().isPrimitiveType( propertyType ); //extra check
    property = new ObjectPropertyImpl( propertyName,
            propertyType,
            multiple );

    if ( propertyLabel != null && !"".equals( propertyLabel ) ) {
        Annotation annotation = new AnnotationImpl( getContext().getAnnotationDefinitions().get( MainDomainAnnotations.LABEL_ANNOTATION ) );
        annotation.setValue( MainDomainAnnotations.VALUE_PARAM, propertyLabel );
        property.addAnnotation( annotation );
    }

    dataObject.addProperty( property );

    if ( !property.isBaseType() ) {
            getContext().getHelper().dataObjectReferenced( property.getClassName(), dataObject.getClassName() );
    }

    notifyChange( new DataObjectFieldCreatedEvent( getContext().getContextId(), getSource(), getDataObject(), property ) );
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:23,代码来源:AddPropertyCommand.java

示例5: safeObjectPropertyDeleteEmptyValidationMessages

import org.kie.workbench.common.services.datamodeller.core.impl.ObjectPropertyImpl; //导入依赖的package包/类
@Test
public void safeObjectPropertyDeleteEmptyValidationMessages() {
    DataObjectBrowser dataObjectBrowser = createBrowser();

    DataObjectImpl dataObject = new DataObjectImpl("test",
                                                   "DataObject");
    dataObjectBrowser.setDataObject(dataObject);

    ObjectProperty objectProperty = new ObjectPropertyImpl("safeField",
                                                           Integer.class.getName(),
                                                           false);

    when(dataObjectValidationService.validateObjectPropertyDeletion(dataObject,
                                                                    objectProperty)).thenReturn(Collections.emptyList());

    dataObjectBrowser.onDeleteProperty(objectProperty,
                                       0);

    verify(view,
           never()).showValidationPopupForDeletion(anyListOf(ValidationMessage.class),
                                                   any(Command.class),
                                                   any(Command.class));
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:24,代码来源:DataObjectBrowserTest.java

示例6: safeObjectPropertyDeleteHasValidationMessages

import org.kie.workbench.common.services.datamodeller.core.impl.ObjectPropertyImpl; //导入依赖的package包/类
@Test
public void safeObjectPropertyDeleteHasValidationMessages() {
    DataObjectBrowser dataObjectBrowser = createBrowser();

    DataObjectImpl dataObject = new DataObjectImpl("test",
                                                   "DataObject");
    dataObjectBrowser.setDataObject(dataObject);

    ObjectProperty objectProperty = new ObjectPropertyImpl("safeField",
                                                           Integer.class.getName(),
                                                           false);

    List<ValidationMessage> validationMessages = Arrays.asList(new ValidationMessage());
    when(dataObjectValidationService.validateObjectPropertyDeletion(dataObject,
                                                                    objectProperty)).thenReturn(validationMessages);

    dataObjectBrowser.onDeleteProperty(objectProperty,
                                       0);

    verify(view,
           times(1)).showValidationPopupForDeletion(anyListOf(ValidationMessage.class),
                                                    any(Command.class),
                                                    any(Command.class)
    );
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:26,代码来源:DataObjectBrowserTest.java

示例7: execute

import org.kie.workbench.common.services.datamodeller.core.impl.ObjectPropertyImpl; //导入依赖的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

示例8: testMaxFieldsForConstructorsStringGeneration1

import org.kie.workbench.common.services.datamodeller.core.impl.ObjectPropertyImpl; //导入依赖的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: loadDataObjectWithBendableScoreType

import org.kie.workbench.common.services.datamodeller.core.impl.ObjectPropertyImpl; //导入依赖的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

示例10: getFieldMetadataMatchingField

import org.kie.workbench.common.services.datamodeller.core.impl.ObjectPropertyImpl; //导入依赖的package包/类
@Test
public void getFieldMetadataMatchingField() {
    Annotation planningScoreAnnotation = new AnnotationImpl(DriverUtils.buildAnnotationDefinition(PlanningScore.class));
    ObjectProperty matchingField = new ObjectPropertyImpl("matchingField",
                                                          HardSoftScore.class.getName(),
                                                          false);
    matchingField.addAnnotation(planningScoreAnnotation);

    Optional<FieldMetadata> fieldMetadata = fieldMetadataProvider.getFieldMetadata(matchingField);

    assertTrue(fieldMetadata.isPresent());
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:13,代码来源:PlannerFieldMetadataProviderTest.java

示例11: getFieldMetadataNonMatchingField

import org.kie.workbench.common.services.datamodeller.core.impl.ObjectPropertyImpl; //导入依赖的package包/类
@Test
public void getFieldMetadataNonMatchingField() {
    Annotation generatedAnnotation = new AnnotationImpl(DriverUtils.buildAnnotationDefinition(Generated.class));
    ObjectProperty nonMatchingField = new ObjectPropertyImpl("nonMatchingField",
                                                             Integer.class.getName(),
                                                             false);
    nonMatchingField.addAnnotation(generatedAnnotation);

    Optional<FieldMetadata> fieldMetadata = fieldMetadataProvider.getFieldMetadata(nonMatchingField);

    assertFalse(fieldMetadata.isPresent());
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:13,代码来源:PlannerFieldMetadataProviderTest.java

示例12: validateIsNotAPlanningScore

import org.kie.workbench.common.services.datamodeller.core.impl.ObjectPropertyImpl; //导入依赖的package包/类
@Test
public void validateIsNotAPlanningScore() {
    DataObject dataObject = new DataObjectImpl("test",
                                               "PlainDataObject");
    ObjectProperty objectProperty = new ObjectPropertyImpl("notAPlanningScore",
                                                           Integer.class.getName(),
                                                           false);

    Collection<ValidationMessage> result = deleteValidator.validate(dataObject,
                                                                    objectProperty);

    assertEquals(0,
                 result.size());
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:15,代码来源:PlanningScoreDeleteValidatorTest.java

示例13: addPropertyTypeBrowseColumn

import org.kie.workbench.common.services.datamodeller.core.impl.ObjectPropertyImpl; //导入依赖的package包/类
@Test
public void addPropertyTypeBrowseColumn() {
    FieldMetadataProvider fieldMetadataProvider = objectProperty -> {
        if ("testField".equals(objectProperty.getName())) {
            ImageWrapper imageWrapper = new ImageWrapper("testUri",
                                                         "testDescription");
            FieldMetadata fieldMetadata = new FieldMetadata(imageWrapper);
            return Optional.of(fieldMetadata);
        }
        return Optional.empty();
    };
    Instance<FieldMetadataProvider> fieldMetadataProviderInstance = new MockInstanceImpl<>(fieldMetadataProvider);
    view = new DataObjectBrowserViewImpl(validationPopup,
                                         fieldMetadataProviderInstance);

    Column<ObjectProperty, List<ImageWrapper>> column = view.createPropertyTypeBrowseColumn();

    ObjectProperty matchingObjectProperty = new ObjectPropertyImpl("testField",
                                                                   "className",
                                                                   false);
    List<ImageWrapper> imageWrapperList = column.getValue(matchingObjectProperty);

    assertEquals(1,
                 imageWrapperList.size());

    ObjectProperty nonMatchingObjectProperty = new ObjectPropertyImpl("nonMatchingTestField",
                                                                      "className",
                                                                      false);
    imageWrapperList = column.getValue(nonMatchingObjectProperty);

    assertEquals(0,
                 imageWrapperList.size());
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:34,代码来源:DataObjectBrowserViewImplTest.java

示例14: validateObjectPropertyDeletion

import org.kie.workbench.common.services.datamodeller.core.impl.ObjectPropertyImpl; //导入依赖的package包/类
@Test
public void validateObjectPropertyDeletion() {
    Collection<ValidationMessage> result = validationService.validateObjectPropertyDeletion(new DataObjectImpl(),
                                                                                            new ObjectPropertyImpl());

    assertEquals(2,
                 result.size());
    assertTrue(result.contains(message1));
    assertTrue(result.contains(message2));
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:11,代码来源:DataObjectValidationServiceImplTest.java

示例15: createEvent

import org.kie.workbench.common.services.datamodeller.core.impl.ObjectPropertyImpl; //导入依赖的package包/类
@Test
public void createEvent() {
    DataObject currentDataObject = new DataObjectImpl();
    ObjectProperty currentField = new ObjectPropertyImpl();
    Method currentMethod = new MethodImpl();
    Module currentModule = new Module();
    String source = "testSource";
    String contextId = "testContextId";
    Path path = new PathFactory.PathImpl();

    DataModelerEvent event = new DataModelerEvent()
            .withCurrentDataObject(currentDataObject)
            .withCurrentField(currentField)
            .withCurrentMethod(currentMethod)
            .withCurrentProject(currentModule)
            .withSource(source)
            .withContextId(contextId)
            .withPath(path);

    assertEquals(currentDataObject, event.getCurrentDataObject());
    assertEquals(currentField, event.getCurrentField());
    assertEquals(currentMethod, event.getCurrentMethod());
    assertEquals(currentModule, event.getCurrentModule());
    assertEquals(source, event.getSource());
    assertEquals(contextId, event.getContextId());
    assertEquals(path, event.getPath());
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:28,代码来源:DataModelerEventTest.java


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