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

org.ow2.bonita.definition.JavaHook Maven / Gradle / Ivy

/**
 * Copyright (C) 2006  Bull S. A. S.
 * Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois
 * This library 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
 * version 2.1 of the License.
 * This library 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 this
 * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
 * Floor, Boston, MA  02110-1301, USA.
 **/
package org.ow2.bonita.definition;

import java.util.HashMap;
import java.util.Map;

import org.ow2.bonita.facade.def.element.HookDefinition;

public class JavaHook extends ClassInfo {

  public static enum Type {
    taskOnReady, taskOnStart, taskOnFinish, taskOnCancel, taskOnSuspend, taskOnResume, onDeadline, automaticOnEnter;
  }
  
  public static final Map MAPPING = new HashMap();
  static {
    MAPPING.put(HookDefinition.Event.taskOnReady, Type.taskOnReady);
    MAPPING.put(HookDefinition.Event.taskOnStart, Type.taskOnStart);
    MAPPING.put(HookDefinition.Event.taskOnFinish, Type.taskOnFinish);
    MAPPING.put(HookDefinition.Event.taskOnCancel, Type.taskOnCancel);
    MAPPING.put(HookDefinition.Event.taskOnSuspend, Type.taskOnSuspend);
    MAPPING.put(HookDefinition.Event.taskOnResume, Type.taskOnResume);
    MAPPING.put(HookDefinition.Event.automaticOnEnter, Type.automaticOnEnter);
  }

  protected Type type;
  protected boolean inTransaction;

  protected JavaHook() { }

  public JavaHook(String className, Type type, boolean inTransaction) {
    this(className, null, type, inTransaction);
  }
  public JavaHook(String className, Map parameters, Type type, boolean inTransaction) {
    super(className, parameters);
    this.type = type;
    this.inTransaction = inTransaction;
  }

  @Override
  public String toString() {
    return "JavaHook: class=" + className + ", type=" + type + ", inTransaction=" + inTransaction;
  }
  public Type getType() {
    return type;
  }
  public boolean isInTransaction() {
    return inTransaction;
  }

}






© 2015 - 2025 Weber Informatics LLC | Privacy Policy