Project Scoping Mechanism
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.
Property Type Default Description project.idstringCurrent project Polarion 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.
Parameter Type Required Description projectstringYes Polarion 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 Level Description Entity type constraint Extracted from constraint annotations on the entity type and converted to Lucene project.id filter Navigation property constraint Merges 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.
All entity query results include a projectId foreign key property linking the entity to its project.
Property Type Description 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:
Format Lucene 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:
Scope Parameter Description Project projectScope = trueConfiguration at individual project level Project Group projectGroupScope = trueConfiguration at project group level Repository repositoryScope = 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 Path Resolution 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 Field Description Prototype Polarion object prototype being queried Query string Complete Lucene query including project.id fragment Result count Number of matching entities Item preview First 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.
Related Pages
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