AgileApps Support Wiki Pre Release

Difference between revisions of "Object Metadata"

From AgileApps Support Wiki
imported>Aeric
 
imported>Aeric
 
(15 intermediate revisions by the same user not shown)
Line 3: Line 3:
Object metadata is the data that describes an object--it's name, for example, and it's ID.
Object metadata is the data that describes an object--it's name, for example, and it's ID.


===CustomObjectMetaDataBean ===
===getObjectMetaData===
;Description:Retrieves metadata from {{type|}}s; not available for {{type}}s   
;Description:Retrieves metadata from {{type|}}s; not available for {{type}}s   
;Syntax:
;Syntax:
CustomObjectMetaDataBean Functions.getObjectMetaData(String objectName)
:{|
       /* where objectName is the Custom Object name */
<pre>CustomObjectMetaDataBean Functions.getObjectMetaData(String objectName)
       /* where objectName is the Custom Object name */</pre>
|}
;Example:<syntaxhighlight lang="java" enclose="div">
;Example:<syntaxhighlight lang="java" enclose="div">
Functions.debug("Initiate Object Meta Data Retrieval");
Logger.info("Initiate Object Meta Data Retrieval", "Metadata");
CustomObjectMetaDataBean comdb = Functions.getObjectMetaData(String objectName)  
CustomObjectMetaDataBean comdb = Functions.getObjectMetaData(String objectName)  
Functions.debug("Object Display Title : "+ comdb.getDisplayTitle());
Logger.info(("Object Display Title : "+ comdb.getDisplayTitle(), "Metadata");
</syntaxhighlight>
</syntaxhighlight>


===Map getObjectMetaDataMap===
===getObjectMetaDataMap===
;Description:Returns a map of all visible {{type|}}s with <tt>object_id</tt> as the key and the corresponding object's metadata as a value
;Description:Returns a map of all visible {{type|}}s with <tt>object_id</tt> as the key and the corresponding object's metadata as a value
;Syntax:<pre>Map Functions.getObjectMetaDataMap()</pre>
;Syntax:<pre>Map Functions.getObjectMetaDataMap()</pre>
;Example:<syntaxhighlight lang="java" enclose="div">
;Example:<syntaxhighlight lang="java" enclose="div">
Functions.debug("Initiate Object Meta Data Retrieval");
Logger.info("Initiate Object Meta Data Retrieval", "Metadata");
Map  comdbCollection = Functions.getObjectMetaDataMap()  
Map  comdbCollection = Functions.getObjectMetaDataMap()  
for(Map.Entry e:comdbCollection.entrySet())
for(Map.Entry e:comdbCollection.entrySet())
     {
     {
     CustomObjectMetaDataBean bean = e.getValue();
     CustomObjectMetaDataBean bean = e.getValue();
     Functions.debug("Object ID :" + e.getKey());
     Logger.info("Object ID :" + e.getKey(), "Metadata");
     Functions.debug(" Object Display Title:" + bean.getDisplayTitle());
     Logger.info(" Object Display Title:" + bean.getDisplayTitle(), "Metadata");
     }
     }
</syntaxhighlight>
</syntaxhighlight>
Line 34: Line 36:
{{:Object Names}}
{{:Object Names}}
;Example:<syntaxhighlight lang="java" enclose="div">
;Example:<syntaxhighlight lang="java" enclose="div">
Functions.debug("Initiate Add object");
Logger.info("Initiate Add object", "Metadata");
CustomObjectMetaDataBean omdb = new CustomObjectMetaDataBean ();
CustomObjectMetaDataBean omdb = new CustomObjectMetaDataBean ();
omdb.setDisplayTitle("JAVA API OBJECT");
omdb.setDisplayTitle("JAVA API OBJECT");
Line 43: Line 45:
omdb.setObjectName("API_OBJ");
omdb.setObjectName("API_OBJ");
String new_object_id = Functions.addObjectMetaData(omdb);
String new_object_id = Functions.addObjectMetaData(omdb);
Functions.debug("Added an object:"+new_object_id);
Logger.info("Added an object:"+new_object_id, "Metadata");
</syntaxhighlight>
</syntaxhighlight>


Line 54: Line 56:
Functions.updateObjectMetaData(omdb);
Functions.updateObjectMetaData(omdb);
</syntaxhighlight>
</syntaxhighlight>


===deleteObjectMetaData===
===deleteObjectMetaData===
Line 63: Line 64:
</syntaxhighlight>
</syntaxhighlight>


<noinclude>[[Category:Customize Java API‎]]</noinclude>
===getRecordLocator===
Get a record locator bean from the specified object, which contains the Key, Lookup, and Search settings,<br>
where:
:* '''Key''' - The concatenation of fields that constitutes the [[Record_Locator#Search_Fields]] examined by the platform when searching for records.
:* '''Search''' - The concatenation of fields that constitutes the [[Record_Locator#Lookup_and_Search_Results_Fields|Lookup and Search Results]] fields that are displayed to the user during a search or Lookup.
:* '''Lookup''' - The concatenation of fields that constitutes the [[Record_Locator#Record_Identifier_Fields|record identifier]], displayed as the value of a Lookup field after a selection has been made.
 
;Syntax:
:<syntaxhighlight lang="java" enclose="div">
RecordLocatorBean rlb = Functions.getRecordLocator(String objectName);
</syntaxhighlight>
 
;Parameters:
:'''objectName -''' The object name or identifier.
 
;Returns:
:[{{DOCHOST}}/javadocs/com/platform/beans/RecordLocatorBean.html RecordLocatorBean]
 
;Throws:
:Exception
 
;Example:
:<syntaxhighlight lang="java" enclose="div">
public Map testGetLookupRecordLocatorColumns() throws Exception
{
RecordLocatorBean rb =  Functions.getRecordLocator("Students");
    Map<String, String> m = new HashMap<String, String>();
    String lookupString = "";
    for(String s : rb.getLookupColumns())
    {
        lookupString = lookupString + s;
    }
    m.put("lookupColumnsRecordLocator",lookupString);
    return m;
}
</syntaxhighlight>
 
===updateRecordLocator===
Modify an object's Record Locator Settings:
:* '''Key -''' [[Record_Locator#Search_Fields|Search Fields]]
:* '''Search -''' [[Record_Locator#Lookup_and_Search_Results_Fields|Lookup and Search Results Fields]]
:* '''Lookup -''' [[Record_Locator#Record_Identifier_Fields|Record Identifier Fields]]
 
;Syntax:
:<syntaxhighlight lang="java" enclose="div">
String objectId = Functions.updateRecordLocator(RecordLocatorBean rlb); 
</syntaxhighlight>
 
;Parameters:
:;'''RecordLocatorBean -''' The object with the values to store.
 
;Returns:
:A string containing the ID of the updated object
 
;Throws:
:Exception
 
;Example:
:<syntaxhighlight lang="java" enclose="div">
public Map testUpdateSearchRecordLocator() throws Exception
{
RecordLocatorBean rlb = Functions.getRecordLocator("Students");
    Map<String, String> m = new HashMap<String, String> ();
    List<String> looklist = new ArrayList<String>();
    looklist.add("emergency_phone");
    looklist.add("student_name");
    rlb.setSearchColumns(looklist);
    Functions.updateRecordLocator(rlb);
 
    String lookupString = "";
    for (String s: rlb.getLookupColumns())
    {
        lookupString = lookupString + s;
    }
    m.put("updatedSearchColumnsRecordLocator", lookupString);
    return m;
}
</syntaxhighlight>
<noinclude>
 
[[Category:Customize Java API‎]]
</noinclude>

Latest revision as of 00:22, 16 October 2014

Learn more: Java API:Customize

Object metadata is the data that describes an object--it's name, for example, and it's ID.

getObjectMetaData

Description
Retrieves metadata from Custom Objects; not available for System Objects
Syntax
CustomObjectMetaDataBean Functions.getObjectMetaData(String objectName)
       /* where objectName is the Custom Object name */
Example
Logger.info("Initiate Object Meta Data Retrieval", "Metadata");
CustomObjectMetaDataBean comdb = Functions.getObjectMetaData(String objectName) 
Logger.info(("Object Display Title : "+ comdb.getDisplayTitle(), "Metadata");

getObjectMetaDataMap

Description
Returns a map of all visible Custom Objects with object_id as the key and the corresponding object's metadata as a value
Syntax
Map Functions.getObjectMetaDataMap()
Example
Logger.info("Initiate Object Meta Data Retrieval", "Metadata");
Map  comdbCollection = Functions.getObjectMetaDataMap() 
for(Map.Entry e:comdbCollection.entrySet())
    {
    CustomObjectMetaDataBean bean = e.getValue();
    Logger.info("Object ID :" + e.getKey(), "Metadata");
    Logger.info(" Object Display Title:" + bean.getDisplayTitle(), "Metadata");
    }

addObjectMetaData

Description
Adds an object and returns the id of the newly created object
Syntax
String Functions.addObjectMetaData(CustomObjectMetaDataBean comdb)
Considerations
  • Object names:
  • Must start with an alphabetic character.
  • May contain only alphanumeric (a-z A-Z 0-9) and underscores (_).
  • May not contain spaces or other characters.
  • Must be 32 characters or less.
Example
Logger.info("Initiate Add object", "Metadata");
CustomObjectMetaDataBean omdb = new CustomObjectMetaDataBean ();
omdb.setDisplayTitle("JAVA API OBJECT");
omdb.setSingluarDisplayTitle("JAVA API OBJECT");
omdb.setBuiltIn(false);
omdb.setNameColumn("name");
omdb.setWebTab(false);
omdb.setObjectName("API_OBJ");
String new_object_id = Functions.addObjectMetaData(omdb);
Logger.info("Added an object:"+new_object_id, "Metadata");

updateObjectMetaData

Description
Updates an object and returns the id of the updated object
Syntax
String Functions.updateObjectMetaData(CustomObjectMetaDataBean comdb)
Example
CustomObjectMetaDataBean omdb = Functions.getObjectMetaData("API_OBJ");
omdb.setDisplayTitle("JAPIOBJ");
Functions.updateObjectMetaData(omdb);

deleteObjectMetaData

Description
Deletes an object
Syntax
Functions.deleteObjectMetaData(CustomObjectMetaDataBean comdb)
Example
Functions.deleteObjectMetaData( Functions.getObjectMetaData("API_OBJ"));

getRecordLocator

Get a record locator bean from the specified object, which contains the Key, Lookup, and Search settings,
where:

  • Key - The concatenation of fields that constitutes the Record_Locator#Search_Fields examined by the platform when searching for records.
  • Search - The concatenation of fields that constitutes the Lookup and Search Results fields that are displayed to the user during a search or Lookup.
  • Lookup - The concatenation of fields that constitutes the record identifier, displayed as the value of a Lookup field after a selection has been made.
Syntax
RecordLocatorBean rlb = Functions.getRecordLocator(String objectName);
Parameters
objectName - The object name or identifier.
Returns
RecordLocatorBean
Throws
Exception
Example
public Map testGetLookupRecordLocatorColumns() throws Exception
{
RecordLocatorBean rb =  Functions.getRecordLocator("Students");
    Map<String, String> m = new HashMap<String, String>();
    String lookupString = "";
    for(String s : rb.getLookupColumns())
    {
        lookupString = lookupString + s;
    }
    m.put("lookupColumnsRecordLocator",lookupString);
    return m;
}

updateRecordLocator

Modify an object's Record Locator Settings:

Syntax
String objectId = Functions.updateRecordLocator(RecordLocatorBean rlb);
Parameters
RecordLocatorBean - The object with the values to store.
Returns
A string containing the ID of the updated object
Throws
Exception
Example
public Map testUpdateSearchRecordLocator() throws Exception
{
 RecordLocatorBean rlb = Functions.getRecordLocator("Students");
     Map<String, String> m = new HashMap<String, String> ();
     List<String> looklist = new ArrayList<String>();
     looklist.add("emergency_phone");
     looklist.add("student_name");
     rlb.setSearchColumns(looklist);
     Functions.updateRecordLocator(rlb);

     String lookupString = "";
     for (String s: rlb.getLookupColumns())
     {
         lookupString = lookupString + s;
     }
     m.put("updatedSearchColumnsRecordLocator", lookupString);
     return m;
}