Junos Space SDK > API Reference Guide

EJB Annotations

Annotations are like meta-tags that you can add to the code and apply to package declarations, type declarations, constructors, methods, fields, parameters, and variables. They provide helpful ways to indicate whether the methods are dependent on other methods, whether they are incomplete, whether the classes have references to other classes, and so on.

Below is a list of Junos Space SDK annotations that can be used on EJB resources.

Junos Space Annotations for EJB

ANNOTATION EXAMPLE DESCRIPTION
@Cursor @Cursor(
   entityClass = CountryEntity.CLASSNAME,
   queryName = CountryEntity.GET_ALL_COUNTRIES
)

public PagingResult getCountries(PagingContext ctx) throws Exception
Applicable on an EJB method. This annotation enables paging on EJB API variables.

Variables:

  • entityClass: Name of the JPA entity class whose query will be used for paging.
  • queryName: Name of the query that will be used for filtering.
@Filterable @Filterable(entityAttrName = "country")
    public String getName() {
   return name;
}
Applicable on the getter/setter of an EJB managed object class. This annotation enables filtering at the EJB level. @Filterable provides the name of an attribute in a JPA entity mapped to the attribute name in the managed object that is used in creating the filtering query criteria.

Variables:

  • entityAttrName: Name of the attribute in the JPA entity class.
  • entityClassName: Name of the JPA entity class.
@JmpNotification @JmpNotification(destination = "topic/HelloWorldDatabaseChange")
@XmlAccessorType(XmlAccessType.NONE)
public class Country extends AbstractManagedObject implements Serializable {}
Applicable on a managed object class in an EJB. This annotation specifies that if there is any change in the JPA entity of this managed object, the change should be published on the topic provided as the destination value.

Variables:

  • destination: Name of the topic on which a change notification needs to be published.
@JobData @JobData(
   name = "Hello World Country Report",
   iconFileName = "HelloWorld_ui/jssdk/hello-world_job_countries_tree_265x315.png",
   detailsActionURL = "/mainui/ctrl/deviceScriptManagerWeb/CMPServlet?
   action=net.juniper.jmp.cems.deviceScriptManagerUI.action.ScriptMgmtJobReportBuilder",
   detailsActionType = "grid"
)

@Schedulable
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public JobInfoTO runDeployScriptsOnDevices    (Collection scriptMgmtMOList,
    ScheduleContext sctx) {
Applicable on schedulable APIs of an EJB. This attribute is used to display the job scheduled by the corresponding API of the EJB in the Junos Space UI.

Variables:

  • name (required): The GUI-facing name for this job.
  • iconFileName: The file name for this icon in the job manager's thumbnail view. The file name format is <app-name>_<root-context-from-application.xml>_<icon-file-path-relative-to-preload-directory>. The icon file is located in a subdirectory of your application (under /web/images/preload).  For example the path HelloWorld_ui/jssdk/hello-world_job_countries_tree_265x315.png corresponds to the HelloWorldWeb/web/images/preload/jobs/countries_tree_265x315.png image file.
  • detailsActionURL: If you need a special URL for showing job result details (for example, when you doubleclick on a job in the job manager's inventory landing page), specify the URL with this variable. Otherwise, the default form is used.
  • detailsActionType: If detailsActionURL is set, set this variable to either “form” or “grid”, depending on the top-level element of the URL.
@ManagedObject @Table(name = "CountryEntity", uniqueConstraints = {
@UniqueConstraint(columnNames = "country") })
@ManagedObject(value={"net.juniper.jmp.helloworld.ejb.Country"},uri="/api/space/HelloWorld/countries/{id})
public class CountryEntity extends OptimisticEntity
Applicable on a JPA entity class. This annotation specifies the name of a managed object class for a JPA entity.

Variables:

  • value: Name of the managed object class for this JPA entity.
  • uri: Pattern of the URI. This URI is added for all data change notifications for this entity.
@Schedulable @Schedulable
@TransactionAttribute( TransactionAttributeType.REQUIRED )
public JobInfoTO getCountriesScheduledLRR(ScheduleContext scheduleCtx);
throws Exception;
Applicable on an EJB method. This annotation is used to mark the methods that can be scheduled in the future. This annotation is used by the job manager interceptor to push scheduling information.

Variables:

  • None
@Sortable @Sortable(entityAttrName = "country")
    public String getName() {
   return name;
}
Applicable on the getter or setter of an EJB managed object class. This annotation enables sorting at the EJB level. @Sortable provides the name of the attribute in the JPA entity mapped to the attribute name in the managed object that will be used in creating the sorting query criteria.

Variables:

  • entityAttrName: Name of the attribute in the JPA entity class.
  • entityClassName: Name of the JPA entity class.