Changeset 7297
- Timestamp:
- Feb 20, 2017, 3:11:16 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/net/sf/basedb/core/snapshot/SnapshotManager.java
r7256 r7297 116 116 { 117 117 this.snapshots = new HashMap<Integer, AnnotationSetSnapshot>(); 118 } 119 120 private Integer projectId; 121 122 /** 123 When a project id is set, the snapshot manager will only 124 search for project-specific annotations explicitely belonging 125 to that project (or default values if projectId=0). 126 127 Note that this parameter typically always need to be off (=null) 128 when searching for annotations to an annotation type that 129 doesn't have enabled project-specific annotations. 130 131 @param projectId The project id or 0 to only search for default 132 values or null to revert to the default behaviour 133 (which load default values if a project-specific values 134 doesn't exists) 135 @since 3.11 136 */ 137 public void setProjectId(Integer projectId) 138 { 139 this.projectId = projectId; 118 140 } 119 141 … … 178 200 179 201 if (filter == null) filter = new StaticFilter<AnnotationSnapshot>(true); 180 int activeProjectId = dc.getSessionControl().getActiveProjectId(); 202 int activeProjectId = projectId == null ? 203 dc.getSessionControl().getActiveProjectId() : projectId; 181 204 182 205 // Needed for recursive searching of inherited annotations … … 196 219 for (AnnotationSnapshot shot : snapshot.getAnnotations()) 197 220 { 221 int shotProjectId = shot.getProjectId(); 222 // Ignore all annotations not belonging to the specified project 223 if (projectId != null && shotProjectId != projectId) continue; 198 224 // Ignore project-specfic annotations not belonging to the current project 199 int projectId = shot.getProjectId(); 200 if (projectId != 0 && projectId != activeProjectId) continue; 225 if (shotProjectId != 0 && shotProjectId != activeProjectId) continue; 201 226 202 227 // Ignore default annotations that already have a project-specific value … … 214 239 result.add(shot); 215 240 // This is a project-specific annotation overriding a default value 216 if ( projectId != 0) overridden.add(shot.getOverrideId());241 if (shotProjectId != 0) overridden.add(shot.getOverrideId()); 217 242 } 218 243 } … … 245 270 { 246 271 result.add(shot); 247 if ( projectId != 0) overridden.add(shot.getOverrideId());272 if (shotProjectId != 0) overridden.add(shot.getOverrideId()); 248 273 } 249 274 }
Note: See TracChangeset
for help on using the changeset viewer.