Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.0.0)

E17493-01

oracle.jdeveloper.audit.model
Class ModelType

java.lang.Object
  extended by oracle.jdeveloper.audit.model.ModelType
Direct Known Subclasses:
DirectoryModelType, ProjectModelType, RootModelType, UnauditableFileModelType, WorkspaceModelType

public abstract class ModelType
extends java.lang.Object

An abstract model type which mediates between the Audit framework and an object model associated with an IDE Element (usually, in fact, with an IDE Node). A model type identifies the Element classes which correspond to object models of its type, knows its corresponding ModelAdapter subclass, and manufactures model adapter instances for each model of its type.

To reduce special case code in the Audit framework, IDE container elements such as Workspaces, Workspace, Project, and packages and directories each have a corresponding ModelType and ModelAdapter subclass.

IDE extensions which provide model types register an AuditProvider with the AuditManager at startup. When Audit initializes, it loads and instantiates the model types from the registered providers.

See Also:
ModelAdapter

Constructor Summary
ModelType()
           
 
Method Summary
 ModelAdapter createModelAdapter(ModelAdapter model, java.util.Collection<Location> fragments)
          Creates a fragmentary model for this model type corresponding to fragments produced by a model of a different model type.
abstract  ModelAdapter createModelAdapter(ModelFactory factory, Element element, java.net.URL url, ContainerModelAdapter directory, ContainerModelAdapter project, ContainerModelAdapter workspace)
          Creates a model for this model type corresponding to a workspace, project, package, element, and URL.
 java.util.Collection<java.lang.Class<? extends Element>> getContainedElementTypes()
          Gets the IDE Element types which correspond to contained (non-root) constructs of this model type.
 java.util.Collection<java.lang.Class<?>> getDefaultPresentationTypes()
          Gets the default presentation types for this model type.
abstract  java.util.Collection<java.lang.Class<?>> getPresentationTypes()
          Gets the presentation types for this model type.
abstract  java.util.Collection<java.lang.Class<? extends Element>> getRootElementTypes()
          Gets the IDE Element types which correspond to root constructs of this model type.
abstract  javax.swing.Icon icon(java.lang.Class type)
          Gets the icon for a presentation type of this model type.
 boolean isAuditable(Element element, ContentDirectory directory, Project project, Workspace workspace)
          Gets whether a root element is auditable in the context of a directory, project, and workspace.
 boolean isContainedElementType(Element element)
          Gets whether an Element is an instance of one of the element types returned by getContainedElementTypes().
 boolean isElementType(Element element)
          Gets whether an Element is an instance of one of the element types returned by getRootElementTypes() or getContainedElementTypes().
 boolean isRootElementType(Element element)
          Gets whether an Element is an instance of one of the element types returned by getRootElementTypes().
abstract  java.lang.String label(java.lang.Class type)
          Gets the label for a presentation type of this model type.
abstract  java.lang.String summary(java.lang.Class type)
          Gets the summary for a presentation type of this model type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModelType

public ModelType()
Method Detail

getRootElementTypes

public abstract java.util.Collection<java.lang.Class<? extends Element>> getRootElementTypes()
Gets the IDE Element types which correspond to root constructs of this model type. These are used to map from objects selected in the IDE into the Audit object model.


getContainedElementTypes

public java.util.Collection<java.lang.Class<? extends Element>> getContainedElementTypes()
Gets the IDE Element types which correspond to contained (non-root) constructs of this model type. These are used to map from objects selected in the IDE into the Audit object model. The default ModelType implementation returns null.


isAuditable

public boolean isAuditable(Element element,
                           ContentDirectory directory,
                           Project project,
                           Workspace workspace)
Gets whether a root element is auditable in the context of a directory, project, and workspace. The default ModelType implementation requires that the directory, project, and workspace be non-null.

Parameters:
element - The element for which to create the model.
directory - The directory containing the element, or null if none.
project - The project containing the element, or null if none.
workspace - The workspace containing the element, or null if none.

createModelAdapter

public abstract ModelAdapter createModelAdapter(ModelFactory factory,
                                                Element element,
                                                java.net.URL url,
                                                ContainerModelAdapter directory,
                                                ContainerModelAdapter project,
                                                ContainerModelAdapter workspace)
Creates a model for this model type corresponding to a workspace, project, package, element, and URL.

Parameters:
factory - The model factory for creating contained models.
element - The element for which to create the model.
url - The URL of the file represented by the model.
directory - The directory containing the element, or null if none.
project - The project containing the element, or null if none.
workspace - The workspace containing the element, or null if none.

createModelAdapter

public ModelAdapter createModelAdapter(ModelAdapter model,
                                       java.util.Collection<Location> fragments)
Creates a fragmentary model for this model type corresponding to fragments produced by a model of a different model type. The default ModelType implementation throws UnsupportedOperationException.

Parameters:
model - The model producing the fragments.
fragments - A list of fragment Locations from model.

getPresentationTypes

public abstract java.util.Collection<java.lang.Class<?>> getPresentationTypes()
Gets the presentation types for this model type. These are the construct types from this model type which can be presented in Audit reports. For example, the Java implementation returns SourceFile, SourceClass, and SourceMethod, but not, for example, SourceField.


getDefaultPresentationTypes

public java.util.Collection<java.lang.Class<?>> getDefaultPresentationTypes()
Gets the default presentation types for this model type. These are the construct types which are presented by default in Audit reports. The types returned here must be included in the types returned by getPresentationTypes(). The ModelType implementation returns getPresentationTypes().


label

public abstract java.lang.String label(java.lang.Class type)
Gets the label for a presentation type of this model type. The label should be localized.


summary

public abstract java.lang.String summary(java.lang.Class type)
Gets the summary for a presentation type of this model type. The summary should be localized.


icon

public abstract javax.swing.Icon icon(java.lang.Class type)
Gets the icon for a presentation type of this model type. If necessary, the icon should be localized.


isElementType

public boolean isElementType(Element element)
Gets whether an Element is an instance of one of the element types returned by getRootElementTypes() or getContainedElementTypes().


isRootElementType

public boolean isRootElementType(Element element)
Gets whether an Element is an instance of one of the element types returned by getRootElementTypes().


isContainedElementType

public boolean isContainedElementType(Element element)
Gets whether an Element is an instance of one of the element types returned by getContainedElementTypes().


Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.0.0)

E17493-01

Copyright © 1997, 2011, Oracle. All rights reserved.