Merged BRANCHES/V4.2 to HEAD:

55206: Branch created for 4.2.x releases.
   55209: Merged HEAD to BRANCHES/V4.2:
        55208: Added Sharepoint config to unit test classpath to fix VtiRequestDispatcherTest.
   55222: Merged HEAD-BUG-FIX to V4.2
        55220: Merged V4.1-BUG-FIX (4.1.7) to HEAD-BUG-FIX (4.2)
           55218: Fix for ALF-19894 Site is not displayed after restoring from Trashcan
             This bug was reported on 4.2, but the bug is also present on 4.1.
             I have added a testcase to reproduce the bug along with a fix.
             The problem was in SiteServiceImpl.delete where the code was writing an empty property value into the {}memberships property
             and therefore there was no record of which users had been members of the deleted site.
   55245: Fixed javadoc while checking that ALF-19055 was fixed.  ActivityService no longer uses 'format
   55246: CLOUD-2050 -Content changes are not synced from Cloud to On-Premise (errors in the logs)
   55249: Hazelcast: Added ability to create cache with 'read-backup-data' via property *.readBackupData
   55250: Hazelcast cache builder now accepts 'async-backup-count' value and any error in setting a value logs the full exception
   55251: Asynchronous cache: Better logging of in- and after-transaction processes
   55252: Asynchronous cache: Better logging of in- and after-transaction processes
   55266: Workflow REST API fix for variable retrieval
   55276: Merged HEAD to BRANCHES/V4.2:
        55274: Disabling Sharepoint unit tests until we can make them run properly in the build.
   55278: ALF-19889 - String for Brazilian Portuguese
   55279: Merged DEV to 4.2
        ALF-17464 : Replication jobs aren't displayed until sorting by some characteristic
           - Changing not exact equals (!==) to not euqals (!=)
   55280: Fix for ALF-19865 - Forgot password link redirects to Login page. Also cleaned up the mess that is the 'Sign in to Alfresco in the cloud' dialog.
   55281: Probable fix for ALF-19225 Intermittent test failures in SubscriptionServiceActivitiesTest
   55282: ALF-19865 - Cloud Sync profile area now looks like the rest of profile area.
   55285: Merged BRANCHES/DEV/BELARUS/HEAD-2013_08_27 to BRANCHES/V4.2:
        55068: ALF-19915 : MT and WebDAV: Content is lost when uploading non-empty document
   55286: Merged BRANCHES/DEV/BELARUS/HEAD-2013_08_29 to BRANCHES/V4.2:
        55207: ALF-19915 : MT and WebDAV: Content is lost when uploading non-empty document
        55210: ALF-19915 : MT and WebDAV: Content is lost when uploading non-empty document
   55297: As part of prep work for fixing ALF-20023 Recent Sites and Favorite Sites in copy/move pickers empty,
   55299: ALF-19556: IE10 specific fix for file upload browse (impressive how IE finds more and more innovative ways to spoil things for itself)
   55300: Fixed date issue when creating a new process instance
   55308: Resync to HEAD@55302


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@55309 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Brian Remmington
2013-09-15 15:00:13 +00:00
parent d333945942
commit ed839dcbe0
10 changed files with 815 additions and 416 deletions

View File

