[jboss-svn-commits] JBL Code SVN: r23367 - in labs/jbossrules/trunk/drools-process: drools-process-task/src/main/java/org/drools/userprofile and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Oct 8 04:09:32 EDT 2008
Author: jervisliu
Date: 2008-10-08 04:09:32 -0400 (Wed, 08 Oct 2008)
New Revision: 23367
Modified:
labs/jbossrules/trunk/drools-process/drools-bpel/.classpath
labs/jbossrules/trunk/drools-process/drools-bpel/.project
labs/jbossrules/trunk/drools-process/drools-process-task/src/main/java/org/drools/userprofile/UserProfileManager.java
labs/jbossrules/trunk/drools-process/drools-process-task/src/main/java/org/drools/userprofile/UserProfileRepository.java
labs/jbossrules/trunk/drools-process/drools-process-task/src/test/java/org/drools/userprofile/MockFileBasedUserProfileRepository.java
Log:
Added more methods to UserProfileManager.
Modified: labs/jbossrules/trunk/drools-process/drools-bpel/.classpath
===================================================================
--- labs/jbossrules/trunk/drools-process/drools-bpel/.classpath 2008-10-08 07:33:31 UTC (rev 23366)
+++ labs/jbossrules/trunk/drools-process/drools-bpel/.classpath 2008-10-08 08:09:32 UTC (rev 23367)
@@ -1,35 +1,35 @@
-<classpath>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
- <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
- <classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/>
- <classpathentry kind="output" path="target/classes"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1/commons-logging-1.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.13/log4j-1.2.13.jar"/>
- <classpathentry kind="var" path="M2_REPO/logkit/logkit/1.0.1/logkit-1.0.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/avalon-framework/avalon-framework/4.1.3/avalon-framework-4.1.3.jar"/>
- <classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.3/servlet-api-2.3.jar"/>
- <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/net/sf/saxon/saxon/8.7/saxon-8.7.jar"/>
- <classpathentry kind="var" path="M2_REPO/net/sf/saxon/saxon-xpath/8.7/saxon-xpath-8.7.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/ode/ode-bpel-compiler/1.2/ode-bpel-compiler-1.2.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/ode/ode-bpel-schemas/1.2/ode-bpel-schemas-1.2.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/ode/ode-utils/1.2/ode-utils-1.2.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/drools/drools-compiler/5.0.0.SNAPSHOT/drools-compiler-5.0.0.SNAPSHOT.jar" sourcepath="M2_REPO/org/drools/drools-compiler/5.0.0.SNAPSHOT/drools-compiler-5.0.0.SNAPSHOT-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/drools/drools-core/5.0.0.SNAPSHOT/drools-core-5.0.0.SNAPSHOT.jar" sourcepath="M2_REPO/org/drools/drools-core/5.0.0.SNAPSHOT/drools-core-5.0.0.SNAPSHOT-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/mvel/mvel/2.0-SNAPSHOT/mvel-2.0-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/antlr/antlr-runtime/3.0.1/antlr-runtime-3.0.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/antlr/gunit/1.0.1/gunit-1.0.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/antlr/antlr/3.0.1/antlr-3.0.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.7/antlr-2.7.7.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/eclipse/jdt/core/3.2.3.v_686_R32x/core-3.2.3.v_686_R32x.jar"/>
- <classpathentry kind="var" path="M2_REPO/janino/janino/2.5.10/janino-2.5.10.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jmock/jmock/2.5.0.1/jmock-2.5.0.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-library/1.1/hamcrest-library-1.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/wsdl4j/wsdl4j/1.6.1/wsdl4j-1.6.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/xalan/xalan/2.7.0/xalan-2.7.0.jar"/>
- <classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/2.0.2/xml-apis-2.0.2.jar"/>
- <classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.8.0/xercesImpl-2.8.0.jar"/>
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
+ <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
+ <classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/>
+ <classpathentry kind="output" path="target/classes"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="var" path="M2_REPO/logkit/logkit/1.0.1/logkit-1.0.1.jar" sourcepath="M2_REPO/logkit/logkit/1.0.1/logkit-1.0.1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/antlr/gunit/1.0.1/gunit-1.0.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/antlr/antlr-runtime/3.0.1/antlr-runtime-3.0.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/mvel/mvel/2.0-SNAPSHOT/mvel-2.0-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/ode/ode-utils/1.2/ode-utils-1.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/net/sf/saxon/saxon-xpath/8.7/saxon-xpath-8.7.jar"/>
+ <classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/2.0.2/xml-apis-2.0.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.7/antlr-2.7.7.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jmock/jmock/2.5.0.1/jmock-2.5.0.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1/commons-logging-1.1.jar" sourcepath="M2_REPO/commons-logging/commons-logging/1.1/commons-logging-1.1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/janino/janino/2.5.10/janino-2.5.10.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/ode/ode-bpel-compiler/1.2/ode-bpel-compiler-1.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-library/1.1/hamcrest-library-1.1.jar"/>
+ <classpathentry kind="src" path="/drools-compiler"/>
+ <classpathentry kind="var" path="M2_REPO/net/sf/saxon/saxon/8.7/saxon-8.7.jar"/>
+ <classpathentry kind="var" path="M2_REPO/xalan/xalan/2.7.0/xalan-2.7.0.jar" sourcepath="M2_REPO/xalan/xalan/2.7.0/xalan-2.7.0-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.8.0/xercesImpl-2.8.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jdt/core/3.2.3.v_686_R32x/core-3.2.3.v_686_R32x.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/antlr/antlr/3.0.1/antlr-3.0.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.13/log4j-1.2.13.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/ode/ode-bpel-schemas/1.2/ode-bpel-schemas-1.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/wsdl4j/wsdl4j/1.6.1/wsdl4j-1.6.1.jar" sourcepath="M2_REPO/wsdl4j/wsdl4j/1.6.1/wsdl4j-1.6.1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.3/servlet-api-2.3.jar" sourcepath="M2_REPO/javax/servlet/servlet-api/2.3/servlet-api-2.3-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
+ <classpathentry kind="src" path="/drools-core"/>
+ <classpathentry kind="var" path="M2_REPO/avalon-framework/avalon-framework/4.1.3/avalon-framework-4.1.3.jar"/>
</classpath>
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-process/drools-bpel/.project
===================================================================
--- labs/jbossrules/trunk/drools-process/drools-bpel/.project 2008-10-08 07:33:31 UTC (rev 23366)
+++ labs/jbossrules/trunk/drools-process/drools-bpel/.project 2008-10-08 08:09:32 UTC (rev 23367)
@@ -1,13 +1,16 @@
-<projectDescription>
- <name>drools-bpel</name>
- <comment>A rule production system</comment>
- <projects/>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
+<projectDescription>
+ <name>drools-bpel</name>
+ <comment>A rule production system</comment>
+ <projects>
+ <project>drools-compiler</project>
+ <project>drools-core</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
</projectDescription>
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-process/drools-process-task/src/main/java/org/drools/userprofile/UserProfileManager.java
===================================================================
--- labs/jbossrules/trunk/drools-process/drools-process-task/src/main/java/org/drools/userprofile/UserProfileManager.java 2008-10-08 07:33:31 UTC (rev 23366)
+++ labs/jbossrules/trunk/drools-process/drools-process-task/src/main/java/org/drools/userprofile/UserProfileManager.java 2008-10-08 08:09:32 UTC (rev 23367)
@@ -11,9 +11,9 @@
/**
* userProfileManager retrieves and update user profile using a pluggable UserProfileRepository.
- * UserProfileRepository is normally implemented by users based on the persistent mechanism
- * (for example property file, RMDB, LDAP etc) as well as the data schema that is used by
- * users' application.
+ * UserProfileRepository is normally implemented by application users based on the persistent mechanism
+ * (for example property file based, RMDB based, LDAP based etc) as well as the data schema that
+ * is used by users' application.
* Following snippet shows how to configure UserProfileRepository in components.xml.
<component name="userProfileManager">
<property name="userProfileRepository">org.drools.task.MockFileBasedUserProfileRepository</property>
@@ -28,7 +28,11 @@
public class UserProfileManager {
UserProfileRepository userProfileRepository = null;
- //get current user
+ /**
+ * Return current user.
+ *
+ * @return User
+ */
public User getUser() {
String userName = "";
if (Contexts.isApplicationContextActive()) {
@@ -37,16 +41,27 @@
return getUser(userName);
}
- public User getUser(String userName) {
+ /**
+ * Return the user according to the userId.
+ *
+ * @return User
+ */
+ public User getUser(String userId) {
if (userProfileRepository == null) {
//TODO: throws exception?
return null;
}
User user = new User();
- user.setUserProfile(userProfileRepository.getUserProfile(userName));
+ UserProfile profile = userProfileRepository.getUserProfile(userId);
+ user.setUserProfile(profile);
+ user.setId(profile.getID());
return user;
}
+ /**
+ * Update user info
+ *
+ */
public void updateUser(User user) {
if (userProfileRepository == null) {
//TODO: throws exception?
@@ -55,6 +70,11 @@
userProfileRepository.setUserProfile(user.getUserProfile());
}
+ /**
+ * Return all registered users
+ *
+ * @return List<User>, a list of all registered users
+ */
public List<User> getUsers() {
if (userProfileRepository == null) {
//TODO: throws exception?
@@ -62,7 +82,25 @@
}
return userProfileRepository.getUsers();
}
+
+ /**
+ * Return a list of Ids of all registered users instead of fully populated User classes.
+ *
+ * @return String[], a list of all registered users' id.
+ */
+ public String[] getUserIds() {
+ if (userProfileRepository == null) {
+ //TODO: throws exception?
+ return null;
+ }
+ return userProfileRepository.getUserIds();
+ }
+ /**
+ * Return all registered users
+ *
+ * @return List<Group>, a list of all registered groups
+ */
public List<Group> getGroups() {
if (userProfileRepository == null) {
//TODO: throws exception?
@@ -71,6 +109,40 @@
return userProfileRepository.getGroups();
}
+ /**
+ * Return a list of Ids of all registered groups instead of fully populated Group classes.
+ *
+ * @return String[], a list of all registered groups' id.
+ */
+ public String[] getGroupIds() {
+ if (userProfileRepository == null) {
+ //TODO: throws exception?
+ return null;
+ }
+ return userProfileRepository.getUserIds();
+ }
+
+ /**
+ * Return a list of all the groups that the user belongs to.
+ *
+ * @param userId Id of the user.
+ * @return List<Group>, a list of groups that the user belongs to.
+ */
+ public List<Group> getGroupsForUser(String userId) {
+ return null;
+ }
+
+ /**
+ * Return a list of all the direct groups and all the sub groups that the user belongs to.
+ *
+ * @param userId Id of the user.
+ * @return List<Group>, a list of all the direct groups and all the sub
+ * groups that the user belongs to.
+ */
+ public List<Group> getFlattenedGroupsForUser(String userId) {
+ return null;
+ }
+
public UserProfileRepository getUserProfileRepository() {
return userProfileRepository;
}
Modified: labs/jbossrules/trunk/drools-process/drools-process-task/src/main/java/org/drools/userprofile/UserProfileRepository.java
===================================================================
--- labs/jbossrules/trunk/drools-process/drools-process-task/src/main/java/org/drools/userprofile/UserProfileRepository.java 2008-10-08 07:33:31 UTC (rev 23366)
+++ labs/jbossrules/trunk/drools-process/drools-process-task/src/main/java/org/drools/userprofile/UserProfileRepository.java 2008-10-08 08:09:32 UTC (rev 23367)
@@ -7,5 +7,7 @@
void setUserProfile(UserProfile info);
List<User> getUsers();
+ String[] getUserIds();
List<Group> getGroups();
+ String[] getGroupIds();
}
Modified: labs/jbossrules/trunk/drools-process/drools-process-task/src/test/java/org/drools/userprofile/MockFileBasedUserProfileRepository.java
===================================================================
--- labs/jbossrules/trunk/drools-process/drools-process-task/src/test/java/org/drools/userprofile/MockFileBasedUserProfileRepository.java 2008-10-08 07:33:31 UTC (rev 23366)
+++ labs/jbossrules/trunk/drools-process/drools-process-task/src/test/java/org/drools/userprofile/MockFileBasedUserProfileRepository.java 2008-10-08 08:09:32 UTC (rev 23367)
@@ -25,6 +25,11 @@
//may need to look into RMDB to get the list of all users
return null;
}
+
+ public String[] getUserIds() {
+ //may need to look into RMDB to get the list of all users
+ return null;
+ }
public List<Group> getGroups() {
List<OrganizationalEntity> members = new ArrayList<OrganizationalEntity>();
@@ -38,4 +43,8 @@
result.add(group);
return null;
}
+
+ public String[] getGroupIds() {
+ return null;
+ }
}
More information about the jboss-svn-commits
mailing list