Using the Strategy Java Web SDK 9.3.1, it is possible to programmatically modify a prompt definition to change the Web display properties. This is beneficial to users who are upgrading from a previous version and want to change some of the display settings that didn't exist previously.
In this example, the following display properties were not selected in a prompt that was created in a previous version:

After modifying the prompt programmatically, these options will now be selected as shown below:

Use the followng code to programmatically change these properties:
package customclasses.misc;
import com.Strategy.web.objects.WebExpressionPrompt;
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.web.objects.WebProperties;
import com.Strategy.web.objects.WebProperty;
import com.Strategy.webapi.EnumDSSXMLAuthModes;
import com.Strategy.webapi.EnumDSSXMLObjectFlags;
public class ModifyPromptDef {
/
public static void main(String[] args) {
// TODO Auto-generated method stub
WebObjectsFactory objectFactory = WebObjectsFactory.getInstance();
WebIServerSession serverSession = objectFactory.getIServerSession();
serverSession.setServerPort(0);
serverSession.setAuthMode(EnumDSSXMLAuthModes.DssXmlAuthStandard);
serverSession.setProjectName("Strategy Tutorial");
serverSession.setLogin("administrator");
serverSession.setPassword("");
serverSession.setServerName("Intelligence Server");
try {
//Create a session on the I-server
String SessionID = serverSession.getSessionID();
System.out.println("Welcome " + serverSession.getLogin());
System.out.println("SessionID: " + SessionID);
WebObjectSource wos=objectFactory.getObjectSource();
wos.setFlags(wos.getFlags()| EnumDSSXMLObjectFlags.DssXmlObjectProperties);
String promptID = "9E8B741B49CF0FC7CA4A2193D351AD77";
WebObjectInfo pinfo = wos.getObject(promptID, 10, true);
out(pinfo.getName());
out(pinfo.getClass().toString());
WebExpressionPrompt wep = (WebExpressionPrompt)pinfo;
out("subtype: "+wep.getSubType());
WebProperties wprops = wep.getDisplayProperties();
out(wprops.getXML());
/*change properties:
DisplaySearchBox (0 > -1)
AllowRootOperatorChange (0 > -1)*/
WebProperty wp1 = wprops.getByName("DisplaySearchBox");
WebProperty wp2 = wprops.getByName("AllowRootOperatorChange");
out(wp1.getName()+" = "+ wp1.getValue());
out(wp2.getName()+" = "+ wp2.getValue());
wp1.setUseDefault(true);
wp1.setValue("-1");
wp2.setValue("-1");
wp1.save();
wp2.save();
wos.save(wep);
out("end");
}catch (WebObjectsException ex) {
System.out.println(ex.getMessage());
ex.printStackTrace();
}
}
public static void out(String s){
System.out.println(s);
}
}