Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
This file is part of Sarasvati.
Sarasvati 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.
Sarasvati 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 Sarasvati. If not, see .
Copyright 2009 Paul Lorenz
*/
package com.googlecode.sarasvati.load;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.googlecode.sarasvati.Arc;
import com.googlecode.sarasvati.External;
import com.googlecode.sarasvati.Graph;
import com.googlecode.sarasvati.Node;
import com.googlecode.sarasvati.load.definition.ArcDefinition;
import com.googlecode.sarasvati.load.definition.ExternalArcDefinition;
import com.googlecode.sarasvati.load.definition.ExternalDefinition;
import com.googlecode.sarasvati.load.definition.NodeDefinition;
import com.googlecode.sarasvati.load.definition.ProcessDefinition;
import com.googlecode.sarasvati.util.SvUtil;
public abstract class AbstractGraphLoader implements GraphLoader
{
protected Map> instanceCache = null;
protected Map nodeCache = null;
protected GraphFactory factory;
protected GraphRepository repository;
protected GraphValidator validator;
protected Graph graph;
public AbstractGraphLoader (final GraphFactory factory,
final GraphRepository repository,
final GraphValidator validator)
{
this.factory = factory;
this.repository = repository;
this.validator = validator;
}
protected Graph getGraph ()
{
return graph;
}
protected void importNodes (final ProcessDefinition procDef) throws SarasvatiLoadException
{
for ( NodeDefinition nodeDef : procDef.getNodes() )
{
String nodeName = nodeDef.getName();
if ( nodeCache.containsKey( nodeName ) )
{
throw new SarasvatiLoadException( "Node name '" + nodeName + "' is not unique in workflow: " + graph.getName() );
}
String type = nodeDef.getType();
List