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


Java ResourceReference类代码示例

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


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

示例1: visit

import org.kie.workbench.common.services.refactoring.ResourceReference; //导入依赖的package包/类
private void visit(final Characteristic c) {
    //Add type
    final String typeName = c.getFact();
    final String fullyQualifiedClassName = getFullyQualifiedClassName(typeName);
    ResourceReference resRef = addResourceReference(fullyQualifiedClassName,
                                                    ResourceType.JAVA);

    //Add field
    final String fieldName = c.getField();
    final String fieldFullyQualifiedClassName = getFieldFullyQualifiedClassName(fullyQualifiedClassName,
                                                                                fieldName);
    resRef.addPartReference(fieldName,
                            PartType.FIELD);
    addResourceReference(fieldFullyQualifiedClassName,
                         ResourceType.JAVA);
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:17,代码来源:GuidedScoreCardIndexVisitor.java

示例2: addField

import org.kie.workbench.common.services.refactoring.ResourceReference; //导入依赖的package包/类
private String addField(final String fieldName,
                        final String fullyQualifiedClassName) {
    final ModelField[] mfs = dmo.getModuleModelFields().get(fullyQualifiedClassName);
    if (mfs != null) {
        for (ModelField mf : mfs) {
            if (mf.getName().equals(fieldName)) {
                // add the type of the field owner and the field reference
                ResourceReference resRef = addResourceReference(fullyQualifiedClassName,
                                                                ResourceType.JAVA);
                resRef.addPartReference(fieldName,
                                        PartType.FIELD);
                // add the type of the field
                addResourceReference(mf.getClassName(),
                                     ResourceType.JAVA);
                return mf.getClassName();
            }
        }
    }
    return null;
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:21,代码来源:PackageDescrIndexVisitor.java

示例3: addReferencedResourcesToIndexBuilder

import org.kie.workbench.common.services.refactoring.ResourceReference; //导入依赖的package包/类
/**
 * This method adds the index terms necessary for impact analysis to the {@link DefaultIndexBuilder}, which is basically
 * the lucene doc for a resource.
 * @param builder The {@link DefaultIndexBuilder} instance for a resource
 * @param resRefCollector A collector containing info (resources, references) on the asset indexed
 * to other resources that an indexed resource has.
 */
protected void addReferencedResourcesToIndexBuilder(DefaultIndexBuilder builder,
                                                    ResourceReferenceCollector resRefCollector) {
    Collection<ResourceReference> referencedResources = resRefCollector.getResourceReferences();
    if (!referencedResources.isEmpty()) {
        for (ResourceReference resourceRef : referencedResources) {
            builder.addGenerator(resourceRef);
        }
    }
    Collection<SharedPart> sharedReferences = resRefCollector.getSharedReferences();
    if (!sharedReferences.isEmpty()) {
        for (SharedPart sharedRef : sharedReferences) {
            builder.addGenerator(sharedRef);
        }
    }

    Collection<Resource> resources = resRefCollector.getResources();
    if (!resources.isEmpty()) {
        for (Resource res : resources) {
            builder.addGenerator(res);
        }
    }
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:30,代码来源:AbstractFileIndexer.java

示例4: visitSingleFieldConstraint

import org.kie.workbench.common.services.refactoring.ResourceReference; //导入依赖的package包/类
private void visitSingleFieldConstraint(final SingleFieldConstraint sfc) {
    ResourceReference resRef = addResourceReference(getFullyQualifiedClassName(sfc.getFactType()),
                                                    ResourceType.JAVA);
    resRef.addPartReference(sfc.getFieldName(),
                            PartType.FIELD);
    addResourceReference(getFullyQualifiedClassName(sfc.getFieldType()),
                         ResourceType.JAVA);

    if (sfc.getConnectives() != null) {
        for (int i = 0; i < sfc.getConnectives().length; i++) {
            visit(sfc.getConnectives()[i]);
        }
    }
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:15,代码来源:GuidedRuleTemplateIndexVisitor.java

示例5: visitConnectiveConstraint

import org.kie.workbench.common.services.refactoring.ResourceReference; //导入依赖的package包/类
private void visitConnectiveConstraint(final ConnectiveConstraint cc) {
    ResourceReference resRef = addResourceReference(getFullyQualifiedClassName(cc.getFactType()),
                                                    ResourceType.JAVA);
    resRef.addPartReference(cc.getFieldName(),
                            PartType.FIELD);
    addResourceReference(getFullyQualifiedClassName(cc.getFieldType()),
                         ResourceType.JAVA);
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:9,代码来源:GuidedRuleTemplateIndexVisitor.java

示例6: visit

import org.kie.workbench.common.services.refactoring.ResourceReference; //导入依赖的package包/类
private void visit(final String fullyQualifiedClassName,
                   final ActionFieldValue afv) {
    ResourceReference resRef = addResourceReference(fullyQualifiedClassName,
                                                    ResourceType.JAVA);
    resRef.addPartReference(afv.getField(),
                            PartType.FIELD);
    addResourceReference(getFullyQualifiedClassName(afv.getType()),
                         ResourceType.JAVA);
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:10,代码来源:GuidedRuleTemplateIndexVisitor.java

示例7: visit

import org.kie.workbench.common.services.refactoring.ResourceReference; //导入依赖的package包/类
public void visit() {
    if (enumLoader.hasErrors()) {
        logger.error("Errors when indexing " + resourcePath.toAbsolutePath().toFile().getAbsolutePath());
        return;
    }
    for (Map.Entry<String, String[]> e : enumLoader.getData().entrySet()) {
        //Add type
        final String typeName = getTypeName(e.getKey());
        final String fullyQualifiedClassName = getFullyQualifiedClassName(typeName);

        //Add field
        final String fieldName = getFieldName(e.getKey());
        final String fieldFullyQualifiedClassName = getFieldFullyQualifiedClassName(fullyQualifiedClassName,
                                                                                    fieldName);

        //If either type or field could not be resolved log a warning
        if (fullyQualifiedClassName == null) {
            logger.warn("Index entry will not be created for '" + e.getKey() + "'. Unable to determine FQCN for '" + typeName + "'. ");
        } else {
            ResourceReference resRef = addResourceReference(fullyQualifiedClassName,
                                                            ResourceType.JAVA);
            if (fieldFullyQualifiedClassName == null) {
                logger.warn("Index entry will not be created for '" + e.getKey() + "'. Unable to determine FQCN for '" + typeName + "." + fieldName + "'. ");
            } else {
                resRef.addPartReference(fieldName,
                                        PartType.FIELD);
                addResourceReference(fieldFullyQualifiedClassName,
                                     ResourceType.JAVA);
            }
        }
    }
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:33,代码来源:EnumIndexVisitor.java

示例8: checkVisitor

import org.kie.workbench.common.services.refactoring.ResourceReference; //导入依赖的package包/类
private void checkVisitor( Collection<String> referenceDefinitions ) {
    Collection<ResourceReference> resourceReferences = visitor.getResourceReferences();
    assertEquals( referenceDefinitions.size(), resourceReferences.size() );

    List<String> resourceReferenceList = resourceReferences.stream().map( resourceReference -> resourceReference.toString() ).collect( Collectors.toList() );
    assertTrue( resourceReferenceList.containsAll( referenceDefinitions ) );
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:8,代码来源:JavaSourceVisitorTest.java

示例9: visit

import org.kie.workbench.common.services.refactoring.ResourceReference; //导入依赖的package包/类
protected void visit(final EnumDeclarationDescr descr) {
    String typeName = getPackagePrefix() + descr.getFullTypeName();
    ResourceReference enumLocalRef = addResourceReference(typeName,
                                                          ResourceType.DRL_ENUM);
    for (EnumLiteralDescr enumLitDescr : descr.getLiterals()) {
        enumLocalRef.addPartReference(enumLitDescr.getName(),
                                      PartType.DRL_ENUM_VAL);
        visitAnnos(enumLitDescr);
    }
    visitAnnos(descr);
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:12,代码来源:PackageDescrIndexVisitor.java

示例10: getResourceReferences

import org.kie.workbench.common.services.refactoring.ResourceReference; //导入依赖的package包/类
/**
 * Used by the {@link AbstractFileIndexer} implementation to get the reference information.
 * @return A {@link Collection} of {@link ResourceReference} instances.
 */
public Collection<ResourceReference> getResourceReferences() {
    if( referencedResourcesMap != null ) {
        return referencedResourcesMap.values();
    }
    return Collections.emptyList();
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:11,代码来源:ResourceReferenceCollector.java

示例11: addResourceReferences

import org.kie.workbench.common.services.refactoring.ResourceReference; //导入依赖的package包/类
/**
 * Used by the Visitor implemenation to add multiple {@link ResourceReference} instances at once.
 * @param collector A {@link ResourceReferenceCollector} containing information about the asset being indexed.
 */
public void addResourceReferences(ResourceReferenceCollector collector) {
    if( collector.referencedResourcesMap != null ) {
        Map<String, ResourceReference> refResMap = internalGetResourceReferences();
        for( Entry<String, ResourceReference> resRefEntry : collector.referencedResourcesMap.entrySet() ) {
            ResourceReference newResRef = resRefEntry.getValue();
            ResourceReference existingResRef = refResMap.put(resRefEntry.getKey(), newResRef);
            if( existingResRef != null ) {
                newResRef.addPartReference(existingResRef.getPartReferences());
            }
        }
    }
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:17,代码来源:ResourceReferenceCollector.java

示例12: visit

import org.kie.workbench.common.services.refactoring.ResourceReference; //导入依赖的package包/类
public void visit(AnnotationSource<? extends JavaClassSource> annoSource) {
    if (annoSource.getQualifiedName().equals(AssetsUsageServiceImplTest.REFERENCED)) {
        ResourceReference reference = addResourceReference(annoSource.getStringValue("resourceFQN"),
                                                           ResourceType.JAVA);
        reference.addPartReference(annoSource.getStringValue("part"),
                                   PartType.FIELD);
    }
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:9,代码来源:TestJavaSourceVisitor.java

示例13: thenCollectorHasResourceReferences

import org.kie.workbench.common.services.refactoring.ResourceReference; //导入依赖的package包/类
private void thenCollectorHasResourceReferences( final ResourceReferenceCollector collector,
                                                 final int resourceReferencesCount ) {
    final Collection<ResourceReference> resourceReferences = collector.getResourceReferences();
    assertNotNull( resourceReferences );
    assertEquals( resourceReferencesCount,
                  resourceReferences.size() );
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:8,代码来源:ResourceReferenceCollectorTest.java

示例14: thenResourceReferenceHasPartReferences

import org.kie.workbench.common.services.refactoring.ResourceReference; //导入依赖的package包/类
private void thenResourceReferenceHasPartReferences( final ResourceReference resourceReference,
                                                     final int partReferencesCount ) {
    assertNotNull( resourceReference );
    assertEquals( ResourceType.JAVA,
                  resourceReference.getResourceType() );
    assertEquals(
            partReferencesCount,
            resourceReference.getPartReferences().size() );
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:10,代码来源:ResourceReferenceCollectorTest.java

示例15: index

import org.kie.workbench.common.services.refactoring.ResourceReference; //导入依赖的package包/类
@Override
public void index(FormDefinition formDefinition, DataObjectFormModel formModel) {
    ResourceReference reference = addResourceReference(formModel.getClassName(),
                                                       ResourceType.JAVA);

    formDefinition.getFields().forEach(fieldDefinition -> visitField(reference, fieldDefinition));
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:8,代码来源:DataModellerFormModelVisitor.java


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