All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hp.autonomy.hod.client.api.analysis.viewdocument.ViewDocumentResponse Maven / Gradle / Ivy

There is a newer version: 0.25.3
Show newest version
/*
 * Copyright 2015-2016 Hewlett-Packard Development Company, L.P.
 * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
 */

package com.hp.autonomy.hod.client.api.analysis.viewdocument;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.binary.StringUtils;


/**
 * Holds the response from the ViewDocument API when not using raw HTML
 */
@Data
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@JsonDeserialize(builder = ViewDocumentResponse.Builder.class)
class ViewDocumentResponse {

    /**
     * @return A String containing an HTML representation of the document
     */
    private final String document;

    @JsonPOJOBuilder(withPrefix = "set")
    public static class Builder {

        private String document;

        public Builder setDocument(final String document) {
            this.document = StringUtils.newStringUtf8(Base64.decodeBase64(document));

            return this;
        }

        public ViewDocumentResponse build() {
            return new ViewDocumentResponse(document);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy