Examples of ParentsForClassCopy


Examples of com.vst.webapp.util.ParentsForClassCopy

            List parentsList = new ArrayList();

            if (classname.equals("objectConstruction")) {
                List buildingObjectList = buildingObjectManager.getBuildingObjects(null);
                for (int i = 0; i < buildingObjectList.size(); i++) {
                    ParentsForClassCopy parentsForClassCopy = new ParentsForClassCopy();
                    BuildingObject buildingObject = (BuildingObject) buildingObjectList.get(i);
                    parentsForClassCopy.setId((long)buildingObject.getObjectId());
                    parentsForClassCopy.setName(buildingObject.toString());
                    parentsList.add(parentsForClassCopy);
                }

                    if (httpServletRequest.getParameter("copy") != null && httpServletRequest.getParameter("parentId") != null && httpServletRequest.getParameter("count") != null) {
                        Integer count = new Integer(httpServletRequest.getParameter("count"));
                        BuildingObject buildingObject = buildingObjectManager.getBuildingObject(httpServletRequest.getParameter("parentId"));
                        ObjectConstruction oldObjectConstruction = objectConstructionManager.getObjectConstruction(objectId);
                        for (int j = 0; j < count.intValue(); j++) {
                            ObjectConstruction newObjectConstruction = (ObjectConstruction) elementCopyManager.getNewObject(oldObjectConstruction);
                            List elementList = newObjectConstruction.getConstructionExamples();
                            for (int f = 0; f < elementList.size(); f++) {
                                ConstructionExample constructionExample = (ConstructionExample) elementList.get(f);
                                constructionExample.setBuildObjectId(new Integer(httpServletRequest.getParameter("parentId")));
                            }
                            newObjectConstruction.setConstructionExamples(elementList);
                            buildingObject.getConstructionTypes().add(newObjectConstruction);
                            objectConstructionManager.saveObjectConstruction(newObjectConstruction);
                            elementCopyManager.setNumZerro();
                        }
                        buildingObjectManager.saveBuildingObject(buildingObject);
                        modelAndView.addObject("sucessfull", "ok");
                    }
            }



            if (classname.equals("constructionExample")) {

                        System.out.println("constructionExample");

                ConstructionExample oldConstructionExample = constructionExampleManager.getConstructionExample(objectId);
                List objectConstructionsList = objectConstructionManager.getObjectConstructionByObjectIdAndConstructionType(oldConstructionExample.getBuildObjectId(),oldConstructionExample.getConstructionType().getConstructionTypeId());

                for (int i = 0; i < objectConstructionsList.size(); i++) {
                    ParentsForClassCopy parentsForClassCopy = new ParentsForClassCopy();
                    ObjectConstruction objectConstruction = (ObjectConstruction) objectConstructionsList.get(i);
                    parentsForClassCopy.setId((long)objectConstruction.getTypeId());
                    parentsForClassCopy.setName(objectConstruction.toString()+"  "+objectConstruction.getDescription());
                    parentsList.add(parentsForClassCopy);
                }
                    if (httpServletRequest.getParameter("copy") != null && httpServletRequest.getParameter("parentId") != null && httpServletRequest.getParameter("count") != null) {
                        Integer count = new Integer(httpServletRequest.getParameter("count"));
                        ObjectConstruction objectConstruction = objectConstructionManager.getObjectConstruction(httpServletRequest.getParameter("parentId"));
                        for (int j = 0; j < count.intValue(); j++) {

                             System.out.println(objectId);
                             System.out.println(oldConstructionExample);
                             System.out.println(oldConstructionExample.getExampleId());

                            ConstructionExample newConstructionExample = (ConstructionExample) elementCopyManager.getNewObject(oldConstructionExample);
                            newConstructionExample.setObjectConstructionId(new Integer(httpServletRequest.getParameter("parentId")));
                            objectConstruction.getConstructionExamples().add(newConstructionExample);
                            constructionExampleManager.saveConstructionExample(newConstructionExample);
                            elementCopyManager.setNumZerro();
                        }
                        objectConstructionManager.saveObjectConstruction(objectConstruction);
                        modelAndView.addObject("sucessfull", "ok");
                    }
            }



            if (classname.equals("constructionDefectZone") || classname.equals("constructionDefect")) {
                Integer exampleId=new Integer(0);
                if (classname.equals("constructionDefectZone")){
                    ConstructionDefectZone constructionDefectZone=constructionDefectManager.getConstructionDefectZone(objectId);
                    exampleId=constructionDefectZone.getExampleId();
                }else if (classname.equals("constructionDefect")){
                     ConstructionDefect constructionDefect=constructionDefectManager.getConstructionDefect(objectId);
                    exampleId=constructionDefect.getExampleId();
                }
                ConstructionExample constEx=constructionExampleManager.getConstructionExample(exampleId.toString());
                List constructionExampleList=constructionExampleManager.getConstructionExamples(constEx.getObjectConstructionId().toString());
                for (int i = 0; i < constructionExampleList.size(); i++) {
                    ParentsForClassCopy parentsForClassCopy = new ParentsForClassCopy();
                    ConstructionExample constructionExample = (ConstructionExample) constructionExampleList.get(i);
                    parentsForClassCopy.setId((long)constructionExample.getExampleId());
                    parentsForClassCopy.setName(constructionExample.toString());
                    parentsList.add(parentsForClassCopy);
                }
                    if (classname.equals("constructionDefectZone") && httpServletRequest.getParameter("copy") != null && httpServletRequest.getParameter("parentId") != null && httpServletRequest.getParameter("count") != null) {
                        Integer count = new Integer(httpServletRequest.getParameter("count"));
                        ConstructionDefectZone oldConstructionDefectZone = constructionDefectManager.getConstructionDefectZone(objectId);
View Full Code Here
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.