SUMMARY: A project’s description can normally be changed using Strategy Developer. However, this can also be done programmatically using Strategy Web SDK 9.4.1-10
The following sample code demonstrates how this can be done:
public static void main(String[] args) {
WebIServerSession isess = null;
isess = WebObjectsFactory.getInstance().getIServerSession();
isess.setServerName("localhost");
isess.setServerPort(0);
isess.setProjectName("Strategy Tutorial");
isess.setLogin("administrator");
isess.setPassword("");
//Get the project object
WebObjectSource objectSource = isess.getFactory().getObjectSource();
try {
WebObjectInfo woi = objectSource.getObject(isess.getProjectID(), EnumDSSXMLObjectTypes.DssXmlTypeProject);
//Populate the object
woi.populate();
//Output the current description
System.out.println("Description: " + woi.getDescription());
//Set a new description and save the project
woi.setDescription("Tutorial");
objectSource.save(woi);
} catch (WebObjectsException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}