Difference between revisions of "Java API Cheatsheet"

From AgileApps Support Wiki
imported>Aeric
imported>Aeric
Line 125: Line 125:


|-width="150"
|-width="150"
|<tt>[[Java_API:Utility#addSavePoint |addSavePoint]](String name)</tt>||Adds a Save Point with name|| None|| [[Java_API:Utility|Utility]]
|<tt>[[Java_API:Utility functions#addSavePoint |addSavePoint]](String name)</tt>||Adds a Save Point with name|| None|| [[Java_API:Utility|Utility]]


|-
|-
|<tt>[[Java_API:Utility#doesSavePointExist |doesSavePointExist]](String name)</tt>||checks whether the named save point exists or not|| Boolean|| [[Java_API:Utility|Utility]]
|<tt>[[Java API:Utility functions#doesSavePointExist |doesSavePointExist]](String name)</tt>||checks whether the named save point exists or not|| Boolean|| [[Java_API:Utility|Utility]]


|-
|-
|<tt>[[Java_API:Utility#getAllSavePoints|getAllSavePoints</tt>]]()</tt>||Returns All Save Points|| Set|| [[Java_API:Utility|Utility]]
|<tt>[[Java_API:Utility functions#getAllSavePoints|getAllSavePoints</tt>]]()</tt>||Returns All Save Points|| Set|| [[Java_API:Utility|Utility]]


|-
|-
|<tt>[[Java_API:Utility#rollback |rollback]]()</tt>||Roll backs all the inserts and updates|| None|| [[Java_API:Utility|Utility]]
|<tt>[[Java_API:Utility functions#rollback |rollback]]()</tt>||Roll backs all the inserts and updates|| None|| [[Java_API:Utility|Utility]]


|-
|-
|<tt>[[Java_API:Utility#rollbackToSavePoint|rollbackToSavePoint]](String name)</tt>||Rollback to specific save point with name|| None|| [[Java_API:Utility|Utility]]
|<tt>[[Java_API:Utility functions#rollbackToSavePoint|rollbackToSavePoint]](String name)</tt>||Rollback to specific save point with name|| None|| [[Java_API:Utility|Utility]]


|-
|-
|<tt>[[Java_API:Utility#removeSavePoint|removeSavePoint]](String name)</tt>||removes save point with name from save point list|| None|| [[Java_API:Utility|Utility]]
|<tt>[[Java_API:Utility functions#removeSavePoint|removeSavePoint]](String name)</tt>||removes save point with name from save point list|| None|| [[Java_API:Utility|Utility]]
|}
|}


Line 165: Line 165:


|-
|-
| <span style="color:red;">'''''Deprecated'''''</span> Use Logger class.<br>&nbsp; &nbsp;(See [[Debug Log]])<br> <tt>[[Java_API:Utility#debug |debug]](Object obj)</tt>||Puts a debug statement into the debug log for Object obj. (<tt>obj</tt> can be a String)|| None|| valign="center" | [[Java_API:Utility|Utility]]
| <span style="color:red;">'''''Deprecated'''''</span> Use Logger class.<br>&nbsp; &nbsp;(See [[Debug Log]])<br> <tt>[[Java_API:Utility#debug |debug]](Object obj)</tt>||Puts a debug statement into the debug log for Object obj. (<tt>obj</tt> can be a String)|| None|| valign="center" | [[Java_API:Utility functions|Utility functions]]


|-
|-
|<tt>[[Java_API:Utility#getEnv |getEnv]](String key)</tt>||Gets the environment variable value for the key|| The value of the environment variable || [[Java_API:Utility|Utility]]
|<tt>[[Java_API:Utility functions#getEnv |getEnv]](String key)</tt>||Gets the environment variable value for the key|| The value of the environment variable || [[Java_API:Utility|Utility]]


|-
|-
|<tt>[[Java_API:Utility#getParametersInstance |getParametersInstance]]()</tt>||Gets an instance of Parameters class || [[Parameters Class|Parameters]] object || [[Java_API:Utility|Utility]]
|<tt>[[Java_API:Utility functions#getParametersInstance |getParametersInstance]]()</tt>||Gets an instance of Parameters class || [[Parameters Class|Parameters]] object || [[Java_API:Utility|Utility]]


|-
|-
|<tt>[[Java_API:Utility#setTargetPage|setTargetPage]](String url)</tt>||Sets the target page|| None|| [[Java_API:Utility|Utility]]
|<tt>[[Java_API:Utility functions#setTargetPage|setTargetPage]](String url)</tt>||Sets the target page|| None|| [[Java_API:Utility|Utility]]


|-
|-
|<tt>[[Java_API:Utility#showMessage|showMessage]](long millisecs)</tt>||Displays message|| None|| [[Java_API:Utility|Utility]]
|<tt>[[Java_API:Utility functions#showMessage|showMessage]](long millisecs)</tt>||Displays message|| None|| [[Java_API:Utility|Utility]]


|-
|-
|<tt>[[Java_API:Utility#sleep|sleep]](String message)</tt>||Sleeps for the designated number of milliseconds.|| None || [[Java_API:Utility|Utility]]
|<tt>[[Java_API:Utility functions#sleep|sleep]](String message)</tt>||Sleeps for the designated number of milliseconds.|| None || [[Java_API:Utility|Utility]]


|-
|-
|<tt>[[Java_API:Utility#throwError|throwError]](String message)</tt>||Throws error with the message|| None|| [[Java_API:Utility|Utility]]
|<tt>[[Java_API:Utility functions#throwError|throwError]](String message)</tt>||Throws error with the message|| None|| [[Java_API:Utility|Utility]]
|}
|}
<br>
<br>

Revision as of 22:40, 21 August 2013

These APIs are defined in the Functions class.

Record Handling

Syntax Description Return Category
addRecord(String objectName, Params params) Adds a new record of type objectId with values from params Result object Record Handling
updateRecord(String objectName, String recordId, Params params) Updates record of type objectId with values params. The Record is identified by recordId Result object Record Handling
changeOwnerShipInfo(String object_id, String record_id, String owner_id) Changes the owner of the designated record None Record Handling
deleteRecord(String objectName, String recordId) Deletes Record of type objectId where id is recordId Result object Record Handling
getRecord(String objectName, String fields, String recordId) Gets the record of type objectId identified by recordId. fields is a comma separated list of fields that you want to fetch Result object Record Handling
getRecordCount(String objectName, String criteria) Returns the number of records in the object int Record Handling
searchRecords(String objectName, String fields, String criteria [, Parameters params]) Search and retrieve the records for an object. fields is a comma-separated list of fields to fetch. criteria is a Filter Expression Result object Record Handling
searchRecords(String objectName, String fields, String criteria, String sortBy, String sortOrder, String sortBy2, String sortOrder2, int offset, int numberOfRows [, Parameters params]) Search and retrieve records for an object. fields is a comma-separated list of fields to fetch. criteria is a Filter Expression Result object Record Handling
execSQL(String query) Execute a SQL query Result object Record Handling
getRecord(String compositeObject, String fields, String recordId) Get a [{Composite Object]] record, with specified fields. Result object Composite Objects
getRecordCount(String compositeObject, String criteria) Gets a count of records in a Composite Object that match specified filtering criteria. int Composite Objects
searchRecords(String compositeObject, String fields, String criteria [, Parameters params]) Search and retrieve Composite Object records. fields is a comma-separated list of fields to fetch. criteria is a Filter Expression Result object Composite Objects
searchRecords(String compositeObject, String fields, String criteria, String sortBy, String sortOrder, String sortBy2, String sortOrder2, int offset, int numberOfRows [, Parameters params]) Search and retrieve Composite Object records. fields is a comma-separated list of fields to fetch. criteria is a Filter Expression Result object Composite Objects


Email and Document Management

Syntax Description Return Category
sendEmail(String objectName, String id, String to, String cc, String subject, String body, String attachmentTemplateId, String attachmentIdList) Sends an Email Result object Email and Document Management
sendEmailUsingTemplate(String objectName, String recordId, String to, String cc, String subject, String bodyTemplateId, String attachmentTemplateId, String attachmentIdList) Sends an Email evaluating Template identified by bodyTemplateId as email body Result object Email and Document Management
generateDocument(String objectName, String recordId, String templateId, String format) 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 object Email and Document Management



Transaction Management

Syntax Description Return Category
addSavePoint(String name) Adds a Save Point with name None Utility
doesSavePointExist(String name) checks whether the named save point exists or not Boolean Utility
getAllSavePoints() Returns All Save Points Set Utility
rollback() Roll backs all the inserts and updates None Utility
rollbackToSavePoint(String name) Rollback to specific save point with name None Utility
removeSavePoint(String name) removes save point with name from save point list None Utility


Utility

Syntax Description Return Category
Deprecated Use Logger class.
   (See Debug Log)
debug(Object obj)
Puts a debug statement into the debug log for Object obj. (obj can be a String) None Utility functions
getEnv(String key) Gets the environment variable value for the key The value of the environment variable Utility
getParametersInstance() Gets an instance of Parameters class Parameters object Utility
setTargetPage(String url) Sets the target page None Utility
showMessage(long millisecs) Displays message None Utility
sleep(String message) Sleeps for the designated number of milliseconds. None Utility
throwError(String message) Throws error with the message None Utility


ServiceConfiguration class (static methods):

Syntax Return Type Description
getServiceName(); String Returns the Service Name (e.g. company name)
getServiceDomainURL(); String Returns the Service URL.


Metadata Management

Syntax Description Return Category
getObjectMetaData(String objectName) Retrieve metadata from a Custom Objects. CustomObjectMetaDataBean Customize
getObjectMetaDataMap() Return a map of all visible Custom Object object metadata records, indexed by object ID. Map: Object ID => CustomObjectMetaDataBean Customize
addObjectMetaData(CustomObjectMetaDataBean) Create a new object. String:Object ID Customize
updateObjectMetaData(CustomObjectMetaDataBean) Modify an object definition. String: Object ID Customize
deleteObjectMetaData(CustomObjectMetaDataBean) Deletes an object None Customize
getRecordLocator(String objectName) Get an object's Record Locator information. RecordLocatorBean Customize
updateRecordLocator(RecordLocatorBean) Modify an object's Record Locator Settings. String:Object ID Customize