Package org.encuestame.utils.web

Examples of org.encuestame.utils.web.UnitProjectBean


            @RequestParam(value = "notify", required = false) Boolean notify,
            @RequestParam(value = "published", required = false) Boolean published,
            HttpServletRequest request,
            HttpServletResponse response) throws JsonGenerationException, JsonMappingException, IOException {
        try {
            final UnitProjectBean projectBean = new UnitProjectBean();
            projectBean.setDateFinish(getFormatDate(dateFinish));
            projectBean.setDateInit(getFormatDate(dateInit));
            projectBean.setDescription(description);
            projectBean.setHide(hide);
            projectBean.setLeader(leader);
            projectBean.setName(filterValue(name));
            projectBean.setNotify(notify);
            projectBean.setPriority(priority);
            projectBean.setProjectInfo(projectInfo);
            projectBean.setPublished(published);
            projectBean.setState(state);
            projectBean.setStatus(1L);
            getProjectService().createProject(projectBean, getUserPrincipalUsername());
            setSuccesResponse();
            log.debug("Project Created");
        } catch (Exception e) {
             setError(e.getMessage(), response);
View Full Code Here


     */
    public UnitProjectBean loadProjectInfo(final UnitProjectBean projectBean) throws EnMeExpcetion {
        if (projectBean.getId()!= null) {
            final Project projectDomain = getProjectDaoImp().getProjectbyId(projectBean.getId());
            if (projectDomain != null) {
                final UnitProjectBean projectBeanRetrieved = ConvertDomainBean.convertProjectDomainToBean(projectDomain);
                //projectBeanRetrieved.setGroupList(ConvertListDomainSelectBean.convertListGroupDomainToSelect(projectDomain.getGroups()));
                return projectBeanRetrieved;
            } else {
                log.info("id project is not found");
                throw new EnMeExpcetion("id project is not found");
View Full Code Here

    /**
     * Test {@link UnitProjectBean}.
     */
    @Test
    public void testUnitProjectBean(){
        final UnitProjectBean projectBean = new UnitProjectBean();
        projectBean.setId(1L);
        projectBean.setDateFinish(new Date());
        projectBean.setDateInit(new Date());
        projectBean.setHide(true);
        projectBean.setLeader(1L);
        projectBean.setName("name");
        projectBean.setNotify(true);
        projectBean.setPriority("HIGH");
        projectBean.setState("Good");
        projectBean.setStatus(1L);
        projectBean.setUserId(1L);
        projectBean.setDescription("description");
        assertNotNull(projectBean.getDateFinish());
        assertNotNull(projectBean.getDateInit());
        assertNotNull(projectBean.getHide());
        assertNotNull(projectBean.getLeader());
        assertNotNull(projectBean.getName());
        assertNotNull(projectBean.getNotify());
        assertNotNull(projectBean.getPriority());
        assertNotNull(projectBean.getState());
        assertNotNull(projectBean.getStatus());
        assertNotNull(projectBean.getUserId());
        assertNotNull(projectBean.toString());
    }
View Full Code Here

     * Test {@link UnitAttachment}
     */
    @Test
    public void testUnitAttachment(){
        final UnitAttachment attachmentBean = new UnitAttachment();
        final UnitProjectBean projectBean = createProjectBean("", 2L, 1L);
        final File myFile =  new File("/uri/");
        attachmentBean.setAttachmentId(1L);
        attachmentBean.setFile(myFile);
        attachmentBean.setFilename("attachFile");
        attachmentBean.setProjectBean(projectBean);
View Full Code Here

    * @param leadId user leader id
    * @param userId user owner id
    * @return {@link UnitProjectBean}
    */
    public UnitProjectBean createProjectBean(final String projectName, final Long leadId, final Long userId){
        final UnitProjectBean projectBean = new UnitProjectBean();
        projectBean.setDateFinish(new Date());
        projectBean.setDateInit(new Date());
        projectBean.setLeader(leadId);
        projectBean.setUserId(userId);
        projectBean.setDescription("description");
        projectBean.setState("good");
        projectBean.setName(projectName);
        return projectBean;
    }
View Full Code Here

     */
    public UnitProjectBean loadProjectInfo(final UnitProjectBean projectBean) throws EnMeExpcetion {
        if (projectBean.getId()!= null) {
            final Project projectDomain = getProjectDaoImp().getProjectbyId(projectBean.getId());
            if (projectDomain != null) {
                final UnitProjectBean projectBeanRetrieved = ConvertDomainBean.convertProjectDomainToBean(projectDomain);
                //projectBeanRetrieved.setGroupList(ConvertListDomainSelectBean.convertListGroupDomainToSelect(projectDomain.getGroups()));
                final List<GeoPoint> list = new ArrayList<GeoPoint>(projectDomain.getLocations());
                log.debug("Locations on Project "+list.size());
                //projectBeanRetrieved.setUnitLocationBeans(ConvertDomainBean.convertListToUnitLocationBean(list));
                return projectBeanRetrieved;
View Full Code Here

        * Test loadProjectInfo.
        * @throws EnMeExpcetion exception
        */
       @Test
       public void testloadProjectInfo() throws EnMeExpcetion{
             final UnitProjectBean projectBean = new UnitProjectBean();
             projectBean.setId(project.getProyectId());
             final UnitProjectBean projectRetrieve = projectService.loadProjectInfo(projectBean);
             assertNotNull(projectRetrieve);
             assertEquals("Should be",project.getProyectId(),projectRetrieve.getId());
       }
View Full Code Here

       * Test loadProjectInfo id null.
       * @throws EnMeExpcetion exception
       */
      @Test(expected = EnMeExpcetion.class)
      public void testloadProjectInfoIdNull() throws EnMeExpcetion{
            final UnitProjectBean projectBean = new UnitProjectBean();
            projectService.loadProjectInfo(projectBean);
      }
View Full Code Here

       * Test loadProjectInfo project null.
       * @throws EnMeExpcetion exception
       */
      @Test(expected = EnMeExpcetion.class)
      public void testloadProjectInfoProjectNull() throws EnMeExpcetion {
            final UnitProjectBean projectBean = new UnitProjectBean();
            projectBean.setId(444L);
            projectService.loadProjectInfo(projectBean);
      }
View Full Code Here

     */
    public static final UnitProjectBean convertProjectDomainToBean(
            final Project project) {
        final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(
                DateUtil.DEFAULT_FORMAT_DATE);
        final UnitProjectBean projectBean = new UnitProjectBean();
        projectBean.setName(project.getProjectDescription());
        projectBean.setDateFinish(project.getProjectDateFinish());
        projectBean.setDateInit(project.getProjectDateStart());
        projectBean.setId(project.getProyectId());
        projectBean.setDescription(project.getProjectDescription());
        projectBean.setName(project.getProjectName());
        projectBean.setProjectInfo(project.getProjectInfo());
        if (project.getLead() != null) {
            projectBean.setLeader(project.getLead().getUid());
        }
        projectBean.setPriority(project.getPriority().name());
        projectBean.setPublished(project.getPublished());
        projectBean.setState(project.getProjectStatus().name());
        if (project.getProjectDateStart() != null) {
            projectBean.setFormatedDateInit(simpleDateFormat.format(project
                    .getProjectDateStart()));
        }
        if (project.getProjectDateFinish() != null) {
            projectBean.setFormatedDateFinish(simpleDateFormat.format(project
                    .getProjectDateFinish()));
        }
        projectBean.setHide(project.getHideProject());
        projectBean.setNotify(project.getNotifyMembers());
        // TODO: add other properties.
        log.debug("project bean converted " + projectBean.toString());
        return projectBean;
    }
View Full Code Here

TOP

Related Classes of org.encuestame.utils.web.UnitProjectBean

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.