Package beans.directory.danger.entity

Examples of beans.directory.danger.entity.DangerService


        if (set == null) {
            set = new HashSet<Integer>();
            uniqMap.put(serviceID, set);
        }
        for (int i = 0; i < list.size(); i++) {
            DangerService ds = list.get(i);
            int specID = ds.getSpeciality().getId();
            if (!set.contains(specID)) {
                set.add(specID);
                return specID;
            }
        }
View Full Code Here


        }
       
        Iterator list = findEntityList(DangerService.class, "danger.id", dangerId).iterator();
        ArrayList<DangerServiceDetails> res = new ArrayList<DangerServiceDetails>();
        while(list.hasNext()) {
            DangerService ds = (DangerService)list.next();
            res.add(ds.getDetails((RightChecker) this));
        }
       
        return res;
    }
View Full Code Here

        if (details.specialityID == 0) {
            list = findEntityList(DangerService.class, fNull);
        } else {
            list = findEntityList(DangerService.class, f);
        }
        DangerService dangerService = (DangerService) list.get(0);
        manager.remove(dangerService);
    }
View Full Code Here

       
        if(details.dangerId == 0) {
            throw new EDataIntegrity("Попытка назначить услуги опасному фактору с ID=0");
        }
       
        DangerService dangerService = null;
        Field f[] = {
            new Field("danger.id", details.dangerId),
            new Field("service.id", details.serviceId),
            new Field("speciality.id", details.specialityID)
        };
        Field fNull[] = {
            new Field("danger.id", details.dangerId),
            new Field("service.id", details.serviceId),
            new Field("speciality", null, Field.OPERATOR_IS_NULL)
        };
        List list;
        if (details.specialityID == 0) {
            list = findEntityList(DangerService.class, fNull);
        } else {
            list = findEntityList(DangerService.class, f);
        }
        if (!list.isEmpty()){
            dangerService = (DangerService) list.get(0);//Должна быть одна и ниибёт
            dangerService.setDescription(details.description);
            Speciality spec = null;
            if (details.specialityID != 0) {
                spec = findEntity(Speciality.class, details.specialityID);
            }
            dangerService.setSpeciality(spec);
        }
        else {
            dangerService = new DangerService();
            dangerService.setDescription(details.description);
            dangerService.setDanger(findEntity(Danger.class, details.dangerId));
            dangerService.setService(findEntity(Service.class, details.serviceId));
            Speciality spec = null;
            if (details.specialityID != 0) {
                spec = findEntity(Speciality.class, details.specialityID);
            }
            dangerService.setSpeciality(spec);
        }

        return saveEntity(dangerService);

    }
View Full Code Here

    public ArrayList<TempMapperChunk> getTempMapperList() throws ClipsServerException {
        //МАП ServiceID, TempMapperChunk
        HashMap<Integer,TempMapperChunk> map = new HashMap<Integer, TempMapperChunk>();
        List<DangerService> list = findEntityList(DangerService.class);
        for (int i = 0; i < list.size(); i++) {
            DangerService ds = list.get(i);
            TempMapperChunk chunk = new TempMapperChunk();
            chunk.service1ID = ds.getService().getId();
            chunk.service2ID = ds.getService().getId();
            chunk.specialityID = 0;
            map.put(ds.getService().getId(), chunk);
        }
        return new ArrayList<TempMapperChunk>(map.values());
    }
View Full Code Here

    public void update(ArrayList<TempMapperChunk> chunkList) throws ClipsServerException {
        for (int i = 0; i < chunkList.size(); i++) {
            TempMapperChunk c = chunkList.get(i);
            List<DangerService> list = findEntityList(DangerService.class, "service.id", c.service1ID);
            for (int j = 0; j < list.size(); j++) {
                DangerService dangerService = list.get(j);
                dangerService.setService(findEntity(Service.class, c.service2ID));
                if (c.specialityID == 0) {
                    dangerService.setSpeciality(null);
                } else {
                    dangerService.setSpeciality(findEntity(Speciality.class, c.specialityID));
                }
                manager.persist(dangerService);
            }
        }
    }
View Full Code Here

TOP

Related Classes of beans.directory.danger.entity.DangerService

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.