mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Fix WCM-857
Added AVMLockingService.removeLocksInDirectory() which, given the state of AttributeService, is a bit of a sledgehammer. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6932 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -678,6 +678,8 @@ public class AVMLockingAwareService implements AVMService, ApplicationContextAwa
|
|||||||
fService.removeNode(parent, name);
|
fService.removeNode(parent, name);
|
||||||
String[] storePath = parent.split(":");
|
String[] storePath = parent.split(":");
|
||||||
fService.createSnapshot(storePath[0], null, null);
|
fService.createSnapshot(storePath[0], null, null);
|
||||||
|
fLockingService.removeLocksInDirectory(getWebProject(storePath[0]), storePath[0],
|
||||||
|
storePath[1] + '/' + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
@@ -689,6 +691,7 @@ public class AVMLockingAwareService implements AVMService, ApplicationContextAwa
|
|||||||
fService.removeNode(path);
|
fService.removeNode(path);
|
||||||
String[] storePath = path.split(":");
|
String[] storePath = path.split(":");
|
||||||
fService.createSnapshot(storePath[0], null, null);
|
fService.createSnapshot(storePath[0], null, null);
|
||||||
|
fLockingService.removeLocksInDirectory(getWebProject(storePath[0]), storePath[0], storePath[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@@ -322,42 +322,41 @@ public class AVMLockingServiceImpl implements AVMLockingService
|
|||||||
}
|
}
|
||||||
keys.remove(3);
|
keys.remove(3);
|
||||||
fAttributeService.removeAttribute(keys, pathKey);
|
fAttributeService.removeAttribute(keys, pathKey);
|
||||||
// AVMLock lock = new AVMLock(lockData);
|
}
|
||||||
// List<String> userKeys = new ArrayList<String>();
|
|
||||||
// userKeys.add(LOCK_TABLE);
|
/* (non-Javadoc)
|
||||||
// userKeys.add(USERS);
|
* @see org.alfresco.service.cmr.avm.locking.AVMLockingService#removeLocksInDirectory(java.lang.String, java.lang.String, java.lang.String)
|
||||||
// for (String user : lock.getOwners())
|
*/
|
||||||
// {
|
public void removeLocksInDirectory(String webProject, String store,
|
||||||
// userKeys.add(user);
|
String path)
|
||||||
// Attribute userLocks = fAttributeService.getAttribute(userKeys);
|
{
|
||||||
// for (int i = userLocks.size() - 1; i >= 0; i--)
|
path = normalizePath(path);
|
||||||
// {
|
if (logger.isDebugEnabled())
|
||||||
// Attribute lockInfo = userLocks.get(i);
|
{
|
||||||
// if (lockInfo.get("web_project").getStringValue().equals(lock.getWebProject())
|
logger.debug("removing locks in directory: " + path + "(" + webProject + ", " + store + ")");
|
||||||
// && lockInfo.get("path").getStringValue().equals(lock.getPath()))
|
}
|
||||||
// {
|
List<String> keys = new ArrayList<String>();
|
||||||
// fAttributeService.removeAttribute(userKeys, i);
|
keys.add(LOCK_TABLE);
|
||||||
// break;
|
keys.add(WEB_PROJECTS);
|
||||||
// }
|
keys.add(webProject);
|
||||||
// }
|
Attribute map = fAttributeService.getAttribute(keys);
|
||||||
// userKeys.remove(2);
|
if (map == null)
|
||||||
// }
|
{
|
||||||
// List<String> storeKeys = new ArrayList<String>(3);
|
return;
|
||||||
// storeKeys.add(LOCK_TABLE);
|
}
|
||||||
// storeKeys.add(STORES);
|
for (Map.Entry<String, Attribute> entry : map.entrySet())
|
||||||
// String store = lock.getStore();
|
{
|
||||||
// storeKeys.add(store);
|
if (logger.isDebugEnabled())
|
||||||
// Attribute storeLocks = fAttributeService.getAttribute(storeKeys);
|
{
|
||||||
// for (int i = storeLocks.size() - 1; i >= 0; i--)
|
logger.debug(entry);
|
||||||
// {
|
}
|
||||||
// Attribute lockInfo = storeLocks.get(i);
|
Attribute child = entry.getValue();
|
||||||
// if (lockInfo.get("web_project").getStringValue().equals(lock.getWebProject()) &&
|
if (child.get("store").getStringValue().equals(store) &&
|
||||||
// lockInfo.get("path").getStringValue().equals(lock.getPath()))
|
child.get("path").getStringValue().startsWith(path + '/'))
|
||||||
// {
|
{
|
||||||
// fAttributeService.removeAttribute(storeKeys, i);
|
fAttributeService.removeAttribute(keys, entry.getKey());
|
||||||
// break;
|
}
|
||||||
// }
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@@ -77,6 +77,14 @@ public interface AVMLockingService
|
|||||||
*/
|
*/
|
||||||
public void removeLock(String webProject, String path);
|
public void removeLock(String webProject, String path);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove all locks on files contained within a directory.
|
||||||
|
* @param webProject
|
||||||
|
* @param store
|
||||||
|
* @param path
|
||||||
|
*/
|
||||||
|
public void removeLocksInDirectory(String webProject, String store, String path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes all locks residing in a store.
|
* Removes all locks residing in a store.
|
||||||
* @param store The store name.
|
* @param store The store name.
|
||||||
|
Reference in New Issue
Block a user