The example provided in this document is provided “as-is” to the user and assumes that the user:
PREREQUISITES:
For the sample to work, the Strategy Web JAR files must be accessible by the Java Runtime
Environment. The Strategy Web JAR files can be found under:
To retrieve the long description of an object using the Strategy Web SDK 9.x, please modify and compile the class below accordingly.
package com.Strategy.sdk.aps;
import com.Strategy.web.objects.WebIServerSession;
import com.Strategy.web.objects.WebObjectInfo;
import com.Strategy.web.objects.WebObjectSource;
import com.Strategy.web.objects.WebObjectsException;
import com.Strategy.web.objects.WebObjectsFactory;
import com.Strategy.webapi.EnumDSSXMLObjectFlags;
import com.Strategy.webapi.EnumDSSXMLObjectTypes;
public class getFullComm{
private static WebObjectsFactory factory = null;
private static WebIServerSession serverSession = null;
public static void main(String[] args) throws WebObjectsException, IllegalArgumentException {
getSession();
WebObjectSource source = factory.getObjectSource();
source.setFlags(source.getFlags()|EnumDSSXMLObjectFlags.DssXmlObjectComments );
WebObjectInfo woi= source.getObject("C1E141DB11D603A2100086B3A5E8F8A4", EnumDSSXMLObjectTypes.DssXmlTypeUser, true); //Replace the object with user's UID.
String[] str=woi.getComments();
int i=0;
while(i<woi.getComments().length)
{
System.out.println("User Group Long Description:" + str);
i++;
}
}
public static WebIServerSession getSession() {
if (serverSession == null) {
//create factory object
factory = WebObjectsFactory.getInstance();
serverSession = factory.getIServerSession();
//Set up session properties
serverSession.setServerName("machinename"); //Should be replaced with the name of an Intelligence Server
serverSession.setServerPort(0);
serverSession.setProjectName("Strategy Tutorial"); //Project where the session should be created
serverSession.setLogin("administrator"); //User ID
serverSession.setPassword(""); //Password
//Initialize the session with the above parameters
try {
System.out.println("\nSession created with ID: " + serverSession.getSessionID());
} catch (WebObjectsException ex) {
handleError(null, "Error creating session:" + ex.getMessage());
}
}
//Return session
return serverSession;
}
/**
* Close Intelligence Server Session
* @param serverSession WebIServerSession
*/
public static void closeSession(WebIServerSession serverSession) {
try {
serverSession.closeSession();
} catch (WebObjectsException ex) {
System.out.println("Error closing session:" + ex.getMessage());
return;
}
System.out.println("Session closed.");
}
/**
* Print out error message, close session and abort execution
* @param serverSession WebIServerSession
* @param message String
*/
public static void handleError(WebIServerSession serverSession, String message) {
System.out.println(message);
if (serverSession != null) {
closeSession(serverSession);
}
System.exit(0);
}
}