Example usage for com.fasterxml.jackson.databind.node TextNode TextNode

List of usage examples for com.fasterxml.jackson.databind.node TextNode TextNode

Introduction

In this page you can find the example usage for com.fasterxml.jackson.databind.node TextNode TextNode.

Prototype

public TextNode(String paramString) 

Source Link

Usage

From source file:de.fhg.fokus.odp.registry.ckan.ODRClientImpl.java

@Override
public User renameUser(User user, String newName) {
    ObjectNode updateParam = OM.createObjectNode();
    updateParam.set("id", new TextNode(user.getId()));
    updateParam.set("name", new TextNode(newName));

    String email = user.getEmail(); // replace email with placeholder, if the existing email is empty.
    updateParam.set("email", new TextNode(StringUtils.isEmpty(email) ? "email@example.com" : email));

    Response response = null;// w w w .  j  av a  2s . c om
    try {
        response = action.updateUser(authorizationKey, updateParam);
        if (response.getStatus() == Response.Status.OK.getStatusCode()) {
            JsonNode result = response.readEntity(JsonNode.class);
            JsonNode userNode = result.get("result");
            return new UserImpl(convert(userNode, UserBean.class));
        } else {
            log.error("could not rename user " + user.getName() + ": " + response.getStatus());
            return null;
        }
    } finally {
        if (response != null) {
            response.close();
        }
    }
}

From source file:com.unboundid.scim2.common.GenericScimResource.java

/**
 * Gets a JsonNode that represents the supplied date.
 *
 * @param date the date to represent as a JsonNode.
 * @return the JsonNode representing the date.
 * @throws ScimException thrown if an error occurs.
 *//*from  w ww .  j  a v  a 2  s  .  c om*/
public static TextNode getDateJsonNode(final Date date) throws ScimException {
    return new TextNode(getStringForDate(date));
}