You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by Ajay Mallik <am...@mortgagehub.com> on 2003/08/27 23:43:23 UTC
creating group and link nodes
Hi All,
I am trying to create a group of users using slide api, just like the one in
Domain.xml file's GroupNode and LinkNode.
I looked at the admin classes using struts, but it just adds a User.
I would highly appreciate if anyone could provide me a code snippet for the
equivalent of this element in Domain.xml:
<objectnode classname="org.apache.slide.structure.GroupNode"
uri="/users/groupA">
<objectnode classname="org.apache.slide.structure.LinkNode"
uri="/users/groupA/john" linkedUri="/users/john"/>
<objectnode classname="org.apache.slide.structure.LinkNode"
uri="/users/groupA/root" linkedUri="/users/root"/>
<objectnode classname="org.apache.slide.structure.SubjectNode"
uri="/users/groupA/singleGroupMember"/>
</objectnode>
Thanks in advance
Ajay Mallik
MortgageHub
Phone: 215 675 3955 x104
Re: creating group and link nodes
Posted by laurent belmonte <la...@aliacom.fr>.
createGroup :
ObjectNode object= new GroupNode();
NamespaceConfig nc = nat.getNamespaceConfig();
String strUri = nc.getUsersPath()+"/"+groupName;
structure.create(slideToken, object, strUri);
// create a revision with the appropriate properties set
NodeRevisionDescriptor revision =
new NodeRevisionDescriptor(0);
revision.setProperty(
new NodeProperty("resourcetype", "<collection/>",
true));
revision.setCreationDate(new Date());
revision.setLastModified(new Date());
revision.setProperty(
new NodeProperty("getcontentlength", "0", true));
revision.setProperty(
new NodeProperty("source", "", true));
content.create(slideToken, strUri, revision, null);
___________________________________________________________________
createUser :
ObjectNode object = new slideroles.basic.UserRoleImpl();
NamespaceConfig nc = nat.getNamespaceConfig();
String strUri = nc.getUsersPath() + "/" + userName;
structure.create(slideToken, object, strUri);
// create a revision with the appropriate properties set
NodeRevisionDescriptor revision = new NodeRevisionDescriptor(0);
revision.setProperty(
new NodeProperty("resourcetype", "<collection/>", true));
revision.setCreationDate(new Date());
revision.setLastModified(new Date());
revision.setProperty(new NodeProperty("getcontentlength", "0",
true));
revision.setProperty(new NodeProperty("source", "", true));
revision.setProperty(
new NodeProperty(
"password",
password,
NodeProperty.SLIDE_NAMESPACE));
content.create(slideToken, strUri, revision, null);
______________________________________________________________________
AddUserToGroup
String strUri = nc.getUsersPath()+"/"+groupName;
structure.createLink(slideToken,new LinkNode(),strUri+"/"+userName,
new SubjectNode(nc.getUsersPath()+"/"+userName))
On Wed, 2003-08-27 at 23:43, Ajay Mallik wrote:
> Hi All,
> I am trying to create a group of users using slide api, just like the one in
> Domain.xml file's GroupNode and LinkNode.
> I looked at the admin classes using struts, but it just adds a User.
> I would highly appreciate if anyone could provide me a code snippet for the
> equivalent of this element in Domain.xml:
>
> <objectnode classname="org.apache.slide.structure.GroupNode"
> uri="/users/groupA">
> <objectnode classname="org.apache.slide.structure.LinkNode"
> uri="/users/groupA/john" linkedUri="/users/john"/>
> <objectnode classname="org.apache.slide.structure.LinkNode"
> uri="/users/groupA/root" linkedUri="/users/root"/>
> <objectnode classname="org.apache.slide.structure.SubjectNode"
> uri="/users/groupA/singleGroupMember"/>
> </objectnode>
>
>
> Thanks in advance
>
>
> Ajay Mallik
> MortgageHub
> Phone: 215 675 3955 x104
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>
>