Problem in getting value in java method :check details

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Problem in getting value in java method :check details

prateek-2
Hello,
   
   I am explaining in detail what i want to do and what i have done .
 
   I have restricted the user from login immediately after he/she gets registered on a ecommerce website. This i have done  by setting " Require customer role = N " of that particular webstore.
  This restricts user from login immediately after getting registered though he/she has password and the control will redirect to login page.

   So the issue is :
   
    We have to go to webtools part of ofbiz . CATALOG --->  Stores ----> choose the particular webstore and click on it.
    Then we go to roles and a form will open . In that i choose "Role type = Customer " ,   partyID and date.
    This will approve that particular user.
   
   The problem is that according to client requirement,  We have to send mail at this time to the email id of that user . Mail content is  " your account has been approved ".

Following are theb files for existing funtionality:
 
   EditProductStoreRoles.ftl , controller.xml, ProductStoreServices.xml.  

   we have added following code in ProductStoreServices.xml.

     <simple-method method-name="createProductStoreRole" short-description="Create ProductStoreRole">
                 <check-permission permission="CATALOG" action="_CREATE"><fail-message message="Security Error: to run createProductStoreRole you must have the CATALOG_CREATE or CATALOG_ADMIN permission"/></check-permission>
                 <check-errors/>
         
                 <make-value value-name="newEntity" entity-name="ProductStoreRole"/>
                 <set-pk-fields map-name="parameters" value-name="newEntity"/>
                 <set-nonpk-fields map-name="parameters" value-name="newEntity"/>
         
          <if-empty field-name="fromDate" map-name="newEntity">
                     <now-timestamp-to-env env-name="nowTimestamp"/>
                     <set from-field="nowTimestamp" field="newEntity.fromDate"/>
                 </if-empty>
         
                 <create-value value-name="newEntity"/>
                 
 //Added functionality                <call-class-method method-name="sendMail" class-name="org.ofbiz.product.store.ProductStoreWorker">
                 
                 </call-class-method>

         
        </simple-method>


     Also we have added the following method in ProductStoreWorker.java
 
 public static void sendMail() throws java.io.IOException
    {
         //Code for sending e-mail
}


In this method I want obtain the PartyId for which "role(e.g. customer)" is just added.
I think there should be value of PartyId in some envoirement variable or by other means.
Plz tell me how to obtain that partyId value in this java method.

Or might it can be sent as an argument to he java method through simple method. If yes, then how?

 Thanks in advance.
 
Prateek
Voltix Softwares Pvt .Ltd
India