Changeset 4379
- Timestamp:
- Aug 5, 2008, 2:22:52 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/net/sf/basedb/core/Install.java
r4372 r4379 107 107 method. 108 108 */ 109 public static final int NEW_SCHEMA_VERSION = Integer.valueOf(6 1).intValue();109 public static final int NEW_SCHEMA_VERSION = Integer.valueOf(62).intValue(); 110 110 111 111 public static synchronized void createTables(boolean update, final ProgressReporter progress) -
trunk/src/core/net/sf/basedb/core/Job.java
r4355 r4379 683 683 return getData().getServer(); 684 684 } 685 686 /** 687 Checks if this job has saved information about the context that was active 688 when this job was created. If context information is available it is possible 689 to re-configure a failed job. 690 @see #configure(GuiContext) 691 @see #getLastGuiContext() 692 @return TRUE if context information is available, FALSE otherwise 693 @since 2.8 694 */ 695 public boolean hasContext() 696 { 697 return getData().getContextItem() != null && getData().getContextType() != null; 698 } 699 700 /** 701 Get the gui-context that was active when this job was created. 702 @return The active context, or null if not known 703 @since 2.8 704 */ 705 public GuiContext getLastGuiContext() 706 { 707 GuiContext context = null; 708 if (hasContext()) 709 { 710 context = new GuiContext(Item.fromValue(getData().getContextItem()), 711 GuiContext.Type.fromValue(getData().getContextType()), getData().getSubContext()); 712 } 713 return context; 714 } 715 685 716 686 717 /** … … 1590 1621 { 1591 1622 JobData data = job.getData(); 1592 data.setStatus(Status.WAITING.getValue()); 1623 data.setStatus(Job.Status.WAITING.getValue()); 1624 data.setPercentComplete(0); 1625 data.setStarted(null); 1626 data.setEnded(null); 1627 data.setStatusMessage(null); 1628 data.setStackTrace(null); 1629 data.setServer(null); 1630 data.setJobAgentId(null); 1593 1631 data.setEstimatedExecutionTime(response.getEstimatedExecutionTime().getValue()); 1594 1632 } … … 1786 1824 1787 1825 /** 1826 The job is beeing prepared for execution. 1827 */ 1828 PREPARED(5, "Preparing", true), 1829 1830 1831 /** 1788 1832 The job is executing. 1789 1833 */ 1790 1834 EXECUTING(2, "Executing", false), 1791 1792 /** 1793 The job has finished successfully. 1794 */ 1795 DONE(3, "Done", false), 1796 1797 /** 1798 The job has finished with an error. 1799 */ 1800 ERROR(4, "Error", false), 1801 1802 /** 1803 The job is beeing prepared for execution. 1804 */ 1805 PREPARED(5, "Preparing", true), 1806 1835 1807 1836 /** 1808 1837 The {@link Signal#ABORT} signal has been sent to the 1809 1838 job, but it has not yet responded. 1810 1839 */ 1811 ABORTING(6, "Aborting", false); 1812 1840 ABORTING(6, "Aborting", false), 1841 1842 /** 1843 The job has finished successfully. 1844 */ 1845 DONE(3, "Done", false), 1846 1847 /** 1848 The job has finished with an error. 1849 */ 1850 ERROR(4, "Error", false); 1851 1813 1852 /** 1814 1853 Maps the integer that is stored in the database. -
trunk/src/core/net/sf/basedb/core/PluginRequest.java
r4105 r4379 26 26 package net.sf.basedb.core; 27 27 28 import net.sf.basedb.core.data.JobData; 28 29 import net.sf.basedb.core.plugin.GuiContext; 29 30 import net.sf.basedb.core.plugin.Plugin; … … 246 247 Save all parameters that have got values in this request/response session. 247 248 */ 248 void saveParameters(DbControl dc )249 void saveParameters(DbControl dc, GuiContext context) 249 250 { 250 251 if (jobParameters != null && !jobParameters.isWriteProtected() && job != null) 251 252 { 252 253 Job theJob = job.isInDatabase() ? Job.getById(dc, job.getId()) : job; 254 JobData jobData = theJob.getData(); 255 if (pluginConfiguration != null) 256 { 257 jobData.setParameterVersion(pluginConfiguration.getParameterVersion()); 258 } 259 if (context != null) 260 { 261 jobData.setContextItem(context.getItem().getValue()); 262 jobData.setContextType(context.getType().getValue()); 263 jobData.setSubContext(context.getSubContext()); 264 265 } 266 else 267 { 268 jobData.setContextItem(null); 269 jobData.setContextType(null); 270 jobData.setSubContext(null); 271 } 253 272 jobParameters.saveParameters(theJob, parameterInfo); 254 273 } -
trunk/src/core/net/sf/basedb/core/PluginResponse.java
r4330 r4379 146 146 throw new PermissionDeniedException("Can't save parameters since response status is: " + getStatus()); 147 147 } 148 request.saveParameters(dc );148 request.saveParameters(dc, request.getGuiContext()); 149 149 } 150 150 -
trunk/src/core/net/sf/basedb/core/Update.java
r4355 r4379 699 699 </td> 700 700 </tr> 701 <tr> 702 <td>62</td> 703 <td> 704 Added: 705 <ul> 706 <li>{@link net.sf.basedb.core.data.JobData#getContextItem()}. 707 <li>{@link net.sf.basedb.core.data.JobData#getContextType()}. 708 <li>{@link net.sf.basedb.core.data.JobData#getSubContext()}. 709 </ul> 710 No special database update is needed. Only increase the schema version. 711 </td> 712 </tr> 701 713 702 714 </table> … … 982 994 } 983 995 984 if (schemaVersion < 6 1)985 { 986 if (progress != null) progress.display((int)(6 0*progress_factor), "--Updating schema version: " + schemaVersion + " -> 61...");987 schemaVersion = setSchemaVersionInTransaction(session, 6 1);996 if (schemaVersion < 62) 997 { 998 if (progress != null) progress.display((int)(61*progress_factor), "--Updating schema version: " + schemaVersion + " -> 62..."); 999 schemaVersion = setSchemaVersionInTransaction(session, 62); 988 1000 } 989 1001 -
trunk/src/core/net/sf/basedb/core/data/JobData.java
r4355 r4379 383 383 } 384 384 385 private Integer contextItem; 386 /** 387 The item type of the context that was active when configuring 388 this job. null = no context was known 389 @hibernate.property column="`context_item`" type="int" 390 @since 2.8 391 */ 392 public Integer getContextItem() 393 { 394 return contextItem; 395 } 396 /** 397 @since 2.8 398 */ 399 public void setContextItem(Integer contextItem) 400 { 401 this.contextItem = contextItem; 402 } 403 404 private Integer contextType; 405 /** 406 The context type that was active when configuring 407 this job. 0 = single item, 1 = list 408 @hibernate.property column="`context_type`" type="int" 409 @since 2.8 410 */ 411 public Integer getContextType() 412 { 413 return contextType; 414 } 415 /** 416 @since 2.8 417 */ 418 public void setContextType(Integer contextType) 419 { 420 this.contextType = contextType; 421 } 422 423 /** 424 The maximum allowed length of the subcontext name. 425 @since 2.8 426 */ 427 public static final int MAX_SUBCONTEXT_LENGTH = 255; 428 private String subContext; 429 /** 430 The name of the subcontext that was active whjen configuring 431 this job. 432 @hibernate.property column="`subcontext`" type="string" length="255" not-null="false" 433 @since 2.8 434 */ 435 public String getSubContext() 436 { 437 return subContext; 438 } 439 /** 440 @since 2.8 441 */ 442 public void setSubContext(String subContext) 443 { 444 this.subContext = subContext; 445 } 446 385 447 /** 386 448 The maximum allowed length of the signal transporter string. -
trunk/www/common/plugin/index.jsp
r4343 r4379 326 326 Job job = Job.getById(dc, jobId); 327 327 328 // TODO - This is not meaningful unless we can get a context329 //int pluginDefinitionId = Values.getInt(request.getParameter("plugindefinition_id"));330 //int pluginConfigurationId = Values.getInt(request.getParameter("pluginconfiguration_id"));331 332 328 //Item itemType = Item.valueOf(request.getParameter("item_type")); 333 329 //String subContext = Values.getString(request.getParameter("subcontext"), ""); 334 330 //GuiContext.Type contextType = GuiContext.Type.valueOf(request.getParameter("context_type")); 335 //GuiContext context = new GuiContext(itemType, contextType, subContext);331 GuiContext context = job.getLastGuiContext(); 336 332 337 333 PluginDefinition plugin = job.getPluginDefinition(); 338 334 PluginConfiguration pluginConfig = job.getPluginConfiguration(); 339 335 340 PluginConfigurationRequest pcRequest = job.configure( null);336 PluginConfigurationRequest pcRequest = job.configure(context); 341 337 sc.setSessionSetting("plugin.configure.request", pcRequest); 342 338 sc.setSessionSetting("plugin.configure.job", job); … … 522 518 dc = sc.newDbControl(); 523 519 Job job = (Job)sc.getSessionSetting("plugin.configure.job"); 520 if (job.isInDatabase()) 521 { 522 dc.reattachItem(job); 523 } 524 else 525 { 526 dc.saveItem(job); 527 } 528 524 529 PluginResponse pluginResponse = (PluginResponse)sc.getSessionSetting("plugin.configure.response"); 525 530 boolean executeImmediately = … … 530 535 job.setSendMessage(Values.getBoolean(request.getParameter("send_message"))); 531 536 job.setRemoveJobWhenFinished(Values.getBoolean(request.getParameter("remove_job"))); 532 dc.saveItem(job);533 537 534 538 if (!executeImmediately) -
trunk/www/views/jobs/view_job.jsp
r4355 r4379 169 169 location.href = 'index.jsp?ID=<%=ID%>&cmd=RestartJob&item_id=<%=itemId%>&useLatestConfiguration='+useLatestConfiguration; 170 170 } 171 function reconfigureJob() 172 { 173 location.href = '../../common/plugin/index.jsp?ID=<%=ID%>&cmd=ConfigureJob&job_id=<%=itemId%>'; 174 } 175 171 176 function deleteItemPermanently() 172 177 { … … 526 531 { 527 532 %> 528 <base:button onclick="restartJob()" title="Restart job" image="refresh.gif" /> 533 <base:button onclick="restartJob()" title="Restart job" 534 image="refresh.gif" 535 tooltip="Try to run this job again with the same parameters" 536 /> 537 <base:button onclick="reconfigureJob()" title="Re-configure job" 538 image="runplugin.gif" 539 tooltip="Change the parameters for this job and try again" 540 visible="<%=job.hasContext()%>" 541 /> 529 542 <% 530 543 }
Note: See TracChangeset
for help on using the changeset viewer.