Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Problem in retrieving data of type IContent

Hi,

I have extended the Jazz repository using my own ecore. One of the data items in turn contains an attribute of type IContent. I have exposed get/set on this attribute using ITeamModelledService.

I set the IContent data as follows -

IContentService contentService = getService(IContentService.class);

byte[] notesTextBytes;

notesTextBytes = notes.getBytes(CONTENT_ENCODING_UTF8);
ByteArrayInputStream inputStream = new ByteArrayInputStream(
notesTextBytes);
contentService.storeContent(IContent.CONTENT_TYPE_TEXT,
CONTENT_ENCODING_UTF8, inputStream, notesTextBytes.length);


I am able to retrive this data too. However, when I restart my server, I am no longer able to get this data.

It throws the exception - Content not found

Would really appreciate help

Thanks
- Vibha

0 votes



5 answers

Permanent link
Hi Vibha,

Are you associating the IContent reference with an Item and saving the Item? I see this in the javadoc for the IContentManager:

Uploaded content must first be claimed before it can be retrieved from the server. Claiming of uploaded content is
done by embedding the reference to the content {@link IContent} within an item
and then saving the item to the server with this new content reference.


Martha
Jazz Team Build Component

0 votes


Permanent link
Hello Martha,

Yes I am storing the content and then saving the reference. Code as follows:

final IContent notesContent = parseToIContent(notes);

IRepositoryItemService repositoryItemService = (IRepositoryItemService) getService(IRepositoryItemService.class);
BusinessProcess linkToProcess = getProcessDefinition(process);
if (linkToProcess != null) {
linkToProcess = (BusinessProcess) linkToProcess.getWorkingCopy();
linkToProcess.getProcessDefinition().setChangesInOrganizationNotes(notesContent);
linkToProcess = (BusinessProcess) repositoryItemService.saveItem(linkToProcess);
code]

It I query for the OrganizationNotes, I am able to get them for sometime and then start getting null (especially after server restart)

Thanks
- Vibha

0 votes


Permanent link
Could it be that the transaction that is writing the items and content is being rolled back due to an exception of some sort. Did you query for the items and content within the same transaction (the one that writes) or a separate one?

0 votes


Permanent link
Does the reference to the IContent have the containment flag set? I seem to remember a similar problem that was caused by an IContent not being contained in the owning item.

Christof
Jazz Work Item team

0 votes


Permanent link
Hello Christof,

Yep, you were correct in the diagnosis. I had not marked the reference as contained.

Thanks a lot

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Jul 18 '08, 7:26 a.m.

Question was seen: 8,231 times

Last updated: Jul 18 '08, 7:26 a.m.

Confirmation Cancel Confirm