Difference between revisions of "Java API"

From AgileApps Support Wiki
imported>Aeric
imported>Aeric
Line 1: Line 1:
<noinclude>__NUMBEREDHEADINGS__</noinclude>The Java API is a set of built-in calls that are made to programmatically customize and extend the platform. Β 
<noinclude>__NUMBEREDHEADINGS__</noinclude>The Java API is a set of built-in calls that are made to programmatically customize and extend the platform. Β 
Β 
__TOC__
== About the Java API ==
The following platform elements provide the ability to make Java API calls from the user interface (UI):
The following platform elements provide the ability to make Java API calls from the user interface (UI):
:*Standard Java [[Classes|classes]], to create custom business logic that models your organization's environment
:*Standard Java [[Classes|classes]], to create custom business logic that models your organization's environment
:*[[Data Policy|Data policies]], by [[Data_Policy#Invoke_a_Java_Method_From_a_Data_Policy|Invoking a Java Method]]
:*[[Data Policy|Data policies]], by [[Data_Policy#Invoke_a_Java_Method_From_a_Data_Policy|Invoking a Java Method]]


:''Learn more: Β 
:''Learn more about the platform:''
::*''[[Getting Started with the Java API]]''
::* [[Getting Started with the Java API]]
::* [[Developer_Suite#Java_Code|Java Code in the Developer Suite]]''
::* [[Java API Cheatsheet]]
::* [[Developer_Suite#Java_Code|Java Code in the Developer Suite]]


== Prerequisite ==
:''Learn more about web services and programming:''
::* [http://en.wikipedia.org/wiki/Java_programming_language Java Programming Language]
::* [http://java.sun.com/docs/books/tutorial/java/concepts/index.html Java Tutorial]
Β 
== Prerequisites ==


You must know the Java programming language to make the Java API calls. This includes knowing the basic elements of Java such as conditional structures (if statement), looping structures (while and for loop statements), variable declaration and assignment, use of operators, variable naming conventions, debugging techniques, and so on.
You must know the Java programming language to make the Java API calls. This includes knowing the basic elements of Java such as conditional structures (if statement), looping structures (while and for loop statements), variable declaration and assignment, use of operators, variable naming conventions, debugging techniques, and so on.
Line 164: Line 170:


==Java API Library Reference==
==Java API Library Reference==
Learn more about web services and programming at these sites:
:''This section has moved to the'' [[Java API Cheatsheet]].
*[http://en.wikipedia.org/wiki/Java_programming_language Java Programming Language]
:(Please adjust your bookmarks!)
*[http://java.sun.com/docs/books/tutorial/java/concepts/index.html Java Tutorial]
Β 
These APIs are defined in the [http://lj.platformatyourservice.com/lj80/download/javadocs/com/platform/api/Functions.html Functions] class.
Β 
{| border="1" cellpadding="5" cellspacing="0"
!Syntax
!Description
!Return
!Category
!API Detail
|-width="150"
|<tt>addEvent (String subject, String ownerID, Date startDate, int hour, int min, int duration [, Parameters params])</tt>||Adds an event with values from params|| [[Result Class|Result object]]|| [[Java_API:Event_and_Task_Management|Event and Task Management]]|| [[Java_API:Event_and_Task_Management#addEvent|<tt>addEvent</tt>]]
|-
|<tt>addRecord (String objectName, Params params)</tt>||Adds a new record of type objectId with values from params|| [[Result Class|Result object]]|| [[Java_API:Record_Handling|Record Handling]]|| [[Java API:Record_Handling#addRecord|<tt>addRecord</tt>]]
|-
|<tt>addSavePoint (String name)</tt>||Adds a Save Point with name|| None|| [[Java_API:Utility|Utility]]|| [[Java_API:Utility#addSavePoint |<tt> addSavePoint </tt>]]
|-
|<tt>addTask (String subject, Date dueDate, String ownerId [, Parameters params])</tt>||Adds a task with values from params|| [[Result Class|Result object]]|| [[Java_API:Event_and_Task_Management|Event and Task Management]]|| [[Java_API:Event_and_Task_Management#addTask|<tt>addTask</tt>]]
|-
|<tt>changeOwnerShipInfo(String object_id, String record_id, String owner_id)</tt>||Changes the owner of the designated record|| None|| [[Java_API:Record_Handling|Record Handling]] || [[Java_API:Record_Handling#changeOwnerShipInfo|changeOwnerShipInfo]]
|-
|<tt>debug (Object obj)</tt>||Puts a debug statement into the debug log for Object obj. obj can be a String also|| None|| [[Java_API:Utility|Utility]]|| [[Java_API:Utility#debug |<tt> debug </tt>]]
|-
|<tt>deleteEvent (String eventId)</tt>||Deletes the event for the eventId|| [[Result Class|Result object]]|| [[Java_API:Event_and_Task_Management|Event and Task Management]]|| [[Java_API:Event_and_Task_Management#deleteEvent | <tt> deleteEvent </tt>]]
|-
|<tt>deleteRecord (String objectName, String recordId)</tt>||Deletes Record of type objectId where id is recordId|| [[Result Class|Result object]]|| [[Java_API:Record_Handling|Record Handling]]|| [[Java API:Record_Handling#deleteRecord |<tt> deleteRecord </tt>]]
|-
|<tt>deleteTask (String recordId)</tt>||Deletes a task for the taskId|| [[Result Class|Result object]]|| [[Java_API:Event_and_Task_Management|Event and Task Management]]|| [[Java_API:Event_and_Task_Management#deleteTask |<tt> deleteTask</tt>]]
|-
|<tt>doesSavePointExist (String name)</tt>||checks whether specified save point with name is exist or not|| Boolean|| [[Java_API:Utility|Utility]]|| [[Java_API:Utility#doesSavePointExist |<tt> doesSavePointExist </tt>]]
|-
|<tt>exec (String functionName, Parameters params)</tt>||Executes function functionName with params as input. Note that this params object is visible in functionName as functionParams|| The return value is defined by the function|| [[Java_API:Utility|Utility]]|| [[Java_API:Utility#exec |<tt> exec </tt>]]
|-
|<tt>generateDocument (String objectName, String recordId, String templateId, String format)</tt>||Generates document of templateId evaluated with params in format. If format is "PDF" it generates the document in PDF format, otherwise HTML format. It relates this generated document to object of type objectId and record with id recordId|| [[Result Class|Result object]]|| [[Java_API:Email_and_Document_Management|Email and Document Management]]|| [[Java API:Email_and_Document_Management#generateDocument |<tt> generateDocument</tt>]]
|-
|<tt>getAllSavePoints()</tt>||Returns All Save Points|| Set|| [[Java_API:Utility|Utility]]|| [[Java_API:Utility#getAllSavePoints|<tt> getAllSavePoints</tt>]]
|-
|<tt>getEnv (String key)</tt>||Gets the environment variable value for the key|| The value of the environment variable || [[Java_API:Utility|Utility]] ||[[Java_API:Utility#getEnv |<tt> getEnv </tt>]]
|-
|<tt>Functions.getParametersInstance()</tt>||Gets an instance of Parameters class||[[Java_API:Utility|Utility]] ||[[Parameters Class|Parameters object]]||[[Java_API:Utility#getParametersInstance |<tt> getParametersInstance </tt>]]
|-
|<tt>getRecord (String objectName, String fields, String recordId)</tt>||Gets the record of type objectId identified by recordId. fields is a comma separated list of fields that you want to fetch|| [[Result Class|Result object]]|| [[Java_API:Record_Handling|Record Handling]]|| [[Java API:Record_Handling#getRecord |<tt> getRecord </tt>]]
|-
|<tt>logActivity (String subject, String objectName, String id, String activityByID, Parameters params)</tt>||Logs an activity|| [[Result Class|Result object]]|| [[Java_API:Event_and_Task_Management|Event and Task Management]]|| [[Java_API:Event_and_Task_Management#logActivity |<tt> logActivity </tt>]]
|-
|<tt>processWorkflowAction (String workflowName,String currentStateName,String recordId,String customObjectName,String workflowAction,String workflowComments)</tt>||Process Work flow Action|| [[Result Class|Result object]]|| [[Java_API:Record_Handling|Record Handling]]|| [[Java_API:Record_Handling#processWorkflowAction |<tt> processWorkflowAction </tt>]]
|-
|<tt>removeSavePoint (String name)</tt>||removes save point with name from save point list|| None|| [[Java_API:Utility|Utility]]|| [[Java_API:Utility#removeSavePoint |<tt> removeSavePoint </tt>]]
|-
|<tt>rollback ()</tt>||Roll backs all the inserts and updates|| None|| [[Java_API:Utility|Utility]]|| [[Java_API:Utility#rollback |<tt> rollback </tt>]]
|-
|<tt>rollbackToSavePoint (String name)</tt>||Rollback to specific save point with name|| None|| [[Java_API:Utility|Utility]]|| [[Java_API:Utility#rollbackToSavePoint |<tt> rollbackToSavePoint </tt>]]
|-
|<tt>searchRecords (String objectName, String fields, String criteria [, Parameters params])</tt>||Search and retrieve the records, for object of type <tt>objectId</tt>. <tt>fields</tt> is a comma-separated list of fields that you want to fetch and criteria is expressed in filter language|| [[Result Class|Result object]]|| [[Java_API:Record_Handling|Record Handling]]|| [[Java API:Record_Handling#searchRecords |<tt> searchRecords </tt>]]
|-
|<tt>sendEmail (String objectName, String id, String to, String cc, String subject, String body, String attachmentTemplateId, String attachmentIdList)</tt>||Sends an Email|| [[Result Class|Result object]]|| [[Java_API:Email_and_Document_Management|Email and Document Management]]|| [[Java API:Email_and_Document_Management#sendEmail |<tt> sendEmail </tt>]]
|-
|<tt>sendEmailUsingTemplate (String objectName, String recordId, String to, String cc, String subject, String bodyTemplateId, String attachmentTemplateId, String attachmentIdList)</tt>||Sends an Email evaluating Template identified by bodyTemplateId as email body|| [[Result Class|Result object]]|| [[Java_API:Email_and_Document_Management|Email and Document Management]]|| [[Java API:Email_and_Document_Management#sendEmailUsingTemplate|<tt> sendEmailUsingTemplate </tt>]]
|-
|<tt>setTargetPage (String url)</tt>||Sets the target page|| None|| [[Java_API:Utility|Utility]]|| [[Java_API:Utility#setTargetPage|<tt>setTargetPage </tt>]]
|-
|<tt>showMessage (long millisecs)</tt>||Displays message|| None|| [[Java_API:Utility|Utility]]|| [[Java_API:Utility#showMessage|<tt>showMessage </tt>]]
|-
|<tt>sleep(String message)</tt>||Sleeps for the designated number of milliseconds.|| None || [[Java_API:Utility|Utility]]|| [[Java_API:Utility#sleep|<tt>sleep </tt>]]
|-
|<tt>throwError (String message)</tt>||Throws error with the message|| None|| [[Java_API:Utility|Utility]]|| [[Java_API:Utility#throwError|<tt>throwError </tt>]]
|-
|<tt>updateEvent (String eventId, Parameters params)</tt>||Updates an event with values in params|| [[Result Class|Result object]]|| [[Java API:Event_and_Task_Management|Event and Task Management]]|| [[Java_API:Event_and_Task_Management#updateEvent|<tt>updateEvent </tt>]]
|-
|<tt>updateRecord (String objectName, String recordId, Params params)</tt>||Updates record of type objectId with values params. The Record is identified by recordId|| [[Result Class|Result object]]|| [[Java_API:Record_Handling|Record Handling]]|| [[Java API:Record_Handling#updateRecord |<tt> updateRecord </tt>]]
|-
|<tt>updateTask (String taskId, Parameters params)</tt>||Updates a task with values in params|| [[Result Class|Result object]]|| [[Java_API:Event_and_Task_Management|Event and Task Management]]|| [[Java_API:Event_and_Task_Management#updateTask |<tt> updateTask </tt>]]
|}
Β 
__FORCETOC__
__FORCETOC__
<noinclude>
<noinclude>

Revision as of 18:06, 16 September 2011

The Java API is a set of built-in calls that are made to programmatically customize and extend the platform.

1 About the Java API

The following platform elements provide the ability to make Java API calls from the user interface (UI):

Learn more about the platform:
Learn more about web services and programming:

2 Prerequisites

You must know the Java programming language to make the Java API calls. This includes knowing the basic elements of Java such as conditional structures (if statement), looping structures (while and for loop statements), variable declaration and assignment, use of operators, variable naming conventions, debugging techniques, and so on.

3 Classes, Objects and APIs

Classes, Objects and APIs Detail
Record Handling

To handle records in Objects

Record Handling for Composite Objects

To operate on records in composite Object Relationships

Workflow Record Handling

To manage Workflows

Record Handling for Tenant Data Sharing

To handle records in Objects shared using Tenant Data Sharing Policies

Data Import

Import CSV data into Objects

Email and Document Management

Provides APIs to manage Email and Documents

Event and Task Management

Provides APIs to create Appointments, Tasks and to Log Activities

Transaction Management

Provides the ability to Rollback transactions to a SavePoint

Support Classes and Objects

Use these support classes and objects when you work with the Java API


Utility

Provides APIs to perform general-purpose operations

GUI

APIs for GUI components

Customize

These Provisional APIs give you the ability to manage metadata for program entities.

Status

API for checking status of scheduled jobs.

4 Identifying Objects and Records

Many of the API record handling calls require an {object} element identifier. To find the Object Type Identifier:

An object type identifier uniquely identifies an object type. It is used to specify object types in APIs.

There are two kinds of type identifiers:

  • objectName: This identifier is a human-readable name for both System Objects and Custom Objects.
  • objectID: This identifier is a human-readable name for System Objects (e.g. "cases"), but for Custom Objects, it is a computer-generated string with no humanly-interpretable semantic value (e.g. 123qwe456rty).
See also:

To find an object type identifier:

  1. Click GearIcon.png > Customization > Objects
  2. In the Display Title column, find the object you're looking for.
  3. The Object Name column has the identifier you need.

Alternatively:

  1. Go to GearIcon.png > Customization > Objects > {object}
  2. Click Properties
  3. The object name appears at the top of the page

Notepad.png

Note:


5 Java API Library Reference

This section has moved to the Java API Cheatsheet.
(Please adjust your bookmarks!)