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

com.box.boxjavalibv2.dao.BoxFolder Maven / Gradle / Ivy

There is a newer version: 3.2.1
Show newest version
package com.box.boxjavalibv2.dao;

import java.util.Map;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * Box folder.
 */
public class BoxFolder extends BoxItem {

    public static final String FIELD_FOLDER_UPLOAD_EMAIL = "folder_upload_email";
    public static final String FIELD_ITEM_COLLECTION = "item_collection";
    public static final String FIELD_HAS_COLLABORATIONS = "has_collaborations";

    /**
     * Constructor.
     */
    public BoxFolder() {
        setType(BoxResourceType.FOLDER.toString());
    }

    /**
     * Copy constructor, this does deep copy for all the fields.
     * 
     * @param obj
     */
    public BoxFolder(BoxFolder obj) {
        super(obj);
    }

    /**
     * Instantiate the object from a map. Each entry in the map reflects to a field.
     * 
     * @param map
     */
    public BoxFolder(Map map) {
        super(map);
    }

    /**
     * This is folder specific field, get the email that can be used to upload file into the folder.
     * 
     * @return email
     */
    @JsonProperty(FIELD_FOLDER_UPLOAD_EMAIL)
    public BoxEmail getFolderUploadEmail() {
        return (BoxEmail) getValue(FIELD_FOLDER_UPLOAD_EMAIL);
    }

    /**
     * Setter. This is only used by {@see Jackson JSON processer}
     * 
     * @param folderUploadEmail
     */
    @JsonProperty(FIELD_FOLDER_UPLOAD_EMAIL)
    protected void setFolderUploadEmail(BoxEmail folderUploadEmail) {
        put(FIELD_FOLDER_UPLOAD_EMAIL, folderUploadEmail);
    }

    /**
     * Getter.Get the items(files, subfolders, web links...) under this box folder.
     * 
     * @return collection of children items.
     */
    @JsonProperty(FIELD_ITEM_COLLECTION)
    public BoxCollection getItemCollection() {
        return (BoxCollection) getValue(FIELD_ITEM_COLLECTION);
    }

    /**
     * Setter. This is only used by {@see Jackson JSON processer}
     * 
     * @param itemCollection
     *            children item.
     */
    @JsonProperty(FIELD_ITEM_COLLECTION)
    protected void setItemCollection(BoxCollection itemCollection) {
        put(FIELD_ITEM_COLLECTION, itemCollection);
    }

    /**
     * Getter.Get whether this box folder has collaborations.
     * 
     * @return whether this box folder has collaborations
     */
    @JsonProperty(FIELD_HAS_COLLABORATIONS)
    public Boolean hasCollaborations() {
        return (Boolean) getValue(FIELD_HAS_COLLABORATIONS);
    }
    
    public boolean hasCollaborations(boolean defaultValue) {
        Boolean hasCollabs = hasCollaborations();
        return hasCollabs != null ? hasCollabs : defaultValue;
    }

    /**
     * Setter. This is only used by {@see Jackson JSON processer}
     * 
     * @param hasCollaborations
     *            whether folder has collaborations.
     */
    @JsonProperty(FIELD_HAS_COLLABORATIONS)
    protected void setHasCollaborations(Boolean hasCollaborations) {
        put(FIELD_HAS_COLLABORATIONS, hasCollaborations);
    }

    public BoxFolder(IBoxParcelWrapper in) {
        super(in);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy