Merged API-STRIKES-BACK (5.2.0) to HEAD (5.2)

127414 jvonka: Node Associations - create node with assocs (peer &/or secondary child)
   - can be optionally used to create (eg. mandatory) assoc(s) to other existing node(s)
   RA-925


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@127604 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jamal Kaabi-Mofrad
2016-06-02 22:19:54 +00:00
parent 15215a1faa
commit 3a0b2f1570
11 changed files with 285 additions and 116 deletions

View File

@@ -24,7 +24,6 @@ import org.alfresco.rest.api.model.Assoc;
import org.alfresco.rest.api.model.AssocChild;
import org.alfresco.rest.api.model.Node;
import org.alfresco.rest.api.model.UserInfo;
import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException;
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
import org.alfresco.rest.framework.resource.parameters.Paging;
import org.alfresco.rest.framework.resource.parameters.Parameters;
@@ -101,37 +100,6 @@ public class AbstractNodeRelation implements InitializingBean
this.dictionaryService = sr.getDictionaryService();
}
protected QName getAssocType(String assocTypeQNameStr)
{
return getAssocType(assocTypeQNameStr, true);
}
protected QName getAssocType(String assocTypeQNameStr, boolean mandatory)
{
QName assocType = null;
if ((assocTypeQNameStr != null) && (! assocTypeQNameStr.isEmpty()))
{
assocType = nodes.createQName(assocTypeQNameStr);
if (dictionaryService.getAssociation(assocType) == null)
{
throw new InvalidArgumentException("Unknown assocType: " + assocTypeQNameStr);
}
if (EXCLUDED_NS.contains(assocType.getNamespaceURI()))
{
throw new InvalidArgumentException("Invalid assocType: " + assocTypeQNameStr);
}
}
if (mandatory && (assocType == null))
{
throw new InvalidArgumentException("Missing "+PARAM_ASSOC_TYPE);
}
return assocType;
}
protected QNamePattern getAssocTypeFromWhereElseAll(Parameters parameters)
{
QNamePattern assocTypeQNamePattern = RegexQNamePattern.MATCH_ALL;
@@ -145,7 +113,7 @@ public class AbstractNodeRelation implements InitializingBean
String assocTypeQNameStr = propertyWalker.getProperty(PARAM_ASSOC_TYPE, WhereClauseParser.EQUALS, String.class);
if (assocTypeQNameStr != null)
{
assocTypeQNamePattern = getAssocType(assocTypeQNameStr);
assocTypeQNamePattern = nodes.getAssocType(assocTypeQNameStr);
}
}