Correcting a couple of typos in javadoc and a minor refactoring in TransferServiceImpl.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19253 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Brian Remmington
2010-03-12 13:28:21 +00:00
parent b3c404b235
commit 76bba1fa4e
2 changed files with 25 additions and 29 deletions

View File

@@ -228,17 +228,7 @@ public class TransferServiceImpl implements TransferService
for(ChildAssociationRef group : groups) for(ChildAssociationRef group : groups)
{ {
NodeRef groupNode = group.getChildRef(); NodeRef groupNode = group.getChildRef();
List<ChildAssociationRef>children = nodeService.getChildAssocs(groupNode, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); ret.addAll(getTransferTargets(groupNode));
for(ChildAssociationRef child : children)
{
if(nodeService.getType(child.getChildRef()).equals(TransferModel.TYPE_TRANSFER_TARGET))
{
TransferTargetImpl newTarget = new TransferTargetImpl();
mapTransferTarget(child.getChildRef(), newTarget);
ret.add(newTarget);
}
}
} }
return ret; return ret;
@@ -251,8 +241,6 @@ public class TransferServiceImpl implements TransferService
{ {
NodeRef home = getTransferHome(); NodeRef home = getTransferHome();
Set<TransferTarget> ret = new HashSet<TransferTarget>();
// get group with assoc groupName // get group with assoc groupName
NodeRef groupNode = nodeService.getChildByName(home, ContentModel.ASSOC_CONTAINS, groupName); NodeRef groupNode = nodeService.getChildByName(home, ContentModel.ASSOC_CONTAINS, groupName);
@@ -262,21 +250,29 @@ public class TransferServiceImpl implements TransferService
throw new TransferException(MSG_NO_GROUP, new Object[]{groupName}); throw new TransferException(MSG_NO_GROUP, new Object[]{groupName});
} }
/** return getTransferTargets(groupNode);
* Get children of groupNode }
*/
/**
* Given the noderef of a group of transfer targets, return all the contained transfer targets.
* @param groupNode
* @return
*/
private Set<TransferTarget> getTransferTargets(NodeRef groupNode)
{
Set<TransferTarget> result = new HashSet<TransferTarget>();
List<ChildAssociationRef>children = nodeService.getChildAssocs(groupNode, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); List<ChildAssociationRef>children = nodeService.getChildAssocs(groupNode, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
for(ChildAssociationRef child : children) for(ChildAssociationRef child : children)
{ {
if(nodeService.getType(child.getChildRef()).equals(TransferModel.TYPE_TRANSFER_TARGET)) if(nodeService.getType(child.getChildRef()).equals(TransferModel.TYPE_TRANSFER_TARGET))
{ {
TransferTargetImpl newTarget = new TransferTargetImpl(); TransferTargetImpl newTarget = new TransferTargetImpl();
mapTransferTarget(child.getChildRef(), newTarget); mapTransferTarget(child.getChildRef(), newTarget);
ret.add(newTarget); result.add(newTarget);
} }
} }
return ret; return result;
} }
/** /**

View File

@@ -126,7 +126,7 @@ public interface TransferService
* @param endpointPath, * @param endpointPath,
* @param username, * @param username,
* @param password, * @param password,
* @return the newly create transfer target. * @return the newly created transfer target.
*/ */
public TransferTarget createAndSaveTransferTarget(String name, String title, String description, String endpointProtocol, public TransferTarget createAndSaveTransferTarget(String name, String title, String description, String endpointProtocol,
String endpointHost, int endpointPort, String endpointPath, String username, char[] password) throws TransferException; String endpointHost, int endpointPort, String endpointPath, String username, char[] password) throws TransferException;