Package com.skymobi.monitor.model

Examples of com.skymobi.monitor.model.WebResult


    @RequestMapping(value = "/admin/views/destroy" )
    public @ResponseBody  WebResult deleteView(String name,  ModelMap map) {

        viewService.delete(name);

        return new WebResult();
    }
View Full Code Here



    @RequestMapping(value = "/admin/views/save")
    public @ResponseBody
    WebResult createView(HttpEntity<View> entity,  ModelMap map) {
        WebResult result=new WebResult();
        try{
            View view=entity.getBody();
            Assert.isTrue(view.getName().length() > 0,"name should not be null");
            logger.debug("save view ={}",view);
            viewService.saveView(view);
        } catch (Exception e){
            result.setSuccess(false);
            result.setMessage(e.getMessage());
        }



        return result;
View Full Code Here

    WebResult updateTask(ModelMap map, @PathVariable String projectName, HttpEntity<Task> entity) {
        Task task=entity.getBody();
        logger.debug("update task {}", new Gson().toJson(task));
        projectService.saveTask(projectName, task);

        return new WebResult();
    }
View Full Code Here

    }
    @RequestMapping(value = "/projects/{projectName}/tasks/{taskName}/destroy")
    public @ResponseBody WebResult deleteTask(ModelMap map, @PathVariable String projectName, @PathVariable String taskName) throws IOException {
        projectService.removeTask(projectName, taskName);

        return new WebResult();

    }
View Full Code Here

    @RequestMapping(value = "/projects/add", method = RequestMethod.POST)
    public @ResponseBody WebResult add( HttpEntity<Project> entity) throws IOException {
        Project project =entity.getBody();
        String userName = simpleAuthz.getPrincipal();
        project.setAdmins(Lists.newArrayList(userName));
        WebResult result=new WebResult();
        project.setMetricCollection(project.getMetricCollection());
        try {
            projectService.create(project);

        } catch (IllegalArgumentException e) {
            result.setSuccess(false);
            result.setMessage(e.getMessage());

        }
        return result;
    }
View Full Code Here

        dbProject.setAlias(project.getAlias());
        dbProject.setMetricCollection(project.getMetricCollection());
        dbProject.setAdmins(project.getAdmins());
        projectService.saveProject(dbProject);

        return new WebResult();
    }
View Full Code Here

        dbProject.getProperties().putAll(map);
        logger.debug("update project ext properties {}", map);

        projectService.saveProject(dbProject);

        return new WebResult();
    }
View Full Code Here

    }
    @RequestMapping(value = "/projects/{projectName}/destroy")
    public @ResponseBody WebResult  delete(@PathVariable String projectName) throws IOException {
        projectService.remove(projectName);

        return new WebResult();

    }
View Full Code Here

    }
    @RequestMapping(value = "/user/list", method = RequestMethod.GET)
    public @ResponseBody
    WebResult listAll(ModelMap map) {
        List<User> users = userManager.listUsers();
        WebResult result=new WebResult(users);

        return result;
    }
View Full Code Here

    }
    @RequestMapping(value = "/user/update", method = RequestMethod.POST)
    public @ResponseBody WebResult   update(HttpEntity<User> entity, HttpServletRequest request,ModelMap mm) throws UnsupportedEncodingException {
       User user=entity.getBody();
        WebResult result=new WebResult();

        try {
            if(userManager.loadUserByUsername(user.getUsername())==null){
                userManager.registerUser(user);
            }else{
                userManager.monitorUser(user);
            }


        } catch (IllegalArgumentException e) {
            result.setSuccess(false);

            result.setMessage(e.getMessage());
        }
       return result;
    }
View Full Code Here

TOP

Related Classes of com.skymobi.monitor.model.WebResult

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.