Package clips.delegate.kek

Source Code of clips.delegate.kek.CommitteeResolutionData

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

package clips.delegate.kek;

import beans.cec.entity.CommitteeResolutionDetails;
import cli_fmw.delegate.directory.complex.DirectoryLocator;
import clips.delegate.directory.complex.DirectoryMKB10;
import clips.delegate.directory.complex.DirectoryMKB10Item;
import clips.delegate.doctor.direction.DirectionLocal;
import cli_fmw.main.ClipsException;
import cli_fmw.delegate.lists.DataChunk;
import cli_fmw.delegate.lists.Mappable;
import clips.delegate.directory.ro.DirectoryCollaborator;
import clips.delegate.directory.ro.DirectoryCollaboratorItem;
import clips.delegate.directory.simple.committeeResolution.DirectoryCommitteeResolution;
import clips.delegate.directory.simple.committeeResolution.DirectoryCommitteeResolutionItem;

/**
* делегат - решение комиссии
* @author ViP
*/
public class CommitteeResolutionData
    extends DataChunk<CommitteeResolutionDetails> implements Mappable<Integer> {

    public CommitteeResolutionData(CommitteeDirectionData direction) throws ClipsException {
        super(new CommitteeResolutionDetails());
        getDetails().directionID = direction.getId();
       
        if(direction.getId() == 0) {
            throw new ClipsException("Необходимо сохранить направление на КЭК перед вынесением решения");
        }
    }
   
    public CommitteeResolutionData(CommitteeDirectionData direction, CommitteeResolutionDetails details)
            throws ClipsException {
        super(details);

        if(details.directionID == 0
                || getDetails().directionID != direction.getId()) {
            throw new RuntimeException("Inconsistent direction data");
        }
    }
       
    @Override
    public Integer getKey() {
        return getDetails().directionID;
    }

    public DirectoryCollaboratorItem getCollaborator() throws ClipsException {
        if (getDetails().collaboratorID != 0) {
            DirectoryCollaborator dir = DirectoryLocator.getDirectory(DirectoryCollaborator.class, false);
            return dir.getItemFromID(getDetails().collaboratorID);
        }
        return null;
    }

    public void setCollaborator(DirectoryCollaboratorItem collab) {
        getDetails().collaboratorID = collab.getID();
        fireContentStateEvent();
    }

    @Deprecated
    public CommitteeLocal getCommittee() {
        return null;
    }

    @Deprecated
    public void setCommittee(CommitteeLocal committee) {
    }

    @Deprecated
    public DirectionLocal getDirection() {
        return null;
    }

    @Deprecated
    public void setDirection(DirectionLocal direction) {
    }
   
    public String getDescription() throws ClipsException {
        return getDetails().description;
    }

    public void setDescription(String desc) throws ClipsException {
        getDetails().description = desc;
        fireContentStateEvent();
    }
   
    public boolean isRendered() throws ClipsException {
        return getDetails().rendered;
    }

    public void setRendered(boolean b) throws ClipsException {
        getDetails().rendered = b;
        fireContentStateEvent();
    }
   
    public DirectoryCommitteeResolutionItem getType() throws ClipsException {
        DirectoryCommitteeResolution  dir= DirectoryLocator.getDirectory(DirectoryCommitteeResolution.class);
        return dir.getItemFromID(getDetails().typeID);
    }

    public void setType(DirectoryCommitteeResolutionItem item) throws ClipsException {
        getDetails().typeID = item.getID();
        fireContentStateEvent();
    }
   
    public DirectoryMKB10Item getMkb() throws ClipsException {
        DirectoryMKB10 dmkb = DirectoryLocator.getDirectory(DirectoryMKB10.class, false);
        if (getDetails().mkb10 == 0) {
            return null;
        }
        return dmkb.getItemFromID(getDetails().mkb10);
    }

    public void setMkb(DirectoryMKB10Item item) {
        getDetails().mkb10 = item != null ? item.getID() : 0;
        fireContentStateEvent();
    }

}
TOP

Related Classes of clips.delegate.kek.CommitteeResolutionData

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.