Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MNT-24528 fix missing aspectnames #3111

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions remote-api/src/main/java/org/alfresco/rest/api/impl/NodesImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -2995,6 +2995,7 @@ public Node upload(String parentFolderNodeId, FormData formData, Parameters para
Boolean versionMajor = null;
String versionComment = null;
String relativePath = null;
String aspectNames = null;
String renditionNames = null;
boolean versioningEnabled = true;

Expand Down Expand Up @@ -3050,6 +3051,10 @@ public Node upload(String parentFolderNodeId, FormData formData, Parameters para
relativePath = getStringOrNull(field.getValue());
break;

case "aspectnames":
aspectNames = getStringOrNull(field.getValue());
break;

case "renditions":
renditionNames = getStringOrNull(field.getValue());
break;
Expand Down Expand Up @@ -3101,8 +3106,10 @@ public Node upload(String parentFolderNodeId, FormData formData, Parameters para
// if requested, make (get or create) path
parentNodeRef = getOrCreatePath(parentNodeRef, relativePath);
final QName assocTypeQName = ContentModel.ASSOC_CONTAINS;
final Set<String> renditions = getRequestedRenditions(renditionNames);
final Set<String> renditions = getRequestedNames(renditionNames);

final Set<String> qnameStrAspects = getRequestedNames(aspectNames)
validateAspects(qnameStrAspects, EXCLUDED_NS, EXCLUDED_ASPECTS);
validateProperties(qnameStrProps, EXCLUDED_NS, Arrays.asList());
try
{
Expand Down Expand Up @@ -3149,7 +3156,9 @@ else if (overwrite && nodeService.hasAspect(existingFile, ContentModel.ASPECT_VE

// Create a new file.
NodeRef nodeRef = createNewFile(parentNodeRef, fileName, nodeTypeQName, content, properties, assocTypeQName, parameters, versionMajor, versionComment);


addCustomAspects(nodeRef, qnameStrAspects, EXCLUDED_ASPECTS);

// Create the response
final Node fileNode = getFolderOrDocumentFullInfo(nodeRef, parentNodeRef, nodeTypeQName, parameters);

Expand Down Expand Up @@ -3235,25 +3244,25 @@ private void checkRenditionNames(Set<String> renditionNames)
}
}

static Set<String> getRequestedRenditions(String renditionsParam)
static Set<String> getRequestedNames(String namesParam)
{
if (renditionsParam == null)
if (namesParam == null)
{
return null;
}

String[] renditionNames = renditionsParam.split(",");
String[] namesArray = namesParam.split(",");

Set<String> renditions = new LinkedHashSet<>(renditionNames.length);
for (String name : renditionNames)
Set<String> names = new LinkedHashSet<>(namesArray.length);
for (String name : namesArray)
{
name = name.trim();
if (!name.isEmpty())
{
renditions.add(name.trim());
names.add(name.trim());
}
}
return renditions;
return names;
}

private void requestRenditions(Set<String> renditionNames, Node fileNode)
Expand Down
Loading