Following code works for 9.1 M40.
void constructSubscription(Notifiable targetObject) throws WTException, WTPropertyVetoException{
//Declare and initialize NotificationSubscription variable
NotificationSubscription subscriptionAttributes = new NotificationSubscription();
//set attributes for subscriptionAttributes
subscriptionAttributes.setName("My Custom Subscription Name");
subscriptionAttributes.setSubject("My Custom Subscription Subject");
subscriptionAttributes.setMessage("My Custom Subscription Message");
subscriptionAttributes.setSendImmediate(true);
//create Map for events. Events are case sensitive.
//Capitalize all characters and add "_" (underscore) between words
//Here is list of a few events
//CHECK_IN_FROM_PROJECT, CHECK_OUT_IN, COPY, DELETE,
//EDIT_ACCESS_CONTROL, EDIT_ATTRIBUTES, EDIT_IDENTITY, MARKUP,
HashMap<String,WTStringMap> eventsMap = new HashMap<String,WTStringMap>();
eventsMap.put("CHECK_OUT_IN", (WTStringMap)null);
eventsMap.put("DELETE", (WTStringMap)null);
//get subscriber, currently setting to session user
NotifySubscriptionRecipient subscriber = NotifySubscriptionRecipient.newNotifySubscriptionRecipient(SessionHelper.getPrincipal(), NotifySubscriptionRecipient.TO_ADDRESS);
//create subscription
NotificationHelper.manager.createObjectSubscription(subscriptionAttributes,subscriber, targetObject, eventsMap, true);
}