7 Working with Design Studio Model Java API

This chapter describes the Oracle Communications Design Studio Model Java API, its utility class and methods, and the plug-in dependencies that are required in your Eclipse installation when using the API to extend Design Studio.

About the Design Studio Model Java API

The Design Studio Model Java API wraps the published Exchange Format XML files produced by Design Studio. When combined with other public Eclipse APIs, the Design Studio Model Java API enables you to extend Design Studio with custom functionality and features. For example, when adding a new action to a Design Studio menu, you can use the Design Studio Model Java API to read information required from the published Exchange Format.

The Design Studio Action Command Examples project includes examples of how to use the Design Studio Model Java API and its utility classes and methods. See "About the design.studio.example.action.command Example Project" for more information. See "Working with the Design Studio Exchange Format" for more information about the Exchange Format.

Table 7-1 lists the top-level packages that you can browse to review Design Studio model information. These packages are located in the design.studio.example.action.command/Plug-in Dependencies folder:

Table 7-1 Top-Level Design Studio Packages

Package Description

oracle.communications.studio.model

Includes Design Studio platform information.

oracle.communications.studio.model.activation

Includes the Design Studio for ASAP product model.

oracle.communications.studio.model.common

Includes conceptual model information.

oracle.communications.studio.model.data

Includes information about the Data Dictionary.

oracle.communications.studio.model.integration

Includes information about the Activation task and about elements and entities that integrate Design Studio for OSM with Design Studio for ASAP.

oracle.communications.studio.model.integrity

Includes the Design Studio for Integrity product model.

oracle.communications.studio.model.inventory

Includes the Design Studio for Inventory product model.

oracle.communications.studio.model.osm

Includes the Design Studio for OSM product model.


About Design Studio Model Java API Utility Classes and Methods

Design Studio provides a utility class and methods that enable you to work with the information published by the Exchange Format.

The ModelLocator class is a helper class that you use to obtain the Design Studio resource and relation model information from the Exchange Format. You require the ModelLocator class and the following fully qualified class name to extend Design Studio using the Design Studio Model Java API:

oracle.communications.studio.model.modellocator.ModelLocator

The following methods are required when extending Design Studio using the ModelLocator class:

  • loadModel

  • getRelationTarget

About the loadModel Method

Consider the following when using the loadModel method:

  • The loadModel method has the following signature:

    public Model loadModel(final IResource resource)

  • You use the loadModel method to load a model referenced by the passed IResource.

  • The loadModel method has the following input:

    org.eclipse.core.resources.IResource
    
  • The loadModel method has the following output:

    oracle.communications.studio.model.Model
    

About the getRelationTarget Method

Consider the following when using the getRelationTarget method:

  • The getRelationTarget method has the following signature:

    public Element getRelationTarget(final Relation relation)

  • You use the getRelationTarget method to obtain the model from an element or entity relation.

  • The getRelationTarget method has the following input:

    oracle.communications.studio.model.Relation
    
  • The getRelationTarget method has the following output:

    oracle.communications.studio.model.Element
    

About the getReferencedBy Method

You can use the getReferencedBy method to find a set of entities that are associated with another entity. For example, you can find all technical actions associated with a specific resource facing service.

Consider the following when using the getReferencedBy method:

  • The getReferencedBy method has the following signature:

    public List<Entity> getReferencedBy(final Entity entity)
    
  • You use the getReferencedBy method to obtain the all the first-level referenced by and realized entities of given entity.

  • The getReferencedBy method has the following input:

    oracle.communications.studio.model.Entity
    
  • The getReferencedBy method has the following output:

    List<oracle.communications.studio.model.Entity> 
    

You can use two additional APIs to filter the getReferenceBy method:

  • The first API enables you to return a list of entities based on the entity file extension:

    List<Entity> getReferenceBy(Entity entity, String fileExtension)

    For example, if you call:

    getReferenceBy(myEntity, "cmnAction")

    the API returns only the action entities that reference myEntity.

  • The second API enables you to return a list of entities based on a list of file extensions:

    List<Entity> getReferenceBy(Entity entity, List<String> fileExtensions)

About Design Studio Model Java API Package Dependencies

Table 7-2 displays the plug-ins that are required in your Eclipse installation when using the Design Studio Model Java API to extend Design Studio.

Note:

See the Eclipse Plug-in Development Environment Guide for information about defining plug-in project dependencies in the Plug-in Manifest editor.

Dependencies that you configure for a plug-in project are saved in the MANIFEST.MF file. You can configure these dependencies in the Plug-in Manifest editor using the fields on the Dependencies tab or by editing the file directly on the MANIFEST.MF tab.

Open the Design Studio Action Command Example project to review examples that illustrate how dependencies are configured in a plug-in project. See "About the design.studio.example.action.command Example Project" for more information.

Table 7-2 Java API Plug-in Dependencies

Plug-in Description

org.eclipse.ui

Required for command and menu extension points.

oracle.communications.studio.model

Contains the Design Studio Model Java API.

org.eclipse.core.expressions

Required if the PropertyTester class is used.

org.eclipse.jface

Required for handling a selection in a view.

org.eclipse.core.resources

Required for handling resource files and folders.

org.eclipse.ui.workbench

Required for handling command execution.

org.eclipse.core.runtime

Required for handling the selection in a view.

org.eclipse.emf.common

Required for handling common EMF model constructs.

org.eclipse.emf.ecore

Required for handling the EMF core model.