mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +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:
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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.domain.activities;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* Common interface for activity DAO service
|
||||
*/
|
||||
public interface ActivitiesDAO
|
||||
{
|
||||
public void startTransaction() throws SQLException;
|
||||
|
||||
public void commitTransaction() throws SQLException;
|
||||
|
||||
public void endTransaction() throws SQLException;
|
||||
}
|
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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.domain.activities;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Interface for activity feed DAO service
|
||||
*/
|
||||
public interface ActivityFeedDAO extends ActivitiesDAO
|
||||
{
|
||||
public long insertFeedEntry(ActivityFeedEntity activityFeed) throws SQLException;
|
||||
|
||||
public int deleteFeedEntries(Date keepDate) throws SQLException;
|
||||
|
||||
public List<ActivityFeedEntity> selectUserFeedEntries(String feedUserId, String format, String siteId, boolean excludeThisUser, boolean excludeOtherUsers) throws SQLException;
|
||||
|
||||
public List<ActivityFeedEntity> selectSiteFeedEntries(String siteUserId, String format) throws SQLException;
|
||||
}
|
@@ -0,0 +1,175 @@
|
||||
/*
|
||||
* 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.domain.activities;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.alfresco.util.ISO8601DateFormat;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/**
|
||||
* Activity Feed DAO
|
||||
*/
|
||||
public class ActivityFeedEntity
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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.domain.activities;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Interface for activity post DAO service
|
||||
*/
|
||||
public interface ActivityPostDAO extends ActivitiesDAO
|
||||
{
|
||||
public List<ActivityPostEntity> selectPosts(ActivityPostEntity activityPost) throws SQLException;
|
||||
|
||||
public Long getMaxActivitySeq() throws SQLException;
|
||||
|
||||
public Long getMinActivitySeq() throws SQLException;
|
||||
|
||||
public Integer getMaxNodeHash() throws SQLException;
|
||||
|
||||
public int deletePosts(Date keepDate, ActivityPostEntity.STATUS status) throws SQLException;
|
||||
|
||||
public long insertPost(ActivityPostEntity activityPost) throws SQLException;
|
||||
|
||||
public int updatePost(long id, String network, String activityData, ActivityPostEntity.STATUS status) throws SQLException;
|
||||
|
||||
public int updatePostStatus(long id, ActivityPostEntity.STATUS status) throws SQLException;
|
||||
}
|
@@ -0,0 +1,186 @@
|
||||
/*
|
||||
* 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.domain.activities;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Activity Post DAO
|
||||
*/
|
||||
public class ActivityPostEntity
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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.domain.activities;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Interface for user activity feed controls DAO service
|
||||
*/
|
||||
public interface FeedControlDAO
|
||||
{
|
||||
public long insertFeedControl(FeedControlEntity activityFeedControl) throws SQLException;
|
||||
|
||||
public int deleteFeedControl(FeedControlEntity activityFeedControl) throws SQLException;
|
||||
|
||||
public List<FeedControlEntity> selectFeedControls(String userId) throws SQLException;
|
||||
|
||||
public long selectFeedControl(FeedControlEntity activityFeedControl) throws SQLException;
|
||||
}
|
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* 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.domain.activities;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.alfresco.service.cmr.activities.FeedControl;
|
||||
|
||||
/**
|
||||
* Activity Feed Control DAO
|
||||
*/
|
||||
public class FeedControlEntity
|
||||
{
|
||||
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 FeedControlEntity()
|
||||
{
|
||||
}
|
||||
|
||||
public FeedControlEntity(String feedUserId)
|
||||
{
|
||||
this.feedUserId = feedUserId;
|
||||
}
|
||||
|
||||
public FeedControlEntity(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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* 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.domain.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.domain.activities.ActivityFeedDAO;
|
||||
import org.alfresco.repo.domain.activities.ActivityFeedEntity;
|
||||
|
||||
public class ActivityFeedDAOImpl extends IBatisSqlMapper implements ActivityFeedDAO
|
||||
{
|
||||
public long insertFeedEntry(ActivityFeedEntity 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<ActivityFeedEntity> selectUserFeedEntries(String feedUserId, String format, String siteId, boolean excludeThisUser, boolean excludeOtherUsers) throws SQLException
|
||||
{
|
||||
ActivityFeedEntity params = new ActivityFeedEntity();
|
||||
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<ActivityFeedEntity>(0);
|
||||
}
|
||||
if ((!excludeThisUser) && (!excludeOtherUsers))
|
||||
{
|
||||
// no excludes => everyone => where feed user is me
|
||||
return (List<ActivityFeedEntity>)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<ActivityFeedEntity>)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<ActivityFeedEntity>)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<ActivityFeedEntity>(0);
|
||||
}
|
||||
if (!excludeThisUser && !excludeOtherUsers)
|
||||
{
|
||||
// no excludes => everyone => where feed user is me
|
||||
return (List<ActivityFeedEntity>)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<ActivityFeedEntity>)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<ActivityFeedEntity>)getSqlMapClient().queryForList("select.activity.feed.for.feeduser.me", params);
|
||||
}
|
||||
}
|
||||
|
||||
// belts-and-braces
|
||||
throw new AlfrescoRuntimeException("Unexpected: invalid arguments");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<ActivityFeedEntity> selectSiteFeedEntries(String siteId, String format) throws SQLException
|
||||
{
|
||||
ActivityFeedEntity params = new ActivityFeedEntity();
|
||||
params.setSiteNetwork(siteId);
|
||||
params.setActivitySummaryFormat(format);
|
||||
|
||||
// for given site
|
||||
return (List<ActivityFeedEntity>)getSqlMapClient().queryForList("select.activity.feed.for.site", params);
|
||||
}
|
||||
}
|
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* 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.domain.activities.ibatis;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.domain.activities.ActivityPostDAO;
|
||||
import org.alfresco.repo.domain.activities.ActivityPostEntity;
|
||||
|
||||
public class ActivityPostDAOImpl extends IBatisSqlMapper implements ActivityPostDAO
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<ActivityPostEntity> selectPosts(ActivityPostEntity activityPost) throws SQLException
|
||||
{
|
||||
if ((activityPost.getJobTaskNode() != -1) &&
|
||||
(activityPost.getMinId() != -1) &&
|
||||
(activityPost.getMaxId() != -1) &&
|
||||
(activityPost.getStatus() != null))
|
||||
{
|
||||
return (List<ActivityPostEntity>)getSqlMapClient().queryForList("select.activity.posts", activityPost);
|
||||
}
|
||||
else if (activityPost.getStatus() != null)
|
||||
{
|
||||
return (List<ActivityPostEntity>)getSqlMapClient().queryForList("select.activity.posts.by.status.only", activityPost);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ArrayList<ActivityPostEntity>(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, ActivityPostEntity.STATUS status) throws SQLException
|
||||
{
|
||||
ActivityPostEntity post = new ActivityPostEntity();
|
||||
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, ActivityPostEntity.STATUS status) throws SQLException
|
||||
{
|
||||
ActivityPostEntity post = new ActivityPostEntity();
|
||||
post.setId(id);
|
||||
post.setStatus(status.toString());
|
||||
post.setLastModified(new Date());
|
||||
|
||||
return getSqlMapClient().update("update.activity.post.status", post);
|
||||
}
|
||||
|
||||
public int deletePosts(Date keepDate, ActivityPostEntity.STATUS status) throws SQLException
|
||||
{
|
||||
ActivityPostEntity params = new ActivityPostEntity();
|
||||
params.setPostDate(keepDate);
|
||||
params.setStatus(status.toString());
|
||||
|
||||
return getSqlMapClient().delete("delete.activity.posts.older.than.date", params);
|
||||
}
|
||||
|
||||
public long insertPost(ActivityPostEntity activityPost) throws SQLException
|
||||
{
|
||||
Long id = (Long)getSqlMapClient().insert("insert.activity.post", activityPost);
|
||||
return (id != null ? id : -1);
|
||||
}
|
||||
}
|
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* 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.domain.activities.ibatis;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.domain.activities.FeedControlDAO;
|
||||
import org.alfresco.repo.domain.activities.FeedControlEntity;
|
||||
|
||||
public class FeedControlDAOImpl extends IBatisSqlMapper implements FeedControlDAO
|
||||
{
|
||||
public long insertFeedControl(FeedControlEntity activityFeedControl) throws SQLException
|
||||
{
|
||||
Long id = (Long)getSqlMapClient().insert("insert.activity.feedcontrol", activityFeedControl);
|
||||
return (id != null ? id : -1);
|
||||
}
|
||||
|
||||
public int deleteFeedControl(FeedControlEntity activityFeedControl) throws SQLException
|
||||
{
|
||||
return getSqlMapClient().delete("delete.activity.feedcontrol", activityFeedControl);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<FeedControlEntity> selectFeedControls(String feedUserId) throws SQLException
|
||||
{
|
||||
FeedControlEntity params = new FeedControlEntity(feedUserId);
|
||||
|
||||
return (List<FeedControlEntity>)getSqlMapClient().queryForList("select.activity.feedcontrols.for.user", params);
|
||||
}
|
||||
|
||||
public long selectFeedControl(FeedControlEntity activityFeedControl) throws SQLException
|
||||
{
|
||||
Long id = (Long)getSqlMapClient().queryForObject("select.activity.feedcontrol", activityFeedControl);
|
||||
return (id != null ? id : -1);
|
||||
}
|
||||
}
|
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* 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.domain.activities.ibatis;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.alfresco.repo.domain.activities.ActivitiesDAO;
|
||||
|
||||
import com.ibatis.sqlmap.client.SqlMapClient;
|
||||
|
||||
public class IBatisSqlMapper implements ActivitiesDAO
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
@@ -0,0 +1,255 @@
|
||||
/*
|
||||
* 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.domain.locks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.alfresco.repo.domain.QNameDAO;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.EqualsHelper;
|
||||
import org.springframework.dao.ConcurrencyFailureException;
|
||||
|
||||
/**
|
||||
* Abstract implementation of the Locks DAO.
|
||||
*
|
||||
* @author Derek Hulley
|
||||
* @since 3.2
|
||||
*/
|
||||
public abstract class AbstractLockDAOImpl implements LockDAO
|
||||
{
|
||||
private QNameDAO qnameDAO;
|
||||
|
||||
/**
|
||||
* @return Returns the DAO for namespace ID resolution
|
||||
*/
|
||||
protected QNameDAO getQNameDAO()
|
||||
{
|
||||
return qnameDAO;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param qnameDAO DAO for namespace ID resolution
|
||||
*/
|
||||
public void setQnameDAO(QNameDAO qnameDAO)
|
||||
{
|
||||
this.qnameDAO = qnameDAO;
|
||||
}
|
||||
|
||||
public boolean getLock(QName lockQName, String lockApplicant, long timeToLive)
|
||||
{
|
||||
String qnameNamespaceUri = lockQName.getNamespaceURI();
|
||||
String qnameLocalName = lockQName.getLocalName();
|
||||
// Force lower case for case insensitivity
|
||||
if (!qnameLocalName.toLowerCase().equals(qnameLocalName))
|
||||
{
|
||||
lockQName = QName.createQName(qnameNamespaceUri, qnameLocalName.toLowerCase());
|
||||
qnameLocalName = lockQName.getLocalName();
|
||||
}
|
||||
// Force the lock applicant to lowercase
|
||||
lockApplicant = lockApplicant.toLowerCase();
|
||||
|
||||
// Resolve the namespace
|
||||
Long qnameNamespaceId = qnameDAO.getOrCreateNamespace(qnameNamespaceUri).getFirst();
|
||||
|
||||
// Get the lock resource for the exclusive lock.
|
||||
// All the locks that are created will need the exclusive case.
|
||||
LockResourceEntity exclusiveLockResource = getLockResource(qnameNamespaceId, qnameLocalName);
|
||||
if (exclusiveLockResource == null)
|
||||
{
|
||||
// Create it
|
||||
exclusiveLockResource = createLockResource(qnameNamespaceId, qnameLocalName);
|
||||
}
|
||||
Long requiredExclusiveLockResourceId = exclusiveLockResource.getId();
|
||||
// Split the lock name
|
||||
List<QName> lockQNames = splitLockQName(lockQName);
|
||||
List<Long> requiredLockResourceIds = new ArrayList<Long>(lockQNames.size());
|
||||
// Create the lock resources
|
||||
for (QName lockQNameIter : lockQNames)
|
||||
{
|
||||
String localname = lockQNameIter.getLocalName();
|
||||
// Get the basic lock resource, forcing a create
|
||||
// TODO: Pull back all lock resources in a single query
|
||||
LockResourceEntity lockResource = getLockResource(qnameNamespaceId, localname);
|
||||
if (lockResource == null)
|
||||
{
|
||||
// Create it
|
||||
lockResource = createLockResource(qnameNamespaceId, localname);
|
||||
}
|
||||
requiredLockResourceIds.add(lockResource.getId());
|
||||
}
|
||||
|
||||
// Now, get all locks for the resources we will need
|
||||
List<LockEntity> existingLocks = getLocks(requiredLockResourceIds);
|
||||
Map<LockEntity, LockEntity> existingLocksMap = new HashMap<LockEntity, LockEntity>();
|
||||
// Check them and make sure they don't prevent locks
|
||||
for (LockEntity existingLock : existingLocks)
|
||||
{
|
||||
boolean canTakeLock = canTakeLock(existingLock, lockApplicant, requiredExclusiveLockResourceId);
|
||||
if (!canTakeLock)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
existingLocksMap.put(existingLock, existingLock);
|
||||
}
|
||||
// Take the locks for the resources.
|
||||
// Existing locks must be updated, if required.
|
||||
for (Long requiredLockResourceId : requiredLockResourceIds)
|
||||
{
|
||||
LockEntity requiredLock = new LockEntity();
|
||||
requiredLock.setSharedResourceId(requiredLockResourceId);
|
||||
requiredLock.setExclusiveResourceId(requiredExclusiveLockResourceId);
|
||||
// Does it exist?
|
||||
if (existingLocksMap.containsKey(requiredLock))
|
||||
{
|
||||
requiredLock = existingLocksMap.get(requiredLock);
|
||||
// Do an update
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create it
|
||||
requiredLock = createLock(
|
||||
requiredLockResourceId,
|
||||
requiredExclusiveLockResourceId,
|
||||
lockApplicant,
|
||||
timeToLive);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean canTakeLock(LockEntity existingLock, String lockApplicant, Long desiredExclusiveLock)
|
||||
{
|
||||
if (EqualsHelper.nullSafeEquals(existingLock.getLockHolder(), lockApplicant))
|
||||
{
|
||||
// The lock applicant to be is also the current lock holder.
|
||||
// Regardless of lock expiry, the lock can be taken
|
||||
return true;
|
||||
}
|
||||
else if (existingLock.hasExpired())
|
||||
{
|
||||
// Expired locks are fair game
|
||||
return true;
|
||||
}
|
||||
else if (existingLock.isExclusive())
|
||||
{
|
||||
// It's a valid, exclusive lock held by someone else ...
|
||||
return false;
|
||||
}
|
||||
else if (desiredExclusiveLock.equals(existingLock.getSharedResourceId()))
|
||||
{
|
||||
// We can't take an exclusive lock if a shared lock is active
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Good to go
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to get the unique, lock resource entity if one exists.
|
||||
*
|
||||
* @param qnameNamespaceId the namespace entity ID
|
||||
* @param qnameLocalName the lock localname
|
||||
* @return Returns the lock resource entity,
|
||||
* or <tt>null</tt> if it doesn't exist
|
||||
*/
|
||||
protected abstract LockResourceEntity getLockResource(Long qnameNamespaceId, String qnameLocalName);
|
||||
|
||||
/**
|
||||
* Create a unique lock resource
|
||||
*
|
||||
* @param qnameNamespaceId the namespace entity ID
|
||||
* @param qnameLocalName the lock localname
|
||||
* @return Returns the newly created lock resource entity
|
||||
*/
|
||||
protected abstract LockResourceEntity createLockResource(Long qnameNamespaceId, String qnameLocalName);
|
||||
|
||||
/**
|
||||
* Get any existing lock data for the resources required. The locks returned are not filtered and
|
||||
* may be expired.
|
||||
*
|
||||
* @param lockResourceIds a list of resource IDs for which to retrieve the current locks
|
||||
* @return Returns a list of locks (expired or not) for the given lock resources
|
||||
*/
|
||||
protected abstract List<LockEntity> getLocks(List<Long> lockResourceIds);
|
||||
|
||||
/**
|
||||
* Create a new lock.
|
||||
* @param sharedResourceId the specific resource to lock
|
||||
* @param exclusiveResourceId the exclusive lock that is being sought
|
||||
* @param lockApplicant the ID of the lock applicant
|
||||
* @param timeToLive the time, in milliseconds, for the lock to remain valid
|
||||
* @return Returns the new lock
|
||||
* @throws ConcurrencyFailureException if the lock was already taken at the time of creation
|
||||
*/
|
||||
protected abstract LockEntity createLock(
|
||||
Long sharedResourceId,
|
||||
Long exclusiveResourceId,
|
||||
String lockApplicant,
|
||||
long timeToLive);
|
||||
|
||||
/**
|
||||
* Split a lock's qualified name into the component parts using the '.' (period) as a
|
||||
* separator on the localname. The namespace is preserved. The provided qualified
|
||||
* name will always be the last component in the returned list.
|
||||
*
|
||||
* @param lockQName the lock name to split into it's higher-level paths
|
||||
* @return Returns the namespace ID along with the ordered localnames
|
||||
*/
|
||||
protected List<QName> splitLockQName(QName lockQName)
|
||||
{
|
||||
String ns = lockQName.getNamespaceURI();
|
||||
String name = lockQName.getLocalName();
|
||||
|
||||
StringTokenizer tokenizer = new StringTokenizer(name, ".");
|
||||
List<QName> ret = new ArrayList<QName>(tokenizer.countTokens());
|
||||
StringBuilder sb = new StringBuilder();
|
||||
// Fill it
|
||||
boolean first = true;
|
||||
while (tokenizer.hasMoreTokens())
|
||||
{
|
||||
if (first)
|
||||
{
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.append(".");
|
||||
}
|
||||
sb.append(tokenizer.nextToken());
|
||||
QName parentLockQName = QName.createQName(ns, sb.toString());
|
||||
ret.add(parentLockQName);
|
||||
}
|
||||
// Done
|
||||
return ret;
|
||||
}
|
||||
}
|
48
source/java/org/alfresco/repo/domain/locks/LockDAO.java
Normal file
48
source/java/org/alfresco/repo/domain/locks/LockDAO.java
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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.domain.locks;
|
||||
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
/**
|
||||
* DAO services for <b>alf_lock</b> and related tables
|
||||
*
|
||||
* @author Derek Hulley
|
||||
* @since 3.2
|
||||
*/
|
||||
public interface LockDAO
|
||||
{
|
||||
/**
|
||||
* Aquire a given exclusive lock, assigning it (and any implicitly shared locks) a
|
||||
* timeout. All shared locks are implicitly taken as well.
|
||||
*
|
||||
* @param lockQName the unique name of the lock to acquire
|
||||
* @param lockApplicant the potential lock holder's identifier (max 36 chars)
|
||||
* @param timeToLive the time (in milliseconds) that the lock must remain
|
||||
* @return Returns <tt>true</tt> if the lock was taken,
|
||||
* otherwise <tt>false</tt>
|
||||
*/
|
||||
boolean getLock(QName lockQName, String lockApplicant, long timeToLive);
|
||||
}
|
99
source/java/org/alfresco/repo/domain/locks/LockDetails.java
Normal file
99
source/java/org/alfresco/repo/domain/locks/LockDetails.java
Normal file
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* 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.domain.locks;
|
||||
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
/**
|
||||
* Class to contain details regarding a lock. A lock is specific to a given
|
||||
* qualified name. For any given lock, there may exist an <b>EXCLUSIVE</b>
|
||||
* lock <u>or</u> several <b>SHARED</b> locks.
|
||||
*
|
||||
* @author Derek Hulley
|
||||
* @since 3.2
|
||||
*/
|
||||
public class LockDetails
|
||||
{
|
||||
/**
|
||||
* The type of lock
|
||||
*
|
||||
* @author Derek Hulley
|
||||
* @since 3.2
|
||||
*/
|
||||
public enum LockType
|
||||
{
|
||||
/**
|
||||
* A lock held by a specific transaction. No other (exclusive or shared) locks
|
||||
* may be held for the same qualified name.
|
||||
*/
|
||||
EXCLUSIVE,
|
||||
/**
|
||||
* A lock that may be held by several transactions when no exclusive lock is held
|
||||
* for the same qualified name.
|
||||
*/
|
||||
SHARED;
|
||||
}
|
||||
|
||||
private final String txnId;
|
||||
private final QName lockQName;
|
||||
private final LockType lockType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param txnId the transaction holding the lock
|
||||
* @param lockQName the qualified name of the lock
|
||||
* @param lockType the type of lock
|
||||
*/
|
||||
public LockDetails(String txnId, QName lockQName, LockType lockType)
|
||||
{
|
||||
this.txnId = txnId;
|
||||
this.lockQName = lockQName;
|
||||
this.lockType = lockType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the transaction holding the lock
|
||||
*/
|
||||
public String getTxnId()
|
||||
{
|
||||
return txnId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the qualified name of the lock
|
||||
*/
|
||||
public QName getLockQName()
|
||||
{
|
||||
return lockQName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the lock type
|
||||
*/
|
||||
public LockType getLockType()
|
||||
{
|
||||
return lockType;
|
||||
}
|
||||
}
|
185
source/java/org/alfresco/repo/domain/locks/LockEntity.java
Normal file
185
source/java/org/alfresco/repo/domain/locks/LockEntity.java
Normal file
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
* 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.domain.locks;
|
||||
|
||||
import org.alfresco.util.EqualsHelper;
|
||||
|
||||
/**
|
||||
* Entity bean for <b>alf_lock</b> table.
|
||||
* <p>
|
||||
* These are unique (see {@link #equals(Object) equals} and {@link #hashCode() hashCode}) based
|
||||
* on the shared and exclusive resource ID combination.
|
||||
*
|
||||
* @author Derek Hulley
|
||||
* @since 3.2
|
||||
*/
|
||||
public class LockEntity
|
||||
{
|
||||
private Long id;
|
||||
private Long version;
|
||||
private Long sharedResourceId;
|
||||
private Long exclusiveResourceId;
|
||||
private String lockHolder;
|
||||
private Long startTime;
|
||||
private Long expiryTime = Long.MAX_VALUE; // TODO:
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return (sharedResourceId == null ? 0 : sharedResourceId.hashCode()) +
|
||||
(exclusiveResourceId == null ? 0 : exclusiveResourceId.hashCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (this == obj)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (obj instanceof LockEntity)
|
||||
{
|
||||
LockEntity that = (LockEntity) obj;
|
||||
return EqualsHelper.nullSafeEquals(this.sharedResourceId, that.sharedResourceId) &&
|
||||
EqualsHelper.nullSafeEquals(this.exclusiveResourceId, that.exclusiveResourceId);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the lock is logically exclusive. A lock is <b>exclusive</b> if the
|
||||
* shared lock resource matches the exclusive lock resource.
|
||||
*
|
||||
* @return Returns <tt>true</tt> if the lock is exclusive or <tt>false<tt> if it is not
|
||||
*/
|
||||
public boolean isExclusive()
|
||||
{
|
||||
if (sharedResourceId == null || exclusiveResourceId == null)
|
||||
{
|
||||
throw new IllegalStateException("LockEntity has not been populated");
|
||||
}
|
||||
return sharedResourceId.equals(exclusiveResourceId);
|
||||
}
|
||||
|
||||
public boolean hasExpired()
|
||||
{
|
||||
return System.currentTimeMillis() > expiryTime;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getVersion()
|
||||
{
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(Long version)
|
||||
{
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public void incrementVersion()
|
||||
{
|
||||
this.version = new Long(version.longValue() + 1L);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the ID of the shared lock resource
|
||||
*/
|
||||
public Long getSharedResourceId()
|
||||
{
|
||||
return sharedResourceId;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param sharedResourceId the ID of the shared lock resource
|
||||
*/
|
||||
public void setSharedResourceId(Long sharedResourceId)
|
||||
{
|
||||
this.sharedResourceId = sharedResourceId;
|
||||
}
|
||||
|
||||
public Long getExclusiveResourceId()
|
||||
{
|
||||
return exclusiveResourceId;
|
||||
}
|
||||
|
||||
public void setExclusiveResourceId(Long exclusiveResourceId)
|
||||
{
|
||||
this.exclusiveResourceId = exclusiveResourceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the ID of the lock holder
|
||||
*/
|
||||
public String getLockHolder()
|
||||
{
|
||||
return lockHolder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param lockHolder the ID of the lock holder
|
||||
*/
|
||||
public void setLockHolder(String lockHolder)
|
||||
{
|
||||
this.lockHolder = lockHolder;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Returns the time when the lock was started
|
||||
*/
|
||||
public Long getStartTime()
|
||||
{
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(Long startTime)
|
||||
{
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public Long getExpiryTime()
|
||||
{
|
||||
return expiryTime;
|
||||
}
|
||||
|
||||
public void setExpiryTime(Long expiryTime)
|
||||
{
|
||||
this.expiryTime = expiryTime;
|
||||
}
|
||||
}
|
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* 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.domain.locks;
|
||||
|
||||
/**
|
||||
* Entity bean for <b>alf_lock_resource</b> table.
|
||||
*
|
||||
* @author Derek Hulley
|
||||
* @since 3.2
|
||||
*/
|
||||
public class LockResourceEntity
|
||||
{
|
||||
private Long id;
|
||||
private Long version;
|
||||
private Long qnameNamespaceId;
|
||||
private String qnameLocalName;
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getVersion()
|
||||
{
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(Long version)
|
||||
{
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the ID of the namespace that the lock belongs to
|
||||
*/
|
||||
public Long getQnameNamespaceId()
|
||||
{
|
||||
return qnameNamespaceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param namespaceId the ID of the namespace that the lock belongs to
|
||||
*/
|
||||
public void setQnameNamespaceId(Long namespaceId)
|
||||
{
|
||||
this.qnameNamespaceId = namespaceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the lock qualified name localname
|
||||
*/
|
||||
public String getQnameLocalName()
|
||||
{
|
||||
return qnameLocalName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param qnameLocalName the lock qualified name localname
|
||||
*/
|
||||
public void setQnameLocalName(String qnameLocalName)
|
||||
{
|
||||
this.qnameLocalName = qnameLocalName;
|
||||
}
|
||||
}
|
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* 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.domain.locks.ibatis;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.domain.locks.AbstractLockDAOImpl;
|
||||
import org.alfresco.repo.domain.locks.LockEntity;
|
||||
import org.alfresco.repo.domain.locks.LockResourceEntity;
|
||||
import org.springframework.orm.ibatis.SqlMapClientTemplate;
|
||||
|
||||
/**
|
||||
* iBatis-specific implementation of the Locks DAO.
|
||||
*
|
||||
* @author Derek Hulley
|
||||
* @since 3.2
|
||||
*/
|
||||
public class LockDAOImpl extends AbstractLockDAOImpl
|
||||
{
|
||||
private static final Long CONST_LONG_ZERO = new Long(0L);
|
||||
private static final String SELECT_LOCKRESOURCE_BY_QNAME = "select.LockResourceByQName";
|
||||
private static final String SELECT_LOCK_BY_SHARED_IDS = "select.LockBySharedIds";
|
||||
private static final String INSERT_LOCKRESOURCE = "insert.LockResource";
|
||||
private static final String INSERT_LOCK = "insert.Lock";
|
||||
|
||||
private SqlMapClientTemplate template;
|
||||
|
||||
public void setSqlMapClientTemplate(SqlMapClientTemplate sqlMapClientTemplate)
|
||||
{
|
||||
this.template = sqlMapClientTemplate;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LockResourceEntity getLockResource(Long qnameNamespaceId, String qnameLocalName)
|
||||
{
|
||||
LockResourceEntity lockResource = new LockResourceEntity();
|
||||
lockResource.setQnameNamespaceId(qnameNamespaceId);
|
||||
lockResource.setQnameLocalName(qnameLocalName);
|
||||
lockResource = (LockResourceEntity) template.queryForObject(SELECT_LOCKRESOURCE_BY_QNAME, lockResource);
|
||||
// Could be null
|
||||
return lockResource;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LockResourceEntity createLockResource(Long qnameNamespaceId, String qnameLocalName)
|
||||
{
|
||||
LockResourceEntity lockResource = new LockResourceEntity();
|
||||
lockResource.setVersion(CONST_LONG_ZERO);
|
||||
lockResource.setQnameNamespaceId(qnameNamespaceId);
|
||||
lockResource.setQnameLocalName(qnameLocalName);
|
||||
Long id = (Long) template.insert(INSERT_LOCKRESOURCE, lockResource);
|
||||
lockResource.setId(id);
|
||||
// Done
|
||||
return lockResource;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected List<LockEntity> getLocks(List<Long> lockResourceIds)
|
||||
{
|
||||
List<LockEntity> locks = template.queryForList(SELECT_LOCK_BY_SHARED_IDS, lockResourceIds);
|
||||
// Done
|
||||
return locks;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LockEntity createLock(
|
||||
Long sharedResourceId,
|
||||
Long exclusiveResourceId,
|
||||
String lockApplicant,
|
||||
long timeToLive)
|
||||
{
|
||||
LockEntity lock = new LockEntity();
|
||||
lock.setVersion(CONST_LONG_ZERO);
|
||||
lock.setSharedResourceId(sharedResourceId);
|
||||
lock.setExclusiveResourceId(exclusiveResourceId);
|
||||
lock.setLockHolder(lockApplicant);
|
||||
long now = System.currentTimeMillis();
|
||||
long exp = now + timeToLive;
|
||||
lock.setStartTime(now);
|
||||
lock.setExpiryTime(exp);
|
||||
Long id = (Long) template.insert(INSERT_LOCK, lock);
|
||||
lock.setId(id);
|
||||
// Done
|
||||
return lock;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user