Subversion Repositories SmartDukaan

Rev

Rev 1051 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

package in.shop2020.creation.controllers;

import in.shop2020.thrift.clients.CatalogServiceClient;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.apache.struts2.interceptor.ParameterAware;

import com.opensymphony.xwork2.ValidationAwareSupport;

@Results({
    @Result(name="success", type="redirectAction", 
                params = {"actionName" , "entity"})
})
public class ItemUpdateController extends ValidationAwareSupport implements ParameterAware {
        
        private static final long serialVersionUID = 7180013499003793197L;
        
        private Map<String, String[]> reqparams;
        
        private static Log log = LogFactory.getLog(ItemUpdateController.class);
        
        private String id;
        
        public String show(){
                try {
                        CatalogServiceClient csc = new CatalogServiceClient();
                        in.shop2020.model.v1.catalog.InventoryService.Client iclient = csc.getClient();
                        long entityId = Long.parseLong(getId());
                        iclient.markItemAsContentComplete(entityId);
                } catch (Exception e) {
                        e.printStackTrace();
                }
                addActionMessage("Entity updated successfully");
                return "success";
        }

        public String getId(){
                return this.id;
        }
        
        public void setId(String id){
                this.id = id;
        }
        
        @Override
        public void setParameters(Map<String, String[]> reqmap) {
                log.info("setParameters:" + reqmap);
                
                this.reqparams = reqmap;
        }
}