rejecting an asset | Community
Skip to main content
roberth55706517
Level 4
November 4, 2015
Solved

rejecting an asset

  • November 4, 2015
  • 10 replies
  • 2566 views

I have a form that I need to be able to reject an asset. I see the code in the javascript to approve an asset. Is there a servlet that handles the rejection of an asset? If I change so that the JSON string contains "rejected" instead of "accepted", the server responds with an error that the field "accepted" does not exist. What would the URL to a servlet that would handle the rejection be?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Lokesh_Shivalingaiah

couple of quick things

1. You are using log.debug. Have you enabled the configuration to log the debug level ?? else use log.info or log.error

2. How have you created your session ?? 

10 replies

Lokesh_Shivalingaiah
Level 10
November 4, 2015

Can you explain a bit more of your use case ?

At what point you would need to reject an asset ? is it at the upload time, processing time and at the usage time...

roberth55706517
Level 4
November 4, 2015

They client creates a project that starts off a workflow. The work flow progresses along until an approval step. At that point they want to be able to reject asset(s) and return the processing to a previous step then proceed normally from there, retracing the steps between. Since there is an approval mechanism, what is the rejection mechanism? Then I'd like to see if any one of the assets associated with the project has been rejected in a GoTo step and branch back. I'm guessing I'll have to modify states of the steps that have to be retraced too.

Lokesh_Shivalingaiah
Level 10
November 4, 2015

So every step of a workflow, you have 'complete' to go fwd and 'Step Back' to basically use it as a reject where it goes to the previous step

roberth55706517
Level 4
November 4, 2015

This implementation has been heavily customized. There isn't a back option it is the fifth step of six where the reject occurs and it has to jump back to the second step and proceed from there until the reviewer accepts all of the assets.

roberth55706517
Level 4
November 6, 2015

I was able to add this, sort of. The problem was that the rejection didn't save unless the step was completed. Since the approve and reject are separate options, if I rejected an image, then approved, the rejected mages would be reset to "pending". I was using an ajax call to a servlet I wrote to set the value in the DAM but it wouldn't save the update in the dam even though I had a session.save() in the servlet code. What could I be missing in not being able to save the value?

smacdonald2008
Level 10
November 7, 2015

What account did you use to open the session - did the user on which the session was based have write permissions for that part of the JCR. That is the only reason why i see not modifying the asset in the DAM. 

Lokesh_Shivalingaiah
Level 10
November 8, 2015

Can you share your code snippet so we can see if something missing

roberth55706517
Level 4
November 9, 2015

The user agent should have full access to that. I'll have to check the permissions. Shouldn't there be an error in the logs?

try { JSONArray jsonData = new JSONArray(data); for( int i = 0; i < jsonData.length(); i++){ JSONObject obj = jsonData.getJSONObject(i); String path = folder + "/" + obj.getString("id") + "/" + obj.getString("rejected"); Resource res = resourceResolver.getResource(path); Node assetMetadataNode = resourceResolver.getResource(res.getPath() + "/jcr:content/metadata").adaptTo(Node.class); assetMetadataNode.setProperty("dam:status", "rejected"); session.save(); String s = assetMetadataNode.getProperty("dam:status").getString(); log.debug(s); session.save(); } }catch(JSONException je) { je.printStackTrace(); }catch(RepositoryException re){ re.printStackTrace(); }catch (Exception e){ e.printStackTrace(); }

The value is in the session when I check it after the first save. I just added the second one just for a test. When I check the DAM in CRX, I don't see the value and I don't see any errors in the logs.

Lokesh_Shivalingaiah
Lokesh_ShivalingaiahAccepted solution
Level 10
November 9, 2015

couple of quick things

1. You are using log.debug. Have you enabled the configuration to log the debug level ?? else use log.info or log.error

2. How have you created your session ?? 

roberth55706517
Level 4
November 10, 2015

The log level is at debug.

The session is being created thus:

Session session = resourceResolver.adaptTo(Session.class);

This is in a servlet that overrides SlingAllMethodsServlet.