// 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/solr/SolrTimestamp.java
// public class SolrTimestamp {
// 
// 
//     private SolrTimestamp() {
//         // Prevent instantiation
//     }
// 
//     /**
//      * Converts a date to the UTC DateField format that Solr expects.
//      *
//      * @param date
//      * @return
//      */
//     public static String convertToUtc(Date date) {
// 
//         DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:00.00'Z'");
//         formatter.setTimeZone(TimeZone.getTimeZone("UTC"));
//         return formatter.format(date);
//     }
// 
//     public static String convertToUtcAndUseNowIfNull(Date date) {
// 
//         return date != null ? convertToUtc(date) : convertToUtc(new Date());
//     }
// }
// 
// Path: aemsolrsearch-geometrixx-media-sample/src/main/java/com/headwire/aemsolrsearch/geometrixxmedia/solr/GeometrixxMediaSchema.java
// public interface GeometrixxMediaSchema {
// 
//     public static final String AUTHOR = "author";
//     public static final String BODY = "body";
//     public static final String DESCRIPTION = "description";
//     public static final String ID = "id";
//     public static final String LAST_MODIFIED = "last_modified";
//     public static final String PUBLISH_DATE = "publishDate";
//     public static final String SLING_RESOUCE_TYPE = "sling_resource_type";
//     public static final String TAGS = "tags";
//     public static final String TITLE = "title";
//     public static final String URL = "url";
// 
// }


import com.day.cq.tagging.Tag;
import com.day.cq.tagging.TagManager;
import com.day.cq.wcm.api.NameConstants;
import com.headwire.aemsolrsearch.geometrixxmedia.model.exceptions.SlingModelsException;
import com.headwire.aemsolrsearch.geometrixxmedia.solr.SolrTimestamp;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.models.annotations.Default;
import org.apache.sling.models.annotations.Model;
import org.apache.sling.models.annotations.Optional;
import org.apache.solr.common.SolrInputDocument;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Named;
import java.util.Arrays;
import java.util.Date;
import static com.headwire.aemsolrsearch.geometrixxmedia.solr.GeometrixxMediaSchema.*;
        return publishDate;
    }

    public Tag[] getTags() {
        return tags;
    }

    public String toString() {

        final StringBuilder sb = new StringBuilder("");
        sb.append("author=").append(author);
        sb.append(", body=").append(body);
        sb.append(", description='").append(description).append('\'');
        sb.append(", id='").append(id).append('\'');
        sb.append(", title='").append(title).append('\'');
        sb.append(", url='").append(url).append('\'');
        sb.append(", slingResourceType='").append(slingResourceType).append('\'');
        sb.append(", lastUpdate=").append(lastUpdate);
        sb.append(", publishDate=").append(publishDate);
        sb.append(", tags=").append(Arrays.toString(tags));
        return sb.toString();
    }

    protected JSONObject getJson() {
        JSONObject json = new JSONObject();
        json.put(ID, getId());
        json.put(TITLE, getTitle());
        json.put(DESCRIPTION, getDescription());
        json.put(BODY, getBody().getBodyAsText());
        json.put(AUTHOR, getAuthor().displayName());
// 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/solr/SolrTimestamp.java
// public class SolrTimestamp {
// 
// 
//     private SolrTimestamp() {
//         // Prevent instantiation
//     }
// 
//     /**
//      * Converts a date to the UTC DateField format that Solr expects.
//      *
//      * @param date
//      * @return
//      */
//     public static String convertToUtc(Date date) {
// 
//         DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:00.00'Z'");
//         formatter.setTimeZone(TimeZone.getTimeZone("UTC"));
//         return formatter.format(date);
//     }
// 
//     public static String convertToUtcAndUseNowIfNull(Date date) {
// 
//         return date != null ? convertToUtc(date) : convertToUtc(new Date());
//     }
// }
// 
// Path: aemsolrsearch-geometrixx-media-sample/src/main/java/com/headwire/aemsolrsearch/geometrixxmedia/solr/GeometrixxMediaSchema.java
// public interface GeometrixxMediaSchema {
// 
//     public static final String AUTHOR = "author";
//     public static final String BODY = "body";
//     public static final String DESCRIPTION = "description";
//     public static final String ID = "id";
//     public static final String LAST_MODIFIED = "last_modified";
//     public static final String PUBLISH_DATE = "publishDate";
//     public static final String SLING_RESOUCE_TYPE = "sling_resource_type";
//     public static final String TAGS = "tags";
//     public static final String TITLE = "title";
//     public static final String URL = "url";
// 
// }


// Path: aemsolrsearch-geometrixx-media-sample/src/main/java/com/headwire/aemsolrsearch/geometrixxmedia/model/GeometrixxMediaPageContent.java
import com.day.cq.tagging.Tag;
import com.day.cq.tagging.TagManager;
import com.day.cq.wcm.api.NameConstants;
import com.headwire.aemsolrsearch.geometrixxmedia.model.exceptions.SlingModelsException;
import com.headwire.aemsolrsearch.geometrixxmedia.solr.SolrTimestamp;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.models.annotations.Default;
import org.apache.sling.models.annotations.Model;
import org.apache.sling.models.annotations.Optional;
import org.apache.solr.common.SolrInputDocument;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Named;
import java.util.Arrays;
import java.util.Date;
import static com.headwire.aemsolrsearch.geometrixxmedia.solr.GeometrixxMediaSchema.*;

        return publishDate;
    }

    public Tag[] getTags() {
        return tags;
    }

    public String toString() {

        final StringBuilder sb = new StringBuilder("");
        sb.append("author=").append(author);
        sb.append(", body=").append(body);
        sb.append(", description='").append(description).append('\'');
        sb.append(", id='").append(id).append('\'');
        sb.append(", title='").append(title).append('\'');
        sb.append(", url='").append(url).append('\'');
        sb.append(", slingResourceType='").append(slingResourceType).append('\'');
        sb.append(", lastUpdate=").append(lastUpdate);
        sb.append(", publishDate=").append(publishDate);
        sb.append(", tags=").append(Arrays.toString(tags));
        return sb.toString();
    }

    protected JSONObject getJson() {
        JSONObject json = new JSONObject();
        json.put(ID, getId());
        json.put(TITLE, getTitle());
        json.put(DESCRIPTION, getDescription());
        json.put(BODY, getBody().getBodyAsText());
        json.put(AUTHOR, getAuthor().displayName());
        json.put(LAST_MODIFIED, SolrTimestamp.convertToUtcAndUseNowIfNull(getLastUpdate()));