mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Part of MOB-436: Cluster-wide Locking Service: Implement DB Changes and Service
- Unit test not checked in as it requires some schema change work that has been done manually - Moved activities DAO code and renamed data services to DAOs (as per iBatis and Wikipedia, etc) - DAO code should now go into org.alfresco.repo.domain... - DAO components are bean:xyzDAO and class:XyzDAO - Entity beans are XyzEntity, etc git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13922 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -30,13 +30,13 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.repo.activities.feed.ActivityFeedDAO;
|
||||
import org.alfresco.repo.activities.feed.ActivityFeedDaoService;
|
||||
import org.alfresco.repo.activities.feed.FeedGenerator;
|
||||
import org.alfresco.repo.activities.feed.control.FeedControlDAO;
|
||||
import org.alfresco.repo.activities.feed.control.FeedControlDaoService;
|
||||
import org.alfresco.repo.activities.post.ActivityPostDAO;
|
||||
import org.alfresco.repo.activities.post.ActivityPostDaoService;
|
||||
import org.alfresco.repo.domain.activities.ActivityFeedDAO;
|
||||
import org.alfresco.repo.domain.activities.ActivityFeedEntity;
|
||||
import org.alfresco.repo.domain.activities.ActivityPostDAO;
|
||||
import org.alfresco.repo.domain.activities.ActivityPostEntity;
|
||||
import org.alfresco.repo.domain.activities.FeedControlDAO;
|
||||
import org.alfresco.repo.domain.activities.FeedControlEntity;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.tenant.TenantService;
|
||||
import org.alfresco.service.cmr.activities.ActivityService;
|
||||
@@ -64,9 +64,9 @@ public class ActivityServiceImpl implements ActivityService
|
||||
private static final int MAX_LEN_ACTIVITY_DATA = 4000; // needs to match schema: activity_data
|
||||
private static final int MAX_LEN_APP_TOOL_ID = 36; // needs to match schema: app_tool
|
||||
|
||||
private ActivityPostDaoService postDaoService;
|
||||
private ActivityFeedDaoService feedDaoService;
|
||||
private FeedControlDaoService feedControlDaoService;
|
||||
private ActivityPostDAO postDAO;
|
||||
private ActivityFeedDAO feedDAO;
|
||||
private FeedControlDAO feedControlDAO;
|
||||
private AuthorityService authorityService;
|
||||
private FeedGenerator feedGenerator;
|
||||
|
||||
@@ -86,19 +86,19 @@ public class ActivityServiceImpl implements ActivityService
|
||||
this.userNamesAreCaseSensitive = userNamesAreCaseSensitive;
|
||||
}
|
||||
|
||||
public void setPostDaoService(ActivityPostDaoService postDaoService)
|
||||
public void setPostDAO(ActivityPostDAO postDAO)
|
||||
{
|
||||
this.postDaoService = postDaoService;
|
||||
this.postDAO = postDAO;
|
||||
}
|
||||
|
||||
public void setFeedDaoService(ActivityFeedDaoService feedDaoService)
|
||||
public void setFeedDAO(ActivityFeedDAO feedDAO)
|
||||
{
|
||||
this.feedDaoService = feedDaoService;
|
||||
this.feedDAO = feedDAO;
|
||||
}
|
||||
|
||||
public void setFeedControlDaoService(FeedControlDaoService feedControlDaoService)
|
||||
public void setFeedControlDAO(FeedControlDAO feedControlDAO)
|
||||
{
|
||||
this.feedControlDaoService = feedControlDaoService;
|
||||
this.feedControlDAO = feedControlDAO;
|
||||
}
|
||||
|
||||
public void setAuthorityService(AuthorityService authorityService)
|
||||
@@ -122,7 +122,7 @@ public class ActivityServiceImpl implements ActivityService
|
||||
*/
|
||||
public void postActivity(String activityType, String siteId, String appTool, String activityData)
|
||||
{
|
||||
postActivity(activityType, siteId, appTool, activityData, ActivityPostDAO.STATUS.PENDING);
|
||||
postActivity(activityType, siteId, appTool, activityData, ActivityPostEntity.STATUS.PENDING);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -135,7 +135,7 @@ public class ActivityServiceImpl implements ActivityService
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("{").append("\"nodeRef\":\"").append(nodeRef.toString()).append("\"").append("}");
|
||||
|
||||
postActivity(activityType, siteId, appTool, sb.toString(), ActivityPostDAO.STATUS.PENDING);
|
||||
postActivity(activityType, siteId, appTool, sb.toString(), ActivityPostEntity.STATUS.PENDING);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -150,7 +150,7 @@ public class ActivityServiceImpl implements ActivityService
|
||||
.append("\"name\":\"").append(name).append("\"")
|
||||
.append("}");
|
||||
|
||||
postActivity(activityType, siteId, appTool, sb.toString(), ActivityPostDAO.STATUS.PENDING);
|
||||
postActivity(activityType, siteId, appTool, sb.toString(), ActivityPostEntity.STATUS.PENDING);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -171,10 +171,10 @@ public class ActivityServiceImpl implements ActivityService
|
||||
.append("\"parentNodeRef\":\"").append(parentNodeRef.toString()).append("\"")
|
||||
.append("}");
|
||||
|
||||
postActivity(activityType, siteId, appTool, sb.toString(), ActivityPostDAO.STATUS.PENDING);
|
||||
postActivity(activityType, siteId, appTool, sb.toString(), ActivityPostEntity.STATUS.PENDING);
|
||||
}
|
||||
|
||||
private void postActivity(String activityType, String siteId, String appTool, String activityData, ActivityPostDAO.STATUS status)
|
||||
private void postActivity(String activityType, String siteId, String appTool, String activityData, ActivityPostEntity.STATUS status)
|
||||
{
|
||||
String currentUser = AuthenticationUtil.getFullyAuthenticatedUser();
|
||||
|
||||
@@ -241,7 +241,7 @@ public class ActivityServiceImpl implements ActivityService
|
||||
try
|
||||
{
|
||||
Date postDate = new Date();
|
||||
ActivityPostDAO activityPost = new ActivityPostDAO();
|
||||
ActivityPostEntity activityPost = new ActivityPostEntity();
|
||||
activityPost.setUserId(currentUser);
|
||||
|
||||
activityPost.setSiteNetwork(tenantService.getName(siteId));
|
||||
@@ -262,7 +262,7 @@ public class ActivityServiceImpl implements ActivityService
|
||||
|
||||
try
|
||||
{
|
||||
long postId = postDaoService.insertPost(activityPost);
|
||||
long postId = postDAO.insertPost(activityPost);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
@@ -312,16 +312,16 @@ public class ActivityServiceImpl implements ActivityService
|
||||
|
||||
try
|
||||
{
|
||||
List<ActivityFeedDAO> activityFeeds = null;
|
||||
List<ActivityFeedEntity> activityFeeds = null;
|
||||
if (siteId != null)
|
||||
{
|
||||
siteId = tenantService.getName(siteId);
|
||||
}
|
||||
|
||||
activityFeeds = feedDaoService.selectUserFeedEntries(feedUserId, format, siteId, excludeThisUser, excludeOtherUsers);
|
||||
activityFeeds = feedDAO.selectUserFeedEntries(feedUserId, format, siteId, excludeThisUser, excludeOtherUsers);
|
||||
|
||||
int count = 0;
|
||||
for (ActivityFeedDAO activityFeed : activityFeeds)
|
||||
for (ActivityFeedEntity activityFeed : activityFeeds)
|
||||
{
|
||||
count++;
|
||||
if (count > maxFeedItems)
|
||||
@@ -363,10 +363,10 @@ public class ActivityServiceImpl implements ActivityService
|
||||
{
|
||||
siteId = tenantService.getName(siteId);
|
||||
|
||||
List<ActivityFeedDAO> activityFeeds = feedDaoService.selectSiteFeedEntries(siteId, format);
|
||||
List<ActivityFeedEntity> activityFeeds = feedDAO.selectSiteFeedEntries(siteId, format);
|
||||
|
||||
int count = 0;
|
||||
for (ActivityFeedDAO activityFeed : activityFeeds)
|
||||
for (ActivityFeedEntity activityFeed : activityFeeds)
|
||||
{
|
||||
count++;
|
||||
if (count > maxFeedItems)
|
||||
@@ -411,7 +411,7 @@ public class ActivityServiceImpl implements ActivityService
|
||||
{
|
||||
if (! existsFeedControl(feedControl))
|
||||
{
|
||||
feedControlDaoService.insertFeedControl(new FeedControlDAO(userId, feedControl));
|
||||
feedControlDAO.insertFeedControl(new FeedControlEntity(userId, feedControl));
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
@@ -458,9 +458,9 @@ public class ActivityServiceImpl implements ActivityService
|
||||
|
||||
try
|
||||
{
|
||||
List<FeedControlDAO> feedControlDaos = feedControlDaoService.selectFeedControls(userId);
|
||||
List<FeedControlEntity> feedControlDaos = feedControlDAO.selectFeedControls(userId);
|
||||
List<FeedControl> feedControls = new ArrayList<FeedControl>(feedControlDaos.size());
|
||||
for (FeedControlDAO feedControlDao : feedControlDaos)
|
||||
for (FeedControlEntity feedControlDao : feedControlDaos)
|
||||
{
|
||||
feedControls.add(feedControlDao.getFeedControl());
|
||||
}
|
||||
@@ -490,7 +490,7 @@ public class ActivityServiceImpl implements ActivityService
|
||||
|
||||
try
|
||||
{
|
||||
feedControlDaoService.deleteFeedControl(new FeedControlDAO(userId, feedControl));
|
||||
feedControlDAO.deleteFeedControl(new FeedControlEntity(userId, feedControl));
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
@@ -516,7 +516,7 @@ public class ActivityServiceImpl implements ActivityService
|
||||
|
||||
try
|
||||
{
|
||||
long id = feedControlDaoService.selectFeedControl(new FeedControlDAO(userId, feedControl));
|
||||
long id = feedControlDAO.selectFeedControl(new FeedControlEntity(userId, feedControl));
|
||||
return (id != -1);
|
||||
}
|
||||
catch (SQLException e)
|
||||
|
@@ -24,7 +24,7 @@
|
||||
*/
|
||||
package org.alfresco.repo.activities.feed;
|
||||
|
||||
import org.alfresco.repo.activities.post.ActivityPostDaoService;
|
||||
import org.alfresco.repo.domain.activities.ActivityPostDAO;
|
||||
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||
import org.alfresco.util.PropertyCheck;
|
||||
import org.alfresco.util.VmShutdownListener;
|
||||
@@ -43,7 +43,7 @@ public abstract class AbstractFeedGenerator implements FeedGenerator
|
||||
|
||||
private int maxItemsPerCycle = 100;
|
||||
|
||||
private ActivityPostDaoService postDaoService;
|
||||
private ActivityPostDAO postDAO;
|
||||
private AuthenticationService authenticationService;
|
||||
|
||||
private String repoEndPoint; // http://hostname:port/webapp (eg. http://localhost:8080/alfresco)
|
||||
@@ -54,9 +54,9 @@ public abstract class AbstractFeedGenerator implements FeedGenerator
|
||||
|
||||
private volatile boolean busy;
|
||||
|
||||
public void setPostDaoService(ActivityPostDaoService postDaoService)
|
||||
public void setPostDAO(ActivityPostDAO postDAO)
|
||||
{
|
||||
this.postDaoService = postDaoService;
|
||||
this.postDAO = postDAO;
|
||||
}
|
||||
|
||||
public void setAuthenticationService(AuthenticationService authenticationService)
|
||||
@@ -84,9 +84,9 @@ public abstract class AbstractFeedGenerator implements FeedGenerator
|
||||
return this.maxItemsPerCycle;
|
||||
}
|
||||
|
||||
public ActivityPostDaoService getPostDaoService()
|
||||
public ActivityPostDAO getPostDaoService()
|
||||
{
|
||||
return this.postDaoService;
|
||||
return this.postDAO;
|
||||
}
|
||||
|
||||
public AuthenticationService getAuthenticationService()
|
||||
@@ -112,7 +112,7 @@ public abstract class AbstractFeedGenerator implements FeedGenerator
|
||||
*/
|
||||
private void checkProperties()
|
||||
{
|
||||
PropertyCheck.mandatory(this, "postDaoService", postDaoService);
|
||||
PropertyCheck.mandatory(this, "postDAO", postDAO);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,175 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.repo.activities.feed;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.alfresco.util.ISO8601DateFormat;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/**
|
||||
* Activity Feed DAO
|
||||
*/
|
||||
public class ActivityFeedDAO
|
||||
{
|
||||
private Long id; // internal DB-generated id
|
||||
private String activityType;
|
||||
private String activitySummary;
|
||||
private String activitySummaryFormat;
|
||||
private String feedUserId;
|
||||
private String postUserId;
|
||||
private String siteNetwork;
|
||||
private String appTool;
|
||||
private Date postDate;
|
||||
private Date feedDate; // for debug
|
||||
private long postId; // for debug - not an explicit FK constraint, could be used to implement re-generate
|
||||
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getActivitySummary()
|
||||
{
|
||||
return activitySummary;
|
||||
}
|
||||
|
||||
public void setActivitySummary(String summary)
|
||||
{
|
||||
this.activitySummary = summary;
|
||||
}
|
||||
|
||||
public String getFeedUserId()
|
||||
{
|
||||
return feedUserId;
|
||||
}
|
||||
|
||||
public void setFeedUserId(String userid)
|
||||
{
|
||||
this.feedUserId = userid;
|
||||
}
|
||||
|
||||
public String getPostUserId()
|
||||
{
|
||||
return postUserId;
|
||||
}
|
||||
|
||||
public void setPostUserId(String userid)
|
||||
{
|
||||
this.postUserId = userid;
|
||||
}
|
||||
|
||||
public String getActivitySummaryFormat()
|
||||
{
|
||||
return activitySummaryFormat;
|
||||
}
|
||||
|
||||
public void setActivitySummaryFormat(String format)
|
||||
{
|
||||
this.activitySummaryFormat = format;
|
||||
}
|
||||
|
||||
public String getSiteNetwork()
|
||||
{
|
||||
return siteNetwork;
|
||||
}
|
||||
|
||||
public void setSiteNetwork(String siteNetwork)
|
||||
{
|
||||
this.siteNetwork = siteNetwork;
|
||||
}
|
||||
|
||||
public String getActivityType()
|
||||
{
|
||||
return activityType;
|
||||
}
|
||||
public void setActivityType(String activityType)
|
||||
{
|
||||
this.activityType = activityType;
|
||||
}
|
||||
|
||||
public Date getPostDate()
|
||||
{
|
||||
return postDate;
|
||||
}
|
||||
|
||||
public void setPostDate(Date postDate)
|
||||
{
|
||||
this.postDate = postDate;
|
||||
}
|
||||
|
||||
public long getPostId()
|
||||
{
|
||||
return postId;
|
||||
}
|
||||
|
||||
public void setPostId(long postId)
|
||||
{
|
||||
this.postId = postId;
|
||||
}
|
||||
|
||||
public Date getFeedDate()
|
||||
{
|
||||
return feedDate;
|
||||
}
|
||||
|
||||
public void setFeedDate(Date feedDate)
|
||||
{
|
||||
this.feedDate = feedDate;
|
||||
}
|
||||
|
||||
public String getAppTool()
|
||||
{
|
||||
return appTool;
|
||||
}
|
||||
|
||||
public void setAppTool(String appTool)
|
||||
{
|
||||
this.appTool = appTool;
|
||||
}
|
||||
|
||||
public String getJSONString() throws JSONException
|
||||
{
|
||||
JSONObject jo = new JSONObject();
|
||||
|
||||
jo.put("id", id);
|
||||
jo.put("postUserId", postUserId);
|
||||
jo.put("postDate", ISO8601DateFormat.format(postDate));
|
||||
if (feedUserId != null) { jo.put("feedUserId", feedUserId); } // eg. site feed
|
||||
jo.put("siteNetwork", siteNetwork);
|
||||
jo.put("activityType", activityType);
|
||||
jo.put("activitySummary", activitySummary);
|
||||
jo.put("activitySummaryFormat", activitySummaryFormat);
|
||||
|
||||
return jo.toString();
|
||||
}
|
||||
}
|
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.repo.activities.feed;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.activities.ibatis.ActivityDaoService;
|
||||
|
||||
/**
|
||||
* Interface for activity feed DAO service
|
||||
*/
|
||||
public interface ActivityFeedDaoService extends ActivityDaoService
|
||||
{
|
||||
public long insertFeedEntry(ActivityFeedDAO activityFeed) throws SQLException;
|
||||
|
||||
public int deleteFeedEntries(Date keepDate) throws SQLException;
|
||||
|
||||
public List<ActivityFeedDAO> selectUserFeedEntries(String feedUserId, String format, String siteId, boolean excludeThisUser, boolean excludeOtherUsers) throws SQLException;
|
||||
|
||||
public List<ActivityFeedDAO> selectSiteFeedEntries(String siteUserId, String format) throws SQLException;
|
||||
}
|
@@ -45,8 +45,9 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.alfresco.repo.activities.feed.control.FeedControlDAO;
|
||||
import org.alfresco.repo.activities.post.ActivityPostDAO;
|
||||
import org.alfresco.repo.domain.activities.ActivityFeedEntity;
|
||||
import org.alfresco.repo.domain.activities.ActivityPostEntity;
|
||||
import org.alfresco.repo.domain.activities.FeedControlEntity;
|
||||
import org.alfresco.repo.template.ISO8601DateFormatMethod;
|
||||
import org.alfresco.util.Base64;
|
||||
import org.alfresco.util.JSONtoFmModel;
|
||||
@@ -86,15 +87,15 @@ public abstract class FeedTaskProcessor
|
||||
logger.debug(">>> Process: jobTaskNode '" + jobTaskNode + "' from seq '" + minSeq + "' to seq '" + maxSeq + "' on this node from grid job.");
|
||||
}
|
||||
|
||||
ActivityPostDAO selector = new ActivityPostDAO();
|
||||
ActivityPostEntity selector = new ActivityPostEntity();
|
||||
selector.setJobTaskNode(jobTaskNode);
|
||||
selector.setMinId(minSeq);
|
||||
selector.setMaxId(maxSeq);
|
||||
selector.setStatus(ActivityPostDAO.STATUS.POSTED.toString());
|
||||
selector.setStatus(ActivityPostEntity.STATUS.POSTED.toString());
|
||||
|
||||
String ticket = ctx.getTicket();
|
||||
|
||||
List<ActivityPostDAO> activityPosts = null;
|
||||
List<ActivityPostEntity> activityPosts = null;
|
||||
int totalGenerated = 0;
|
||||
|
||||
try
|
||||
@@ -112,7 +113,7 @@ public abstract class FeedTaskProcessor
|
||||
Map<String, Template> templateCache = new TreeMap<String, Template>();
|
||||
|
||||
// for each activity post ...
|
||||
for (ActivityPostDAO activityPost : activityPosts)
|
||||
for (ActivityPostEntity activityPost : activityPosts)
|
||||
{
|
||||
String postingUserId = activityPost.getUserId();
|
||||
String activityType = activityPost.getActivityType();
|
||||
@@ -172,7 +173,7 @@ public abstract class FeedTaskProcessor
|
||||
if (fmTemplates.size() == 0)
|
||||
{
|
||||
logger.error(">>> Skipping activity post " + activityPost.getId() + " since no specific/generic templates for activityType: " + activityType );
|
||||
updatePostStatus(activityPost.getId(), ActivityPostDAO.STATUS.ERROR);
|
||||
updatePostStatus(activityPost.getId(), ActivityPostEntity.STATUS.ERROR);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -184,7 +185,7 @@ public abstract class FeedTaskProcessor
|
||||
catch(JSONException je)
|
||||
{
|
||||
logger.error(">>> Skipping activity post " + activityPost.getId() + " due to invalid activity data: " + je);
|
||||
updatePostStatus(activityPost.getId(), ActivityPostDAO.STATUS.ERROR);
|
||||
updatePostStatus(activityPost.getId(), ActivityPostEntity.STATUS.ERROR);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -221,7 +222,7 @@ public abstract class FeedTaskProcessor
|
||||
catch(Exception e)
|
||||
{
|
||||
logger.error(">>> Skipping activity post " + activityPost.getId() + " since failed to get site members: " + e);
|
||||
updatePostStatus(activityPost.getId(), ActivityPostDAO.STATUS.ERROR);
|
||||
updatePostStatus(activityPost.getId(), ActivityPostEntity.STATUS.ERROR);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -240,7 +241,7 @@ public abstract class FeedTaskProcessor
|
||||
|
||||
for (String connectedUser : connectedUsers)
|
||||
{
|
||||
List<FeedControlDAO> feedControls = null;
|
||||
List<FeedControlEntity> feedControls = null;
|
||||
if (! connectedUser.equals(""))
|
||||
{
|
||||
feedControls = getFeedControls(connectedUser);
|
||||
@@ -272,7 +273,7 @@ public abstract class FeedTaskProcessor
|
||||
logger.warn("Unknown format for: " + fmTemplate + " default to '"+formatFound+"'");
|
||||
}
|
||||
|
||||
ActivityFeedDAO feed = new ActivityFeedDAO();
|
||||
ActivityFeedEntity feed = new ActivityFeedEntity();
|
||||
|
||||
// Generate activity feed summary
|
||||
feed.setFeedUserId(connectedUser);
|
||||
@@ -312,7 +313,7 @@ public abstract class FeedTaskProcessor
|
||||
}
|
||||
}
|
||||
|
||||
updatePostStatus(activityPost.getId(), ActivityPostDAO.STATUS.PROCESSED);
|
||||
updatePostStatus(activityPost.getId(), ActivityPostEntity.STATUS.PROCESSED);
|
||||
|
||||
commitTransaction();
|
||||
|
||||
@@ -344,13 +345,13 @@ public abstract class FeedTaskProcessor
|
||||
|
||||
public abstract void endTransaction() throws SQLException;
|
||||
|
||||
public abstract List<ActivityPostDAO> selectPosts(ActivityPostDAO selector) throws SQLException;
|
||||
public abstract List<ActivityPostEntity> selectPosts(ActivityPostEntity selector) throws SQLException;
|
||||
|
||||
public abstract List<FeedControlDAO> selectUserFeedControls(String userId) throws SQLException;
|
||||
public abstract List<FeedControlEntity> selectUserFeedControls(String userId) throws SQLException;
|
||||
|
||||
public abstract long insertFeedEntry(ActivityFeedDAO feed) throws SQLException;
|
||||
public abstract long insertFeedEntry(ActivityFeedEntity feed) throws SQLException;
|
||||
|
||||
public abstract int updatePostStatus(long id, ActivityPostDAO.STATUS status) throws SQLException;
|
||||
public abstract int updatePostStatus(long id, ActivityPostEntity.STATUS status) throws SQLException;
|
||||
|
||||
|
||||
protected String callWebScript(String urlString, String ticket) throws MalformedURLException, URISyntaxException, IOException
|
||||
@@ -531,20 +532,20 @@ public abstract class FeedTaskProcessor
|
||||
return textWriter.toString();
|
||||
}
|
||||
|
||||
protected List<FeedControlDAO> getFeedControls(String connectedUser) throws SQLException
|
||||
protected List<FeedControlEntity> getFeedControls(String connectedUser) throws SQLException
|
||||
{
|
||||
// TODO cache for this run
|
||||
return selectUserFeedControls(connectedUser);
|
||||
}
|
||||
|
||||
protected boolean acceptActivity(ActivityPostDAO activityPost, List<FeedControlDAO> feedControls)
|
||||
protected boolean acceptActivity(ActivityPostEntity activityPost, List<FeedControlEntity> feedControls)
|
||||
{
|
||||
if (feedControls == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
for (FeedControlDAO feedControl : feedControls)
|
||||
for (FeedControlEntity feedControl : feedControls)
|
||||
{
|
||||
if (((feedControl.getSiteNetwork() == null) || (feedControl.getSiteNetwork().length() == 0)) && (feedControl.getAppTool() != null))
|
||||
{
|
||||
|
@@ -28,7 +28,7 @@ import java.sql.SQLException;
|
||||
import java.util.Date;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.repo.activities.feed.ActivityFeedDaoService;
|
||||
import org.alfresco.repo.domain.activities.ActivityFeedDAO;
|
||||
import org.alfresco.util.PropertyCheck;
|
||||
import org.alfresco.util.VmShutdownListener;
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -46,11 +46,11 @@ public class FeedCleaner
|
||||
|
||||
private int maxAgeMins = 0;
|
||||
|
||||
private ActivityFeedDaoService feedDaoService;
|
||||
private ActivityFeedDAO feedDAO;
|
||||
|
||||
public void setFeedDaoService(ActivityFeedDaoService feedDaoService)
|
||||
public void setFeedDAO(ActivityFeedDAO feedDAO)
|
||||
{
|
||||
this.feedDaoService = feedDaoService;
|
||||
this.feedDAO = feedDAO;
|
||||
}
|
||||
|
||||
public void setMaxAgeMins(int mins)
|
||||
@@ -63,7 +63,7 @@ public class FeedCleaner
|
||||
*/
|
||||
private void checkProperties()
|
||||
{
|
||||
PropertyCheck.mandatory(this, "feedDaoService", feedDaoService);
|
||||
PropertyCheck.mandatory(this, "feedDAO", feedDAO);
|
||||
|
||||
// check the max age
|
||||
if (maxAgeMins <= 0)
|
||||
@@ -82,7 +82,7 @@ public class FeedCleaner
|
||||
Date keepDate = new Date(keepTimeOffset);
|
||||
|
||||
// clean old entries
|
||||
int deletedCount = feedDaoService.deleteFeedEntries(keepDate);
|
||||
int deletedCount = feedDAO.deleteFeedEntries(keepDate);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
|
@@ -1,118 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.repo.activities.feed.control;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.alfresco.service.cmr.activities.FeedControl;
|
||||
|
||||
/**
|
||||
* Activity Feed Control DAO
|
||||
*/
|
||||
public class FeedControlDAO
|
||||
{
|
||||
private Long id; // internal DB-generated id
|
||||
private String feedUserId;
|
||||
private String siteNetwork;
|
||||
private String appTool;
|
||||
|
||||
private Date lastModified; // when inserted
|
||||
|
||||
// TODO - review - deleted feed controls are not kept and available feed controls are currently retrieved during generation, hence
|
||||
// it is possible for a feed control to be applied even if lastModified is greater than postDate - could check the date !
|
||||
// it is also possible for a feed control to not be applied if it is deleted just after the post - would need to keep, at least until next generation
|
||||
|
||||
public FeedControlDAO()
|
||||
{
|
||||
}
|
||||
|
||||
public FeedControlDAO(String feedUserId)
|
||||
{
|
||||
this.feedUserId = feedUserId;
|
||||
}
|
||||
|
||||
public FeedControlDAO(String feedUserId, FeedControl feedControl)
|
||||
{
|
||||
this.feedUserId = feedUserId;
|
||||
this.siteNetwork = feedControl.getSiteId();
|
||||
this.appTool = feedControl.getAppToolId();
|
||||
this.lastModified = new Date();
|
||||
}
|
||||
|
||||
public FeedControl getFeedControl()
|
||||
{
|
||||
return new FeedControl(this.siteNetwork, this.appTool);
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getSiteNetwork()
|
||||
{
|
||||
return siteNetwork;
|
||||
}
|
||||
|
||||
public void setSiteNetwork(String siteNetwork)
|
||||
{
|
||||
this.siteNetwork = siteNetwork;
|
||||
}
|
||||
|
||||
public String getAppTool()
|
||||
{
|
||||
return appTool;
|
||||
}
|
||||
|
||||
public void setAppTool(String appTool)
|
||||
{
|
||||
this.appTool = appTool;
|
||||
}
|
||||
|
||||
public String getFeedUserId()
|
||||
{
|
||||
return feedUserId;
|
||||
}
|
||||
|
||||
public void setFeedUserId(String feedUserId)
|
||||
{
|
||||
this.feedUserId = feedUserId;
|
||||
}
|
||||
|
||||
public Date getLastModified()
|
||||
{
|
||||
return lastModified;
|
||||
}
|
||||
|
||||
public void setLastModified(Date lastModified)
|
||||
{
|
||||
this.lastModified = lastModified;
|
||||
}
|
||||
}
|
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.repo.activities.feed.control;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Interface for user activity feed controls DAO service
|
||||
*/
|
||||
public interface FeedControlDaoService
|
||||
{
|
||||
public long insertFeedControl(FeedControlDAO activityFeedControl) throws SQLException;
|
||||
|
||||
public int deleteFeedControl(FeedControlDAO activityFeedControl) throws SQLException;
|
||||
|
||||
public List<FeedControlDAO> selectFeedControls(String userId) throws SQLException;
|
||||
|
||||
public long selectFeedControl(FeedControlDAO activityFeedControl) throws SQLException;
|
||||
}
|
@@ -27,13 +27,13 @@ package org.alfresco.repo.activities.feed.local;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.activities.feed.ActivityFeedDAO;
|
||||
import org.alfresco.repo.activities.feed.ActivityFeedDaoService;
|
||||
import org.alfresco.repo.activities.feed.FeedTaskProcessor;
|
||||
import org.alfresco.repo.activities.feed.control.FeedControlDAO;
|
||||
import org.alfresco.repo.activities.feed.control.FeedControlDaoService;
|
||||
import org.alfresco.repo.activities.post.ActivityPostDAO;
|
||||
import org.alfresco.repo.activities.post.ActivityPostDaoService;
|
||||
import org.alfresco.repo.domain.activities.ActivityFeedDAO;
|
||||
import org.alfresco.repo.domain.activities.ActivityFeedEntity;
|
||||
import org.alfresco.repo.domain.activities.ActivityPostDAO;
|
||||
import org.alfresco.repo.domain.activities.ActivityPostEntity;
|
||||
import org.alfresco.repo.domain.activities.FeedControlDAO;
|
||||
import org.alfresco.repo.domain.activities.FeedControlEntity;
|
||||
|
||||
import com.ibatis.sqlmap.client.SqlMapClient;
|
||||
|
||||
@@ -42,27 +42,27 @@ import com.ibatis.sqlmap.client.SqlMapClient;
|
||||
*/
|
||||
public class LocalFeedTaskProcessor extends FeedTaskProcessor
|
||||
{
|
||||
private ActivityPostDaoService postDaoService;
|
||||
private ActivityFeedDaoService feedDaoService;
|
||||
private FeedControlDaoService feedControlDaoService;
|
||||
private ActivityPostDAO postDAO;
|
||||
private ActivityFeedDAO feedDAO;
|
||||
private FeedControlDAO feedControlDAO;
|
||||
|
||||
// used to start/end/commit transaction
|
||||
// note: currently assumes that all dao services are configured with this mapper / data source
|
||||
private SqlMapClient sqlMapper;
|
||||
|
||||
public void setPostDaoService(ActivityPostDaoService postDaoService)
|
||||
public void setPostDAO(ActivityPostDAO postDAO)
|
||||
{
|
||||
this.postDaoService = postDaoService;
|
||||
this.postDAO = postDAO;
|
||||
}
|
||||
|
||||
public void setFeedDaoService(ActivityFeedDaoService feedDaoService)
|
||||
public void setFeedDAO(ActivityFeedDAO feedDAO)
|
||||
{
|
||||
this.feedDaoService = feedDaoService;
|
||||
this.feedDAO = feedDAO;
|
||||
}
|
||||
|
||||
public void setFeedControlDaoService(FeedControlDaoService feedControlDaoService)
|
||||
public void setFeedControlDAO(FeedControlDAO feedControlDAO)
|
||||
{
|
||||
this.feedControlDaoService = feedControlDaoService;
|
||||
this.feedControlDAO = feedControlDAO;
|
||||
}
|
||||
|
||||
public void setSqlMapClient(SqlMapClient sqlMapper)
|
||||
@@ -85,23 +85,23 @@ public class LocalFeedTaskProcessor extends FeedTaskProcessor
|
||||
sqlMapper.endTransaction();
|
||||
}
|
||||
|
||||
public List<ActivityPostDAO> selectPosts(ActivityPostDAO selector) throws SQLException
|
||||
public List<ActivityPostEntity> selectPosts(ActivityPostEntity selector) throws SQLException
|
||||
{
|
||||
return postDaoService.selectPosts(selector);
|
||||
return postDAO.selectPosts(selector);
|
||||
}
|
||||
|
||||
public long insertFeedEntry(ActivityFeedDAO feed) throws SQLException
|
||||
public long insertFeedEntry(ActivityFeedEntity feed) throws SQLException
|
||||
{
|
||||
return feedDaoService.insertFeedEntry(feed);
|
||||
return feedDAO.insertFeedEntry(feed);
|
||||
}
|
||||
|
||||
public int updatePostStatus(long id, ActivityPostDAO.STATUS status) throws SQLException
|
||||
public int updatePostStatus(long id, ActivityPostEntity.STATUS status) throws SQLException
|
||||
{
|
||||
return postDaoService.updatePostStatus(id, status);
|
||||
return postDAO.updatePostStatus(id, status);
|
||||
}
|
||||
|
||||
public List<FeedControlDAO> selectUserFeedControls(String userId) throws SQLException
|
||||
public List<FeedControlEntity> selectUserFeedControls(String userId) throws SQLException
|
||||
{
|
||||
return feedControlDaoService.selectFeedControls(userId);
|
||||
return feedControlDAO.selectFeedControls(userId);
|
||||
}
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<hibernate-mapping>
|
||||
|
||||
<class
|
||||
name="org.alfresco.repo.activities.post.ActivityPostDAO"
|
||||
name="org.alfresco.repo.domain.activities.ActivityPostEntity"
|
||||
table="alf_activity_post" >
|
||||
|
||||
<!-- auto-generated ID -->
|
||||
@@ -30,7 +30,7 @@
|
||||
</class>
|
||||
|
||||
<class
|
||||
name="org.alfresco.repo.activities.feed.ActivityFeedDAO"
|
||||
name="org.alfresco.repo.domain.activities.ActivityFeedEntity"
|
||||
table="alf_activity_feed" >
|
||||
|
||||
<!-- auto-generated ID -->
|
||||
@@ -52,7 +52,7 @@
|
||||
</class>
|
||||
|
||||
<class
|
||||
name="org.alfresco.repo.activities.feed.control.FeedControlDAO"
|
||||
name="org.alfresco.repo.domain.activities.FeedControlEntity"
|
||||
table="alf_activity_feed_control" >
|
||||
|
||||
<!-- auto-generated ID -->
|
||||
|
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.repo.activities.ibatis;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* Common interface for activity DAO service
|
||||
*/
|
||||
public interface ActivityDaoService
|
||||
{
|
||||
public void startTransaction() throws SQLException;
|
||||
|
||||
public void commitTransaction() throws SQLException;
|
||||
|
||||
public void endTransaction() throws SQLException;
|
||||
}
|
@@ -1,122 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.repo.activities.ibatis;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.repo.activities.feed.ActivityFeedDAO;
|
||||
import org.alfresco.repo.activities.feed.ActivityFeedDaoService;
|
||||
|
||||
public class IBatisActivityFeedDaoServiceImpl extends IBatisSqlMapper implements ActivityFeedDaoService
|
||||
{
|
||||
public long insertFeedEntry(ActivityFeedDAO activityFeed) throws SQLException
|
||||
{
|
||||
Long id = (Long)getSqlMapClient().insert("insert.activity.feed", activityFeed);
|
||||
return (id != null ? id : -1);
|
||||
}
|
||||
|
||||
public int deleteFeedEntries(Date keepDate) throws SQLException
|
||||
{
|
||||
return getSqlMapClient().delete("delete.activity.feed.entries.older.than.date", keepDate);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<ActivityFeedDAO> selectUserFeedEntries(String feedUserId, String format, String siteId, boolean excludeThisUser, boolean excludeOtherUsers) throws SQLException
|
||||
{
|
||||
ActivityFeedDAO params = new ActivityFeedDAO();
|
||||
params.setFeedUserId(feedUserId);
|
||||
params.setActivitySummaryFormat(format);
|
||||
|
||||
if (siteId != null)
|
||||
{
|
||||
// given site
|
||||
params.setSiteNetwork(siteId);
|
||||
|
||||
if (excludeThisUser && excludeOtherUsers)
|
||||
{
|
||||
// effectively NOOP - return empty feed
|
||||
return new ArrayList<ActivityFeedDAO>(0);
|
||||
}
|
||||
if ((!excludeThisUser) && (!excludeOtherUsers))
|
||||
{
|
||||
// no excludes => everyone => where feed user is me
|
||||
return (List<ActivityFeedDAO>)getSqlMapClient().queryForList("select.activity.feed.for.feeduser.and.site", params);
|
||||
}
|
||||
else if ((excludeThisUser) && (!excludeOtherUsers))
|
||||
{
|
||||
// exclude feed user => others => where feed user is me and post user is not me
|
||||
return (List<ActivityFeedDAO>)getSqlMapClient().queryForList("select.activity.feed.for.feeduser.others.and.site", params);
|
||||
}
|
||||
else if ((excludeOtherUsers) && (!excludeThisUser))
|
||||
{
|
||||
// exclude others => me => where feed user is me and post user is me
|
||||
return (List<ActivityFeedDAO>)getSqlMapClient().queryForList("select.activity.feed.for.feeduser.me.and.site", params);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// all sites
|
||||
|
||||
if (excludeThisUser && excludeOtherUsers)
|
||||
{
|
||||
// effectively NOOP - return empty feed
|
||||
return new ArrayList<ActivityFeedDAO>(0);
|
||||
}
|
||||
if (!excludeThisUser && !excludeOtherUsers)
|
||||
{
|
||||
// no excludes => everyone => where feed user is me
|
||||
return (List<ActivityFeedDAO>)getSqlMapClient().queryForList("select.activity.feed.for.feeduser", params);
|
||||
}
|
||||
else if (excludeThisUser)
|
||||
{
|
||||
// exclude feed user => others => where feed user is me and post user is not me
|
||||
return (List<ActivityFeedDAO>)getSqlMapClient().queryForList("select.activity.feed.for.feeduser.others", params);
|
||||
}
|
||||
else if (excludeOtherUsers)
|
||||
{
|
||||
// exclude others => me => where feed user is me and post user is me
|
||||
return (List<ActivityFeedDAO>)getSqlMapClient().queryForList("select.activity.feed.for.feeduser.me", params);
|
||||
}
|
||||
}
|
||||
|
||||
// belts-and-braces
|
||||
throw new AlfrescoRuntimeException("Unexpected: invalid arguments");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<ActivityFeedDAO> selectSiteFeedEntries(String siteId, String format) throws SQLException
|
||||
{
|
||||
ActivityFeedDAO params = new ActivityFeedDAO();
|
||||
params.setSiteNetwork(siteId);
|
||||
params.setActivitySummaryFormat(format);
|
||||
|
||||
// for given site
|
||||
return (List<ActivityFeedDAO>)getSqlMapClient().queryForList("select.activity.feed.for.site", params);
|
||||
}
|
||||
}
|
@@ -1,108 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.repo.activities.ibatis;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.activities.post.ActivityPostDAO;
|
||||
import org.alfresco.repo.activities.post.ActivityPostDaoService;
|
||||
|
||||
public class IBatisActivityPostDaoServiceImpl extends IBatisSqlMapper implements ActivityPostDaoService
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<ActivityPostDAO> selectPosts(ActivityPostDAO activityPost) throws SQLException
|
||||
{
|
||||
if ((activityPost.getJobTaskNode() != -1) &&
|
||||
(activityPost.getMinId() != -1) &&
|
||||
(activityPost.getMaxId() != -1) &&
|
||||
(activityPost.getStatus() != null))
|
||||
{
|
||||
return (List<ActivityPostDAO>)getSqlMapClient().queryForList("select.activity.posts", activityPost);
|
||||
}
|
||||
else if (activityPost.getStatus() != null)
|
||||
{
|
||||
return (List<ActivityPostDAO>)getSqlMapClient().queryForList("select.activity.posts.by.status.only", activityPost);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ArrayList<ActivityPostDAO>(0);
|
||||
}
|
||||
}
|
||||
|
||||
public Long getMaxActivitySeq() throws SQLException
|
||||
{
|
||||
return (Long)getSqlMapClient().queryForObject("select.activity.post.max.seq");
|
||||
}
|
||||
|
||||
public Long getMinActivitySeq() throws SQLException
|
||||
{
|
||||
return (Long)getSqlMapClient().queryForObject("select.activity.post.min.seq");
|
||||
}
|
||||
|
||||
public Integer getMaxNodeHash() throws SQLException
|
||||
{
|
||||
return (Integer)getSqlMapClient().queryForObject("select.activity.post.max.jobtasknode");
|
||||
}
|
||||
|
||||
public int updatePost(long id, String siteNetwork, String activityData, ActivityPostDAO.STATUS status) throws SQLException
|
||||
{
|
||||
ActivityPostDAO post = new ActivityPostDAO();
|
||||
post.setId(id);
|
||||
post.setSiteNetwork(siteNetwork);
|
||||
post.setActivityData(activityData);
|
||||
post.setStatus(status.toString());
|
||||
post.setLastModified(new Date());
|
||||
|
||||
return getSqlMapClient().update("update.activity.post.data", post);
|
||||
}
|
||||
|
||||
public int updatePostStatus(long id, ActivityPostDAO.STATUS status) throws SQLException
|
||||
{
|
||||
ActivityPostDAO post = new ActivityPostDAO();
|
||||
post.setId(id);
|
||||
post.setStatus(status.toString());
|
||||
post.setLastModified(new Date());
|
||||
|
||||
return getSqlMapClient().update("update.activity.post.status", post);
|
||||
}
|
||||
|
||||
public int deletePosts(Date keepDate, ActivityPostDAO.STATUS status) throws SQLException
|
||||
{
|
||||
ActivityPostDAO params = new ActivityPostDAO();
|
||||
params.setPostDate(keepDate);
|
||||
params.setStatus(status.toString());
|
||||
|
||||
return getSqlMapClient().delete("delete.activity.posts.older.than.date", params);
|
||||
}
|
||||
|
||||
public long insertPost(ActivityPostDAO activityPost) throws SQLException
|
||||
{
|
||||
Long id = (Long)getSqlMapClient().insert("insert.activity.post", activityPost);
|
||||
return (id != null ? id : -1);
|
||||
}
|
||||
}
|
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.repo.activities.ibatis;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.activities.feed.control.FeedControlDAO;
|
||||
import org.alfresco.repo.activities.feed.control.FeedControlDaoService;
|
||||
|
||||
public class IBatisFeedControlDaoServiceImpl extends IBatisSqlMapper implements FeedControlDaoService
|
||||
{
|
||||
public long insertFeedControl(FeedControlDAO activityFeedControl) throws SQLException
|
||||
{
|
||||
Long id = (Long)getSqlMapClient().insert("insert.activity.feedcontrol", activityFeedControl);
|
||||
return (id != null ? id : -1);
|
||||
}
|
||||
|
||||
public int deleteFeedControl(FeedControlDAO activityFeedControl) throws SQLException
|
||||
{
|
||||
return getSqlMapClient().delete("delete.activity.feedcontrol", activityFeedControl);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<FeedControlDAO> selectFeedControls(String feedUserId) throws SQLException
|
||||
{
|
||||
FeedControlDAO params = new FeedControlDAO(feedUserId);
|
||||
|
||||
return (List<FeedControlDAO>)getSqlMapClient().queryForList("select.activity.feedcontrols.for.user", params);
|
||||
}
|
||||
|
||||
public long selectFeedControl(FeedControlDAO activityFeedControl) throws SQLException
|
||||
{
|
||||
Long id = (Long)getSqlMapClient().queryForObject("select.activity.feedcontrol", activityFeedControl);
|
||||
return (id != null ? id : -1);
|
||||
}
|
||||
}
|
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.repo.activities.ibatis;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import com.ibatis.sqlmap.client.SqlMapClient;
|
||||
|
||||
public class IBatisSqlMapper implements ActivityDaoService
|
||||
{
|
||||
private SqlMapClient sqlMapper;
|
||||
|
||||
public void setSqlMapClient(SqlMapClient sqlMapper)
|
||||
{
|
||||
this.sqlMapper = sqlMapper;
|
||||
}
|
||||
|
||||
public SqlMapClient getSqlMapClient()
|
||||
{
|
||||
return this.sqlMapper;
|
||||
}
|
||||
|
||||
public void startTransaction() throws SQLException
|
||||
{
|
||||
sqlMapper.startTransaction();
|
||||
}
|
||||
|
||||
public void commitTransaction() throws SQLException
|
||||
{
|
||||
sqlMapper.commitTransaction();
|
||||
}
|
||||
|
||||
public void endTransaction() throws SQLException
|
||||
{
|
||||
sqlMapper.endTransaction();
|
||||
}
|
||||
}
|
@@ -1,186 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.repo.activities.post;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Activity Post DAO
|
||||
*/
|
||||
public class ActivityPostDAO
|
||||
{
|
||||
public enum STATUS { POSTED, PENDING, PROCESSED, ERROR };
|
||||
|
||||
private Long id; // internal DB-generated sequence id
|
||||
private String activityData;
|
||||
private String activityType;
|
||||
private String userId;
|
||||
private int jobTaskNode = -1;
|
||||
private String siteNetwork;
|
||||
private String appTool;
|
||||
private String status;
|
||||
private Date postDate;
|
||||
private Date lastModified; // for debug
|
||||
|
||||
// for selector
|
||||
private long minId = -1;
|
||||
private long maxId = -1;
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public int getJobTaskNode()
|
||||
{
|
||||
return jobTaskNode;
|
||||
}
|
||||
|
||||
public void setJobTaskNode(int jobTaskNode)
|
||||
{
|
||||
this.jobTaskNode = jobTaskNode;
|
||||
}
|
||||
|
||||
public long getMinId()
|
||||
{
|
||||
return minId;
|
||||
}
|
||||
|
||||
public void setMinId(long minId)
|
||||
{
|
||||
this.minId = minId;
|
||||
}
|
||||
|
||||
public long getMaxId()
|
||||
{
|
||||
return maxId;
|
||||
}
|
||||
|
||||
public void setMaxId(long maxId)
|
||||
{
|
||||
this.maxId = maxId;
|
||||
}
|
||||
|
||||
public String getSiteNetwork()
|
||||
{
|
||||
return siteNetwork;
|
||||
}
|
||||
|
||||
public void setSiteNetwork(String siteNetwork)
|
||||
{
|
||||
this.siteNetwork = siteNetwork;
|
||||
}
|
||||
|
||||
public String getActivityData()
|
||||
{
|
||||
return activityData;
|
||||
}
|
||||
|
||||
public void setActivityData(String activityData)
|
||||
{
|
||||
this.activityData = activityData;
|
||||
}
|
||||
|
||||
public String getActivityType()
|
||||
{
|
||||
return activityType;
|
||||
}
|
||||
|
||||
public void setActivityType(String activityType)
|
||||
{
|
||||
this.activityType = activityType;
|
||||
}
|
||||
|
||||
public Date getPostDate()
|
||||
{
|
||||
return postDate;
|
||||
}
|
||||
|
||||
public void setPostDate(Date postDate)
|
||||
{
|
||||
this.postDate = postDate;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Date getLastModified()
|
||||
{
|
||||
return lastModified;
|
||||
}
|
||||
|
||||
public void setLastModified(Date lastModified)
|
||||
{
|
||||
this.lastModified = lastModified;
|
||||
}
|
||||
|
||||
public String getAppTool()
|
||||
{
|
||||
return appTool;
|
||||
}
|
||||
|
||||
public void setAppTool(String appTool)
|
||||
{
|
||||
this.appTool = appTool;
|
||||
}
|
||||
|
||||
// for debug only
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("ActivityPost\n[");
|
||||
sb.append("id=").append(id).append(",");
|
||||
sb.append("status=").append(status).append(",");
|
||||
sb.append("postDate=").append(postDate).append(",");
|
||||
sb.append("userId=").append(userId).append(",");
|
||||
sb.append("siteNetwork=").append(siteNetwork).append(",");
|
||||
sb.append("appTool=").append(appTool).append(",");
|
||||
sb.append("type=").append(activityType).append(",");
|
||||
sb.append("jobTaskNode=").append(jobTaskNode).append(",");
|
||||
sb.append("data=\n").append(activityData).append("\n]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.repo.activities.post;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.activities.ibatis.ActivityDaoService;
|
||||
|
||||
/**
|
||||
* Interface for activity post DAO service
|
||||
*/
|
||||
public interface ActivityPostDaoService extends ActivityDaoService
|
||||
{
|
||||
public List<ActivityPostDAO> selectPosts(ActivityPostDAO activityPost) throws SQLException;
|
||||
|
||||
public Long getMaxActivitySeq() throws SQLException;
|
||||
|
||||
public Long getMinActivitySeq() throws SQLException;
|
||||
|
||||
public Integer getMaxNodeHash() throws SQLException;
|
||||
|
||||
public int deletePosts(Date keepDate, ActivityPostDAO.STATUS status) throws SQLException;
|
||||
|
||||
public long insertPost(ActivityPostDAO activityPost) throws SQLException;
|
||||
|
||||
public int updatePost(long id, String network, String activityData, ActivityPostDAO.STATUS status) throws SQLException;
|
||||
|
||||
public int updatePostStatus(long id, ActivityPostDAO.STATUS status) throws SQLException;
|
||||
}
|
@@ -28,8 +28,8 @@ import java.sql.SQLException;
|
||||
import java.util.Date;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.repo.activities.post.ActivityPostDAO;
|
||||
import org.alfresco.repo.activities.post.ActivityPostDaoService;
|
||||
import org.alfresco.repo.domain.activities.ActivityPostDAO;
|
||||
import org.alfresco.repo.domain.activities.ActivityPostEntity;
|
||||
import org.alfresco.util.PropertyCheck;
|
||||
import org.alfresco.util.VmShutdownListener;
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -47,11 +47,11 @@ public class PostCleaner
|
||||
|
||||
private int maxAgeMins = 0;
|
||||
|
||||
private ActivityPostDaoService postDaoService;
|
||||
private ActivityPostDAO postDAO;
|
||||
|
||||
public void setPostDaoService(ActivityPostDaoService postDaoService)
|
||||
public void setPostDAO(ActivityPostDAO postDAO)
|
||||
{
|
||||
this.postDaoService = postDaoService;
|
||||
this.postDAO = postDAO;
|
||||
}
|
||||
|
||||
public void setMaxAgeMins(int mins)
|
||||
@@ -64,7 +64,7 @@ public class PostCleaner
|
||||
*/
|
||||
private void checkProperties()
|
||||
{
|
||||
PropertyCheck.mandatory(this, "postDaoService", postDaoService);
|
||||
PropertyCheck.mandatory(this, "postDAO", postDAO);
|
||||
|
||||
// check the max age
|
||||
if (maxAgeMins <= 0)
|
||||
@@ -83,7 +83,7 @@ public class PostCleaner
|
||||
Date keepDate = new Date(keepTimeOffset);
|
||||
|
||||
// clean old entries - PROCESSED - does not clean POSTED or PENDING, which will need to be done manually, if stuck
|
||||
int deletedCount = postDaoService.deletePosts(keepDate, ActivityPostDAO.STATUS.PROCESSED);
|
||||
int deletedCount = postDAO.deletePosts(keepDate, ActivityPostEntity.STATUS.PROCESSED);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
|
@@ -29,8 +29,8 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.activities.post.ActivityPostDAO;
|
||||
import org.alfresco.repo.activities.post.ActivityPostDaoService;
|
||||
import org.alfresco.repo.domain.activities.ActivityPostDAO;
|
||||
import org.alfresco.repo.domain.activities.ActivityPostEntity;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||
import org.alfresco.repo.tenant.TenantService;
|
||||
@@ -61,16 +61,16 @@ public class PostLookup
|
||||
|
||||
private static VmShutdownListener vmShutdownListener = new VmShutdownListener(PostLookup.class.getName());
|
||||
|
||||
private ActivityPostDaoService postDaoService;
|
||||
private ActivityPostDAO postDAO;
|
||||
private NodeService nodeService;
|
||||
private PermissionService permissionService;
|
||||
private TransactionService transactionService;
|
||||
private PersonService personService;
|
||||
private TenantService tenantService;
|
||||
|
||||
public void setPostDaoService(ActivityPostDaoService postDaoService)
|
||||
public void setPostDAO(ActivityPostDAO postDAO)
|
||||
{
|
||||
this.postDaoService = postDaoService;
|
||||
this.postDAO = postDAO;
|
||||
}
|
||||
|
||||
public void setNodeService(NodeService nodeService)
|
||||
@@ -103,7 +103,7 @@ public class PostLookup
|
||||
*/
|
||||
private void checkProperties()
|
||||
{
|
||||
PropertyCheck.mandatory(this, "postDaoService", postDaoService);
|
||||
PropertyCheck.mandatory(this, "postDAO", postDAO);
|
||||
PropertyCheck.mandatory(this, "nodeService", nodeService);
|
||||
PropertyCheck.mandatory(this, "permissionService", permissionService);
|
||||
PropertyCheck.mandatory(this, "transactionService", transactionService);
|
||||
@@ -116,21 +116,21 @@ public class PostLookup
|
||||
checkProperties();
|
||||
try
|
||||
{
|
||||
ActivityPostDAO params = new ActivityPostDAO();
|
||||
params.setStatus(ActivityPostDAO.STATUS.PENDING.toString());
|
||||
ActivityPostEntity params = new ActivityPostEntity();
|
||||
params.setStatus(ActivityPostEntity.STATUS.PENDING.toString());
|
||||
|
||||
List<ActivityPostDAO> activityPosts = postDaoService.selectPosts(params);
|
||||
List<ActivityPostEntity> activityPosts = postDAO.selectPosts(params);
|
||||
|
||||
if (activityPosts.size() > 0)
|
||||
{
|
||||
logger.info("Update: " + activityPosts.size() + " activity posts");
|
||||
}
|
||||
|
||||
for (final ActivityPostDAO activityPost : activityPosts)
|
||||
for (final ActivityPostEntity activityPost : activityPosts)
|
||||
{
|
||||
try
|
||||
{
|
||||
postDaoService.startTransaction();
|
||||
postDAO.startTransaction();
|
||||
|
||||
final JSONObject jo = new JSONObject(new JSONTokener(activityPost.getActivityData()));
|
||||
final String postUserId = activityPost.getUserId();
|
||||
@@ -167,10 +167,10 @@ public class PostLookup
|
||||
|
||||
activityPost.setLastModified(new Date());
|
||||
|
||||
postDaoService.updatePost(activityPost.getId(), activityPost.getSiteNetwork(), activityPost.getActivityData(), ActivityPostDAO.STATUS.POSTED);
|
||||
postDAO.updatePost(activityPost.getId(), activityPost.getSiteNetwork(), activityPost.getActivityData(), ActivityPostEntity.STATUS.POSTED);
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
activityPost.setStatus(ActivityPostDAO.STATUS.POSTED.toString()); // for debug output
|
||||
activityPost.setStatus(ActivityPostEntity.STATUS.POSTED.toString()); // for debug output
|
||||
logger.debug("Updated: " + activityPost);
|
||||
}
|
||||
|
||||
@@ -178,15 +178,15 @@ public class PostLookup
|
||||
}
|
||||
}, tenantService.getDomainUser(AuthenticationUtil.getSystemUserName(), tenantDomain));
|
||||
|
||||
postDaoService.commitTransaction();
|
||||
postDAO.commitTransaction();
|
||||
}
|
||||
catch (JSONException e)
|
||||
{
|
||||
// log error, but consume exception (skip this post)
|
||||
logger.error("Skipping activity post " + activityPost.getId() + ": " + e);
|
||||
postDaoService.updatePostStatus(activityPost.getId(), ActivityPostDAO.STATUS.ERROR);
|
||||
postDAO.updatePostStatus(activityPost.getId(), ActivityPostEntity.STATUS.ERROR);
|
||||
|
||||
postDaoService.commitTransaction();
|
||||
postDAO.commitTransaction();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
@@ -195,7 +195,7 @@ public class PostLookup
|
||||
}
|
||||
finally
|
||||
{
|
||||
postDaoService.endTransaction();
|
||||
postDAO.endTransaction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user