Sometimes user want to update a report name via Strategy Web SDK.
Before executing the code:

After executing the code:

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 update a report name using SDK, create a java class as below:
package com.Strategy.jeff;
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.EnumDSSXMLObjectTypes;
public class setObjName{
private static WebObjectsFactory factory = null;
private static WebIServerSession serverSession = null;
public static void main(String[] args) throws WebObjectsException, IllegalArgumentException {
getSession();
WebObjectSource source = factory.getObjectSource();
WebObjectInfo obj= source.getObject("D518D2894FF7346A6BA1E5A47B212A35", EnumDSSXMLObjectTypes.DssXmlTypeReportDefinition, true); //Replace the object with report's UID.
source.save(obj, "newname");
System.out.println("done!");
}
public static WebIServerSession getSession() {
if (serverSession == null) {
//create factory object
factory = WebObjectsFactory.getInstance();
serverSession = factory.getIServerSession();
//Set up session properties
serverSession.setServerName("SERVER_NAME"); //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);
}
}