Hi........I am trying to send Email Notification from a Repository Service on a Create Event -
the EmailId of the person is a metadata property .I get this value of the metadata property and assign it to IRecipient Object . But whenever i am uploading any new object in that repository , i am not getting an emails.
Below is the code of the recive method of the Repository Service. Plz let me know twhat all i am missing.
public void received(IEvent event) {
IRecipient recipient = null;
String UserID = recipient.getID();
IResourceEvent myEvent = (IResourceEvent) event;
IResource res = (IResource)event.getParameter();
String resname = res.getDisplayName();
String EnterpriseID=null;
try{
RecipientFactory recfact = RecipientFactory.getInstance();
PropertyName propertyUserName = new PropertyName("http://sapportals.com/xmlns/cm","USERNAME");;
Property propUName = new Property(propertyUserName ,new Integer(0));
if (res.getProperty(propertyUserName )!=null) {
//String docName = res.getName();
RID resRID = res.getRID();
resRID.toString();
IProperty enterpriseid = res.getProperty(propertyContributorName);
EnterpriseID = enterpriseid.getValueAsString();
}
recipient = recfact.getRecipient(EnterpriseID,1 );
ISubscriptionManager subscriptionManager = com.sapportals.wcm.repository.service.subscription.SubscriptionUtils.getSubscriptionManager(res);
ISubscriptionCondition mycondition = subscriptionManager.createSubscriptionCondition();
mycondition.setInterval("ALWAYS");
mycondition.setRecursionLevel("999");
mycondition.setRidTracking(subscriptionManager.getDefaultConditionRidTracking(res));
ISubscriptionAttributes attributes = null;
attributes.setNotificationText("your annotation here");
ISubscription simpleSubscription = subscriptionManager.createSubscription( res.getContext(), resname, mycondition, res, null, recipient, attributes);
}catch (WcmException e){
System.out.println(e);
}
Regards
Smita