Package beans.service

Source Code of beans.service.MoneyTransactionBean

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package beans.service;

import framework.beans.EntityDetails;
import framework.beans.FacadeBean;
import framework.beans.security.BeanRights;
import beans.user.collaborator.entities.Collaborator;
import framework.generic.ClipsServerException;
import javax.ejb.EJBException;
import javax.ejb.Stateful;
import beans.UserRightsSet;
import framework.audit.AuditDoc;
import framework.security.UserRight;
import java.util.Date;
import java.util.List;

/**
* Security - Ok.
* @author axe
*/
@Stateful(mappedName="clips-beans/MoneyTransactionBean")
public class MoneyTransactionBean extends FacadeBean<MoneyTransaction>
        implements MoneyTransactionBeanRemote {
   
    public static final UserRight RIGHT_CREATION = UserRightsSet.CREATE_MONEY_TRANSACTION;

    public MoneyTransactionBean() {
        super(MoneyTransaction.class);
    }

    @Override
    protected void initBeanRights() {
        int[] r = new int[7];
        r[COMMAND_READ] = RightPresence(UserRightsSet.READ_SERVICE_RENDER_TRANSACTION_DETAIL.id);
        r[COMMAND_CREATE] = RightPresence(RIGHT_CREATION.id);

        int mr = RightPresence(UserRightsSet.MODIFY_REMOVE_ADMIN_MONEY_TRANSACTION.id);
        r[COMMAND_MODIFY] = mr;
        r[COMMAND_REMOVE] = mr;
       
        rights = new BeanRights(r);
    }
   
    /**
     * Обновляет данные сущности.
     * @param details новые детали сущности
     * @throws EJBException в случае если обновление отвергнуто системой
     *          безопастности либо произошла ошибка
     * @return идентификатор сущности
     */
    @Override
    protected void onUpdate(MoneyTransaction entity, EntityDetails details,
            AuditDoc auditDoc, List<AuditDoc> auditDocList) throws ClipsServerException{
        MoneyTransactionDetails d = (MoneyTransactionDetails) details;
        entity.setDate(d.date);
        entity.setCollaborator(findEntity(Collaborator.class, d.collaboratorID));
        entity.setDescription(d.description);
        entity.setMoney(d.money);
        entity.setPermitted(d.permitted);
        entity.setServiceRender(findEntity(ServiceRender.class, d.serviceRenderID));
    }   
}
TOP

Related Classes of beans.service.MoneyTransactionBean

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.