static String createUID(Project project, Resource resource) { String uid = resource.getKey(); if (!StringUtils.equals(Scopes.PROJECT, resource.getScope())) { // not a project nor a library uid = new StringBuilder(ResourceModel.KEY_SIZE) .append(project.getKey()) .append(':') .append(resource.getKey()) .toString(); } return uid; }
/** * Views plugin creates copy of technical projects and should be allowed to copy all measures even * internal ones */ private boolean isTechnicalProjectCopy(Resource resource) { return Scopes.FILE.equals(resource.getScope()) && Qualifiers.PROJECT.equals(resource.getQualifier()); }
/** @return whether a resource is an entity. */ public static boolean isEntity(Resource resource) { return resource != null && Scopes.FILE.equals(resource.getScope()); }
/** @return whether a resource is a space */ public static boolean isSpace(Resource resource) { return resource != null && Scopes.DIRECTORY.equals(resource.getScope()); }
/** @return whether a resource is a set */ public static boolean isSet(Resource resource) { return resource != null && Scopes.PROJECT.equals(resource.getScope()); }
/** * @param resource not nullable * @return true if this type of resource is persisted in database * @since 2.6 */ public static boolean isPersistable(Resource resource) { return StringUtils.equals(Scopes.PROJECT, resource.getScope()) || StringUtils.equals(Scopes.DIRECTORY, resource.getScope()) || StringUtils.equals(Scopes.FILE, resource.getScope()); }