Hi Marc, >>hi all, >> >>is it possible to create LinkNodes with the slide-client-API?
I posted some code detailing this in reply to one of your earlier questions. I'm including it below in case you missed it. Apologies to those who already received it. If something about this is still unclear, feel free to ask :) Regards, Michael -------/ Michael Plomer /--/ stud. Hilfskraft CONCERT /---- ------/ Fraunhofer IPSI /--/ Kooperationskomponenten /----- -----/ Darmstadt/Germany /--/ eMail: [EMAIL PROTECTED] /------ >>-----Urspr�ngliche Nachricht----- >>Von: Michael Plomer [mailto:[EMAIL PROTECTED] >>Gesendet: Samstag, 24. Mai 2003 03:26 >>An: 'Slide Users Mailing List' >>Betreff: AW: creating GroupNodes and LinkNodes >> >> >>Hi Marc, >> >>first, you'll need to obtain a NamespaceAccessToken: >> >> // prepare the namespace access token (assuming you want >> // the default namespace) >> String namespace = Domain.getDefaultNamespace(); >> NamespaceAccessToken nat = Domain.accessNamespace(new SecurityToken(this), namespace); >> // "this" is a HttpServlet in my case, but could be almost anything (or so I think...) >> >>Next, you need a SlideToken, which you could construct, for >>instance, from the credentials in your servlets request (that >>is, assuming you are writing a servlet...). >> >> // prepare the slide token >> Principal principal = request.getUserPrincipal(); >> CredentialsToken credentials; >> if (principal == null) >> credentials = new CredentialsToken(""); >> else >> credentials = new CredentialsToken(principal); >> SlideToken st = new SlideTokenImpl(credentials); >> >>Creating a group node is pretty straightforward, most of the >>code deals >>with exception handling: >> >> // prepare the structure helper >> Structure structureHelper = nat.getStructureHelper(); >> >> try { >> try { >> // start namespace tansaction >> nat.begin(); >> // create the node in the structure >> ObjectNode object = new GroupNode(); >> structureHelper.create(st, object, "/users/testgroup"); >> // commit the transaction >> nat.commit(); >> } catch (AccessDeniedException ex) { >> ... // handle exception >> throw ex; >> } catch (ObjectAlreadyExistsException ex) { >> ... // handle exception >> throw ex; >> } catch (Exception ex) { >> ... // handle exception >> throw ex; >> } >> // ... SUCCESS ... >> } catch (Exception ex) { >> try { >> nat.rollback(); >> } catch (SystemException sysex) { // catch silently } >> } >> >>Linking users into the group should be done like this: >> >> // prepare the structure helper >> Structure structureHelper = nat.getStructureHelper(); >> >> try { >> try { >> // start namespace tansaction >> nat.begin(); >> // retrieve the node to be linked >> ObjectNode object = structureHelper.retrieve(st, "/users/testuser"); >> // create the link node >> structureHelper.createLink(st, new LinkNode(), "/users/testgroup/testuser", object); >> // commit the transaction >> nat.commit(); >> } catch (AccessDeniedException ex) { >> ... // handle exception >> throw ex; >> } catch (ObjectAlreadyExistsException ex) { >> ... // handle exception >> throw ex; >> } catch (Exception ex) { >> ... // handle exception >> throw ex; >> } >> // ... SUCCESS ... >> } catch (Exception ex) { >> try { >> nat.rollback(); >> } catch (SystemException sysex) { // catch silently } >> } >> >>Hope this helps. Keep in mind that while this code is from a servlet >>I wrote and actually works, I might have edited in some errors when >>writing this mail... >> >>Regards, >>Michael >> >>-------/ Michael Plomer /--/ stud. Hilfskraft CONCERT /---- >>------/ Fraunhofer IPSI /--/ Kooperationskomponenten /----- >>-----/ Darmstadt/Germany /--/ eMail: [EMAIL PROTECTED] /------ >> >>>>-----Urspr�ngliche Nachricht----- >>>>Von: Marc Sommer [mailto:[EMAIL PROTECTED] >>>>Gesendet: Donnerstag, 22. Mai 2003 16:52 >>>>An: Slide Users Mailing List >>>>Betreff: creating GroupNodes and LinkNodes >>>> >>>> >>>>hi NG, >>>> >>>>i need help to create GroupNodes and LinkNodes with the >>>>low-level-api of >>>>slide... >>>> >>>><objectnode classname="org.apache.slide.structure.GroupNode" >>>>uri="/users/testgroup"> >>>><objectnode classname="org.apache.slide.structure.LinkNode" >>>>uri="/users/testgroup/testuser" linkedUri="/users/testuser"/> >>>></objectnode> >>>> >>>>could anybody post a snippet which shows that, including >>the usage of >>>>the NamespaceAccessToken and SecurityToken? >>>> >>>>thanks in advance >>>>marc >>>> >>>> >>>>-- >>>> >>>>Marc Sommer >>>>Interne Applikationen >>>>+49 721 91374-364 >>>>PGP Key-ID: 0743ED19 >>>>Schlund + Partner AG >>>>http://www.schlund.de >>>> >>>> >>>>------------------------------------------------------------ >>--------- >>>>To unsubscribe, e-mail: [EMAIL PROTECTED] >>>>For additional commands, e-mail: [EMAIL PROTECTED] >>>> >>>> >> >> >>--------------------------------------------------------------------- >>To unsubscribe, e-mail: [EMAIL PROTECTED] >>For additional commands, e-mail: [EMAIL PROTECTED] >> >> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
