Package com.fasterxml.jackson.databind

Examples of com.fasterxml.jackson.databind.JsonNode


        public NextOutcome next(){
            if ( ! jsonIter.hasNext()){
                return NextOutcome.NONE_LEFT;
            }
            JsonNode contentJSON = ConstantROP.this.config.getContent().getRoot();
            if (contentJSON.isArray())
            { // list of constant records was specified
                JsonNode node;
                node = jsonIter.next();
                convertJsonToRP(node, record);
                return NextOutcome.INCREMENTED_SCHEMA_UNCHANGED;
            }
            else{
View Full Code Here


      try {
        if (parser.nextToken() == null) {
//          logger.debug("No current token, returning.");
          return NextOutcome.NONE_LEFT;
        }
        JsonNode n = mapper.readTree(parser);
        if (n == null) {
//          logger.debug("Nothing was returned for read tree, returning.");
          return NextOutcome.NONE_LEFT;
        }
//        logger.debug("Record found, returning new json record.");
View Full Code Here

  /** Returns the generated plan. */
  public String getJsonString() {
    String s = rootNode.toString();
   
    if(logger.isDebugEnabled()){
      JsonNode node;
      try {
        ObjectMapper mapper = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT);
        node = mapper.readValue(s, JsonNode.class);
        logger.debug("Optiq Generated Logical Plan: {}", mapper.writeValueAsString(node));
      } catch (IOException e) {
View Full Code Here

            if ( searchResponse.getStatus() != Response.Status.OK.getStatusCode() )
            {
                reportErrors( searchResponse );
            }

            JsonNode issueTree = getResponseTree( searchResponse );
            assert issueTree.isObject();
            JsonNode issuesNode = issueTree.get( "issues" );
            assert issuesNode.isArray();
            buildIssues( issuesNode, jiraUrl, jiraProject );
        }
        finally
        {
            Thread.currentThread().setContextClassLoader( ccl );
View Full Code Here

    private void reportErrors( Response resp )
        throws IOException, MojoExecutionException
    {
        if ( MediaType.APPLICATION_JSON_TYPE.getType().equals( getResponseMediaType( resp ).getType() ) )
        {
            JsonNode errorTree = getResponseTree( resp );
            assert errorTree.isObject();
            JsonNode messages = errorTree.get( "errorMessages" );
            if ( messages != null )
            {
                for ( int mx = 0; mx < messages.size(); mx ++ )
                {
                    getLog().error( messages.get( mx ).asText() );
                }
            }
            else
            {
                JsonNode message = errorTree.get( "message" );
                if ( message != null )
                {
                    getLog().error( message.asText() );
                }
            }
        }
        throw new MojoExecutionException( String.format( "Failed to query issues; response %d", resp.getStatus() ) );
    }
View Full Code Here

        {
            getLog().error( String.format( "Could not get %s list from %s", what, listRestUrlPattern ) );
            reportErrors( resp );
        }

        JsonNode items = getResponseTree( resp );
        String[] pieces = input.split( "," );
        for (String item : pieces ) {
            targetList.add( resolveOneItem( items, what, item ) );
        }
    }
View Full Code Here

    private String resolveOneItem( JsonNode items, String what, String nameOrId )
        throws IOException, MojoExecutionException, MojoFailureException
    {
        for ( int cx = 0; cx < items.size(); cx ++ )
        {
            JsonNode item = items.get( cx );
            if ( nameOrId.equals( item.get( "id" ).asText() ) )
            {
                return nameOrId;
            }
            else if ( nameOrId.equals( item.get( "name" ).asText() ) )
            {
                return item.get( "id" ).asText();
            }
        }
        throw new MojoFailureException( String.format("Could not find %s %s.", what, nameOrId ) );
    }
View Full Code Here

    private void buildIssues( JsonNode issuesNode, String jiraUrl, String jiraProject )
    {
        issueList = new ArrayList<Issue>(  );
        for ( int ix = 0; ix < issuesNode.size(); ix++ )
        {
            JsonNode issueNode = issuesNode.get( ix );
            assert issueNode.isObject();
            Issue issue = new Issue();
            JsonNode val;

            val = issueNode.get( "id" );
            if ( val != null )
            {
                issue.setId( val.asText() );
            }

            val = issueNode.get( "key" );
            if ( val != null )
            {
                issue.setKey( val.asText() );
                issue.setLink( String.format( "%s/browse/%s", jiraUrl, val.asText()) );
            }

            // much of what we want is in here.
            JsonNode fieldsNode = issueNode.get( "fields" );

            val = fieldsNode.get( "assignee" );
            processAssignee( issue, val );

            val = fieldsNode.get( "created" );
            processCreated( issue, val );

            val = fieldsNode.get( "comment" );
            processComments( issue, val );

            val = fieldsNode.get( "fixVersions" );
            processFixVersions( issue, val );


            val = fieldsNode.get( "priority" );
            processPriority( issue, val );

            val = fieldsNode.get( "reporter" );
            processReporter( issue, val );

            val = fieldsNode.get( "resolution" );
            processResolution( issue, val );

            val = fieldsNode.get( "status" );
            processStatus( issue, val );

            val = fieldsNode.get( "summary" );
            if ( val != null )
            {
                issue.setSummary( val.asText() );
            }
View Full Code Here

        }
    }

    private String getPerson( JsonNode val )
    {
        JsonNode nameNode = val.get( "displayName" );
        if ( nameNode == null )
        {
            nameNode = val.get( "name" );
        }
        if ( nameNode != null )
        {
            return nameNode.asText();
        }
        else
        {
            return null;
        }
View Full Code Here

        if (val != null)
        {
            assert val.isArray();
            for ( int vx = 0; vx < val.size(); vx++ )
            {
                JsonNode fvNode = val.get( vx );
                issue.addFixVersion( fvNode.get( "name" ).asText() );
            }
        }
    }
View Full Code Here

TOP

Related Classes of com.fasterxml.jackson.databind.JsonNode

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.