Package org.sonar.wsclient.services

Examples of org.sonar.wsclient.services.Rule


            int pageIndex=1;
            do{
                query.pageIndex(pageIndex);
                result = issueClient.find(query);
                for(Issue issue:result.list()) {
                    Rule rule = rulesCache.get(issue.ruleKey());
                    if(rule == null) {
                        rule=getRule(userCredentials, issue.ruleKey());
                        if(rule == null){
                            throw new IllegalStateException("No such rule in server: "+issue.ruleKey());
                        }
View Full Code Here


   
    private List<Rule> readRules(JsonReader reader) throws IOException, ParseException {
        List<Rule> ruleList = new LinkedList<>();
        reader.beginArray();
        while (reader.hasNext()) {
            Rule rule = readRule(reader);
            ruleList.add(rule);
        }
        reader.endArray();
        return ruleList;
    }
View Full Code Here

        return issue;
    }
   
    private Rule readRule(JsonReader reader) throws IOException, ParseException {
        reader.beginObject();
        Rule rule=new Rule();
        while (reader.hasNext()) {
           
            String name = reader.nextName();
            switch (name) {
                case "key":
                    rule.setKey(reader.nextString());
                    break;
                case "name":
                    rule.setTitle(reader.nextString());
                    break;
                default:
                    reader.skipValue();
                    break;
            }
View Full Code Here

        }
        String jsonRule = httpRequestFactory.get("/api/rules/show", params);
        try{
            JsonElement jsonElement = new JsonParser().parse(new StringReader(jsonRule));
            JsonObject rule = (JsonObject) ((JsonObject)jsonElement).get("rule");
            Rule rule1 = new Rule();
            rule1.setKey(rule.get("key").getAsString());
            rule1.setTitle(rule.get("name").getAsString());
            rule1.setDescription(rule.get("htmlDesc").getAsString());
            return rule1;
        }catch(JsonSyntaxException ex) {
            return null;
        }
    }
View Full Code Here

TOP

Related Classes of org.sonar.wsclient.services.Rule

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.