@@ -585,6 +585,8 @@ public abstract class AbstractAsynchronouslyRefreshedCache<T> implements Asynchr
/**
* Build the cache entry for the specific tenant.
* This method is called in a thread-safe manner i.e. it is only ever called by a single
* thread.
*/
protected abstract T buildCache(String tenantId);
@@ -690,7 +692,6 @@ public abstract class AbstractAsynchronouslyRefreshedCache<T> implements Asynchr
}
@SuppressWarnings("deprecation")
@Override
public void flush()
{

View File

@@ -25,13 +25,9 @@ package org.alfresco.repo.cache;
*/
public abstract class AbstractRefreshableCacheEvent implements RefreshableCacheEvent
{
/**
*
*/
private static final long serialVersionUID = 1324638640132648062L;
private String cacheId;
private String tenantId;
AbstractRefreshableCacheEvent(String cacheId, String tenantId)
@@ -40,34 +36,51 @@ public abstract class AbstractRefreshableCacheEvent implements RefreshableCacheE
this.tenantId = tenantId;
}
/*
* (non-Javadoc)
* @see org.alfresco.repo.cache.RefreshableCacheEvent#getCacheId()
*/
@Override
public String getCacheId()
{
return cacheId;
}
/*
* (non-Javadoc)
* @see org.alfresco.repo.cache.RefreshableCacheEvent#getTenantId()
*/
@Override
public String getTenantId()
{
return tenantId;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString()
{
return "AbstractRefreshableCacheEvent [cacheId=" + cacheId + ", tenantId=" + tenantId + "]";
}
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + ((cacheId == null) ? 0 : cacheId.hashCode());
result = prime * result + ((tenantId == null) ? 0 : tenantId.hashCode());
return result;
}
@Override
public boolean equals(Object obj)
{
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
AbstractRefreshableCacheEvent other = (AbstractRefreshableCacheEvent) obj;
if (cacheId == null)
{
if (other.cacheId != null) return false;
}
else if (!cacheId.equals(other.cacheId)) return false;
if (tenantId == null)
{
if (other.tenantId != null) return false;
}
else if (!tenantId.equals(other.tenantId)) return false;
return true;
}
}

View File

