org.ucworkbench.model
Interface IUCElement

All Known Subinterfaces:
Action, Activity, Condition, ConditionOperation, ConditionRegistry, EUCObject, IActor, IDescriptionSection, IExtension, IExtensionSection, IFileElement, IFileModel, IFolderElement, IIdentifiable, IMainScenario, IModelFileElement, IModule, INumber, INumberable, INumberableScenarioable, INumberElement, IPropertiesSection, IProperty, IPropertyColonSeparator, IPropertyName, IPropertyValue, IReference, IRequirementsFolder, IScenario, IScenarioable, IScenarioItem, IScreen, IScreenFolder, ISection, ISectionHeader, IStep, ISummarySection, ITemplate, ITemplatesFolder, ITestsFolder, IText, ITextable, ITextModel, ITextWithReferences, ITitleable, IUCProject, IUseCase, IUseCaseReference, IWhitespace, Parameter, Step, TestCase, Validation

public interface IUCElement

This is a basic interface for all objects in the model: project, requirements folder, templates folder, screens folder, use cases, steps, etc. The interface provides basic tree structure of elements (parent, child elements), Visitor pattern entry (accept, childrenAccept) etc.


Method Summary
 void accept(IUCElementVisitor visitor, java.lang.Object data)
          Invokes IUCElementVisitor.visit(IUCElement, Object) method giving this as the first parameter, and data as second parameter.
 void childrenAccept(IUCElementVisitor visitor, java.lang.Object object)
          Invokes the accept(IUCElementVisitor, Object) method for all direct children (@link IUCElement.getChildren()), giving object as a second parameter.
 boolean exists()
          Determines if the underlying resource for the element exists.
 IUCElement getAncestor(org.ucworkbench.model.UCElementType ancestorType)
          Returns the nearest parent object in the hierarchy of the type given as a parameter.
 java.util.Collection<IUCElement> getChildren()
          Returns the collection of all children objects in the model.
 IResource getCorrespondingResource()
          Returns the resource that corresponds directly to this element, or null if there is no resource that corresponds to this element.
 java.lang.String getElementName()
          Returns the name of this element.
 org.ucworkbench.model.UCElementType getElementType()
          Returns this element's kind encoded as an integer.
 IUCElement getParent()
          Returns the element directly containing this element, or null if this element has no parent.
 IPath getPath()
          Returns the path to the innermost resource enclosing this element.
 IUCProject getUCProject()
          Returns the UC project this element is contained in, or null if this element is not contained in any UC project (for instance, the IUseCase is not contained in any UC project).
 IResource getUnderlyingResource()
          Returns the smallest underlying resource that contains this element, or null if this element is not contained in a resource.
 

Method Detail

accept

void accept(IUCElementVisitor visitor,
            java.lang.Object data)
Invokes IUCElementVisitor.visit(IUCElement, Object) method giving this as the first parameter, and data as second parameter. If recursive execution is needed, you have to call childrenAccept in the visit method.

Parameters:
visitor -
data -

childrenAccept

void childrenAccept(IUCElementVisitor visitor,
                    java.lang.Object object)
Invokes the accept(IUCElementVisitor, Object) method for all direct children (@link IUCElement.getChildren()), giving object as a second parameter.

Parameters:
visitor -
object -

getChildren

java.util.Collection<IUCElement> getChildren()
Returns the collection of all children objects in the model.

Returns:
the collection of IUCElement elements of direct children of the current model element.

getParent

IUCElement getParent()
Returns the element directly containing this element, or null if this element has no parent. This is a handle-only method.

Returns:
the parent element, or null if this element has no parent

getAncestor

IUCElement getAncestor(org.ucworkbench.model.UCElementType ancestorType)
Returns the nearest parent object in the hierarchy of the type given as a parameter.

Parameters:
ancestorType - the desired type of parent object
Returns:
nearest parent of the given type or null if no such parent object exists

getUCProject

IUCProject getUCProject()
Returns the UC project this element is contained in, or null if this element is not contained in any UC project (for instance, the IUseCase is not contained in any UC project). This is a handle-only method.

Returns:
the containing UC project, or null if this element is not contained in a UC project

exists

boolean exists()
Determines if the underlying resource for the element exists.

Returns:
true if the underlying resource exists

getCorrespondingResource

IResource getCorrespondingResource()
Returns the resource that corresponds directly to this element, or null if there is no resource that corresponds to this element.

For example, the corresponding resource for an UseCase is its underlying IFile. There are no corresponding resources for IStep, IExtension, etc.

Returns:
the corresponding resource, or null if none
Throws:
org.ucworkbench.UCWorkbenchException - if this element does not exist or if an exception occurs while accessing its corresponding resource

getElementName

java.lang.String getElementName()
Returns the name of this element. This is a handle-only method.

Returns:
the element name

getElementType

org.ucworkbench.model.UCElementType getElementType()
Returns this element's kind encoded as an integer. This is a handle-only method.

Returns:
the kind of element; one of the constants declared in IUCElement
See Also:
IUCElement

getPath

IPath getPath()
Returns the path to the innermost resource enclosing this element. If this element is not included in an external archive, the path returned is the full, absolute path to the underlying resource, relative to the workbench. If this element is included in an external archive, the path returned is the absolute path to the archive in the file system. This is a handle-only method.

Returns:
the path to the innermost resource enclosing this element

getUnderlyingResource

IResource getUnderlyingResource()
Returns the smallest underlying resource that contains this element, or null if this element is not contained in a resource.

Returns:
the underlying resource, or null if none
Throws:
org.ucworkbench.UCWorkbenchException - if this element does not exist or if an exception occurs while accessing its underlying resource