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


Java DataObject.getClassName方法代码示例

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


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

示例1: getJavaTypeFQCN

import org.kie.workbench.common.services.datamodeller.core.DataObject; //导入方法依赖的package包/类
private String getJavaTypeFQCN(final DataObject dataObject) {
    final String packageName = dataObject.getPackageName();
    final String className = dataObject.getClassName();
    if (packageName == null || packageName.equals("")) {
        return className;
    }
    return packageName + "." + className;
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:9,代码来源:DecisionTableXLSToDecisionTableGuidedConverter.java

示例2: refreshTitle

import org.kie.workbench.common.services.datamodeller.core.DataObject; //导入方法依赖的package包/类
private void refreshTitle(DataObject dataObject) {
    if (dataObject != null) {
        String label = DataModelerUtils.getDataObjectFullLabel(dataObject,
                                                               false);
        String title = "'" + label + "'" + Constants.INSTANCE.modelEditor_general_properties_label();
        String tooltip = dataObject.getClassName();
        view.setDomainContainerTitle(title,
                                     tooltip);
    }
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:11,代码来源:DataModelerScreenPresenter.java

示例3: reset

import org.kie.workbench.common.services.datamodeller.core.DataObject; //导入方法依赖的package包/类
private void reset() {
    referencedBy.clear();
    references.clear();
    classNames.clear();
    labelledClassNames.clear();
    offspringMap.clear();
    if (dataModel != null) {
        for (DataObject extClassName : dataModel.getExternalClasses()) {
            classNames.put(extClassName.getClassName(), null);
            labelledClassNames.put(extClassName.getClassName(), extClassName.getClassName());
        }
        for (DataObject object : dataModel.getDataObjects()) {
            String className = object.getClassName();
            classNames.put(className, AnnotationValueHandler.getStringValue( object, MainDomainAnnotations.LABEL_ANNOTATION ));
            labelledClassNames.put(DataModelerUtils.getDataObjectFullLabel(object), className);

            String superClassName = object.getSuperClassName();
            if (superClassName != null &&  !"".equals(superClassName)) objectExtended(superClassName, className, true);

            for (ObjectProperty prop : object.getProperties()) {
                if (!prop.isBaseType()) {
                    objectReferenced(prop.getClassName(), object.getClassName());
                }
            }
        }
    }
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:28,代码来源:DataModelHelper.java

示例4: setObjectSelectorLabel

import org.kie.workbench.common.services.datamodeller.core.DataObject; //导入方法依赖的package包/类
private void setObjectSelectorLabel(DataObject dataObject) {
    String label = dataObject != null ? DataModelerUtils.getDataObjectFullLabel(dataObject,
                                                                                false) : "";
    String title = dataObject != null ? dataObject.getClassName() : "";
    view.setObjectSelectorLabel(label,
                                title);
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:8,代码来源:DataObjectBrowser.java

示例5: updateSource

import org.kie.workbench.common.services.datamodeller.core.DataObject; //导入方法依赖的package包/类
/**
 * Updates Java code provided in the source parameter with the data object values provided in the dataObject
 * parameter. This method does not write any changes in the file system.
 * @param source Java code to be updated.
 * @param path Path to the java file. (used for error messages adf and project )
 * @param dataObject Data object definition.
 * @return returns a GenerationResult object with the updated Java code and the dataObject parameter as is.
 */
@Override
public GenerationResult updateSource(final String source,
                                     final Path path,
                                     final DataObject dataObject) {

    GenerationResult result = new GenerationResult();
    KieModule module;

    try {

        module = moduleService.resolveModule(path);
        if (module == null) {
            logger.warn("File : " + path.toURI() + " do not belong to a valid module");
            result.setSource(source);
            return result;
        }

        ClassLoader classLoader = classLoaderHelper.getModuleClassLoader(module);
        Pair<String, List<DataModelerError>> updateResult = updateJavaSource(source,
                                                                             dataObject,
                                                                             new HashMap<String, String>(),
                                                                             new ArrayList<String>(),
                                                                             classLoader);
        result.setSource(updateResult.getK1());
        result.setDataObject(dataObject);
        result.setErrors(updateResult.getK2());

        return result;
    } catch (Exception e) {
        logger.error("Source file for data object: " + dataObject.getClassName() + ", couldn't be updated",
                     e);
        throw new ServiceException("Source file for data object: " + dataObject.getClassName() + ", couldn't be updated",
                                   e);
    }
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:44,代码来源:DataModelerServiceImpl.java

示例6: getObjectPropertyPathList

import org.kie.workbench.common.services.datamodeller.core.DataObject; //导入方法依赖的package包/类
private List<ObjectPropertyPath> getObjectPropertyPathList(Annotation comparatorDefinition) {
    ComparatorDefinitionAnnotationValueHandler comparatorAnnotationHandler = new ComparatorDefinitionAnnotationValueHandler(comparatorDefinition);
    List<ObjectPropertyPath> objectPropertyPathList = new ArrayList<>();
    List<Annotation> comparatorFieldPaths = comparatorAnnotationHandler.getObjectPropertyPaths();

    for (Annotation comparatorFieldPath : comparatorFieldPaths) {
        ObjectPropertyPath objectPropertyPath = new ObjectPropertyPathImpl();
        objectPropertyPath.setDescending(!comparatorAnnotationHandler.isAscending(comparatorFieldPath));

        List<Annotation> comparatorFields = comparatorAnnotationHandler.getObjectProperties(comparatorFieldPath);
        if (!comparatorFields.isEmpty()) {

            String objectPropertyName = comparatorAnnotationHandler.getName(comparatorFields.get(0));

            ObjectProperty objectProperty = dataObject.getProperty(objectPropertyName);
            if (objectProperty == null) {
                throw new IllegalStateException(dataObject.getName() + "Comparator: Property " + objectPropertyName + " not found in data object " + dataObject.getClassName());
            }
            objectPropertyPath.appendObjectProperty(objectProperty);
            for (int i = 1; i < comparatorFields.size(); i++) {

                objectPropertyName = comparatorAnnotationHandler.getName(comparatorFields.get(i));

                ObjectProperty lastObjectPropertyInPath = objectPropertyPath.getObjectPropertyPath().get(objectPropertyPath.getObjectPropertyPath().size() - 1);
                if (lastObjectPropertyInPath.isBaseType() || lastObjectPropertyInPath.isPrimitiveType()) {
                    throw new IllegalStateException(dataObject.getName() + "Comparator: Cannot append property " + objectPropertyName + " to primitive/base type " + lastObjectPropertyInPath.getClassName());
                }
                DataObject lastDataObjectInPath = getContext().getDataModel().getDataObject(lastObjectPropertyInPath.getClassName());
                if (lastObjectPropertyInPath == null) {
                    throw new IllegalStateException(dataObject.getName() + "Comparator: Data object " + lastObjectPropertyInPath.getClassName() + " not found");
                }
                ObjectProperty currentObjectProperty = lastDataObjectInPath.getProperty(objectPropertyName);
                if (currentObjectProperty == null) {
                    throw new IllegalStateException(dataObject.getName() + "Comparator: Property " + objectPropertyName + " not found in data object " + lastDataObjectInPath.getClassName());
                }
                objectPropertyPath.appendObjectProperty(currentObjectProperty);
            }
        }
        objectPropertyPathList.add(objectPropertyPath);
    }

    return objectPropertyPathList;
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:44,代码来源:PlannerDataObjectEditor.java

示例7: updateDataObject

import org.kie.workbench.common.services.datamodeller.core.DataObject; //导入方法依赖的package包/类
/**
 * Updates data object provided in the dataObject parameter with the Java code provided in the source parameter.
 * This method does not write changes in the file system.
 * @param dataObject Data object definition to be updated.
 * @param source Java code to use for the update.
 * @param path Path to the java file. (used for error messages adf)
 * @return returns a GenerationResult object with the updated data object and the source and path parameter as is.
 */
@Override
public GenerationResult updateDataObject(final DataObject dataObject,
                                         final String source,
                                         final Path path) {
    //Resolve the dataobject update in memory

    GenerationResult result = new GenerationResult();
    KieModule module;

    try {
        result.setSource(source);
        module = moduleService.resolveModule(path);
        if (module == null) {
            logger.warn("File : " + path.toURI() + " do not belong to a valid module");
            result.setSource(source);
            return result;
        }

        ClassLoader classLoader = classLoaderHelper.getModuleClassLoader(module);
        JavaRoasterModelDriver modelDriver = new JavaRoasterModelDriver(ioService,
                                                                        Paths.convert(path),
                                                                        classLoader,
                                                                        filterHolder);
        ModelDriverResult driverResult = modelDriver.loadDataObject(source,
                                                                    Paths.convert(path));

        if (driverResult.hasErrors()) {
            result.setErrors(serviceHelper.toDataModelerError(driverResult.getErrors()));
        } else {
            if (driverResult.getDataModel().getDataObjects().size() > 0) {
                result.setDataObject(driverResult.getDataModel().getDataObjects().iterator().next());
            }
        }

        return result;
    } catch (Exception e) {
        logger.error("Source file for data object: " + dataObject.getClassName() + ", couldn't be parsed",
                     e);
        throw new ServiceException("Source file for data object: " + dataObject.getClassName() + ", couldn't be parsed",
                                   e);
    }
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:51,代码来源:DataModelerServiceImpl.java

示例8: resolveSaveSource

import org.kie.workbench.common.services.datamodeller.core.DataObject; //导入方法依赖的package包/类
private GenerationResult resolveSaveSource(final String source,
                                           final Path path,
                                           final DataObject dataObject) {
    GenerationResult result = new GenerationResult();
    KieModule module;
    String updatedSource;

    try {

        module = moduleService.resolveModule(path);
        if (module == null) {
            logger.warn("File : " + path.toURI() + " do not belong to a valid module");
            result.setSource(source);
            return result;
        }

        if (dataObject != null) {
            //the source needs to be updated with the DataObject definition prior to save
            result = updateSource(source,
                                  path,
                                  dataObject);
            updatedSource = result.getSource();
        } else {
            //if the dataObject wasn't provided the source is already prepared to be saved and likely
            //it's not parsed at the ui. So we will save the provided source and try to parse the data object
            updatedSource = source;
        }

        if (dataObject == null) {
            ClassLoader classLoader = classLoaderHelper.getModuleClassLoader(module);
            JavaRoasterModelDriver modelDriver = new JavaRoasterModelDriver(ioService,
                                                                            Paths.convert(path),
                                                                            classLoader,
                                                                            filterHolder);
            ModelDriverResult driverResult = modelDriver.loadDataObject(source,
                                                                        Paths.convert(path));

            if (driverResult.hasErrors()) {
                result.setErrors(serviceHelper.toDataModelerError(driverResult.getErrors()));
            } else {
                if (driverResult.getDataModel().getDataObjects().size() > 0) {
                    result.setDataObject(driverResult.getDataModel().getDataObjects().iterator().next());
                }
            }
        }

        result.setSource(updatedSource);

        return result;
    } catch (Exception e) {
        logger.error("Source file couldn't be updated, path: " + path.toURI() + ", dataObject: " + (dataObject != null ? dataObject.getClassName() : null) + ".",
                     e);
        throw new ServiceException("Source file couldn't be updated, path: " + path.toURI() + ", dataObject: " + (dataObject != null ? dataObject.getClassName() : null) + ".",
                                   e);
    }
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:57,代码来源:DataModelerServiceImpl.java

示例9: createFormModel

import org.kie.workbench.common.services.datamodeller.core.DataObject; //导入方法依赖的package包/类
public DataObjectFormModel createFormModel(DataObject dataObject,
                                           Path path) {
    this.path = path;

    initClassLoader();

    DataObjectFormModel formModel = new DataObjectFormModel(dataObject.getName(),
                                                            dataObject.getClassName());

    formModel.getProperties().clear();

    formModel.getProperties().addAll(getDataObjectProperties(dataObject));

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


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