It's all about the answers!

Ask a question

Is there a way to fetch "relate time" - when an attachment is related to work-item using java api?

Vijayakumar Balasubramaniyan (2845) | asked Dec 12 '14, 3:54 a.m.
edited Dec 12 '14, 3:55 a.m.
I am working on a synchronizer tool which migrates and synchronizes the objects between 2 different applications. There is a need to synchronize the attachments between the applications as well.

I have to fetch the list of attachments for a given work-item and also fetch the date-time when it actually got related to the work-item. There is an option to fetch the create_time of the attachment, but that time is when the attachment is created/uploaded. After the attachment is uploaded, you have to save the work-item. So there is a chance for uploading the attachments and after couple of minutes saving the work-item. This use-case creates problem in my tool as I am using the create_time to make some decisions. Misunderstood that the create_time is going to be the same as relate_time.

So I would like to know whether there is a way to get the relate_time for an attachment using plain java-api.

Any kind of input is highly appreciated. Thanks.

One answer

permanent link
Ralph Schoon (62.7k33643) | answered Dec 12 '14, 5:37 a.m.
The API only exposes CREATION_DATE_PROPERTY with getCreationDate(). The AttachmentImpl internal class, also does not expose any other data as far as I can see. So you would have to work with the creationDate - it is in milliseconds, that should be accurate enough, I think.

Vijayakumar Balasubramaniyan commented Dec 12 '14, 6:20 a.m.

Thanks for you input Ralph Schoon.
Yes, the API exposes only create_time. I just wanted to understand is there any other way of getting the relate_time information. Say, if the relationships are maintained in a table or something internally and if there is an API to check that table...... or something that sort of.

I am kind of struck with this and without getting the relate_time I won't be able to proceed further. Other option for me is just drop of this feature (attachment handling) from the tool that I am working on - which would be a bad thing to do and customer will have problems. :(

Ralph Schoon commented Dec 12 '14, 6:55 a.m. | edited Dec 12 '14, 6:57 a.m.

See how that works. I don't see why the information would not be sufficient for a synchronizer. I know others have written synchronizers that also include attachments.

Of course in the details it can get tricky and I might just not see it yet.

Maybe the problem is setting the attachment time in RTC. Not sure if you can do that. I have seen areas where you could with some tricks.

Your answer

Register or to post your answer.