Skip to main content

Project Scoping Mechanism

diagram

Automatic Project Filtering

When a Powersheet is opened within a Polarion project context, the query resolver creates a project-scoped instance that automatically appends a project.id filter to all queries.
PropertyTypeDefaultDescription
project.idstringCurrent projectPolarion project identifier automatically appended to all Lucene queries

Lucene Query Fragment

The project scope is appended to every Lucene query as:
AND project.id:"<projectId>"
This fragment is cached internally as projectIdQueryFragment to avoid rebuilding it for each query execution.

Example

Original query:
type:systemRequirement AND HAS_VALUE:title
After project scoping:
type:systemRequirement AND HAS_VALUE:title AND project.id:"MyProject"

Project URL Parameter

The Powersheet widget receives the project ID from the URL project query parameter.
ParameterTypeRequiredDescription
projectstringYesPolarion project ID. Falls back to environment variable if not provided.
The project parameter is required. If missing from both the URL and the environment, the application displays an error.

Project Constraint Annotations

The domain model supports project constraints at the entity type and navigation property levels.

Entity Type Project Constraints

domainModelTypes:
  SystemRequirement:
    polarionType: systemRequirement
    constraints:
      load:
        project:
          id: MyProject
Constraint LevelDescription
Entity type constraintExtracted from constraint annotations on the entity type and converted to Lucene project.id filter
Navigation property constraintMerges constraints from both the navigation property and the target entity type annotations

Dynamic Project Constraints

Project constraints can reference dynamic context labels resolved at runtime:
constraints:
  load:
    project:
      id: $context.source.project.id
Dynamic context labels in project constraints (e.g., $context.source.project.id) are resolved at query time. Verify that the context variable is available in your configuration scenario.

Query Result Metadata

All entity query results include a projectId foreign key property linking the entity to its project.
PropertyTypeDescription
projectIdstringForeign key referencing the Polarion project that owns this entity
The projectId follows the foreign key naming convention where navigation property names are suffixed with Id.

Object ID with Project Prefix

Entity queries support an objectId format that includes the project prefix:
FormatLucene Translation
WI-123id:"WI-123"
elibrary/WI-123(project.id:"elibrary" AND id:"WI-123")
The project/id format expands to a compound AND query combining both project.id and id predicates.

Administration Scope Levels

Powersheet configuration is available at three scope levels in Polarion administration:
ScopeParameterDescription
ProjectprojectScope = trueConfiguration at individual project level
Project GroupprojectGroupScope = trueConfiguration at project group level
RepositoryrepositoryScope = trueGlobal configuration at repository level
Access administration via Administration > Nextedy POWERSHEET.

Cross-Project Model References

Domain models can be referenced across projects using qualified paths:
Model PathResolution
rtmCurrent project: <currentProjectId>/rtm
OtherProject/rtmExplicit project: OtherProject/rtm
/rtmGlobal scope: _global/rtm
Cross-project model references require appropriate permissions in both the source and target projects. Verify access with your Polarion administrator.

Debug Logging

Project-scoped queries include structured debug logging:
Log FieldDescription
PrototypePolarion object prototype being queried
Query stringComplete Lucene query including project.id fragment
Result countNumber of matching entities
Item previewFirst 5 item IDs from the result set

Complete YAML Example

sources:
  - id: requirements
    title: System Requirements
    model: rtm
    query:
      from: SystemRequirement
      where: "type:systemRequirement AND HAS_VALUE:title"
    constraints:
      applyCurrentDocumentTo: SystemRequirement
    expand:
      - name: designRequirements
        title: Design Requirements
        expand:
          - name: designRequirement
In this configuration, the query engine automatically adds AND project.id:"<currentProject>" to the Lucene query. The applyCurrentDocumentTo constraint further scopes results to the current document within the project.
Source context: GenericQueryResolver, PolarionQueryProcessor, QueryFactory, PowersheetConstants, hivemodule.xml
Source Code
  • PolarionQueryProcessor.java
  • GenericQueryResolver.java
  • SaveTest.java
  • QueryDataTest.java
  • prod-powersheet-src/com.nextedy.powersheet/src/META-INF/hivemodule.xml