com.ilient.api
Class SysaidApiService

java.lang.Object
  extended by com.ilient.api.SysaidApiService

public class SysaidApiService
extends java.lang.Object

Created by IntelliJ IDEA. User: ofer Date: Feb 21, 2010 Time: 5:30:34 PM To change this template use File | Settings | File Templates.


Constructor Summary
SysaidApiService()
           
 
Method Summary
 void delete(long sessionId, ApiSysaidObject apiSysObj)
          Deleting a SysAid object from the database.
 java.lang.String executeApiSysAidObjectAction(long sessionId, ApiSysaidObject apiSysObj, java.lang.String actionName, java.lang.Object[] actionParams)
          Executing a SysAidObject's action.
 java.lang.String[] executeSelectQuery(long sessionId, ApiSysaidObject apiSysObj, java.lang.String condition)
          Executing a select query for a given ApiSysaidObject.
 java.lang.String getApiSysAidObjectActions(long sessionId, ApiSysaidObject apiSysObj)
          Get a list of all the actions available for a given SysAidObject.
 ApiSysaidObject loadById(long sessionId, ApiSysaidObject apiSysObj, java.lang.Object id)
          Loading a SysAid object from the database according to its id.
 ApiSysaidObject loadByStringId(long sessionId, ApiSysaidObject apiSysObj, java.lang.String id)
          Loading a SysAid object from the database according to its id.
 long login(java.lang.String accountId, java.lang.String userName, java.lang.String password)
          Logging in to SysAid
 void logout(long sessionId)
          Logging out from SysAid
 java.lang.Object save(long sessionId, ApiSysaidObject apiSysObj)
          Saving a SysAid Object to the db.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SysaidApiService

public SysaidApiService()
Method Detail

delete

public void delete(long sessionId,
                   ApiSysaidObject apiSysObj)
Deleting a SysAid object from the database.

Parameters:
sessionId - Login session id.
apiSysObj - The SysAid Object to be deleted.

executeApiSysAidObjectAction

public java.lang.String executeApiSysAidObjectAction(long sessionId,
                                                     ApiSysaidObject apiSysObj,
                                                     java.lang.String actionName,
                                                     java.lang.Object[] actionParams)
Executing a SysAidObject's action.

Parameters:
sessionId - Login session id.
apiSysObj - An instance of ApiSysaidObject (could be empty).
actionName - The action name. Use the getApiSysAidObjectActions method to get an object's available actions.
actionParams - An array of the action's parameters (null value if no paramaters are needed).
Returns:
Upon a successfull execution null or an exception's message if action fails.

executeSelectQuery

public java.lang.String[] executeSelectQuery(long sessionId,
                                             ApiSysaidObject apiSysObj,
                                             java.lang.String condition)
Executing a select query for a given ApiSysaidObject.

Parameters:
sessionId - Login session id.
apiSysObj - The given ApiSysaidObject.
condition - The condition part of the SQL query (Could be empty - Getting all the existing object ids).
Returns:
An array of object ids matching the query.

getApiSysAidObjectActions

public java.lang.String getApiSysAidObjectActions(long sessionId,
                                                  ApiSysaidObject apiSysObj)
Get a list of all the actions available for a given SysAidObject. Currently there is only one action in ApiProject.

Parameters:
sessionId - Login session id.
apiSysObj - An instance of ApiSysaidObject (could be empty).
Returns:
A list of all the Object's available actions.

loadById

public ApiSysaidObject loadById(long sessionId,
                                ApiSysaidObject apiSysObj,
                                java.lang.Object id)
Loading a SysAid object from the database according to its id.

Parameters:
sessionId - Login Session id.
apiSysObj - The SysAid Object to be loaded (mostly an empty one).
id - The object id.
Returns:
A ApiSysaidObject or null if none is found.

loadByStringId

public ApiSysaidObject loadByStringId(long sessionId,
                                      ApiSysaidObject apiSysObj,
                                      java.lang.String id)
Loading a SysAid object from the database according to its id.

Parameters:
sessionId - Login Session id.
apiSysObj - The SysAid Object to be loaded (mostly an empty one).
id - The object id as a String (a number must be catsed to a string).
Returns:
A ApiSysaidObject or null if none is found.

login

public long login(java.lang.String accountId,
                  java.lang.String userName,
                  java.lang.String password)
Logging in to SysAid

Parameters:
accountId - The account name.
userName - The user name.
password - The password
Returns:
Login session id

logout

public void logout(long sessionId)
Logging out from SysAid

Parameters:
sessionId - The login session id

save

public java.lang.Object save(long sessionId,
                             ApiSysaidObject apiSysObj)
Saving a SysAid Object to the db. If it's a new object, then creating it, otherwise updating it. The method returns the object's id. Here is the list of SysAid Objects and their id types: ApiCatalogItem - String ApiCI - int ApiServiceRequest - int ApiComputer - String ApiComputerItemList - String ApiSoftware - int ApiCompany - int ApiSupplier - int ApiSysAidUser - String ApiProject - int ApiTask - int

Parameters:
sessionId - Login session id.
apiSysObj - The SysAid Object to be saved.
Returns:
The Object id.