@@ -30,13 +30,11 @@ public interface RefreshableCacheEvent extends Serializable
{
/**
* Get the cache id
* @return
*/
public String getCacheId();
/**
* Get the affected tenant id
* @return
*/
public String getTenantId();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2012 Alfresco Software Limited.
* Copyright (C) 2005-2013 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -25,6 +25,25 @@ import org.alfresco.service.cmr.repository.NodeRef;
public class LockUtils
{
/**
* Indicates if the node is locked AND the current user is not lock owner.
*
* @param nodeRef node reference
* @param lockService LockService
*/
public static boolean isLockedAndNotLockOwner(NodeRef nodeRef, LockService lockService)
{
LockStatus lockStatus = lockService.getLockStatus(nodeRef);
switch (lockStatus)
{
case NO_LOCK:
case LOCK_EXPIRED:
case LOCK_OWNER:
return false;
default:
return true;
}
}
/**
* Indicates if the node is locked AND it's not a WRITE_LOCK for the current user.<p>
@@ -43,7 +62,7 @@ public class LockUtils
case LOCK_EXPIRED:
return false;
case LOCK_OWNER:
return lockService.getLockType(nodeRef) != LockType.WRITE_LOCK;
return lockService.getLockType(nodeRef).equals(LockType.WRITE_LOCK);
default:
return true;
}

View File

@@ -1454,6 +1454,9 @@ public class SiteServiceImpl extends AbstractLifecycleBean implements SiteServic
*/
public void deleteSite(final String shortName)
{
// In deleting the site node, we have to jump through a few hoops to manage the site groups.
// The order of execution is important here.
logger.debug("delete site :" + shortName);
final NodeRef siteNodeRef = getSiteNodeRef(shortName);
if (siteNodeRef == null)
@@ -1465,11 +1468,35 @@ public class SiteServiceImpl extends AbstractLifecycleBean implements SiteServic
// Delete the cached reference
siteNodeRefCache.remove(shortName);
// Collection for recording the group memberships present on the site
final Map<String, Set<String>> groupsMemberships = new HashMap<String, Set<String>>();
// Save the group memberships so we can use them later
this.nodeService.setProperty(siteNodeRef, QName.createQName(null, "memberships"), (Serializable)groupsMemberships);
// Get and retain the membership of the site we're deleting. We do this to support restoration of a site node from the trashcan.
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Void>()
{
public Void doWork() throws Exception
{
final String siteGroup = getSiteGroup(shortName, true);
if (authorityService.authorityExists(siteGroup))
{
// Collection for recording the group memberships present on the site
final Map<String, Set<String>> groupsMemberships = new HashMap<String, Set<String>>();
// Iterate over the role related groups and delete then
Set<String> permissions = permissionService.getSettablePermissions(siteType);
for (String permission : permissions)
{
String siteRoleGroup = getSiteRoleGroup(shortName, permission, true);
// Collect up the memberships so we can potentially restore them later
Set<String> groupUsers = authorityService.getContainedAuthorities(null, siteRoleGroup, true);
groupsMemberships.put(siteRoleGroup, groupUsers);
}
// Save the group memberships so we can use them later
nodeService.setProperty(siteNodeRef, QName.createQName(null, "memberships"), (Serializable)groupsMemberships);
}
return null;
}
}, AuthenticationUtil.getSystemUserName());
// The default behaviour is that sites cannot be deleted. But we disable that behaviour here
// in order to allow site deletion only via this service. Share calls this service for deletion.
@@ -1493,7 +1520,7 @@ public class SiteServiceImpl extends AbstractLifecycleBean implements SiteServic
// Delete the associated groups
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>()
{
public Object doWork() throws Exception
public Void doWork() throws Exception
{
// Delete the master site group
final String siteGroup = getSiteGroup(shortName, true);
@@ -1507,10 +1534,6 @@ public class SiteServiceImpl extends AbstractLifecycleBean implements SiteServic
{
String siteRoleGroup = getSiteRoleGroup(shortName, permission, true);
// Collect up the memberships so we can potentially restore them later
Set<String> groupUsers = authorityService.getContainedAuthorities(null, siteRoleGroup, true);
groupsMemberships.put(siteRoleGroup, groupUsers);
// Delete the site role group
authorityService.deleteAuthority(siteRoleGroup);
}

View File

@@ -42,7 +42,6 @@ public interface ActivityService extends ActivityPostService
* Will return activities for all users across all sites, or optionally for all users for specified site.
*
* @param userId - required
* @param format - required
* @param siteId - optional, if set then will filter by given siteId else return all sites
* @return list of JSON feed entries
*/
@@ -61,7 +60,6 @@ public interface ActivityService extends ActivityPostService
* note: if both excludes are true then no activities will be returned.
*
* @param userId - required
* @param format - required
* @param siteId - optional, if set then will filter by given siteId else return all sites
* @param excludeThisUser - if TRUE then will exclude activities for this user (hence returning other users only)
* @param excludeOthersUsers - if TRUE then will exclude activities for other users (hence returning this user only)
@@ -83,7 +81,6 @@ public interface ActivityService extends ActivityPostService
* note: if both excludes are true then no activities will be returned.
*
* @param userId - required
* @param format - required
* @param siteId - optional, if set then will filter by given siteId else return all sites
* @param excludeThisUser - if TRUE then will exclude activities for this user (hence returning other users only)
* @param excludeOthersUsers - if TRUE then will exclude activities for other users (hence returning this user only)
@@ -106,7 +103,6 @@ public interface ActivityService extends ActivityPostService
* note: if both excludes are true then no activities will be returned.
*
* @param userId - required
* @param format - required
* @param siteId - optional, if set then will filter by given siteId else return all sites
* @param excludeThisUser - if TRUE then will exclude activities for this user (hence returning other users only)
* @param excludeOthersUsers - if TRUE then will exclude activities for other users (hence returning this user only)
@@ -129,7 +125,6 @@ public interface ActivityService extends ActivityPostService
* note: if both excludes are true then no activities will be returned.
*
* @param userId - required
* @param format - required
* @param siteId - optional, if set then will filter by given siteId else return all sites
* @param excludeThisUser - if TRUE then will exclude activities for this user (hence returning other users only)
* @param excludeOthersUsers - if TRUE then will exclude activities for other users (hence returning this user only)
@@ -149,7 +144,6 @@ public interface ActivityService extends ActivityPostService
* Retrieve site feed
*
* @param activityType - required
* @param format - required
* @return list of JSON feed entries
*/
@NotAuditable