
cz.wicketstuff.boss.flow.model.basic.FlowTree Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of boss-flow Show documentation
Show all versions of boss-flow Show documentation
Workflow control and configuration java framework
/*
* Et netera, http://boss.etnetera.cz - Copyright (C) 2012
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License (version 2.1) as published by the Free Software
* Foundation.
*
* 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:
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
*/
package cz.wicketstuff.boss.flow.model.basic;
import java.io.Serializable;
import java.util.Map;
import cz.wicketstuff.boss.flow.model.IFlowState;
import cz.wicketstuff.boss.flow.model.IFlowTransition;
import cz.wicketstuff.boss.flow.model.IFlowTree;
public class FlowTree implements IFlowTree, Serializable {
private static final long serialVersionUID = 1L;
private Integer flowId;
private String flowName;
private IFlowState defaultInitialState;
private Map transitionNamesMap;
private Map transitionIdsMap;
private Map stateNamesMap;
private Map stateIdsMap;
public FlowTree() {
}
public FlowTree(Integer flowId, String flowName) {
this.flowId = flowId;
this.flowName = flowName;
}
@Override
public Integer getFlowId() {
return flowId;
}
@Override
public String getFlowName() {
return flowName;
}
@Override
public IFlowTransition getTransition(String name) {
return getTransitionNamesMap().get(name);
}
@Override
public IFlowTransition getTransition(Integer id) {
return getTransitionIdsMap().get(id);
}
@Override
public IFlowState getState(String name) {
return getStateNamesMap().get(name);
}
@Override
public IFlowState getState(Integer id) {
return getStateIdsMap().get(id);
}
@Override
public boolean containsTransition(String name) {
return getTransitionNamesMap().containsKey(name);
}
@Override
public boolean containsTransition(Integer id) {
return getTransitionIdsMap().containsKey(id);
}
@Override
public boolean containsState(String name) {
return getStateNamesMap().containsKey(name);
}
@Override
public boolean containsState(Integer id) {
return getStateIdsMap().containsKey(id);
}
public Map getTransitionNamesMap() {
return transitionNamesMap;
}
public void setTransitionNamesMap(
Map transitionNamesMap) {
this.transitionNamesMap = transitionNamesMap;
}
public Map getTransitionIdsMap() {
return transitionIdsMap;
}
public void setTransitionIdsMap(Map transitionIdsMap) {
this.transitionIdsMap = transitionIdsMap;
}
public Map getStateNamesMap() {
return stateNamesMap;
}
public void setStateNamesMap(Map stateNamesMap) {
this.stateNamesMap = stateNamesMap;
}
public Map getStateIdsMap() {
return stateIdsMap;
}
public void setStateIdsMap(Map stateIdsMap) {
this.stateIdsMap = stateIdsMap;
}
@Override
public IFlowState getDefaultInitialState() {
return defaultInitialState;
}
public void setDefaultInitialState(IFlowState defaultInitialState) {
this.defaultInitialState = defaultInitialState;
}
@Override
protected void finalize() throws Throwable {
if(stateIdsMap != null) {
stateIdsMap.clear();
stateIdsMap = null;
}
if(stateNamesMap != null) {
stateNamesMap.clear();
stateNamesMap = null;
}
if(transitionIdsMap != null) {
transitionIdsMap.clear();
transitionIdsMap = null;
}
if(transitionNamesMap != null) {
transitionNamesMap.clear();
transitionNamesMap = null;
}
defaultInitialState = null;
super.finalize();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy