Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2011 Michael Ruflin, Andr´┐Ż Locher, Claudia von Bastian. This file is part of Tatool. Tatool is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Tatool is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Tatool. If not, see <>. /
 package ch.tatool.core.module.scheduler;
 import java.util.Date;
Abstract module scheduler. Implements module and dataservice properties.

Michael Ruflin
 public abstract class AbstractModuleScheduler implements ModuleScheduler {

Module associated with this scheduler.
     private Module module;
Session service to obtain session information from a module object.
     private DataService dataService;
The i18n messages object used to get the correct text values.
     public Messages messages;
The maximum amount of sessions allowed for a module controlled by this scheduler
     private int maxSessions = 0;
Set the module this scheduler should manage.
     public void setModule(Module module) {
         this. = module;
Set the dataService it might need.
     public void setDataService(DataService dataService) {
         this. = dataService;
Set the messages object used for i18n of text values
     public void setMessages(Messages messages) {
     	this. = messages;
Sets the maximum of sessions allowed for a module controlled by this scheduler
     public void setMaxSessions(Integer maxSessions) {
     	this. = maxSessions;
Get the maximum of sessions allowed for a module controlled by this scheduler
     public int getMaxSessions() {
     	return ;

Gets the module this scheduler is used for.

     public Module getModule() {
         return ;

Gets the ModuleDataService this scheduler is using.

     public DataService getDataService() {
         return ;
     public String getSchedulerNumSessions(Module module) {
     	 long sessionCount = .getSessionCount(modulefalse);
     	 return String.valueOf(sessionCount);
     public String getSchedulerLastSessionDate(Module module) {
    	ModuleSession lastSession = .getLastSession(modulefalse);
    	String lastSessionString = "";
    	if (lastSession != null) {
            DateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
            Date d = lastSession.getStartTime();
            lastSessionString = dateFormat.format(d);
        } else {
        	 lastSessionString = "-";
    	return lastSessionString;
    public class ModuleSchedulerMessageImpl implements ModuleSchedulerMessage {
    	private boolean isSessionStartAllowed;
    	private String messageTitle;
    	private String messageText;
    	public ModuleSchedulerMessageImpl() {
    	public ModuleSchedulerMessageImpl(boolean isSessionStartAllowed) {
    		this. = isSessionStartAllowed;
    	public boolean isSessionStartAllowed() {
		public void setSessionStartAllowed(boolean isSessionStartAllowed) {
			this. = isSessionStartAllowed;
    	public String getMessageTitle() {
			return ;
		public void setMessageTitle(String messageTitle) {
			this. = messageTitle;
    	public String getMessageText() {
			return ;
		public void setMessageText(String messageText) {
			this. = messageText;
New to GrepCode? Check out our FAQ X