All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.anaptecs.jeaf.services.scheduling.ScheduledTaskQuery Maven / Gradle / Ivy

There is a newer version: 1.8.0
Show newest version
/*
 * anaptecs GmbH, Ricarda-Huch-Str. 71, 72760 Reutlingen, Germany
 * 
 * Copyright 2004 - 2019. All rights reserved.
 */
package com.anaptecs.jeaf.services.scheduling;

import java.util.Calendar;

import com.anaptecs.jeaf.core.api.MessageConstants;
import com.anaptecs.jeaf.core.api.QueryObject;
import com.anaptecs.jeaf.xfun.api.XFun;

/**
 * Class defines the query criterias for searching scheduled tasks. All the possible attributes will be linked by a
 * logical AND if they are set.
 */
public class ScheduledTaskQuery extends QueryObject {
  /**
   * Default serial version uid.
   */
  private static final long serialVersionUID = 1L;

  /**
   * Type of service that will be called when the task will be executed.
   */
  private Class serviceClass;

  /**
   * Begin of the interval when the task will be executed the next time.
   */
  private Calendar executionIntervalBegin;

  /**
   * End of the interval when the task will be executed the next time.
   */
  private Calendar executionIntervalEnd;

  /**
   * Attribute defines whether only successful or failed task should be searched.
   */
  private Boolean successful;

  /**
   * Initialize object. Nothing special to do.
   */
  public ScheduledTaskQuery( ) {
    // Nothing to do.
  }

  /**
   * Method returns the attribute "serviceClass". Type of service that will be called when the task will be executed.
   * 
   * @return Class Value to which the attribute "serviceClass" is set.
   */
  public Class getServiceClass( ) {
    return serviceClass;
  }

  /**
   * Method sets the attribute "serviceClass". Type of service that will be called when the task will be executed.
   * 
   * @param pServiceClass Value to which the attribute "serviceClass" should be set.
   */
  public void setServiceClass( Class pServiceClass ) {
    // Assign value to attribute
    serviceClass = pServiceClass;
  }

  /**
   * Method returns the attribute "executionIntervalBegin". Begin of the interval when the task will be executed the
   * next time.
   * 
   * @return Calendar Value to which the attribute "executionIntervalBegin" is set.
   */
  public Calendar getExecutionIntervalBegin( ) {
    return executionIntervalBegin;
  }

  /**
   * Method sets the attribute "executionIntervalBegin". Begin of the interval when the task will be executed the next
   * time.
   * 
   * @param pExecutionIntervalBegin Value to which the attribute "executionIntervalBegin" should be set.
   */
  public void setExecutionIntervalBegin( Calendar pExecutionIntervalBegin ) {
    // Assign value to attribute
    executionIntervalBegin = pExecutionIntervalBegin;
  }

  /**
   * Method returns the attribute "executionIntervalEnd". End of the interval when the task will be executed the next
   * time.
   * 
   * @return Calendar Value to which the attribute "executionIntervalEnd" is set.
   */
  public Calendar getExecutionIntervalEnd( ) {
    return executionIntervalEnd;
  }

  /**
   * Method sets the attribute "executionIntervalEnd". End of the interval when the task will be executed the next time.
   * 
   * @param pExecutionIntervalEnd Value to which the attribute "executionIntervalEnd" should be set.
   */
  public void setExecutionIntervalEnd( Calendar pExecutionIntervalEnd ) {
    // Assign value to attribute
    executionIntervalEnd = pExecutionIntervalEnd;
  }

  /**
   * Method returns the attribute "successful". Attribute defines whether only successful or failed task should be
   * searched.
   * 
   * @return Boolean Value to which the attribute "successful" is set.
   */
  public Boolean getSuccessful( ) {
    return successful;
  }

  /**
   * Method sets the attribute "successful". Attribute defines whether only successful or failed task should be
   * searched.
   * 
   * @param pSuccessful Value to which the attribute "successful" should be set.
   */
  public void setSuccessful( Boolean pSuccessful ) {
    // Assign value to attribute
    successful = pSuccessful;
  }

  /**
   * Method returns a StringBuilder that can be used to create a String representation of this object. the returned
   * StringBuilder also takes care about attributes of super classes.
   *
   * @return {@link StringBuilder} StringBuilder representing this object. The method never returns null.
   */
  protected StringBuilder toStringBuilder( ) {
    StringBuilder lBuilder = new StringBuilder(256);
    lBuilder.append(XFun.getMessageRepository().getMessage(MessageConstants.OBJECT_INFO, this.getClass().getName()));
    lBuilder.append('\n');
    lBuilder.append(XFun.getMessageRepository().getMessage(MessageConstants.OBJECT_ATTRIBUTES_SECTION));
    lBuilder.append('\n');
    lBuilder.append(
        XFun.getMessageRepository().getMessage(MessageConstants.OBJECT_ATTRIBUTE, "serviceClass", "" + serviceClass));
    lBuilder.append('\n');
    lBuilder.append(XFun.getMessageRepository().getMessage(MessageConstants.OBJECT_ATTRIBUTE, "executionIntervalBegin",
        "" + executionIntervalBegin));
    lBuilder.append('\n');
    lBuilder.append(XFun.getMessageRepository().getMessage(MessageConstants.OBJECT_ATTRIBUTE, "executionIntervalEnd",
        "" + executionIntervalEnd));
    lBuilder.append('\n');
    lBuilder.append(
        XFun.getMessageRepository().getMessage(MessageConstants.OBJECT_ATTRIBUTE, "successful", "" + successful));
    lBuilder.append('\n');
    return lBuilder;
  }

  /**
   * Method creates a new String with the values of all attributes of this class. All references to other objects will
   * be ignored.
   * 
   * @return {@link String} String representation of this object. The method never returns null.
   */
  @Override
  public String toString( ) {
    return this.toStringBuilder().toString();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy