Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Identifying dam event of copy

Avatar

Avatar
Level 1
arturoar
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
arturoar
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile
arturoar
Level 1

12-05-2021

Hello to everyone 

 

I'm facing a problem when i try to identify when dam events my requirement is that when an asset is being copied, moved or created we need to add a new property into the metadata of that asset, the method that i have is the next one, this method is in a class that implements EventHandler, DAMEventService.

public void handleEvent(Event event) {

DamEvent damEvent = DamEvent.fromEvent(event);

LOGGER.debug("********** EventType=" + damEvent.getType() + " === " + damEvent.getAssetPath());

/* Use case when Creating Assets and Versioning Assets after DAM Update Asset Workflow finished processing */
if(DamEvent.Type.DAM_UPDATE_ASSET_WORKFLOW_COMPLETED == damEvent.getType() ||
/* Use case when Moving and Copying Assets after DAM Update Asset Workflow finished processing */
DamEvent.Type.DAM_METADATA_WRITEBACK_WORKFLOW_COMPLETED == damEvent.getType() ||
DamEvent.Type.ASSET_CREATED == damEvent.getType() ||
DamEvent.Type.ASSET_MOVED == damEvent.getType() ||
DamEvent.Type.VERSIONED == damEvent.getType()){

this.callProcessNodeFromPath(damEvent);

}

}

the workflows events are used to identify when an asset is begin uploaded and it was processed by DAM Update Asset workflow, but there is not a specific case for copy so I add create but that create a new problem, because asset_created is also trigger when an asset is uploaded and that is a problem because my listener and the workflow is trying to write the metadata properties at the same time and I get an exception.

 

javax.jcr.InvalidItemStateException: OakState0001: Unresolved conflicts in /content/dam/path/imagename.jpg/jcr:content/metadata
 
my method to write the metadata is the nextone
metadataNode.setProperty(metadata_field, Value);
session.save();

if I delete the ASSET_CREATED everything works fine but that leaves out of the scope the copied and this is required in my development.

I also try a refresh on my session but and it didn't work and that would only solve the problem with two classes writing at the same time but not my problem identifying the copy case.

so my question are 

 

  • is there a way to detect that an asset is being copied without using the asset_created flag?
  • do you know a different way to solve this problem
  • anyone has face a similar problem that could help me?

 

DAM DAM Assets event event trigger

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 5
Level 5
Ritesh_M
Level 5

Likes

85 likes

Total Posts

69 posts

Correct Reply

24 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
Affirm 1
View profile

Avatar
Boost 5
Level 5
Ritesh_M
Level 5

Likes

85 likes

Total Posts

69 posts

Correct Reply

24 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
Affirm 1
View profile
Ritesh_M
Level 5

13-05-2021

Hi @arturoar ,

 

One way would be that instead of creating a handler, you can customize the DAM update Asset workflow model to add custom process. You can add another process to add the custom property once the asset workflow completes its work.

Notably, The default workflow DAM Asset Update is no longer available in Asset as a cloud Service, in case if there is any future plan to use.

 

https://experienceleague.adobe.com/docs/experience-manager-cloud-service/assets/assets-cloud-changes...

BTW, it is always recommended to have either a listener or workflow configured on a node else synchronization problem might occur.

Answers (0)