David,
I am planning to have the below method in my XxxServiceImpl class (I have remote-service=true in service.xml). Basically I want to directlry hit this URL from outside the portlet, by clicking a link say in an email. It will only have some id as a parameter to the method.
I want to update the database record whenever the method is hit for a particular code/id. To update I need servicecontext instance. I am just doing ]ServiceContext serviceContext = new ServiceContext() without any request objet attached. There is no actionRequest etc associated when the method is called, as it is being called from a link outside the portlet. When I try the below, it is not updating the record, basically I am trying to change the status of 'activeSatus' from inactive to active when the method is being called with a particular verification code Could you help?
Thanks
Smile
public void updateEmailVerification(String validationCode) throws SystemException, PortalException {
ServiceContext serviceContext = new ServiceContext();
List<EmailSubscription> emails = new ArrayList<EmailSubscription>();
emails = EmailSubscriptionLocalServiceUtil.findByValidationCode(validationCode);
System.out.println("Inside Update verification method." +serviceContext);
if (emails != null) {
for (EmailSubscription sub: emails) {
long subscriptionID = sub.getSubscriptionId();
String userEmail = sub.getUserEmail();
String subscriptionCategory = sub.getSubscriptionCategory();
String activeStatus ="ACTIVE";
EmailSubscriptionLocalServiceUtil.updateSubscription(subscriptionID, userEmail, subscriptionCategory, activeStatus, validationCode, serviceContext);
}
}
}
Firmi prego dentro per inbandierare questo come inadeguato.