001package com.box.sdk;
002
003import java.util.ArrayList;
004import java.util.List;
005
006/**
007 * Optional parameters for creating an updating a Retention Policy.
008 *
009 * @see BoxRetentionPolicy
010 */
011public class RetentionPolicyParams {
012
013    /**
014     * @see #getCanOwnerExtendRetention()
015     */
016    private boolean canOwnerExtendRetention;
017
018    /**
019     * @see #getAreOwnersNotified()
020     */
021    private boolean areOwnersNotified;
022
023    /**
024     * @see #getCustomNotificationRecipients()
025     */
026    private List<BoxUser.Info> customNotificationRecipients;
027
028    /**
029     * Creates optional retention policy params with default values.
030     */
031    public RetentionPolicyParams() {
032        this.canOwnerExtendRetention = false;
033        this.areOwnersNotified = false;
034        this.customNotificationRecipients = new ArrayList<BoxUser.Info>();
035    }
036
037    /**
038     * @return the flag denoting whether the owner can extend the retention.
039     */
040    public boolean getCanOwnerExtendRetention() {
041        return this.canOwnerExtendRetention;
042    }
043
044    /**
045     * Set the flag denoting whether the owner can extend the retentiion.
046     *
047     * @param canOwnerExtendRetention The flag value.
048     */
049    public void setCanOwnerExtendRetention(boolean canOwnerExtendRetention) {
050        this.canOwnerExtendRetention = canOwnerExtendRetention;
051    }
052
053    /**
054     * @return the flag denoting whether owners and co-onwers are notified when the retention period is ending.
055     */
056    public boolean getAreOwnersNotified() {
057        return this.areOwnersNotified;
058    }
059
060    /**
061     * Set the flag denoting whether owners and co-owners are notified when the retention period is ending.
062     *
063     * @param areOwnersNotified The flag value.
064     */
065    public void setAreOwnersNotified(boolean areOwnersNotified) {
066        this.areOwnersNotified = areOwnersNotified;
067    }
068
069    /**
070     * @return the list of extra users to notify when the retention period is ending.
071     */
072    public List<BoxUser.Info> getCustomNotificationRecipients() {
073        return this.customNotificationRecipients;
074    }
075
076    /**
077     * Set the list of extra users to notify when the retention period is ending.
078     *
079     * @param customNotificationRecipients The list of users.
080     */
081    public void setCustomNotificationRecipients(List<BoxUser.Info> customNotificationRecipients) {
082        this.customNotificationRecipients = customNotificationRecipients;
083    }
084
085    /**
086     * Add a user by ID to the list of people to notify when the retention period is ending.
087     *
088     * @param userID The ID of the user to add to the list.
089     */
090    public void addCustomNotificationRecipient(String userID) {
091        BoxUser user = new BoxUser(null, userID);
092        this.customNotificationRecipients.add(user.new Info());
093
094    }
095
096    /**
097     * Add a user to the list of people to notify when the retention period is ending.
098     *
099     * @param user The info of the user to add to the list
100     */
101    public void addCustomNotificationRecipient(BoxUser user) {
102        this.customNotificationRecipients.add(user.new Info());
103    }
104}
105