Update of
/var/cvs/contributions/CMSContainer_Modules/community/src/java/com/finalist/cmsc/services/community/person
In directory
james.mmbase.org:/tmp/cvs-serv23218/community/src/java/com/finalist/cmsc/services/community/person
Modified Files:
PersonHibernateService.java PersonService.java
Log Message:
CMSC-888 fix.
See also:
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer_Modules/community/src/java/com/finalist/cmsc/services/community/person
See also: http://www.mmbase.org/jira/browse/CMSC-888
Index: PersonHibernateService.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Modules/community/src/java/com/finalist/cmsc/services/community/person/PersonHibernateService.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- PersonHibernateService.java 31 Mar 2008 19:49:02 -0000 1.4
+++ PersonHibernateService.java 7 May 2008 02:54:19 -0000 1.5
@@ -16,6 +16,7 @@
import org.hibernate.Criteria;
import org.hibernate.criterion.Example;
import org.hibernate.criterion.Restrictions;
+import org.hibernate.criterion.MatchMode;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.transaction.annotation.Transactional;
@@ -53,6 +54,23 @@
/** [EMAIL PROTECTED] */
@Transactional
+ public List<Person> getLikePersons(Person example) {
+ if (example == null) {
+ return Collections.emptyList();
+ }
+
+ Example userExample = Example.create(example).
+ enableLike(MatchMode.ANYWHERE).
+ excludeZeroes().
+ ignoreCase();
+ List personList =
getSession().createCriteria(Person.class).add(userExample).list();
+ return personList;
+ }
+
+ /**
+ * [EMAIL PROTECTED]
+ */
+ @Transactional
public Person createPerson(String firstName, String infix, String lastName,
Long authenticationId) {
if (firstName == null) {
throw new IllegalArgumentException("Firstname is null. ");
@@ -82,6 +100,10 @@
getSession().saveOrUpdate(person);
getSession().flush();
}
+ @Transactional
+ public List<Person> getAllPersons() {
+ return getSession().createCriteria(Person.class).list();
+ }
/** [EMAIL PROTECTED] */
@Transactional
Index: PersonService.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Modules/community/src/java/com/finalist/cmsc/services/community/person/PersonService.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- PersonService.java 31 Mar 2008 19:49:02 -0000 1.3
+++ PersonService.java 7 May 2008 02:54:19 -0000 1.4
@@ -35,6 +35,16 @@
*/
List<Person> getPersons(Person example);
+ /**
+ * Get a list of matching persons that like the given example. The fields
+ * that are set on the example Person are the criteria for the search.
+ *
+ * @param example
+ * the example person
+ * @return a list of persons that like the given example.
+ */
+ List<Person> getLikePersons(Person example);
+
Person getPersonByAuthenticationId(Long authenticationId);
Person createPerson(String firstName, String infix, String lastName, Long
authenticationId);
@@ -44,6 +54,8 @@
*/
void updatePerson(Person person);
+ List<Person> getAllPersons();
+
boolean deletePersonByAuthenticationId(Long userId);
}
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs