Package beans.user.collaborator.entities

Examples of beans.user.collaborator.entities.Collaborator


        }
        return new ModificationInfo(pacientsMap.size(), auditDetailsList);
    }

    private AuditDetails unionCollab(Client dst, Client src) throws ClipsServerException {
        Collaborator coll1 = null;
        Collaborator coll2 = null;
        List<Collaborator> collL = findEntityList(Collaborator.class, "client.id", dst.getId());
        if (!collL.isEmpty()) {
            coll1 = collL.get(0);
        }
        collL = findEntityList(Collaborator.class, "client.id", src.getId());
        if (!collL.isEmpty()) {
            coll2 = collL.get(0);
        }
        if (coll1 != null && coll2 != null) {
            throw new ClipsServerException("На каждого из объединяемых пациентов ссылаются \"Сотрудники\"");
        } else if (coll2 != null) {
            AuditDoc<Collaborator> auditColl = new AuditDoc<Collaborator>(coll2, getCollaborator());
            coll2.setClient(dst);
            saveEntity(coll2);
            auditColl.check(coll2);
            System.out.println("    КОЛЛАБ " + coll2.getId());
            return persistAudit(auditColl);
        } else if (coll1 != null) {
            System.out.println("    КОЛЛАБ " + coll1.getId());
        }
        return null;
View Full Code Here


        //entity.setLoginGroup(findEntity(LoginGroup.class, d.loginGroup));
        if (d.code == null || d.code.isEmpty()) {
            throw new ClipsServerException("Не указан табельный номер сотрудника");
        }
        //Проверка Существует ли другой сотрудник с таким табельным номером
        Collaborator coll = findEntity(Collaborator.class, getCollaboratorId());
        Lpu lpu = coll.getLpu();

        Field[] f = {new Field("code", d.code), new Field("lpu", lpu)};
        List<Collaborator> collabList = findEntityList(Collaborator.class, f);
        boolean founded = false;
        for (Collaborator collaborator : collabList) {
View Full Code Here

        return list;
    }

    @Override
    public ModificationInfo addFunctions(CollaboratorFunctionsDetails cfd) throws ClipsServerException {
        Collaborator collaborator = getExistentEntity();
        if (collaborator.getId() != cfd.collaboratorID){
            throw new EDataIntegrity("Попытка добавить исполняемые обязанности другому сотруднику");
        }
        int count = getEntityCount(CollaboratorFunctions.class,
                            new Field[]{new Field("collaborator", collaborator),
                                        new Field("dvr.id", cfd.dvrID),
                                        new Field("firstMedicalAid.id", cfd.firstMedicalAidID),
                                        new Field("receptionType.id", cfd.receptionTypeID),
                                        new Field("speciality.id", cfd.specialityID),
                                        new Field("trash", false)});
        if (count > 0){
            throw new EDataIntegrity("У данного сотрудника уже есть исполняемые обязанности с указанными параметрами");
        }
        CollaboratorFunctions functions;
        if (cfd.id == 0){
             functions = new CollaboratorFunctions(collaborator,
                                    cfd.dvrID != 0 ? findEntity(Dvr.class, cfd.dvrID) : null,
                                    cfd.firstMedicalAidID != 0 ? findEntity(MedicalAidType.class, cfd.firstMedicalAidID) : null,
                                    findEntity(ReceptionType.class, cfd.receptionTypeID),
                                    findEntity(Speciality.class, cfd.specialityID),
                                    cfd.external_key);

             collaborator.addFunction(functions);
        }else{
            throw new EDataIntegrity("Данные не могут быть изменены");
        }
       
        manager.flush();
View Full Code Here

     * @throws generic.EDataIntegrity
     */
    @Override
    public ModificationInfo setRights(Set<Integer> rights) throws ClipsServerException {
        checkCommandAccessibility(COMMAND_WRITE_COLLABORATOR_RIGHTS);
        Collaborator entity = getExistentEntity();

        checkDischarge();
        Set<Integer> backup = new HashSet<Integer>(rights);
        Set<Integer> oldRights = getRights();
        //make rights to add
        rights.removeAll(oldRights);
        //make rights to delete
        oldRights.removeAll(backup);

        ArrayList<AuditDoc> auditDocList = new ArrayList<AuditDoc>();
        int eid = entity.getId();
        for (Integer id : rights) {
            /*Проверка дополнительного ограничения:
             * дать право можно только в том случае если у раздающего права есть такое право */
            UserRight right = UserRightsSet.getRightFromID(id);
            if (!isSuperUser() && !hasRight(right)) {
View Full Code Here

        if (renderedDate == null)  {
            //не оказана
            return right.id;
        } else {
            //оказана
            Collaborator collRender = functions.getCollaborator();
            if (collab.getId() == collRender.getId()) {
                //сотрудник тот же
                return right.id;
            } else {
                //сотрудник другой
                if (collab.getLpu().getId() == collRender.getLpu().getId()) {
                    //из той же клиники
                    return right.id;
                } else {
                    //из другой клиники
                    return -right.id;
View Full Code Here

                throw new EDataIntegrity("Попытка записать услугу пациента в прием другого");
            }
            ls.add(ser);
        }

        Collaborator collab = findEntity(Collaborator.class, details.collaboratorID);
        if(collab.isTrash()) {
            throw new ClipsServerException("Нельзя записать на прием к уволенному сотруднику");
        }
       
        SheduleReception sr = null;
        if(details.id != 0) {
View Full Code Here

        //ОДЗ
        if(count <0 || count>=4) {
            throw new EJBException("Неверное значение периода недели: " + count);
        }
        //сделаем ченить полезное
        Collaborator coll = findEntity(Collaborator.class, collaborator);
        coll.setWeekPeriod(count);
        manager.merge(coll);
       
        //очистим все работы до конца 2007 года
        Calendar cal = GregorianCalendar.getInstance();
        cal.set(2007,0, 1, 0, 0, 0);
View Full Code Here

   * @throws ClipsServerException
   * @security без ограничений
     */
    @Override
    public List<DayShift> getDetails() throws ClipsServerException {
        Collaborator collab = findEntity(Collaborator.class, getCollaboratorId());
        Iterator<SheduleWeek> list = findEntityList(SheduleWeek.class, "lpu", collab.getLpu()).iterator();
        ArrayList<DayShift> result = new ArrayList<DayShift>();
        for(int i=0; i<7; i++) {
            result.add(null);
        }
        while(list.hasNext()) {
           SheduleWeek swp = list.next();
           Integer dayIndex = swp.getDayIndex();
           if(dayIndex<0 || dayIndex>6) {
               throw new ClipsServerException("Некорректные данные о недельном расписании в БД");
           }
           if(result.get(dayIndex) != null) {
               manager.remove(swp);
           } else {
               TimeOffset shiftBegin = new TimeOffset(swp.getBegin());
               TimeOffset shiftEnd = new TimeOffset(swp.getEnd());
               DayShift dayShift = new DayShift(shiftBegin, shiftEnd);
               result.set(dayIndex, dayShift);
           }
        }

        //add missing days
        for(int i=0; i<7; i++) {
            DayShift dayShift = result.get(i);
            if(dayShift == null) {
                dayShift = new DayShift();
                result.set(i, dayShift);

                SheduleWeek swp = new SheduleWeek();
                swp.setDayIndex(i);
                swp.setBegin(0);
                swp.setEnd(0);
                swp.setLpu(collab.getLpu());
                manager.persist(swp);
            }
        }
        return result;
    }
View Full Code Here

                    + timeEnd + " < " + timeBegin + ")");
        }
       
        checkCommandAccessibility(COMMAND_MODIFY);
       
        Collaborator collab = findEntity(Collaborator.class, getCollaboratorId());
        SheduleWeek swp = null;
        Field f[] = {
            new Field("dayIndex", dayOfWeek),
            new Field("lpu", collab.getLpu()),
        };
        Iterator<SheduleWeek>  list = findEntityList(SheduleWeek.class, f).iterator();
        //delete dublicates
        if(list.hasNext()) {
            swp = list.next();
            while(list.hasNext()) {
                SheduleWeek week = list.next();
                manager.remove(week);
            }
        }

        if(swp == null) {
            swp = new SheduleWeek();
            swp.setDayIndex(dayOfWeek);
            swp.setBegin(timeBegin.getRaw());
            swp.setEnd(timeEnd.getRaw());
            swp.setLpu(collab.getLpu());
            manager.persist(swp);
        } else {
            swp.setBegin(timeBegin.getRaw());
            swp.setEnd(timeEnd.getRaw());
            swp.setLpu(collab.getLpu());
            manager.merge(swp);
        }
    }
View Full Code Here

    @Override
    public ModificationInfo setCommitteeMember(CommitteeMemberDetails details) throws ClipsServerException {
        checkCommandAccessibility(COMMAND_MODIFY);
        Committee entity = getExistentEntity();
       
        Collaborator coll = findEntity(Collaborator.class, details.collaboratorID);
    coll.checkNotFired();
       
        CommitteeMember member = null;
        AuditDoc<CommitteeMember> auditDoc;
        if(details.id != 0) {
            member = findEntity(CommitteeMember.class, details.id);
View Full Code Here

TOP

Related Classes of beans.user.collaborator.entities.Collaborator

Copyright © 2018 www.massapicom. 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.