Update of 
/var/cvs/contributions/CMSContainer_Modules/community/src/java/com/finalist/cmsc/services/community/person
In directory james.mmbase.org:/tmp/cvs-serv10900/services/community/person

Modified Files:
      Tag: b1_5
        PersonHibernateService.java PersonService.java 
Log Message:
CMSC-1265  Community: improve import and export options of community users


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-1265


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.23.2.6
retrieving revision 1.23.2.7
diff -u -b -r1.23.2.6 -r1.23.2.7
--- PersonHibernateService.java 3 Mar 2009 09:08:13 -0000       1.23.2.6
+++ PersonHibernateService.java 3 Mar 2009 10:30:16 -0000       1.23.2.7
@@ -502,68 +502,4 @@
       criteria = criteria.setResultTransformer(criteria.DISTINCT_ROOT_ENTITY); 
       return criteria.list();
    }
-   @Transactional
-   public void importDataFromFileRecord(String level,
-         PersonExportImportVO importPerson) {
-      Person p = 
getPersonByUserId(importPerson.getAuthentication().getUserId());
-      if ("over".equals(level)) {
-         if(p != null) {
-            
authenticationService.updateAuthenticationPassword(importPerson.getAuthentication().getUserId(),
 importPerson.getAuthentication().getPassword());
-            p.setEmail(importPerson.getEmail());
-            p.setActive(importPerson.getActive());
-            updatePerson(p);
-         }
-         else {
-            Authentication authentication = 
authenticationService.createAuthentication(importPerson.getAuthentication());
-            if (authentication.getId() != null) {
-               if(importPerson.getAuthorityId()>0 ){
-                  Authority authority = 
this.getAuthorityById(importPerson.getAuthorityId());
-                  if (null!=authentication.getAuthorities()) {
-                     authentication.getAuthorities().add(authority);
-                  }
-               }
-               addPerson(importPerson, authentication);
-            } 
-         }         
-      }
-      else{
-         // add new users or put user to another group
-         createNewPerson(importPerson);
-      }
-      
-   }
-   @Transactional
-   private void addPerson(PersonExportImportVO importPerson,
-         Authentication authentication) {
-      Person person = new Person();
-      person.setEmail(importPerson.getEmail());
-      person.setActive(importPerson.getActive());
-      person.setAuthenticationId(authentication.getId());
-      getSession().saveOrUpdate(authentication);
-      updatePerson(person);
-   }
-   @Transactional(propagation = Propagation.REQUIRED)
-   private void createNewPerson(PersonExportImportVO xperson) {
-
-      Authentication authentication = xperson.getAuthentication();
-      
if(authenticationService.authenticationExists(authentication.getUserId()) && 
xperson.getAuthorityId()>0 ){
-         Authority authority = this.getAuthorityById(xperson.getAuthorityId());
-         if(null!=authority){
-            authentication = 
authenticationService.getAuthenticationById(authenticationService.getAuthenticationIdForUserId(authentication.getUserId()));
-            authentication.getAuthorities().add(authority);
-            getSession().saveOrUpdate(authentication);
-         }
-      }
-      else 
if(!authenticationService.authenticationExists(authentication.getUserId())){
-         authentication = 
authenticationService.createAuthentication(authentication);
-         if(xperson.getAuthorityId()>0 ){
-            Authority authority = 
this.getAuthorityById(xperson.getAuthorityId());
-            if (null!=authentication.getAuthorities()) {
-               authentication.getAuthorities().add(authority);
-            }
-         }
-         addPerson(xperson, authentication);
-      }
-   
-   }
 }


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.16.2.5
retrieving revision 1.16.2.6
diff -u -b -r1.16.2.5 -r1.16.2.6
--- PersonService.java  3 Mar 2009 09:08:13 -0000       1.16.2.5
+++ PersonService.java  3 Mar 2009 10:30:16 -0000       1.16.2.6
@@ -89,5 +89,4 @@
 
    public List<Authority> getAllAuthorities();
    
-   public void importDataFromFileRecord(String level, PersonExportImportVO 
importPerson);
 }
_______________________________________________
Cvs mailing list
Cvs@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to