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