Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  
  package de.xwic.etlgine.server.admin.jobs;
  
  
Displays Job Details.

Author(s):
lippisch
 
 public class JobDetailsControl extends BaseContentContainer {
 
 	private final IJob job;
 	private Button btDisable;
     private Button btReactivateJobTrigger;
 	private ErrorWarning errInfo;

Parameters:
container
name
 
 	public JobDetailsControl(IControlContainer containerString nameIJob job) {
 		super(containername);
 		this. = job;
 
 		setTitle("Job Details (" + job.getName() + ")");
 		
 		
 		 = new ErrorWarning(this"errorInfo");
 
 	}

 
 	private void createActionBar() {
 
 		ToolBar abar = new ToolBar(this"actionBar");
 		ToolBarGroup group = abar.addGroup();
 		
 		Button btReturn = group.addButton();
 		btReturn.setTitle("Return");
 			private static final long serialVersionUID = 1L;
 			public void objectSelected(SelectionEvent event) {
 			}
 		});
 
 		 = group.addButton();
 		.setTitle(.isDisabled() ? "Enable" : "Disable");
 			private static final long serialVersionUID = 1L;
 			public void objectSelected(SelectionEvent event) {
 			}
 		});
 
          = group.addButton();
         .setTitle("Activate Trigger for Failed Job");
             private static final long serialVersionUID = 1L;
             public void objectSelected(SelectionEvent event) {
                 onActivateJobTrigger();
             }
         });
 
 		
 	}

 
 	protected void onDisable() {
 		.setTitle(.isDisabled() ? "Enable" : "Disable");
 	}
    
 
    protected void onActivateJobTrigger() {
        if (.isExecuting()) {
           .showError("The selected job is currently executing.");
       } else {
           .setStopTriggerAfterError(false);
           // Hack so that the job next run time is calculated and the job is not started immediately
           if(null != .getTrigger()) {
               .getTrigger().notifyJobFinished(true);
           }
           .showWarning("The job trigger has been activated");
           this.setRequireRedraw(true);
       }
   }

	protected void onReturn() {
	}

Returns:
the job
	public IJob getJob() {
		return ;
	}

Returns:
the last exception's stack trace
		if ( == null || .getLastException() == null) {
			return null;
		}
		PrintWriter pw = new PrintWriter(stackTrace);
		pw.flush();
		return stackTrace.toString();
	}
	public String getJobState(IJob job) {
		String jobState = job.getState().name();
            if(job.isStopTriggerAfterError()) {
            	jobState = jobState + " [TRIGGER OFF]";
            } else {
            	jobState = jobState + " [TRIGGER ON]";
            }
        }	
		return jobState;
	}
New to GrepCode? Check out our FAQ X