/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.fp.bpmlib.transaction.task;

import java.util.List;

import com.fp.common.logger.APPLogger;
import com.fp.dto.rules.TransactionRule;
import com.fp.dto.save.SaveRequest;
import com.fp.persistence.pbpm.gene.TbpmGroups;

// TODO: Auto-generated Javadoc
/**
 * Class AddGroups encargada de.
 * 
 * @author BPTWPA
 */
public class AddGroups extends TransactionRule {

    /** serialVersionUID. */
    private static final long serialVersionUID = 1L;

    /**
     * Normal process.
     * 
     * @param pSaveRequest the save request
     * @return save request
     * @throws Exception la exception
     */
    @Override
    public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception {

        List<Object> tbpmGroups = pSaveRequest.getSaveBeanModifiedRecords("TBPMGROUPS");
        if (tbpmGroups != null) {
            for (Object objs : tbpmGroups) {
                try {
                    TbpmGroups groups = (TbpmGroups) objs;
                    //TaskServerSingleton.getInstance().getDaemon().addGroup(groups.getPk().getGroupcode());
                } catch (Exception e) {
                    APPLogger.getLogger().warn(e, e);
                }
            }
        }
        return pSaveRequest;
    }

    /**
     * Reverse process.
     * 
     * @param pSaveRequest the save request
     * @return save request
     * @throws Exception la exception
     */
    @Override
    public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception {
        return pSaveRequest;
    }

}
