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:
Note:
More elaborate programs will require additional library files and are out of the scope of this document.
It is possible to extract the subscription information for the open session using Strategy Web SDK. This document gives an example of how to accomplish this.
package com.Strategy.memo;
import com.Strategy.web.objects.SimpleList;
import com.Strategy.web.objects.WebIServerSession;
import com.Strategy.web.objects.WebObjectsFactory;
import com.Strategy.web.objects.WebSubscription;
import com.Strategy.web.objects.WebSubscriptionsSource;
import com.Strategy.webapi.EnumDSSXMLSubscriptionDeliveryType;
public class QuerySubscriptions {
public static void main(String[] args) {
WebIServerSession webIServerSession = null;
WebObjectsFactory webObjectFactory = WebObjectsFactory.getInstance();
webIServerSession = webObjectFactory.getIServerSession();
webIServerSession.setServerName("SERVER_HOSTNAME");
webIServerSession.setServerPort(0);
webIServerSession.setProjectName("Strategy Tutorial");
webIServerSession.setLogin("administrator");
webIServerSession.setPassword("");
try{
WebSubscriptionsSource subSource = webObjectFactory.getSubscriptionsSource();
System.out.println("List of subscriptions: ");
SimpleList subList =
subSource.getSubscriptionsByDeliveryMode
(EnumDSSXMLSubscriptionDeliveryType.DssXmlDeliveryTypeAll);
System.out.println("\tTotal subscriptions: " + subList.size());
printSubInfo(subList);
subList =
subSource.getSubscriptionsByDeliveryMode
(EnumDSSXMLSubscriptionDeliveryType.DssXmlDeliveryTypeEmail);
System.out.println("\tEmail subscriptions: " + subList.size());
printSubInfo(subList);
subList =
subSource.getSubscriptionsByDeliveryMode
(EnumDSSXMLSubscriptionDeliveryType.DssXmlDeliveryTypeInbox);
System.out.println("\tHistory List subscriptions: " + subList.size());
printSubInfo(subList);
subList =
subSource.getSubscriptionsByDeliveryMode
(EnumDSSXMLSubscriptionDeliveryType.DssXmlDeliveryTypeMobile);
System.out.println("\tMobile subscriptions: " + subList.size());
printSubInfo(subList);
subList =
subSource.getSubscriptionsByDeliveryMode
(EnumDSSXMLSubscriptionDeliveryType.DssXmlDeliveryTypeFile);
System.out.println("\tFile subscriptions: " + subList.size());
printSubInfo(subList);
subList =
subSource.getSubscriptionsByDeliveryMode
(EnumDSSXMLSubscriptionDeliveryType.DssXmlDeliveryTypePrinter);
System.out.println("\tPrinter subscriptions: " + subList.size());
printSubInfo(subList);
webIServerSession.closeSession();
}catch(Exception e){}
}
public static void printSubInfo(SimpleList sl) throws Exception {
for(int i = 0; i < sl.size(); i++) {
WebSubscription ws = (WebSubscription)sl.item(i);
System.out.println("\t\t Name: " + ws.getName() + "Report/Document: " +
ws.getcontent().getName());
}
}
}
WARNING:
This customization is provided as a convenience to Strategy users and is only directly applicable to the version stated. While this code may apply to other releases directly, Strategy Technical Support makes no guarantees that the code provided will apply to any future or previous builds. In the event of a code change in future builds, Strategy may not be able to provide additional code on this matter even though this customization is provided at this time for this specific build.