Package com.box.boxjavalibv2.requests.requestobjects

Source Code of com.box.boxjavalibv2.requests.requestobjects.BoxItemCopyRequestObject

package com.box.boxjavalibv2.requests.requestobjects;

import com.box.boxjavalibv2.dao.BoxFile;
import com.box.boxjavalibv2.dao.BoxFolder;
import com.box.boxjavalibv2.dao.BoxItem;
import com.box.boxjavalibv2.jsonentities.MapJSONStringEntity;
import com.box.restclientv2.requestsbase.BoxDefaultRequestObject;

public class BoxItemCopyRequestObject extends BoxDefaultRequestObject {

    private BoxItemCopyRequestObject() {
    }

    public static BoxItemCopyRequestObject copyItemRequestObject(String parentId) {
        BoxItemCopyRequestObject entity = new BoxItemCopyRequestObject();
        entity.setParent(parentId);
        return entity;
    }

    /**
     * Set parent folder of the file.
     *
     * @param parentId
     *            id of parent
     * @return
     */
    private BoxItemCopyRequestObject setParent(String parentId) {
        MapJSONStringEntity entity = new MapJSONStringEntity();
        entity.put(BoxFolder.FIELD_ID, parentId);
        put(BoxItem.FIELD_PARENT, entity);
        return this;
    }

    /**
     * Set name of the file.
     *
     * @param name
     *            name
     * @return
     */
    public BoxItemCopyRequestObject setName(String name) {
        put(BoxFile.FIELD_NAME, name);
        return this;
    }
}
TOP

Related Classes of com.box.boxjavalibv2.requests.requestobjects.BoxItemCopyRequestObject

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.