cb.util
Class PetalObjectFactory

java.lang.Object
  |
  +--cb.util.PetalObjectFactory

public class PetalObjectFactory
extends java.lang.Object

Create empty Petal objects with just some initial properties (the quid in particular) set up. The user can then add them to model, i.e. PetalFile object. Some objects are created by reading serialized templates from the templates directory. init() is called on them usually automagically when they're added to the model.

Version:
$Id: PetalObjectFactory.java,v 1.13 2001/07/30 15:49:37 dahm Exp $
Author:
M. Dahm
See Also:
PetalFile

Constructor Summary
protected PetalObjectFactory()
           
 
Method Summary
 AssocAttachView createAssocAttachView()
           
 Association createAssociation(Class clazz1, Class clazz2)
          Create association without explicit name, it will have an invisible anonymous name.
 Association createAssociation(Class clazz, UseCase caze)
           
 Association createAssociation(java.lang.String name, Class clazz1, Class clazz2)
          Create Association between two classes.
 Association createAssociation(java.lang.String name, Class clazz, UseCase caze)
           
 Association createAssociation(java.lang.String name, UseCase case1, UseCase case2)
          Create Association between two use cases.
 Association createAssociation(UseCase case1, UseCase case2)
          Create association without explicit name, it will have an invisible anonymous name.
 AssociationViewNew createAssociationView(Association assoc)
           
 AssociationViewNew createAssociationView(Association assoc, boolean show_label)
          Creates view for given association.
 AttachView createAttachView()
           
 Class createClass(java.lang.String name)
          Creates empty class object with just the name and the quid set.
 ClassAttribute createClassAttribute(java.lang.String name, java.lang.String type)
          Creates new class attribute (aka field)
 ClassUtility createClassUtility(java.lang.String name)
          Creates empty utility class object with just the name and the quid set.
 ClassView createClassView(Class clazz)
          Creates class view for given class and sets the qualified name and quidu for the referenced class accordingly.
 InheritanceRelationship createInheritanceRelationship(Inheritable clazz, Inheritable super_class)
          Create InheritanceRelationship between two classes, this method is called by Class.addSuperClass().
 java.util.List createInheritViews(Inheritable clazz)
           
 Class createInterface(java.lang.String name)
          Just like createClass() except that it sets the stereotype to "Interface".
 ItemLabel createItemLabel(java.lang.String text)
           
 LogicalCategory createLogicalCategory(java.lang.String name)
          Creates empty class category (logical view).
 PetalFile createModel()
          Creates empty model.
 NoteView createNoteView(java.lang.String text)
           
 Operation createOperation(java.lang.String name, java.lang.String result, List params)
          Creates new operation (aka method)
 RealizeRelationship createRealizeRelationship(Class clazz, Class inter)
          Create RealizeRelationship between class and an interface, called by Class.addImplementedInterface().
 java.util.List createRealizeViews(Class clazz)
           
 SegLabel createSegLabel(java.lang.String text)
           
 UseCase createUseCase(java.lang.String name)
          Creates use case object with just the name and the quid set.
 UseCaseCategory createUseCaseCategory(java.lang.String name)
          Creates empty class category (use case view).
 UseCaseView createUseCaseView(UseCase caze)
          Creates use case view for given class and sets the qualified name and quidu for the referenced class accordingly.
 UsesRelationship createUsesRelationship(Class clazz, Class clazz2)
          Create UsesRelationship between class and an interface, called by Class.addUsedClass().
 java.util.List createUsesViews(Class clazz)
           
 java.lang.String getAnonymousName()
           
static PetalObjectFactory getInstance()
           
protected static PetalNode getTemplate(java.lang.String name)
          Read object from templates directory
static void setInstance(PetalObjectFactory inst)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PetalObjectFactory

protected PetalObjectFactory()
Method Detail

getInstance

public static PetalObjectFactory getInstance()

setInstance

public static void setInstance(PetalObjectFactory inst)

getTemplate

protected static PetalNode getTemplate(java.lang.String name)
Read object from templates directory

createModel

public PetalFile createModel()
Creates empty model.

createClass

public Class createClass(java.lang.String name)
Creates empty class object with just the name and the quid set. init() is called on it after has been added to a model.
See Also:
ClassCategory.addToModel(cb.petal.Class)

createUseCase

public UseCase createUseCase(java.lang.String name)
Creates use case object with just the name and the quid set. init() is called on it after has been added to a model.
See Also:
UseCaseCategory.addToModel(UseCase)

createInterface

public Class createInterface(java.lang.String name)
Just like createClass() except that it sets the stereotype to "Interface".

createClassUtility

public ClassUtility createClassUtility(java.lang.String name)
Creates empty utility class object with just the name and the quid set. init() is called on it after has been added to a model.
See Also:
ClassCategory.addToModel(cb.petal.Class)

createOperation

public Operation createOperation(java.lang.String name,
                                 java.lang.String result,
                                 List params)
Creates new operation (aka method)
See Also:
Class.addOperation(cb.petal.Operation)

