/** * This code was auto-generated by a Codezu. * * Changes to this file may cause incorrect behavior and will be lost if * the code is regenerated. */ package com.mozu.api.clients.content.documentlists; import java.util.List; import java.util.ArrayList; import com.mozu.api.MozuClient; import com.mozu.api.MozuClientFactory; import com.mozu.api.MozuUrl; import com.mozu.api.Headers; import org.joda.time.DateTime; import com.mozu.api.security.AuthTicket; import org.apache.commons.lang.StringUtils; import com.mozu.api.DataViewMode; /** <summary> * Use the document tree subresource to retrieve documents and manage content within the document hierarchy. * </summary> */ public class DocumentTreeClient { /** * Retrieve the content associated with the document, such as a product image or PDF specifications file. * <p><pre><code> * MozuClient<java.io.InputStream> mozuClient=GetTreeDocumentContentClient(dataViewMode, documentListName, documentName); * client.setBaseAddress(url); * client.executeRequest(); * Stream stream = client.Result(); * </code></pre></p> * @param documentListName Name of content documentListName to delete * @param documentName The name of the document in the site. * @return Mozu.Api.MozuClient <Stream> * @see Stream */ public static MozuClient<java.io.InputStream> getTreeDocumentContentClient(com.mozu.api.DataViewMode dataViewMode, String documentListName, String documentName) throws Exception { MozuUrl url = com.mozu.api.urls.content.documentlists.DocumentTreeUrl.getTreeDocumentContentUrl(documentListName, documentName); String verb = "GET"; Class<?> clz = java.io.InputStream.class; MozuClient<java.io.InputStream> mozuClient = (MozuClient<java.io.InputStream>) MozuClientFactory.getInstance(clz); mozuClient.setVerb(verb); mozuClient.setResourceUrl(url); mozuClient.addHeader(Headers.X_VOL_DATAVIEW_MODE ,dataViewMode.toString()); return mozuClient; } /** * Performs transformations on a document. For example, resizing an image. * <p><pre><code> * MozuClient<java.io.InputStream> mozuClient=TransformTreeDocumentContentClient( documentListName, documentName); * client.setBaseAddress(url); * client.executeRequest(); * Stream stream = client.Result(); * </code></pre></p> * @param documentListName Name of content documentListName to delete * @param documentName The name of the document in the site. * @return Mozu.Api.MozuClient <Stream> * @see Stream */ public static MozuClient<java.io.InputStream> transformTreeDocumentContentClient(String documentListName, String documentName) throws Exception { return transformTreeDocumentContentClient( documentListName, documentName, null, null, null, null, null, null, null); } /** * Performs transformations on a document. For example, resizing an image. * <p><pre><code> * MozuClient<java.io.InputStream> mozuClient=TransformTreeDocumentContentClient( documentListName, documentName, width, height, max, maxWidth, maxHeight, crop, quality); * client.setBaseAddress(url); * client.executeRequest(); * Stream stream = client.Result(); * </code></pre></p> * @param crop Crops the image based on the specified coordinates. The reference point for positive coordinates is the top-left corner of the image, and the reference point for negative coordinates is the bottom-right corner of the image.Usage: Example: removes 10 pixels from all edges of the image. leaves the image uncropped. * @param documentListName Name of content documentListName to delete * @param documentName The name of the document in the site. * @param height Specifies an exact height dimension for the image, in pixels. * @param max Specifies a pixel limitation for the largest side of an image. * @param maxHeight Specifies a pixel limitation for the height of the image, preserving the aspect ratio if the image needs resizing. * @param maxWidth Specifies a pixel limitation for the width of the image, preserving the aspect ratio if the image needs resizing. * @param quality Adjusts the image compression. Accepts values from 0-100, where 100 = highest quality, least compression. * @param width Specifies an exact width dimension for the image, in pixels. * @return Mozu.Api.MozuClient <Stream> * @see Stream */ public static MozuClient<java.io.InputStream> transformTreeDocumentContentClient(String documentListName, String documentName, Integer width, Integer height, Integer max, Integer maxWidth, Integer maxHeight, String crop, Integer quality) throws Exception { MozuUrl url = com.mozu.api.urls.content.documentlists.DocumentTreeUrl.transformTreeDocumentContentUrl(crop, documentListName, documentName, height, max, maxHeight, maxWidth, quality, width); String verb = "GET"; Class<?> clz = java.io.InputStream.class; MozuClient<java.io.InputStream> mozuClient = (MozuClient<java.io.InputStream>) MozuClientFactory.getInstance(clz); mozuClient.setVerb(verb); mozuClient.setResourceUrl(url); return mozuClient; } /** * Retrieves a document based on its document list and folder path in the document hierarchy. * <p><pre><code> * MozuClient<com.mozu.api.contracts.content.Document> mozuClient=GetTreeDocumentClient(dataViewMode, documentListName, documentName); * client.setBaseAddress(url); * client.executeRequest(); * Document document = client.Result(); * </code></pre></p> * @param documentListName Name of content documentListName to delete * @param documentName The name of the document in the site. * @return Mozu.Api.MozuClient <com.mozu.api.contracts.content.Document> * @see com.mozu.api.contracts.content.Document */ public static MozuClient<com.mozu.api.contracts.content.Document> getTreeDocumentClient(com.mozu.api.DataViewMode dataViewMode, String documentListName, String documentName) throws Exception { return getTreeDocumentClient(dataViewMode, documentListName, documentName, null, null); } /** * Retrieves a document based on its document list and folder path in the document hierarchy. * <p><pre><code> * MozuClient<com.mozu.api.contracts.content.Document> mozuClient=GetTreeDocumentClient(dataViewMode, documentListName, documentName, includeInactive, responseFields); * client.setBaseAddress(url); * client.executeRequest(); * Document document = client.Result(); * </code></pre></p> * @param documentListName Name of content documentListName to delete * @param documentName The name of the document in the site. * @param includeInactive Include inactive content. * @param responseFields Use this field to include those fields which are not included by default. * @return Mozu.Api.MozuClient <com.mozu.api.contracts.content.Document> * @see com.mozu.api.contracts.content.Document */ public static MozuClient<com.mozu.api.contracts.content.Document> getTreeDocumentClient(com.mozu.api.DataViewMode dataViewMode, String documentListName, String documentName, Boolean includeInactive, String responseFields) throws Exception { MozuUrl url = com.mozu.api.urls.content.documentlists.DocumentTreeUrl.getTreeDocumentUrl(documentListName, documentName, includeInactive, responseFields); String verb = "GET"; Class<?> clz = com.mozu.api.contracts.content.Document.class; MozuClient<com.mozu.api.contracts.content.Document> mozuClient = (MozuClient<com.mozu.api.contracts.content.Document>) MozuClientFactory.getInstance(clz); mozuClient.setVerb(verb); mozuClient.setResourceUrl(url); mozuClient.addHeader(Headers.X_VOL_DATAVIEW_MODE ,dataViewMode.toString()); return mozuClient; } /** * Updates the binary data or content associated with a document, such as a product image or PDF specifications file, by supplying the document name. * <p><pre><code> * MozuClient mozuClient=UpdateTreeDocumentContentClient( stream, documentListName, documentName, contentType); * client.setBaseAddress(url); * client.executeRequest(); * </code></pre></p> * @param documentListName Name of content documentListName to delete * @param documentName The name of the document in the site. * @param stream Data stream that delivers information. Used to input and output data. * @return Mozu.Api.MozuClient * @see Stream */ public static MozuClient updateTreeDocumentContentClient(java.io.InputStream stream, String documentListName, String documentName, String contentType) throws Exception { MozuUrl url = com.mozu.api.urls.content.documentlists.DocumentTreeUrl.updateTreeDocumentContentUrl(documentListName, documentName); String verb = "PUT"; MozuClient mozuClient = (MozuClient) MozuClientFactory.getInstance(); mozuClient.setVerb(verb); mozuClient.setResourceUrl(url); mozuClient.setBody(stream); if (!StringUtils.isEmpty(contentType)) mozuClient.addHeader(Headers.CONTENT_TYPE, contentType); return mozuClient; } /** * Deletes the content associated with a document, such as a product image or PDF specifications file. * <p><pre><code> * MozuClient mozuClient=DeleteTreeDocumentContentClient( stream, documentListName, documentName, contentType); * client.setBaseAddress(url); * client.executeRequest(); * </code></pre></p> * @param documentListName Name of content documentListName to delete * @param documentName The name of the document in the site. * @param stream Data stream that delivers information. Used to input and output data. * @return Mozu.Api.MozuClient * @see Stream */ public static MozuClient deleteTreeDocumentContentClient(java.io.InputStream stream, String documentListName, String documentName, String contentType) throws Exception { MozuUrl url = com.mozu.api.urls.content.documentlists.DocumentTreeUrl.deleteTreeDocumentContentUrl(documentListName, documentName); String verb = "DELETE"; MozuClient mozuClient = (MozuClient) MozuClientFactory.getInstance(); mozuClient.setVerb(verb); mozuClient.setResourceUrl(url); mozuClient.setBody(stream); if (!StringUtils.isEmpty(contentType)) mozuClient.addHeader(Headers.CONTENT_TYPE, contentType); return mozuClient; } }