Tabnine Logo
ResourceUtils.isProject
Code IndexAdd Tabnine to your IDE (free)

How to use
isProject
method
in
org.sonar.api.resources.ResourceUtils

Best Java code snippets using org.sonar.api.resources.ResourceUtils.isProject (Showing top 9 results out of 315)

origin: org.sonarsource.sonarqube/sonar-batch

 public boolean isProjectOrModule() {
  return ResourceUtils.isProject(r);
 }
}
origin: org.codehaus.sonar.plugins/sonar-core-plugin

@Override
public void decorate(Resource resource, DecoratorContext context) {
 if (ResourceUtils.isProject(resource)) {
  persistConfiguration(resource);
 }
}
origin: org.sonarsource.sonarqube/sonar-batch

@CheckForNull
private static String getDescription(Resource r) {
 // Only for projets and modules
 return ResourceUtils.isProject(r) ? r.getDescription() : null;
}
origin: org.codehaus.sonar/sonar-batch

@VisibleForTesting
void saveCharacteristicMeasure(DecoratorContext context, Characteristic characteristic, Double value, boolean inMemory) {
 // we need the value on projects (root or module) even if value==0 in order to display correctly the SQALE history chart (see SQALE-122)
 // BUT we don't want to save zero-values for non top-characteristics (see SQALE-147)
 if (value > 0.0 || (ResourceUtils.isProject(context.getResource()) && characteristic.isRoot())) {
  Measure measure = new Measure(CoreMetrics.TECHNICAL_DEBT);
  measure.setCharacteristic(characteristic);
  saveMeasure(context, measure, value, inMemory);
 }
}
origin: org.codehaus.sonar-plugins/sonar-issues-report-plugin

@Override
public void decorate(Resource resource, DecoratorContext context) {
 if (!ResourceUtils.isPersistable(resource)) {
  return;
 }
 File path = null;
 if (ResourceUtils.isProject(resource)) {
  path = fs.baseDir();
 } else if (resource.getPath() != null) {
  path = new File(fs.baseDir(), resource.getPath());
 }
 ResourceNode resourceNode = new ResourceNode(resource, path, fs.sourceCharset());
 RESOURCE_BY_KEY.put(resource.getEffectiveKey(), resourceNode);
 for (DecoratorContext childContext : context.getChildren()) {
  Resource child = childContext.getResource();
  ResourceNode childNode = RESOURCE_BY_KEY.get(child.getEffectiveKey());
  if (childNode != null) {
   resourceNode.addChild(childNode);
  }
 }
}
origin: org.sonarsource.sonarqube/sonar-batch

private Bucket doIndex(Resource resource, @Nullable Resource parentReference) {
 Bucket bucket = getBucket(resource);
 if (bucket != null) {
  return bucket;
 }
 if (StringUtils.isBlank(resource.getKey())) {
  LOG.warn("Unable to index a resource without key " + resource);
  return null;
 }
 Resource parent = (Resource) ObjectUtils.defaultIfNull(parentReference, currentProject);
 Bucket parentBucket = getBucket(parent);
 if (parentBucket == null && parent != null) {
  LOG.warn("Resource ignored, parent is not indexed: " + resource);
  return null;
 }
 if (ResourceUtils.isProject(resource) || /* For technical projects */ResourceUtils.isRootProject(resource)) {
  resource.setEffectiveKey(resource.getKey());
 } else {
  resource.setEffectiveKey(ComponentKeys.createEffectiveKey(currentProject, resource));
 }
 bucket = new Bucket(resource).setParent(parentBucket);
 addBucket(resource, bucket);
 Resource parentResource = parentBucket != null ? parentBucket.getResource() : null;
 BatchComponent component = componentCache.add(resource, parentResource);
 if (ResourceUtils.isProject(resource)) {
  component.setInputComponent(new DefaultInputModule(resource.getEffectiveKey()));
 }
 return bucket;
}
origin: org.codehaus.sonar/sonar-batch

private Bucket doIndex(Resource resource, @Nullable Resource parentReference) {
 Bucket bucket = getBucket(resource);
 if (bucket != null) {
  return bucket;
 }
 if (StringUtils.isBlank(resource.getKey())) {
  LOG.warn("Unable to index a resource without key " + resource);
  return null;
 }
 Resource parent = null;
 if (!ResourceUtils.isLibrary(resource)) {
  // a library has no parent
  parent = (Resource) ObjectUtils.defaultIfNull(parentReference, currentProject);
 }
 Bucket parentBucket = getBucket(parent);
 if (parentBucket == null && parent != null) {
  LOG.warn("Resource ignored, parent is not indexed: " + resource);
  return null;
 }
 if (ResourceUtils.isProject(resource) || /* For technical projects */ResourceUtils.isRootProject(resource)) {
  resource.setEffectiveKey(resource.getKey());
 } else {
  resource.setEffectiveKey(ComponentKeys.createEffectiveKey(currentProject, resource));
 }
 bucket = new Bucket(resource).setParent(parentBucket);
 addBucket(resource, bucket);
 Resource parentResource = parentBucket != null ? parentBucket.getResource() : null;
 resourceCache.add(resource, parentResource);
 return bucket;
}
origin: org.codehaus.sonar/sonar-batch

@Override
public void decorate(Resource resource, DecoratorContext context) {
 if (!ResourceUtils.isProject(resource)) {
  return;
 }
 UsedQProfiles used = new UsedQProfiles();
 for (Measure childProfilesMeasure : context.getChildrenMeasures(CoreMetrics.QUALITY_PROFILES)) {
  String data = childProfilesMeasure.getData();
  if (data != null) {
   UsedQProfiles childProfiles = UsedQProfiles.fromJson(data);
   used.add(childProfiles);
  }
 }
 Measure detailsMeasure = new Measure(CoreMetrics.QUALITY_PROFILES, used.toJson());
 context.saveMeasure(detailsMeasure);
}
origin: org.codehaus.sonar/sonar-batch

if (ResourceUtils.isProject(resource)) {
org.sonar.api.resourcesResourceUtilsisProject

Javadoc

This method equal isRootProject(resource) or isModuleProject(resource)

Popular methods of ResourceUtils

  • isUnitTestClass
  • isFile
    Alias for #isEntity(Resource)
  • isEntity
  • isSet
  • isUnitTestFile
  • isDirectory
    Alias for #isSpace(Resource)
  • isModuleProject
  • isRootProject
  • isPackage
  • isPersistable
  • isSubview
  • isView
  • isSubview,
  • isView,
  • isLibrary,
  • isSpace

Popular in Java

  • Reactive rest calls using spring rest template
  • getSupportFragmentManager (FragmentActivity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • setContentView (Activity)
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Option (scala)
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now