Changeset 2139
- Timestamp:
- Mar 31, 2006, 2:56:55 PM (17 years ago)
- Location:
- trunk/src/core/net/sf/basedb/core
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/net/sf/basedb/core/InternalJobQueue.java
r1886 r2139 413 413 job = Job.getById(dc, jobId); 414 414 415 // Set the active project 416 int projectId = job.getActiveProjectId(); 417 if (projectId != 0) 418 { 419 try 420 { 421 Project activeProject = Project.getById(dc, projectId); 422 impersonated.setActiveProject(activeProject); 423 } 424 catch (Throwable t) 425 { 426 log.error("Exception while setting active project. Continuing with no active project.", t); 427 } 428 } 429 415 430 // Get an execution request and close the db connection 416 431 PluginExecutionRequest exec = null; -
trunk/src/core/net/sf/basedb/core/Job.java
r1924 r2139 25 25 package net.sf.basedb.core; 26 26 27 import net.sf.basedb.core.Transactional.Action; 27 28 import net.sf.basedb.core.data.JobData; 28 29 import net.sf.basedb.core.data.MessageData; … … 221 222 return getStatus() == Status.EXECUTING; 222 223 } 224 /** 225 Set's the project id to the currently active project. 226 */ 227 @Override 228 void onBeforeCommit(Action action) 229 throws NotLoggedInException, BaseException 230 { 231 super.onBeforeCommit(action); 232 int projectId = getSessionControl().getActiveProjectId(); 233 if (projectId != 0) 234 { 235 getData().setActiveProjectId(projectId); 236 } 237 } 223 238 // ------------------------------------------- 224 239 … … 356 371 if (priority < 1 || priority > 10) throw new NumberOutOfRangeException("priority", priority, 1, 10); 357 372 getData().setPriority(priority); 373 } 374 375 /** 376 The ID of the project that should be made the active project while running 377 this job. If the project can't be loaded the job should be executed without 378 an active project. 379 @return The ID of the active project, or 0 if no project should be active 380 */ 381 public int getActiveProjectId() 382 { 383 return getData().getActiveProjectId(); 358 384 } 359 385 -
trunk/src/core/net/sf/basedb/core/data/JobData.java
r1701 r2139 204 204 } 205 205 206 private int activeProjectId; 207 /** 208 The ID of the project that should be made active when running this job. 209 @hibernate.property column="`project_id`" type="int" not-null="true" 210 */ 211 public int getActiveProjectId() 212 { 213 return activeProjectId; 214 } 215 public void setActiveProjectId(int activeProjectId) 216 { 217 this.activeProjectId = activeProjectId; 218 } 219 206 220 private Date created; 207 221 /**
Note: See TracChangeset
for help on using the changeset viewer.