Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
14792 manas 1
/**
2
 * Copyright 2010-present Facebook.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *    http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
 
17
package com.facebook.model;
18
 
19
import org.json.JSONObject;
20
 
21
import java.util.Date;
22
import java.util.List;
23
 
24
/**
25
 * Provides a strongly-typed representation of an Open Graph Action.
26
 * For more documentation of OG Actions, see: https://developers.facebook.com/docs/opengraph/actions/
27
 *
28
 * Note that this interface is intended to be used with GraphObject.Factory or OpenGraphAction.Factory
29
 * and not implemented directly.
30
 */
31
public interface OpenGraphAction extends GraphObject {
32
    /**
33
     * Gets the ID of the action.
34
     * @return the ID
35
     */
36
    String getId();
37
 
38
    /**
39
     * Sets the ID of the action.
40
     * @param id the ID
41
     */
42
    void setId(String id);
43
 
44
    /**
45
     * Gets the type of the action, which is a string in the form "mynamespace:mytype".
46
     * @return the type
47
     */
48
    String getType();
49
 
50
    /**
51
     * Sets the type of the action, which is a string in the form "mynamespace:mytype".
52
     * @param type the type
53
     */
54
    void setType(String type);
55
 
56
    /**
57
     * Gets the start time of the action.
58
     * @return the start time
59
     */
60
    Date getStartTime();
61
 
62
    /**
63
     * Sets the start time of the action.
64
     * @param startTime the start time
65
     */
66
    void setStartTime(Date startTime);
67
 
68
    /**
69
     * Gets the end time of the action.
70
     * @return the end time
71
     */
72
    Date getEndTime();
73
 
74
    /**
75
     * Sets the end time of the action.
76
     * @param endTime the end time
77
     */
78
    void setEndTime(Date endTime);
79
 
80
    /**
81
     * Gets the time the action was published, if any.
82
     * @return the publish time
83
     */
84
    Date getPublishTime();
85
 
86
    /**
87
     * Sets the time the action was published.
88
     * @param publishTime the publish time
89
     */
90
    void setPublishTime(Date publishTime);
91
 
92
    /**
93
     * Gets the time the action was created.
94
     * @return the creation time
95
     */
96
    public Date getCreatedTime();
97
 
98
    /**
99
     * Sets the time the action was created.
100
     * @param createdTime the creation time
101
     */
102
    public void setCreatedTime(Date createdTime);
103
 
104
    /**
105
     * Gets the time the action expires at.
106
     * @return the expiration time
107
     */
108
    public Date getExpiresTime();
109
 
110
    /**
111
     * Sets the time the action expires at.
112
     * @param expiresTime the expiration time
113
     */
114
    public void setExpiresTime(Date expiresTime);
115
 
116
    /**
117
     * Gets the unique string which will be passed to the OG Action owner's website
118
     * when a user clicks through this action on Facebook.
119
     * @return the ref string
120
     */
121
    String getRef();
122
 
123
    /**
124
     * Sets the unique string which will be passed to the OG Action owner's website
125
     * when a user clicks through this action on Facebook.
126
     * @param ref the ref string
127
     */
128
    void setRef(String ref);
129
 
130
    /**
131
     * Gets the message assoicated with the action.
132
     * @return the message
133
     */
134
    String getMessage();
135
 
136
    /**
137
     * Sets the message associated with the action.
138
     * @param message the message
139
     */
140
    void setMessage(String message);
141
 
142
    /**
143
     * Gets the place where the action took place.
144
     * @return the place
145
     */
146
    GraphPlace getPlace();
147
 
148
    /**
149
     * Sets the place where the action took place.
150
     * @param place the place
151
     */
152
    void setPlace(GraphPlace place);
153
 
154
    /**
155
     * Gets the list of profiles that were tagged in the action.
156
     * @return the profiles that were tagged in the action
157
     */
158
    GraphObjectList<GraphObject> getTags();
159
 
160
    /**
161
     * Sets the list of profiles that were tagged in the action.
162
     * @param tags the profiles that were tagged in the action
163
     */
164
    void setTags(List<? extends GraphObject> tags);
165
 
166
    /**
167
     * Gets the images that were associated with the action.
168
     * @return the images
169
     */
170
    List<JSONObject> getImage();
171
 
172
    /**
173
     * Sets the images that were associated with the action.
174
     * @param image the images
175
     */
176
    void setImage(List<JSONObject> image);
177
 
178
    /**
179
     * Sets the images associated with the Open Graph action by specifying their URLs. This is a helper
180
     * that will create GraphObjects with the correct URLs and populate the property with those objects.
181
     * @param urls the URLs
182
     */
183
    @CreateGraphObject("url")
184
    @PropertyName("image")
185
    void setImageUrls(List<String> urls);
186
 
187
    /**
188
     * Gets the from-user associated with the action.
189
     * @return the user
190
     */
191
    GraphUser getFrom();
192
 
193
    /**
194
     * Sets the from-user associated with the action.
195
     * @param from the from-user
196
     */
197
    void setFrom(GraphUser from);
198
 
199
    /**
200
     * Gets the 'likes' that have been performed on this action.
201
     * @return the likes
202
     */
203
    public JSONObject getLikes();
204
 
205
    /**
206
     * Sets the 'likes' that have been performed on this action.
207
     * @param likes the likes
208
     */
209
    public void setLikes(JSONObject likes);
210
 
211
    /**
212
     * Gets the application that created this action.
213
     * @return the application
214
     */
215
    GraphObject getApplication();
216
 
217
    /**
218
     * Sets the application that created this action.
219
     * @param application the application
220
     */
221
    void setApplication(GraphObject application);
222
 
223
    /**
224
     * Gets the comments that have been made on this action.
225
     * @return the comments
226
     */
227
    public JSONObject getComments();
228
 
229
    /**
230
     * Sets the comments that have been made on this action.
231
     * @param comments the comments
232
     */
233
    void setComments(JSONObject comments);
234
 
235
    /**
236
     * Gets the type-specific data for this action; for instance, any properties
237
     * referencing Open Graph objects will appear under here.
238
     * @return a GraphObject representing the type-specific data
239
     */
240
    GraphObject getData();
241
 
242
    /**
243
     * Sets the type-specific data for this action.
244
     * @param data a GraphObject representing the type-specific data
245
     */
246
    void setData(GraphObject data);
247
 
248
 
249
    /**
250
     * Gets whether the action has been explicitly shared by the user. See
251
     * <a href="https://developers.facebook.com/docs/opengraph/guides/explicit-sharing/">Explicit Sharing</a> for
252
     * more information.
253
     * @return true if this action was explicitly shared
254
     */
255
    @PropertyName("fb:explicitly_shared")
256
    boolean getExplicitlyShared();
257
 
258
    /**
259
     * Sets whether the action has been explicitly shared by the user. See
260
     * <a href="https://developers.facebook.com/docs/opengraph/guides/explicit-sharing/">Explicit Sharing</a> for
261
     * more information. You should only specify this property if explicit sharing has been enabled for an
262
     * Open Graph action type.
263
     * @param explicitlyShared true if this action was explicitly shared
264
     */
265
    @PropertyName("fb:explicitly_shared")
266
    void setExplicitlyShared(boolean explicitlyShared);
267
 
268
    /**
269
     * Exposes helpers for creating instances of OpenGraphAction.
270
     */
271
    final class Factory {
272
        /**
273
         * Creates an OpenGraphAction suitable for posting via, e.g., a native Share dialog.
274
         * @return an OpenGraphAction
275
         */
276
        @Deprecated
277
        public static OpenGraphAction createForPost() {
278
            return createForPost(OpenGraphAction.class, null);
279
        }
280
 
281
        /**
282
         * Creates an OpenGraphAction suitable for posting via, e.g., a native Share dialog.
283
         * @param type the Open Graph action type for the action, or null if it will be specified later
284
         * @return an OpenGraphAction
285
         */
286
        public static OpenGraphAction createForPost(String type) {
287
            return createForPost(OpenGraphAction.class, type);
288
        }
289
 
290
        /**
291
         * Creates an OpenGraphAction suitable for posting via, e.g., a native Share dialog.
292
         * @param type the Open Graph action type for the action, or null if it will be specified later
293
         * @param graphObjectClass the OpenGraphAction-derived type to return
294
         * @return an OpenGraphAction
295
         */
296
        public static <T extends OpenGraphAction> T createForPost(Class<T> graphObjectClass, String type) {
297
            T object = GraphObject.Factory.create(graphObjectClass);
298
 
299
            if (type != null) {
300
                object.setType(type);
301
            }
302
 
303
            return object;
304
        }
305
    }
306
}