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