Hi Xabi,

You should use the BusinessSheet object than enables you to access field values 
easily, and at the end of the extension code call an update the second sheet 
(not the current sheet if I understand correctly).

//Get Cacheable sheet
ServiceLocator lServiceLocator =  
pContext.get(ExtensionPointParameters.SERVICE_LOCATOR);
      SheetService lSheetService = lServiceLocator.getSheetService();
      CacheableSheet lCacheableSheet = 
lSheetService.getCacheableSheet(pRoleToken, pSheetId);

                // Get BusinessSheet from Cacheable sheet
      BusinessSheet lBusinessSheet = new CacheableSheetAccess(pRoleToken, 
lSheetService.getCacheableSheetType(pRoleToken, lCacheableSheet.getTypeId(), 
CacheProperties.IMMUTABLE),
                  lCacheableSheet, 
ValuesAccessProperties.CHECKED_READ_OR_WRITE);

                // Then you have several methods in BusinessSheet to access all 
field types and get or set value directly from field label. You just need to 
know exactly the field type to call the correct method.
      lBusinessSheet.getStringField("TS_Completed").set("Write this");

//Then call directly an update of the sheet (using method read() to go back 
from BusinessSheet to CacheableSheet).
lSheetService.updateSheet(pRoleToken, ((CacheableSheetAccess) 
lBusinessSheet).read(), pContext);

Regards,
Anne

De : [email protected] 
[mailto:[email protected]] De la part de Topcased user 
list where issues are discussed
Envoyé : mardi 30 octobre 2012 09:39
À : [email protected]
Objet : [Topcased-users] Sheet access (cacheablesheet)

Hi everyone,

I'm developing a GPM instance and I got a question that I couldn't solve yet: I 
added a "preupdate"  extension point (in java) in a sheet type. What I want 
with this extension point is to read some field values from the sheet which is 
being updated and put these values in the fields of another different sheet. 
The problem is that I couldn't get access to write in the other sheet: I can 
read field values from all the sheets but I can only write in the sheet which 
is being updated.
I tried with this:

ServiceLocator lServiceLocator =  
pContext.get(ExtensionPointParameters.SERVICE_LOCATOR);
SheetService lSheetService = lServiceLocator.getSheetService();
CacheableSheet lCacheableSheet = lSheetService.getCacheableSheet(roleToken, 
sheetId);
FieldValueData lNoteAuthor =  new FieldValueData("TS_Completed", "Write this");
            lCacheableSheet.setValue(lNoteAuthor);


sheetId is the ID from the different sheet and "TS_Completed" is the name of 
the String field where I wanted to write.
I wonder if it will have to do with the Context..
I'm using the 2.0.2 version of GPM.


Many thanks in advance,

Best regards.


Xabi García





________________________________

Ce message et les pièces jointes sont confidentiels et réservés à l'usage 
exclusif de ses destinataires. Il peut également être protégé par le secret 
professionnel. Si vous recevez ce message par erreur, merci d'en avertir 
immédiatement l'expéditeur et de le détruire. L'intégrité du message ne pouvant 
être assurée sur Internet, la responsabilité du groupe Atos ne pourra être 
engagée quant au contenu de ce message. Bien que les meilleurs efforts soient 
faits pour maintenir cette transmission exempte de tout virus, l'expéditeur ne 
donne aucune garantie à cet égard et sa responsabilité ne saurait être engagée 
pour tout dommage résultant d'un virus transmis.

This e-mail and the documents attached are confidential and intended solely for 
the addressee; it may also be privileged. If you receive this e-mail in error, 
please notify the sender immediately and destroy it. As its integrity cannot be 
secured on the Internet, the Atos group liability cannot be triggered for the 
message content. Although the sender endeavors to maintain a computer 
virus-free network, the sender does not warrant that this transmission is 
virus-free and will not be liable for any damages resulting from any virus 
transmitted.
_______________________________________________
Topcased-users mailing list
[email protected]
http://lists.gforge.enseeiht.fr/cgi-bin/mailman/listinfo/topcased-users

Reply via email to