// Path: aemsolrsearch-geometrixx-media-sample/src/main/java/com/headwire/aemsolrsearch/geometrixxmedia/model/exceptions/SlingModelsException.java
// public class SlingModelsException extends Exception {
// 
// 	public SlingModelsException(String message) {
// 		super(message);
// 	}
// 
// }
// 
// Path: aemsolrsearch-geometrixx-media-sample/src/main/java/com/headwire/aemsolrsearch/geometrixxmedia/util/HtmlUtils.java
// public class HtmlUtils {
// 
//     /**
//      * Converts HTML to plain text.
//      *
//      * @param html
//      * @return Plain text on success and an empty string otherwise.
//      */
//     public static String htmlToText(String html) {
// 
//         if (StringUtils.isBlank(html)) {
//             return "";
//         }
// 
//         return Jsoup.parse(html).text();
//     }
// }
// 
// Path: aemsolrsearch-geometrixx-media-sample/src/main/java/com/headwire/aemsolrsearch/geometrixxmedia/util/MarkdownUtils.java
// public class MarkdownUtils {
// 
//     /**
//      * Converts Markdown to HTML.
//      *
//      * @param markdown
//      * @return Markdown on success and an empty string otherwise.
//      */
//     public static String markdownToHtml(String markdown) {
// 
//         if (StringUtils.isBlank(markdown)) {
//             return "";
//         }
// 
//         MarkdownProcessor proc = new MarkdownProcessor();
//         return proc.markdown(markdown);
//     }
// }


import com.day.cq.dam.api.Asset;
import com.day.cq.dam.api.Rendition;
import com.headwire.aemsolrsearch.geometrixxmedia.model.exceptions.SlingModelsException;
import com.headwire.aemsolrsearch.geometrixxmedia.util.HtmlUtils;
import com.headwire.aemsolrsearch.geometrixxmedia.util.MarkdownUtils;
import org.apache.commons.io.IOUtils;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceUtil;
import org.apache.sling.models.annotations.Default;
import org.apache.sling.models.annotations.Model;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.PostConstruct;
import java.io.IOException;
import java.io.StringWriter;
        }

    }

    public GeometrixxMediaArticleBody(Resource resource) throws SlingModelsException {

        if (null == resource) {
            LOG.info("Resource is null");
            throw new SlingModelsException("Resource is null");
        }

        if (ResourceUtil.isNonExistingResource(resource)) {
            LOG.warn("Can't adapt non existent resource: '{}'", resource.getPath());
            throw new SlingModelsException(
                "Can't adapt non existent resource." + resource.getPath());
        }

        this.resource = resource;

    }

    public GeometrixxMediaArticleBody(String body){
        this.body = body;
    }

    public String getBody() {
        return body;
    }

    public String getBodyAsHtml() {
// Path: aemsolrsearch-geometrixx-media-sample/src/main/java/com/headwire/aemsolrsearch/geometrixxmedia/model/exceptions/SlingModelsException.java
// public class SlingModelsException extends Exception {
// 
// 	public SlingModelsException(String message) {
// 		super(message);
// 	}
// 
// }
// 
// Path: aemsolrsearch-geometrixx-media-sample/src/main/java/com/headwire/aemsolrsearch/geometrixxmedia/util/HtmlUtils.java
// public class HtmlUtils {
// 
//     /**
//      * Converts HTML to plain text.
//      *
//      * @param html
//      * @return Plain text on success and an empty string otherwise.
//      */
//     public static String htmlToText(String html) {
// 
//         if (StringUtils.isBlank(html)) {
//             return "";
//         }
// 
//         return Jsoup.parse(html).text();
//     }
// }
// 
// Path: aemsolrsearch-geometrixx-media-sample/src/main/java/com/headwire/aemsolrsearch/geometrixxmedia/util/MarkdownUtils.java
// public class MarkdownUtils {
// 
//     /**
//      * Converts Markdown to HTML.
//      *
//      * @param markdown
//      * @return Markdown on success and an empty string otherwise.
//      */
//     public static String markdownToHtml(String markdown) {
// 
//         if (StringUtils.isBlank(markdown)) {
//             return "";
//         }
// 
//         MarkdownProcessor proc = new MarkdownProcessor();
//         return proc.markdown(markdown);
//     }
// }


// Path: aemsolrsearch-geometrixx-media-sample/src/main/java/com/headwire/aemsolrsearch/geometrixxmedia/model/GeometrixxMediaArticleBody.java
import com.day.cq.dam.api.Asset;
import com.day.cq.dam.api.Rendition;
import com.headwire.aemsolrsearch.geometrixxmedia.model.exceptions.SlingModelsException;
import com.headwire.aemsolrsearch.geometrixxmedia.util.HtmlUtils;
import com.headwire.aemsolrsearch.geometrixxmedia.util.MarkdownUtils;
import org.apache.commons.io.IOUtils;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceUtil;
import org.apache.sling.models.annotations.Default;
import org.apache.sling.models.annotations.Model;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.PostConstruct;
import java.io.IOException;
import java.io.StringWriter;

        }

    }

    public GeometrixxMediaArticleBody(Resource resource) throws SlingModelsException {

        if (null == resource) {
            LOG.info("Resource is null");
            throw new SlingModelsException("Resource is null");
        }

        if (ResourceUtil.isNonExistingResource(resource)) {
            LOG.warn("Can't adapt non existent resource: '{}'", resource.getPath());
            throw new SlingModelsException(
                "Can't adapt non existent resource." + resource.getPath());
        }

        this.resource = resource;

    }

    public GeometrixxMediaArticleBody(String body){
        this.body = body;
    }

    public String getBody() {
        return body;
    }

    public String getBodyAsHtml() {
        return MarkdownUtils.markdownToHtml(body);