createClassAttribute

public ClassAttribute createClassAttribute(java.lang.String name,
                                           java.lang.String type)
Creates new class attribute (aka field)
See Also:
Class.addClassAttribute(cb.petal.ClassAttribute)

createUseCaseCategory

public UseCaseCategory createUseCaseCategory(java.lang.String name)
Creates empty class category (use case view).

createLogicalCategory

public LogicalCategory createLogicalCategory(java.lang.String name)
Creates empty class category (logical view).
See Also:
LogicalCategory.addToModel(cb.petal.LogicalCategory)

createInheritanceRelationship

public InheritanceRelationship createInheritanceRelationship(Inheritable clazz,
                                                             Inheritable super_class)
Create InheritanceRelationship between two classes, this method is called by Class.addSuperClass(). Shouldn't be called directly I think. If you really want to, don't forget to call init().
See Also:
Inheritable.addSuperClassifier(cb.petal.Inheritable)

createRealizeRelationship

public RealizeRelationship createRealizeRelationship(Class clazz,
                                                     Class inter)
Create RealizeRelationship between class and an interface, called by Class.addImplementedInterface(). Shouldn't be called directly I think. If you really want to, don't forget to call init().
See Also:
Class.addImplementedInterface(cb.petal.Class)

createUsesRelationship

public UsesRelationship createUsesRelationship(Class clazz,
                                               Class clazz2)
Create UsesRelationship between class and an interface, called by Class.addUsedClass(). Shouldn't be called directly I think. If you really want to, don't forget to call init().
See Also:
Class.addUsedClass(cb.petal.Class)

getAnonymousName

public final java.lang.String getAnonymousName()

createAssociation

public Association createAssociation(java.lang.String name,
                                     Class clazz1,
                                     Class clazz2)
Create Association between two classes. Cardinality and other properties can be configured in the roles of the returned object. Classes must have already been added to the model.

createAssociation

public Association createAssociation(Class clazz1,
                                     Class clazz2)
Create association without explicit name, it will have an invisible anonymous name.

createAssociation

public Association createAssociation(java.lang.String name,
                                     UseCase case1,
                                     UseCase case2)
Create Association between two use cases. Use cases must have already been added to the model.

createAssociation

public Association createAssociation(java.lang.String name,
                                     Class clazz,
                                     UseCase caze)

createAssociation

public Association createAssociation(Class clazz,
                                     UseCase caze)

createAssociation

public Association createAssociation(UseCase case1,
                                     UseCase case2)
Create association without explicit name, it will have an invisible anonymous name.

createClassView

public ClassView createClassView(Class clazz)
Creates class view for given class and sets the qualified name and quidu for the referenced class accordingly. The tag, i.e., the index in the views list (@12, e.g.), is set when the view is added to the model. It is also set them for the ItemLabel objects associated with the view.

These properties/view objects will be set (if defined in given class): quidu, label, stereotype, QualifiedNameParameter

See Also:
Diagram.addToView(ClassView)

createNoteView

public NoteView createNoteView(java.lang.String text)
Returns:
new note view with given text

createAttachView

public AttachView createAttachView()

createItemLabel

public ItemLabel createItemLabel(java.lang.String text)
Returns:
new item label with given text

createSegLabel

public SegLabel createSegLabel(java.lang.String text)
Returns:
new segment abel with given text

createAssocAttachView

public AssocAttachView createAssocAttachView()

createInheritViews

public java.util.List createInheritViews(Inheritable clazz)
Returns:
list of inherit view objects since a class may extend multiple classes (not in Java, I know). The client and supplier tags (@5, e.g. which are references to the corresponding class view indexes) are set when the views are added to the model.
See Also:
ClassDiagram.addToView(cb.petal.InheritView)

createRealizeViews

public java.util.List createRealizeViews(Class clazz)
Returns:
list of realize view objects since a class may implement multiple interfaces. The client and supplier tags (@5, e.g. which are references to the corresponding class view indexes) are set when the views are added to the model.
See Also:
ClassDiagram.addToView(cb.petal.RealizeView)

createUsesViews

public java.util.List createUsesViews(Class clazz)
Returns:
list of uses view objects. The client and supplier tags (@5, e.g. which are references to the corresponding class view indexes) are set when the views are added to the model.
See Also:
ClassDiagram.addToView(cb.petal.UsesView)

createAssociationView

public AssociationViewNew createAssociationView(Association assoc,
                                                boolean show_label)
Creates view for given association.
Parameters:
show_label - show association name
See Also:
Diagram.addToView(cb.petal.ClassView)

createAssociationView

public AssociationViewNew createAssociationView(Association assoc)

createUseCaseView

public UseCaseView createUseCaseView(UseCase caze)
Creates use case view for given class and sets the qualified name and quidu for the referenced class accordingly. The tag, i.e., the index in the views list (@12, e.g.), is set when the view is added to the model. It is also set them for the ItemLabel objects associated with the view.
See Also:
UseCaseDiagram.addToView(UseCaseView)