View Javadoc
1   /*
2    * Copyright (C) 2003-2007 eXo Platform SAS.
3    *
4    * This program is free software; you can redistribute it and/or
5    * modify it under the terms of the GNU Affero General Public License
6    * as published by the Free Software Foundation; either version 3
7    * of the License, or (at your option) any later version.
8    *
9    * This program is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   * GNU General Public License for more details.
13   *
14   * You should have received a copy of the GNU General Public License
15   * along with this program; if not, see<http://www.gnu.org/licenses/>.
16   */
17  package org.exoplatform.social.core.activity.model;
18  
19  import org.exoplatform.services.log.ExoLogger;
20  import org.exoplatform.services.log.Log;
21  import org.exoplatform.social.core.identity.provider.OrganizationIdentityProvider;
22  import org.exoplatform.social.core.identity.provider.SpaceIdentityProvider;
23  
24  /**
25   * ActivityStream implementation.
26   */
27  public class ActivityStreamImpl implements ActivityStream {
28  
29    /**
30     * Logger.
31     */
32    private static final Log LOG = ExoLogger.getLogger(ActivityStreamImpl.class);
33  
34    /**
35     * Internal activityStorage uuid, from "published" node.
36     */
37    private String id;
38    /**
39     * With context of user, prettyId is remoteUser (root, john...). With context
40     * of space, prettyId is spaceName (space.getName()). By using this prettyId,
41     * we can construct its url to portal ui.
42     */
43    private String prettyId;
44  
45    /**
46     * Context Type.
47     */
48    private Type type;
49  
50    /**
51     * Stream tittle.
52     */
53    private String title;
54  
55    /**
56     * Favicon URL for this stream.
57     */
58    private String faviconUrl;
59  
60    /**
61     * Permalink link to this stream (url on Social).
62     */
63    private String permaLink;
64  
65    /**
66     * {@inheritDoc}
67     */
68    public final void setType(final String name) {
69      //TODO this is not loosely coupled
70      if (name.equals(OrganizationIdentityProvider.NAME)) {
71        setType(Type.USER);
72      } else if (name.equals(SpaceIdentityProvider.NAME)) {
73        setType(Type.SPACE);
74      } else {
75        LOG.warn("Failed to set activity stream type with type:" + name);
76      }
77    }
78  
79    /**
80     * {@inheritDoc}
81     */
82    public final String getId() {
83      return id;
84    }
85  
86    /**
87     * {@inheritDoc}
88     */
89    public final void setId(final String uuid) {
90      this.id = uuid;
91    }
92  
93    /**
94     * {@inheritDoc}
95     */
96    public final String getPrettyId() {
97      return prettyId;
98    }
99  
100   /**
101    * {@inheritDoc}
102    */
103   public final void setPrettyId(final String sPrettyId) {
104     prettyId = sPrettyId;
105   }
106 
107   /**
108    * {@inheritDoc}
109    */
110   public final Type getType() {
111     return type;
112   }
113 
114   /**
115    * {@inheritDoc}
116    */
117   public final void setType(final Type sType) {
118     type = sType;
119   }
120 
121   /**
122    * {@inheritDoc}
123    */
124   public final String getFaviconUrl() {
125     return faviconUrl;
126   }
127 
128   /**
129    * {@inheritDoc}
130    */
131   public final void setFaviconUrl(final String sFaviconUrl) {
132     faviconUrl = sFaviconUrl;
133   }
134 
135   /**
136    * {@inheritDoc}
137    */
138   public final String getTitle() {
139     return title;
140   }
141 
142   /**
143    * {@inheritDoc}
144    */
145   public final void setTitle(final String sTitle) {
146     title = sTitle;
147   }
148 
149   /**
150    * {@inheritDoc}
151    */
152   public final String getPermaLink() {
153     return permaLink;
154   }
155 
156   /**
157    * {@inheritDoc}
158    */
159   public final void setPermaLink(final String sPermaLink) {
160     permaLink = sPermaLink;
161   }
162 }