[jbpm-commits] JBoss JBPM SVN: r3775 - in jbpm4/trunk/modules: api/src/main/java/org/jbpm/identity and 7 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Feb 4 10:06:02 EST 2009
Author: tom.baeyens at jboss.com
Date: 2009-02-04 10:06:02 -0500 (Wed, 04 Feb 2009)
New Revision: 3775
Added:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/IdentityService.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/identity/
jbpm4/trunk/modules/api/src/main/java/org/jbpm/identity/Group.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/identity/User.java
jbpm4/trunk/modules/pvm/src/main/docs/
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateMembership.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindGroupsByUserNameAndGroupType.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/identity/IdentityTest.java
Removed:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Group.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/User.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/IdentityService.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/identity/IdentityTest.java
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessDefinition.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateGroup.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteGroup.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/GetGroups.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/GetUsers.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/GroupImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentityServiceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentitySessionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/UserImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/spi/IdentitySession.java
Log:
JBPM-1993 further work out the identity integration
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/IdentityService.java (from rev 3754, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/IdentityService.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/IdentityService.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/IdentityService.java 2009-02-04 15:06:02 UTC (rev 3775)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm;
+
+import java.util.List;
+
+import org.jbpm.identity.Group;
+import org.jbpm.identity.User;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface IdentityService {
+
+ void createUser(String userName, String givenName, String familyName);
+ void deleteUser(String userName);
+
+ void createGroup(String groupName, String groupType);
+ void createGroup(String groupName, String groupType, String parentgroupName);
+
+ void createMembership(String userName, String groupName, String groupType, String role);
+
+ List<User> getUsers();
+
+ List<Group> getGroups();
+
+ List<Group> findGroupsByUserAndGroupType(String userName, String groupType);
+}
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/IdentityService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessDefinition.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessDefinition.java 2009-02-04 13:55:39 UTC (rev 3774)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessDefinition.java 2009-02-04 15:06:02 UTC (rev 3775)
@@ -51,7 +51,7 @@
/** automatically assigned during deployment of a process that
* represents the sequence number for process definitions with
- * the same {@link ObservableElement#getId() name}. */
+ * the same {@link ObservableElement#getName() name}. */
int getVersion();
/** the description name given to this process definition.
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/identity/Group.java (from rev 3754, jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Group.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/identity/Group.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/identity/Group.java 2009-02-04 15:06:02 UTC (rev 3775)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.identity;
+
+
+/** a group.
+ *
+ * @author Tom Baeyens
+ */
+public interface Group {
+
+ String TYPE_ORGANISATION_UNIT = "ORGANIZATION_UNIT";
+
+ String getName();
+}
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/identity/Group.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/identity/User.java (from rev 3754, jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/User.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/identity/User.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/identity/User.java 2009-02-04 15:06:02 UTC (rev 3775)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.identity;
+
+
+/** a user
+ * @author Tom Baeyens
+ */
+public interface User {
+
+ String getName();
+
+ String getGivenName();
+ String getFamilyName();
+}
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/identity/User.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Group.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Group.java 2009-02-04 13:55:39 UTC (rev 3774)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Group.java 2009-02-04 15:06:02 UTC (rev 3775)
@@ -1,35 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.task;
-
-
-/** a group.
- *
- * @author Tom Baeyens
- */
-public interface Group {
-
- String TYPE_ORGANISATION_UNIT = "ORGANIZATION_UNIT";
-
- String getId();
- String getName();
-}
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/User.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/User.java 2009-02-04 13:55:39 UTC (rev 3774)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/User.java 2009-02-04 15:06:02 UTC (rev 3775)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.task;
-
-
-/** a user
- * @author Tom Baeyens
- */
-public interface User {
-
- String getId();
-
- String getGivenName();
- String getFamilyName();
-}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/IdentityService.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/IdentityService.java 2009-02-04 13:55:39 UTC (rev 3774)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/IdentityService.java 2009-02-04 15:06:02 UTC (rev 3775)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.identity;
-
-import java.util.List;
-
-import org.jbpm.task.Group;
-import org.jbpm.task.User;
-
-
-/**
- * @author Tom Baeyens
- */
-public interface IdentityService {
-
- void createUser(String userId, String givenName, String familyName);
- void deleteUser(String userId);
-
- void createGroup(String groupId, String groupName, String groupType);
- void createGroup(String groupId, String groupName, String groupType, String parentGroupId);
-
- List<User> getUsers();
-
- List<Group> getGroups();
-}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateGroup.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateGroup.java 2009-02-04 13:55:39 UTC (rev 3774)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateGroup.java 2009-02-04 15:06:02 UTC (rev 3775)
@@ -33,14 +33,12 @@
private static final long serialVersionUID = 1L;
- protected String groupId;
protected String groupName;
protected String groupType;
protected String parentGroupId;
- public CreateGroup(String groupId, String groupName, String groupType, String parentGroupId) {
- this.groupId = groupId;
+ public CreateGroup(String groupName, String groupType, String parentGroupId) {
this.groupName = groupName;
this.groupType = groupType;
this.parentGroupId = parentGroupId;
@@ -48,7 +46,7 @@
public Void execute(Environment environment) throws Exception {
IdentitySession identitySession = environment.get(IdentitySession.class);
- identitySession.createGroup(groupId, groupName, groupType, parentGroupId);
+ identitySession.createGroup(groupName, groupType, parentGroupId);
return null;
}
}
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateMembership.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateMembership.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateMembership.java 2009-02-04 15:06:02 UTC (rev 3775)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.identity.cmd;
+
+import org.jbpm.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.pvm.internal.identity.spi.IdentitySession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class CreateMembership implements Command<Object> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String userId;
+ protected String groupId;
+ protected String groupType;
+ protected String role;
+
+ public CreateMembership(String userId, String groupId, String groupType, String role) {
+ this.userId = userId;
+ this.groupId = groupId;
+ this.groupType = groupType;
+ this.role = role;
+ }
+
+ public Object execute(Environment environment) throws Exception {
+ IdentitySession identitySession = environment.get(IdentitySession.class);
+ identitySession.createMembership(userId, groupId, groupType, role);
+ return null;
+ }
+
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateMembership.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteGroup.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteGroup.java 2009-02-04 13:55:39 UTC (rev 3774)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteGroup.java 2009-02-04 15:06:02 UTC (rev 3775)
@@ -34,14 +34,16 @@
private static final long serialVersionUID = 1L;
protected String groupId;
+ protected String groupType;
- public DeleteGroup(String groupId) {
+ public DeleteGroup(String groupId, String groupType) {
this.groupId = groupId;
+ this.groupType = groupType;
}
public Void execute(Environment environment) throws Exception {
IdentitySession identitySession = environment.get(IdentitySession.class);
- identitySession.deleteGroup(groupId);
+ identitySession.deleteGroup(groupId, groupType);
return null;
}
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindGroupsByUserNameAndGroupType.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindGroupsByUserNameAndGroupType.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindGroupsByUserNameAndGroupType.java 2009-02-04 15:06:02 UTC (rev 3775)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.identity.cmd;
+
+import java.util.List;
+
+import org.jbpm.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.identity.Group;
+import org.jbpm.pvm.internal.identity.spi.IdentitySession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class FindGroupsByUserNameAndGroupType implements Command<List<Group>> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String userName;
+ protected String groupType;
+
+ public FindGroupsByUserNameAndGroupType(String userName, String groupType) {
+ this.userName = userName;
+ this.groupType = groupType;
+ }
+
+ public List<Group> execute(Environment environment) throws Exception {
+ IdentitySession identitySession = environment.get(IdentitySession.class);
+ return identitySession.findGroupsByUserAndGroupType(userName, groupType);
+ }
+
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindGroupsByUserNameAndGroupType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/GetGroups.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/GetGroups.java 2009-02-04 13:55:39 UTC (rev 3774)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/GetGroups.java 2009-02-04 15:06:02 UTC (rev 3775)
@@ -25,8 +25,8 @@
import org.jbpm.cmd.Command;
import org.jbpm.env.Environment;
+import org.jbpm.identity.Group;
import org.jbpm.pvm.internal.identity.spi.IdentitySession;
-import org.jbpm.task.Group;
/**
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/GetUsers.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/GetUsers.java 2009-02-04 13:55:39 UTC (rev 3774)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/GetUsers.java 2009-02-04 15:06:02 UTC (rev 3775)
@@ -25,8 +25,8 @@
import org.jbpm.cmd.Command;
import org.jbpm.env.Environment;
+import org.jbpm.identity.User;
import org.jbpm.pvm.internal.identity.spi.IdentitySession;
-import org.jbpm.task.User;
/**
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/GroupImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/GroupImpl.java 2009-02-04 13:55:39 UTC (rev 3774)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/GroupImpl.java 2009-02-04 15:06:02 UTC (rev 3775)
@@ -23,7 +23,7 @@
import java.io.Serializable;
-import org.jbpm.task.Group;
+import org.jbpm.identity.Group;
/**
@@ -33,17 +33,12 @@
private static final long serialVersionUID = 1L;
- protected String id;
protected String name;
- public GroupImpl(String id, String name) {
- this.id = id;
+ public GroupImpl(String name) {
this.name = name;
}
- public String getId() {
- return id;
- }
public String getName() {
return name;
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentityServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentityServiceImpl.java 2009-02-04 13:55:39 UTC (rev 3774)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentityServiceImpl.java 2009-02-04 15:06:02 UTC (rev 3775)
@@ -23,16 +23,18 @@
import java.util.List;
+import org.jbpm.IdentityService;
import org.jbpm.cmd.CommandService;
-import org.jbpm.pvm.internal.identity.IdentityService;
+import org.jbpm.identity.Group;
+import org.jbpm.identity.User;
import org.jbpm.pvm.internal.identity.cmd.CreateGroup;
+import org.jbpm.pvm.internal.identity.cmd.CreateMembership;
import org.jbpm.pvm.internal.identity.cmd.CreateUser;
import org.jbpm.pvm.internal.identity.cmd.DeleteGroup;
import org.jbpm.pvm.internal.identity.cmd.DeleteUser;
+import org.jbpm.pvm.internal.identity.cmd.FindGroupsByUserNameAndGroupType;
import org.jbpm.pvm.internal.identity.cmd.GetGroups;
import org.jbpm.pvm.internal.identity.cmd.GetUsers;
-import org.jbpm.task.Group;
-import org.jbpm.task.User;
/**
@@ -50,23 +52,31 @@
return commandService.execute(new GetUsers());
}
- public void createUser(String userId, String givenName, String familyName) {
- commandService.execute(new CreateUser(userId, givenName, familyName));
+ public void createUser(String userName, String givenName, String familyName) {
+ commandService.execute(new CreateUser(userName, givenName, familyName));
}
- public void createGroup(String groupId, String groupName, String groupType) {
- commandService.execute(new CreateGroup(groupId, groupName, groupType, null));
+ public void createGroup(String groupName, String groupType) {
+ commandService.execute(new CreateGroup(groupName, groupType, null));
}
- public void createGroup(String groupId, String groupName, String groupType, String parentGroupId) {
- commandService.execute(new CreateGroup(groupId, groupName, groupType, parentGroupId));
+ public void createGroup(String groupName, String groupType, String parentGroupName) {
+ commandService.execute(new CreateGroup(groupName, groupType, parentGroupName));
}
- public void deleteUser(String userId) {
- commandService.execute(new DeleteUser(userId));
+ public void deleteUser(String userName) {
+ commandService.execute(new DeleteUser(userName));
}
- public void deleteGroup(String groupId) {
- commandService.execute(new DeleteGroup(groupId));
+ public void deleteGroup(String groupName, String groupType) {
+ commandService.execute(new DeleteGroup(groupName, groupType));
}
+
+ public void createMembership(String userName, String groupName, String groupType, String role) {
+ commandService.execute(new CreateMembership(userName, groupName, groupType, role));
+ }
+
+ public List<Group> findGroupsByUserAndGroupType(String userName, String groupType) {
+ return commandService.execute(new FindGroupsByUserNameAndGroupType(userName, groupType));
+ }
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentitySessionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentitySessionImpl.java 2009-02-04 13:55:39 UTC (rev 3774)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentitySessionImpl.java 2009-02-04 15:06:02 UTC (rev 3775)
@@ -23,6 +23,7 @@
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import org.jboss.identity.idm.api.Attribute;
@@ -31,6 +32,8 @@
import org.jboss.identity.idm.api.Identity;
import org.jboss.identity.idm.api.IdentitySearchControl;
import org.jboss.identity.idm.api.IdentitySession;
+import org.jboss.identity.idm.api.Role;
+import org.jboss.identity.idm.api.RoleType;
import org.jboss.identity.idm.exception.IdentityException;
import org.jboss.identity.idm.impl.api.NameFilterSearchControl;
import org.jboss.identity.idm.impl.api.SimpleAttribute;
@@ -38,9 +41,9 @@
import org.jboss.identity.idm.p3p.P3PConstants;
import org.jbpm.JbpmException;
import org.jbpm.env.Environment;
+import org.jbpm.identity.Group;
+import org.jbpm.identity.User;
import org.jbpm.pvm.internal.tx.StandardTransaction;
-import org.jbpm.task.Group;
-import org.jbpm.task.User;
/**
@@ -58,16 +61,16 @@
transaction.enlistResource(identitySessionResource);
}
- public void createUser(String userId, String givenName, String lastName) {
+ public void createUser(String userName, String givenName, String lastName) {
try {
- Identity identity = identitySession.getPersistenceManager().createIdentity(userId);
+ Identity identity = identitySession.getPersistenceManager().createIdentity(userName);
Attribute[] attributes = new Attribute[] {
new SimpleAttribute(P3PConstants.INFO_USER_NAME_GIVEN, new String[] { givenName }),
new SimpleAttribute(P3PConstants.INFO_USER_NAME_FAMILY, new String[] { lastName })
};
identitySession.getAttributesManager().addAttributes(identity, attributes);
} catch (IdentityException e) {
- throw new JbpmException("couldn't create user "+userId, e);
+ throw new JbpmException("couldn't create user "+userName, e);
}
}
@@ -94,64 +97,53 @@
}
}
- public void deleteUser(String userId) {
+ public void deleteUser(String userName) {
try {
- Collection<org.jboss.identity.idm.api.Identity> identities = identitySession
- .getPersistenceManager()
- .findIdentity(new IdentitySearchControl[]{
- new NameFilterSearchControl(userId)
- } );
+ org.jboss.identity.idm.api.Identity identity = findIdentity(userName);
- if ( (identities==null) || (identities.size()==0) ) {
+ if (identity==null) {
return;
}
- org.jboss.identity.idm.api.Identity identity = identities.iterator().next();
-
identitySession
.getPersistenceManager()
.removeIdentity(identity, true);
} catch (IdentityException e) {
- throw new JbpmException("couldn't delete group "+userId, e);
+ throw new JbpmException("couldn't delete group "+userName, e);
}
}
-
- public void createGroup(String groupId, String groupName, String groupType, String parentGroupId) {
+ public void createGroup(String groupName, String groupType, String parentGroupName) {
try {
- GroupType groupIdType = new SimpleGroupType(groupType);
- org.jboss.identity.idm.api.Group group = identitySession.getPersistenceManager().createGroup(groupId, groupIdType);
+ GroupType simpleGroupType = new SimpleGroupType(groupType);
+ org.jboss.identity.idm.api.Group group = identitySession.getPersistenceManager().createGroup(groupName, simpleGroupType);
- org.jboss.identity.idm.api.Group parentGroup = null;
- if (parentGroupId!=null) {
- parentGroup = identitySession.getPersistenceManager().findGroup(parentGroupId, groupIdType);
+ if (parentGroupName!=null) {
+ org.jboss.identity.idm.api.Group parentGroup = findGroup(parentGroupName, groupType);
+ if (parentGroup==null) {
+ throw new JbpmException("parent group "+parentGroupName+" doesn't exist");
+ }
identitySession.getRelationshipManager().associateGroups(parentGroup, group);
}
- Attribute[] attributes = new Attribute[] {
- new SimpleAttribute(P3PConstants.INFO_USER_NAME_GIVEN, new String[] { groupName })
- };
- identitySession.getAttributesManager().addAttributes(group, attributes);
-
} catch (IdentityException e) {
- throw new JbpmException("couldn't create group "+groupId, e);
+ throw new JbpmException("couldn't create group "+groupName, e);
}
}
public List<Group> getGroups(String groupType) {
try {
- GroupType groupIdType = new SimpleGroupType(groupType);
+ GroupType simpleGroupType = new SimpleGroupType(groupType);
Collection<org.jboss.identity.idm.api.Group> idGroups = identitySession
.getPersistenceManager()
- .findGroup(groupIdType);
+ .findGroup(simpleGroupType);
List<Group> groups = new ArrayList<Group>();
for (org.jboss.identity.idm.api.Group idGroup: idGroups) {
- String name = idGroup.getName();
- String groupName = getAttributeString(idGroup, P3PConstants.INFO_USER_NAME_GIVEN);
-
- GroupImpl group = new GroupImpl(name, groupName);
+ String groupName = idGroup.getName();
+
+ GroupImpl group = new GroupImpl(groupName);
groups.add(group);
}
@@ -162,37 +154,112 @@
}
}
- public void deleteGroup(String groupId) {
+ public void deleteGroup(String groupName, String groupType) {
try {
- GroupType groupIdType = new SimpleGroupType(groupId);
-
- Collection<org.jboss.identity.idm.api.Group> groups = identitySession
- .getPersistenceManager()
- .findGroup(groupIdType, new IdentitySearchControl[]{
- new NameFilterSearchControl(groupId)
- } );
-
- if ( (groups==null) || (groups.size()==0) ) {
+ org.jboss.identity.idm.api.Group group = findGroup(groupName, groupType);
+
+ if (group==null) {
return;
}
-
- org.jboss.identity.idm.api.Group group = groups.iterator().next();
-
+
identitySession
.getPersistenceManager()
.removeGroup(group, true);
} catch (IdentityException e) {
- throw new JbpmException("couldn't delete group "+groupId, e);
+ throw new JbpmException("couldn't delete group "+groupName, e);
}
}
+ public void createMembership(String userName, String groupName, String groupType, String role) {
+ try {
+ org.jboss.identity.idm.api.Group group = findGroup(groupName, groupType);
+ if (group==null) {
+ throw new JbpmException("group "+groupName+" doesn't exist");
+ }
+ org.jboss.identity.idm.api.Identity identity = findIdentity(userName);
+ if (identity==null) {
+ throw new JbpmException("user "+userName+" doesn't exist");
+ }
+
+
+ if (role!=null) {
+ RoleType roleType = identitySession.getRoleManager().getRoleType(role);
+ if (roleType==null) {
+ roleType = identitySession.getRoleManager().createRoleType(role);
+ }
+
+ identitySession.getRoleManager().createRole(roleType, identity, group);
+
+ } else {
+ identitySession.getRelationshipManager().associateIdentities(group, identity);
+ }
+
+ } catch (Exception e) {
+ throw new JbpmException("couldn't create membership "+userName+", "+groupName+", "+role, e);
+ }
+ }
+ public List<Group> findGroupsByUserAndGroupType(String userName, String groupType) {
+ try {
+ org.jboss.identity.idm.api.Identity identity = findIdentity(userName);
+ if (identity==null) {
+ return Collections.EMPTY_LIST;
+ }
+
+ List<Group> groups = new ArrayList<Group>();
+
+ GroupType identityGroupType = new SimpleGroupType(groupType);
+ Collection<org.jboss.identity.idm.api.Group> identityGroups = identitySession.getRelationshipManager().findAssociatedGroups(identity, identityGroupType);
+
+ for (org.jboss.identity.idm.api.Group identityGroup: identityGroups) {
+ String groupName = identityGroup.getName();
+ GroupImpl group = new GroupImpl(groupName);
+ groups.add(group);
+ }
+
+ return groups;
+
+ } catch (Exception e) {
+ throw new JbpmException("couldn't get groups for user "+userName+" and groupType "+groupType, e);
+ }
+ }
+
+ protected org.jboss.identity.idm.api.Identity findIdentity(String userName) throws IdentityException {
+ Collection<org.jboss.identity.idm.api.Identity> identities = identitySession
+ .getPersistenceManager()
+ .findIdentity(new IdentitySearchControl[]{
+ new NameFilterSearchControl(userName)
+ } );
+
+ if ( (identities==null) || (identities.size()==0) ) {
+ return null;
+ }
+
+ return identities.iterator().next();
+ }
+
+ protected org.jboss.identity.idm.api.Group findGroup(String groupName, String groupType) throws IdentityException {
+ GroupType groupIdType = new SimpleGroupType(groupType);
+
+ Collection<org.jboss.identity.idm.api.Group> groups = identitySession
+ .getPersistenceManager()
+ .findGroup(groupIdType, new IdentitySearchControl[]{
+ new NameFilterSearchControl(groupName)
+ } );
+
+ if ( (groups==null) || (groups.size()==0) ) {
+ return null;
+ }
+
+ return groups.iterator().next();
+ }
+
protected String getAttributeString(Identity identity, String attributeName) throws IdentityException {
return getAttributeString(identity, null, attributeName);
}
-
+
protected String getAttributeString(org.jboss.identity.idm.api.Group idGroup, String attributeName) throws IdentityException {
return getAttributeString(null, idGroup, attributeName);
}
@@ -210,7 +277,8 @@
}
return null;
}
-
+
+
public IdentitySession getIdentitySession() {
return identitySession;
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/UserImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/UserImpl.java 2009-02-04 13:55:39 UTC (rev 3774)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/UserImpl.java 2009-02-04 15:06:02 UTC (rev 3775)
@@ -23,7 +23,7 @@
import java.io.Serializable;
-import org.jbpm.task.User;
+import org.jbpm.identity.User;
/**
@@ -33,18 +33,18 @@
private static final long serialVersionUID = 1L;
- protected String id;
+ protected String name;
protected String givenName;
protected String familyName;
- public UserImpl(String id, String givenName, String familyName) {
- this.id = id;
+ public UserImpl(String name, String givenName, String familyName) {
+ this.name = name;
this.givenName = givenName;
this.familyName = familyName;
}
- public String getId() {
- return id;
+ public String getName() {
+ return name;
}
public String getGivenName() {
return givenName;
@@ -59,6 +59,6 @@
) {
return givenName+" "+familyName;
}
- return id;
+ return name;
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/spi/IdentitySession.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/spi/IdentitySession.java 2009-02-04 13:55:39 UTC (rev 3774)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/spi/IdentitySession.java 2009-02-04 15:06:02 UTC (rev 3775)
@@ -23,8 +23,8 @@
import java.util.List;
-import org.jbpm.task.Group;
-import org.jbpm.task.User;
+import org.jbpm.identity.Group;
+import org.jbpm.identity.User;
/**
@@ -32,11 +32,15 @@
*/
public interface IdentitySession {
- void createUser(String userId, String givenName, String familyName);
+ void createUser(String userName, String givenName, String familyName);
List<User> getUsers();
- void deleteUser(String userId);
+ void deleteUser(String userName);
- void createGroup(String groupId, String groupName, String groupType, String parentGroupId);
+ void createGroup(String groupName, String groupType, String parentGroupName);
List<Group> getGroups(String groupType);
- void deleteGroup(String groupId);
+ void deleteGroup(String groupName, String groupType);
+
+ void createMembership(String userName, String groupName, String groupType, String role);
+
+ List<Group> findGroupsByUserAndGroupType(String userName, String groupType);
}
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/identity/IdentityTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/identity/IdentityTest.java 2009-02-04 13:55:39 UTC (rev 3774)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/identity/IdentityTest.java 2009-02-04 15:06:02 UTC (rev 3775)
@@ -1,66 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.identity;
-
-import java.util.List;
-
-import org.jbpm.task.Group;
-import org.jbpm.task.User;
-import org.jbpm.test.DbTestCase;
-
-
-/**
- * @author Tom Baeyens
- */
-public class IdentityTest extends DbTestCase {
-
- public void testSingleUser() throws Exception {
- IdentityService identityService = processEngine.get(IdentityService.class);
-
- identityService.createUser("johndoe", "John", "Doe");
-
- List<User> users = identityService.getUsers();
- assertNotNull(users);
- assertEquals(1, users.size());
-
- User johndoe = users.get(0);
- assertEquals("johndoe", johndoe.getId());
- assertEquals("John", johndoe.getGivenName());
- assertEquals("Doe", johndoe.getFamilyName());
- assertEquals("John Doe", johndoe.toString());
-
- identityService.deleteUser("johndoe");
-
- assertEquals(0, identityService.getUsers().size());
- }
-
- public void testSingleGroup() throws Exception {
- IdentityService identityService = processEngine.get(IdentityService.class);
-
- identityService.createUser("johndoe", "John", "Doe");
- identityService.createUser("joesmoe", "Joe", "Smoe");
-
- identityService.createGroup("redhat", "Red Hat", Group.TYPE_ORGANISATION_UNIT);
- identityService.createGroup("jboss", "JBoss", Group.TYPE_ORGANISATION_UNIT, "redhat");
- identityService.createGroup("jbpm", "jBPM", Group.TYPE_ORGANISATION_UNIT, "jboss");
- }
-}
Added: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/identity/IdentityTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/identity/IdentityTest.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/identity/IdentityTest.java 2009-02-04 15:06:02 UTC (rev 3775)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.identity;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.jbpm.IdentityService;
+import org.jbpm.identity.Group;
+import org.jbpm.identity.User;
+import org.jbpm.test.DbTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class IdentityTest extends DbTestCase {
+
+ public void testSingleUser() throws Exception {
+ IdentityService identityService = processEngine.get(IdentityService.class);
+
+ identityService.createUser("johndoe", "John", "Doe");
+
+ List<User> users = identityService.getUsers();
+ assertNotNull(users);
+ assertEquals(1, users.size());
+
+ User johndoe = users.get(0);
+ assertEquals("johndoe", johndoe.getName());
+ assertEquals("John", johndoe.getGivenName());
+ assertEquals("Doe", johndoe.getFamilyName());
+ assertEquals("John Doe", johndoe.toString());
+
+ identityService.deleteUser("johndoe");
+
+ assertEquals(0, identityService.getUsers().size());
+ }
+
+ public void testSingleGroup() throws Exception {
+ IdentityService identityService = processEngine.get(IdentityService.class);
+
+ identityService.createUser("johndoe", "John", "Doe");
+ identityService.createUser("joesmoe", "Joe", "Smoe");
+ identityService.createUser("jackblack", "Jack", "Black");
+
+ identityService.createGroup("redhat", Group.TYPE_ORGANISATION_UNIT);
+ identityService.createGroup("jboss", Group.TYPE_ORGANISATION_UNIT, "redhat");
+ identityService.createGroup("jbpm", Group.TYPE_ORGANISATION_UNIT, "jboss");
+
+ identityService.createMembership("johndoe", "jbpm", Group.TYPE_ORGANISATION_UNIT, "developer");
+ identityService.createMembership("joesmoe", "jbpm", Group.TYPE_ORGANISATION_UNIT, "developer");
+ identityService.createMembership("jackblack", "jboss", Group.TYPE_ORGANISATION_UNIT, "manager");
+
+ List<Group> groups = identityService.findGroupsByUserAndGroupType("jackblack", Group.TYPE_ORGANISATION_UNIT);
+
+ // assertEquals(1, groups.size());
+ // Group group = groups.get(0);
+ // assertEquals("jboss", group.getName());
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/identity/IdentityTest.java
___________________________________________________________________
Name: svn:mergeinfo
+
More information about the jbpm-commits
mailing list