FileDocCategorySizeDatePackage
ModelExporter.javaAPI DocExample2634Tue Dec 08 01:21:00 GMT 1998oisoft.togetherx.scripts.Rose98Export

ModelExporter.java

//---------------------------------------------------------
// Copyright (c) 1998  Object International Software GmbH
//
// Author: Eugene Belyaev
//---------------------------------------------------------

package oisoft.togetherx.scripts.Rose98Export;

import oisoft.togetherx.scriptapi.UML.*;
import oisoft.togetherx.scriptapi.UML.enums.*;
import java.util.Hashtable;
import java.io.*;
import java.awt.*;

/** @author  Eugene Belyaev
 *  @version 2.1.0
 */
public class ModelExporter {
	private Linker myLinker = null;
	private Writer o = null;
	private Writer rep = null;
	private Optioner optioner = null;
	private Hashtable quidTable;
	private Hashtable refTable;
	private boolean isVisual = false;
	private boolean isClassViewMode = false;
	private boolean isCategoryViewMode = false;
	private String CurrentDiagram;

	public ModelExporter( UMLModel model, Optioner optioner ) {
		if (model!=null) {

			this.optioner = optioner;

			model.setIncludeVisibleOnly( false );
			model.setIncludeModelOnly( false );

			UMLPackage rootpackage = model.getRootPackage();
			if( rootpackage != null )
			{
				optioner.linker = new Linker(rootpackage, optioner);
				o = new Writer( optioner.output_stream.getPath() );
				optioner.writer = o;
//				rep = new Writer( "d:\\Export_To_Rose_98.log" );
				optioner.rootCategory = rootpackage.getQualifiedName();
				myLinker = optioner.linker;
				quidTable = myLinker.getQuidTable();
				refTable = myLinker.getRefTable();
	       		 	o.out( "(object Petal" );
				o.advance();
				o.out( "version 42" );
				o.retreat();
				o.out( ")" ); // close Petal
				o.newline();

				o.out( "(object Design " + o.makeString( "Logical View" ) );
				o.advance();
				o.out( "quid" + o.tab() + o.makeString( "EB0000000000" ) );
				//o.out( "root_category (object Class_Category " + o.makeString( "Logical View" ) );
				//String quid = "EB1000000000";
				//o.advance();
				//o.out( "quid" + o.tab() + o.makeString( quid ) );
				//o.out( "logical_models" + o.tab() + "(list unit_reference_list" );
				//o.advance();
				isVisual = false;
				(new ClassExporter(optioner)).visitClassDiagram( (UMLClassDiagram)rootpackage );
				//rootpackage.accept( this );
				//o.retreat();
				//o.out( ")" ); // close logical_models
       		 	//o.retreat();

				//o.out( ")" ); // close root_category
				//o.retreat();
				o.out( ")" ); // close Design
	       			o.close();
//				rep.close();
				System.out.println( "DONE" );
			} else optioner.manager.createMessage( "Rose98Export error: no model loaded" );
		}
	}
}