Exjob och personimport vid inlogg.

git-svn-id: svn://svn.dsv.su.se/scipro/scipro/trunk@550 73ecded7-942e-4092-bab0-0e58ef0ee984
This commit is contained in:
frej-app 2011-04-04 08:34:43 +00:00
parent a53cdd06a5
commit 585913e23c
24 changed files with 1587 additions and 16 deletions

@ -219,6 +219,11 @@
<version>1.4.15</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>1.6</version>
</dependency>
</dependencies>

@ -0,0 +1,31 @@
package se.su.dsv.scipro;
/**
* Class defining global settings for the application. Use application context to
* instantiate objects!
*
* @author Dan Kjellman <dan-kjel@dsv.su.se>
*
*/
public class ApplicationSettings {
private boolean enableRemoteUserLookup;
private String remoteLookupUrl;
public boolean isEnableRemoteUserLookup() {
return enableRemoteUserLookup;
}
public void setEnableRemoteUserLookup(boolean enableRemoteUserLookup) {
this.enableRemoteUserLookup = enableRemoteUserLookup;
}
public void setRemoteLookupUrl(String remoteLookupUrl) {
this.remoteLookupUrl = remoteLookupUrl;
}
public String getRemoteLookupUrl() {
return remoteLookupUrl;
}
}

@ -1,19 +1,17 @@
package se.su.dsv.scipro;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import javax.security.auth.login.FailedLoginException;
import javax.security.auth.login.LoginException;
import javax.servlet.http.Cookie;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.wicket.Request;
import org.apache.wicket.Session;
import org.apache.wicket.injection.web.InjectorHolder;
import org.apache.wicket.protocol.http.WebRequest;
import org.apache.wicket.protocol.http.WebSession;
import org.apache.wicket.spring.injection.annot.SpringBean;
@ -24,6 +22,7 @@ import se.su.dsv.scipro.data.dao.interfaces.UserSettingsDao;
import se.su.dsv.scipro.data.dataobjects.Project;
import se.su.dsv.scipro.data.dataobjects.User;
import se.su.dsv.scipro.data.dataobjects.UserSettings;
import se.su.dsv.scipro.json.IUserLookup;
import se.su.dsv.scipro.security.auth.Authenticator;
import se.su.dsv.scipro.security.auth.roles.Admin;
import se.su.dsv.scipro.security.auth.roles.DefaultRole;
@ -51,6 +50,9 @@ public class SciProSession extends WebSession {
@SpringBean
private UserSettingsDao userSettingsDao;
@SpringBean(name="userFullLookup")
private IUserLookup userLookup;
private List<Role> roles = new ArrayList<Role>();
private User user = null;
@ -139,12 +141,20 @@ public class SciProSession extends WebSession {
if(tmp.length > 1)
loggedInAsUsername = tmp[1];
}
try {
auth.authenticate(username, password);
this.user = userDao.getUserByUsername(username);
if( user == null)
throw new NullPointerException("No user with this username found in the database, despite successful authentication");
if( user == null){
try{
user = doUserLookup(username);
if(user == null){
throw new NullPointerException("No user with username "+username+" found in the database, or in daisy, despite successful authentication ");
}
} catch (NullPointerException e) {
throw e;
}
}
setLoggedInIdentity(username+"@"+"dsv.su.se");
if(user.getEmailAddress() == null || user.getEmailAddress().trim().equals("")){
@ -155,10 +165,18 @@ public class SciProSession extends WebSession {
* Here we switch the logged in user to be that of the person chosen be the logged in admin
*/
if(roleDao.isSysadmin(user) && loggedInAsUsername != null){
if(roleDao.isAdmin(user) && loggedInAsUsername != null){
this.user = userDao.getUserByUsername(loggedInAsUsername);
if( user == null)
throw new NullPointerException("No user with this username found in the database, despite successful authentication");
if( user == null){
try{
user = doUserLookup(loggedInAsUsername);
if(user == null){
throw new NullPointerException("No user with username "+loggedInAsUsername+" found in the database, or in daisy, despite successful authentication ");
}
} catch (NullPointerException e) {
throw e;
}
}
}
if(roleDao.isStudent(user)){
roles.add(new Student());
@ -200,7 +218,7 @@ public class SciProSession extends WebSession {
e.printStackTrace();
} catch (LoginException e) {
e.printStackTrace();
}
}
return false;
}
@ -216,5 +234,23 @@ public class SciProSession extends WebSession {
}
return false;
}
private User doUserLookup(String username) throws NullPointerException {
try{
User u = userLookup.lookup(username);
if(u != null){
return u;
}
Logger.getLogger("Application").log(Level.WARN, "" + username + " authenticated successfully, but the user was not found from daisy");
return null;
} catch (IOException ioe){
//TODO: Log exception
//ioe.printStackTrace();
throw new NullPointerException("Could not communicate with daisy");
} catch (Exception e) {
//TODO: Log exception
//e.printStackTrace();
throw new NullPointerException(e.getMessage());
}
}
}

@ -22,5 +22,7 @@ public interface ProjectDao extends Dao<Project>{
public List<Project> searchProjectByTitle(final String searchTerm);
public List<Project> searchProjectByTitle(final String searchTerm, final Integer limit, final boolean includeWithoutSchedule);
public Project getProjectByIdentifier(final Long identifier);
}

@ -217,4 +217,21 @@ public class ProjectDaoJPAImp extends AbstractDaoJPAImp<Project> implements Proj
public List<Project> searchProjectByTitle(final String searchTerm) {
return searchProjectByTitle(searchTerm, null, true);
}
@Transactional
public Project getProjectByIdentifier(final Long identifier){
return getJpaTemplate().execute(new JpaCallback<Project>() {
public Project doInJpa(EntityManager em)
throws PersistenceException {
TypedQuery<Project> query = em.createQuery("select p FROM Project p WHERE p.identifier = :identifier", Project.class);
query.setParameter("identifier", identifier);
try{
return query.getSingleResult();
} catch (NoResultException e) {
return null;
}
}
});
}
}

@ -26,7 +26,7 @@ public class ProjectClass extends DomainObject {
public static final String MASTER = "MASTER";
public static final String BACHELOR = "BACHELOR";
public static final String PHD = "PHD";
public static final String UNKNOWN = "UNKNOWN";
private static final long serialVersionUID = 1L;
@Id

@ -15,7 +15,7 @@ import se.su.dsv.scipro.data.dao.interfaces.EventParticipant;
@Entity
@Cacheable(true)
@Cache(usage= CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) //Hibernate specific
public class Student extends Role {
public class Student extends ProjectTeamMember {
private static final long serialVersionUID = 6274323425191904206L;

@ -4,7 +4,7 @@ public enum ProjectTeamMemberRoles {
REVIEWER,
CO_SUPERVISOR,
OPPONENT,
/*
* Maybe add opponent here... But then Student must implement ProjectResponsible
*/

@ -0,0 +1,100 @@
package se.su.dsv.scipro.json;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import se.su.dsv.scipro.ApplicationSettings;
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
import se.su.dsv.scipro.data.dataobjects.User;
/**
* This class does a lookup on a username against the remote remoteLookupUrl specified in
* the applicationContext, under ApplicationSettings.
*
*
* @author Dan Kjellman <dan-kjel@dsv.su.se>
*/
public class DefaultUserFullLookup implements IUserLookup {
/*
* References populated by spring (from applicationContext)
*/
private UserDao userDao;
private JsonUserFullResponseHandler userResponseHandler;
private ApplicationSettings settings;
private Logger logger;
public DefaultUserFullLookup(){
logger = Logger.getRootLogger();
}
/**
* Perform lookup against remote server
*
* @param username the username to lookup
* @throws IOException if there was an error in the connection
*/
public User lookup(String username) throws IOException {
if(username == null){
logger.log(Level.ERROR, "Trying to pass null instead of a username to the userlookup");
throw new IllegalStateException("You cannot pass null as the lookup parameter");
}
System.out.println("Starting lookup for: " + username);
Map<String, String> params = new HashMap<String, String>();
//For now you can only log in with dsv.su.se accounts...
params.put("username", username);
RequestSender request = new RequestSender(userResponseHandler, settings.getRemoteLookupUrl(), params, RequestSender.REQUEST_TYPE_POST);
try{
request.processRequest();
} catch (IOException e) {
//Gets logged by the requestsender....
throw e;
}
/*
* Lookup the user and return
*/
User u = userDao.getUserByUsername(username);
if(u != null){
logger.log(Level.INFO, "Imported user/username from remote system: " + u.getFirstName() + " " + u.getLastName() + "("+username+") id: " + u.getId());
}
return u;
}
/*
* Getters and setters (for spring)
*/
public UserDao getUserDao() {
return userDao;
}
public void setUserDao(UserDao userDao) {
this.userDao = userDao;
}
public JsonUserFullResponseHandler getUserResponseHandler() {
return userResponseHandler;
}
public void setUserResponseHandler(JsonUserFullResponseHandler userResponseHandler) {
this.userResponseHandler = userResponseHandler;
}
public ApplicationSettings getSettings() {
return settings;
}
public void setSettings(ApplicationSettings settings) {
this.settings = settings;
}
}

@ -0,0 +1,100 @@
package se.su.dsv.scipro.json;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import se.su.dsv.scipro.ApplicationSettings;
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
import se.su.dsv.scipro.data.dataobjects.User;
/**
* This class does a lookup on a username against the remote remoteLookupUrl specified in
* the applicationContext, under ApplicationSettings.
*
*
* @author Dan Kjellman <dan-kjel@dsv.su.se>
*/
public class DefaultUserLookup implements IUserLookup {
/*
* References populated by spring (from applicationContext)
*/
private UserDao userDao;
private JsonUserResponseHandler userResponseHandler;
private ApplicationSettings settings;
private Logger logger;
public DefaultUserLookup(){
logger = Logger.getRootLogger();
}
/**
* Perform lookup against remote server
*
* @param username the username to lookup
* @throws IOException if there was an error in the connection
*/
public User lookup(String username) throws IOException {
if(username == null){
logger.log(Level.ERROR, "Trying to pass null instead of a username to the userlookup");
throw new IllegalStateException("You cannot pass null as the lookup parameter");
}
System.out.println("Starting lookup for: " + username);
Map<String, String> params = new HashMap<String, String>();
//For now you can only log in with dsv.su.se accounts...
params.put("userid", username);
RequestSender request = new RequestSender(userResponseHandler, settings.getRemoteLookupUrl(), params, RequestSender.REQUEST_TYPE_POST);
try{
request.processRequest();
} catch (IOException e) {
//Gets logged by the requestsender....
throw e;
}
/*
* Lookup the user and return
*/
User u = userDao.getUserByUsername(username);
if(u != null){
logger.log(Level.INFO, "Imported user/username from remote system: " + u.getFirstName() + " " + u.getLastName() + "("+username+") id: " + u.getId());
}
return u;
}
/*
* Getters and setters (for spring)
*/
public UserDao getUserDao() {
return userDao;
}
public void setUserDao(UserDao userDao) {
this.userDao = userDao;
}
public JsonUserResponseHandler getUserResponseHandler() {
return userResponseHandler;
}
public void setUserResponseHandler(JsonUserResponseHandler userResponseHandler) {
this.userResponseHandler = userResponseHandler;
}
public ApplicationSettings getSettings() {
return settings;
}
public void setSettings(ApplicationSettings settings) {
this.settings = settings;
}
}

@ -0,0 +1,6 @@
package se.su.dsv.scipro.json;
public interface ILookup<T, E> {
public T lookup(E lookupParam) throws Exception;
}

@ -0,0 +1,5 @@
package se.su.dsv.scipro.json;
public interface IResponseHandler {
public void handleResponse(String response);
}

@ -0,0 +1,7 @@
package se.su.dsv.scipro.json;
import se.su.dsv.scipro.data.dataobjects.User;
public interface IUserLookup extends ILookup<User, String>{
public User lookup(String username) throws Exception;
}

@ -0,0 +1,711 @@
package se.su.dsv.scipro.json;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import se.su.dsv.scipro.ApplicationSettings;
import se.su.dsv.scipro.data.dao.interfaces.ProjectClassDao;
import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
import se.su.dsv.scipro.data.dao.interfaces.ProjectFollowerDao;
import se.su.dsv.scipro.data.dao.interfaces.RoleDao;
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
import se.su.dsv.scipro.data.dao.interfaces.UsernameDao;
import se.su.dsv.scipro.data.dataobjects.Employee;
import se.su.dsv.scipro.data.dataobjects.Project;
import se.su.dsv.scipro.data.dataobjects.ProjectClass;
import se.su.dsv.scipro.data.dataobjects.ProjectFollower;
import se.su.dsv.scipro.data.dataobjects.Role;
import se.su.dsv.scipro.data.dataobjects.Student;
import se.su.dsv.scipro.data.dataobjects.User;
import se.su.dsv.scipro.data.dataobjects.Username;
import se.su.dsv.scipro.data.enums.ProjectStatus;
import se.su.dsv.scipro.data.enums.ProjectTeamMemberRoles;
import se.su.dsv.scipro.jsonobjects.JsonThesis;
import se.su.dsv.scipro.jsonobjects.JsonThesisParticipant;
import se.su.dsv.scipro.jsonobjects.JsonUser;
import se.su.dsv.scipro.jsonobjects.JsonUserContainer;
import se.su.dsv.scipro.jsonobjects.JsonUserRole;
import se.su.dsv.scipro.jsonobjects.JsonUsername;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
public abstract class JsonResponseHandler implements IResponseHandler {
/*
* References populated by spring (from applicationContext)
*/
@Autowired
protected UserDao userDao;
@Autowired
protected UsernameDao userNameDao;
@Autowired
protected ProjectDao projectDao;
@Autowired
protected ProjectClassDao projectClassDao;
@Autowired
protected ProjectFollowerDao projectFollowerDao;
@Autowired
protected RoleDao roleDao;
@SpringBean(name="userLookup")
protected IUserLookup userLookup;
//protected ThesisDao thesisDao;
//protected ThesisParticipationDao thesisParticipationDao;
protected ApplicationSettings settings;
protected JpaTransactionManager txManager;
protected Logger logger;
//private Set<Long> supervisorIdentifiers = null;
private int numUsersCreated = 0;
private int numEmailChanges = 0;
private int numFirstNameChanges = 0;
private int numLastNameChanges = 0;
private int numUsernamesAdded = 0;
private int numSupervisorsCreated = 0;
private int numThesesCreated = 0;
private int numThesesChanged = 0;
private Project project;
public JsonResponseHandler(){
super();
logger = Logger.getRootLogger();
}
/**
* Creates a thesis user from a json user
*
* @param jsonUser the json user to use for creation
* @return User the create thesisuser
*/
protected User createThesisUser(JsonUser jsonUser, boolean doFullCheck){
/*if(supervisorIdentifiers == null){
lookupSupervisors();
}*/
TransactionStatus status = null;
User thesisUser = null;
status = txManager.getTransaction(null);
try {
thesisUser = new User();
thesisUser.setFirstName(jsonUser.firstName);
thesisUser.setLastName(jsonUser.lastName);
thesisUser.setIdentifier(jsonUser.id);
thesisUser.setEmailAddress(jsonUser.email);
//System.out.println("Trying to save " + thesisUser.getIdentifier());
thesisUser = userDao.save(thesisUser);
/*
* Check against daisy if the user is a supervisor - if so, create a supervisor role
*/
for(JsonUserRole jur : jsonUser.roles){
if(jur.role.equals("AUTHOR")){
roleDao.makeStudent(thesisUser);
}
if(jur.role.equals("SUPERVISOR")){
roleDao.makeEmployee(thesisUser);
}
if(jur.role.equals("ADMIN")){
roleDao.makeAdmin(thesisUser);
}
}
for(JsonUsername jsonUsername : jsonUser.usernames){
Username thesisUserName = new Username();
thesisUserName.setUserName(jsonUsername.username.toLowerCase().trim());
thesisUserName.setRealm(jsonUsername.realm.toUpperCase().trim());
thesisUserName.setUser(thesisUser);
thesisUserName = userNameDao.save(thesisUserName);
}
if(doFullCheck){
checkAndCreateProject(jsonUser.theses);
}
txManager.commit(status);
numUsersCreated++;
//System.out.println("Saved to database...");
} catch (Exception e){
logger.log(Level.ERROR, "Cannot save jsonuser with jsonuserid: " + jsonUser.id + " - Rolling back...\n" + e.getMessage());
txManager.rollback(status);
return null;
}
return thesisUser;
}
/**
* Look for changes in a jsonuser against a thesisuser. BEWARE: you need to be sure that
* a corresponding thesisuser exists, or an exception will be thrown
*
* @param daisyUser
* @return
*/
protected boolean lookForChangesInUserAndSave(JsonUser jsonUser){
/*
if(supervisorIdentifiers == null){
lookupSupervisors();
}*/
TransactionStatus status = null;
status = txManager.getTransaction(new DefaultTransactionDefinition());
User thesisUser = userDao.getUserByIdentifier(jsonUser.id);
if(thesisUser == null){
throw new NullPointerException("You cannot pass a json user without a corresponding thesisuser to lookForChangesInUserAndSave");
}
boolean hasChanged = false;
//Check if firstName has changed
if((thesisUser.getFirstName() == null && jsonUser.firstName != null)
|| (thesisUser.getFirstName() != null && !thesisUser.getFirstName().equals(jsonUser.firstName))){
thesisUser.setFirstName(jsonUser.firstName);
//System.out.println("First name has changed to " + daisyUser.firstName);
numFirstNameChanges++;
hasChanged = true;
}
//Check if lastName has changed
if((thesisUser.getLastName() == null && jsonUser.lastName != null)
|| (thesisUser.getLastName() != null && !thesisUser.getLastName().equals(jsonUser.lastName))){
thesisUser.setLastName(jsonUser.lastName);
//System.out.println("Last name has changed to " + daisyUser.lastName);
numLastNameChanges++;
hasChanged = true;
}
//Check if email has changed
if((thesisUser.getEmailAddress() == null && jsonUser.email != null)
|| (thesisUser.getEmailAddress() != null && !thesisUser.getEmailAddress().equals(jsonUser.email))){
thesisUser.setEmailAddress(jsonUser.email);
//System.out.println("E-mail changed to " + daisyUser.email);
numEmailChanges++;
hasChanged = true;
}
/*
//Check changes in ThesisApplication. TODO
for(JsonThesis jThesis : jsonUser.theses){
Thesis current = thesisDao.getThesisByIdentifier(jThesis.thesisID);
if(current != null){
checkAndChangeThesis(current, jThesis);
}else{
createThesis(jThesis);
}
}*/
//Iterate through known usernames
for(Username thesisUserName : thesisUser.getUserNames()){
//Iterate the usernames from the response and check for a match
Iterator<JsonUsername> iter = jsonUser.usernames.iterator();
while(iter.hasNext()){
JsonUsername jsonUsername = iter.next();
//If username - realm combo found, remove from set
if(jsonUsername.username.equalsIgnoreCase(thesisUserName.getUserName()) && jsonUsername.realm.equalsIgnoreCase(thesisUserName.getRealm())){
iter.remove();
}
}
}
if(hasChanged || jsonUser.usernames.size() > 0){
try{
//Save the user
thesisUser = userDao.save(thesisUser);
//Loop the remaining (new usernames) and save...
//System.out.println("Number of new usernames: " + daisyUser.usernames.size());
for(JsonUsername jsonUsername : jsonUser.usernames){
Username thesisUserName = new Username();
thesisUserName.setUserName(jsonUsername.username.toLowerCase().trim());
thesisUserName.setRealm(jsonUsername.realm.toUpperCase().trim());
thesisUserName.setUser(thesisUser);
thesisUserName = userNameDao.save(thesisUserName);
numUsernamesAdded++;
}
txManager.commit(status);
return true;
} catch (Exception e){
txManager.rollback(status);
logger.log(Level.FATAL, "Failed to save changes for user:" + thesisUser.getIdentifier() + " - Rolling back...\n" + e.getMessage());
}
}
if(!status.isCompleted()){
txManager.commit(status);
}
return false;
}
private void checkAndCreateProject(Set<JsonThesis> theses) throws Exception{
for(JsonThesis jThesis : theses){
project = projectDao.getProjectByIdentifier(jThesis.thesisID);
if(project == null){
project = new Project();
project.setDateCreated(new Date());
project.setIdentifier(jThesis.thesisID);
project.setTitle(jThesis.title);
if(jThesis.status.equals("STARTED") || jThesis.status.equals("LATE")){
project.setProjectStatus(ProjectStatus.ACTIVE);
}else if(jThesis.status.equals("FINISHED")){
project.setProjectStatus(ProjectStatus.COMPLETED);
}else{
project.setProjectStatus(ProjectStatus.INACTIVE);
}
ProjectClass pc = null;
if(ProjectClass.BACHELOR.equals(jThesis.type)){
pc = projectClassDao.getProjectClass(ProjectClass.BACHELOR);
if(pc == null){
pc = new ProjectClass(ProjectClass.BACHELOR,"Bachelor","Bachelor degree thesis project");
pc = projectClassDao.save(pc);
}
}
else if(ProjectClass.MASTER.equals(jThesis.type)){
pc = projectClassDao.getProjectClass(ProjectClass.MASTER);
if(pc == null){
pc = new ProjectClass(ProjectClass.MASTER,"Master","Master degree thesis project");
pc = projectClassDao.save(pc);
}
}else if(ProjectClass.PHD.equals(jThesis.type)){
pc = projectClassDao.getProjectClass(ProjectClass.PHD);
if(pc == null){
pc = new ProjectClass(ProjectClass.PHD,"Ph.D","Ph.D degree thesis project");
pc = projectClassDao.save(pc);
}
}else{
pc = projectClassDao.getProjectClass(ProjectClass.UNKNOWN);
if(pc == null){
pc = new ProjectClass(ProjectClass.UNKNOWN,"UNKNOWN","Unknown degree thesis project");
pc = projectClassDao.save(pc);
}
}
if(pc != null){
project.setProjectClass(pc);
}
project = projectDao.save(project);
TreeSet<ProjectFollower> followers = new TreeSet<ProjectFollower>();
for(JsonThesisParticipant jtp : jThesis.participants){
User u = userDao.getUserByIdentifier(jtp.id);
if(u == null){
String id = String.valueOf(jtp.id);
u = userLookup.lookup(id);
}
u = userDao.getUserByIdentifier(jtp.id);
if(u != null){
if(jtp.role.equals("SUPERVISOR")){
Employee e = roleDao.makeEmployee(u);
project.setHeadSupervisor(e);
}else if(jtp.role.equals("PARTICIPANT")){
Student s = roleDao.makeStudent(u);
Set<Student> authors = project.getProjectParticipants();
authors.add(s);
project.setProjectParticipants(authors);
}
else{
ProjectFollower pf = new ProjectFollower();
pf.setDateCreated(new Date());
if(jtp.role.equals("ASSISTANT_SUPERVISOR")){
pf.setProjectRole(ProjectTeamMemberRoles.CO_SUPERVISOR);
pf.setFollower((Employee)roleDao.makeEmployee(u));
}else if(jtp.role.equals("OPPONENT")){
pf.setProjectRole(ProjectTeamMemberRoles.OPPONENT);
pf.setFollower((Student)roleDao.makeStudent(u));
}else if (jtp.role.equals("EXAMINER")){
pf.setProjectRole(ProjectTeamMemberRoles.REVIEWER);
pf.setFollower(roleDao.makeEmployee(u));
}
if(pf.getFollower() != null && pf.getProjectRole() != null){
pf.setProject(project);
pf = projectFollowerDao.save(pf);
followers.add(pf);
}
}
}
}
project.setProjectFollowers(followers);
project = projectDao.save(project);
}
}
}
/*
private void checkAndChangeThesis(Thesis current, JsonThesis jThesis){
boolean changed = false;
//Check title
if(!current.getTitle().equals(jThesis.title)){
changed = true;
current.setTitle(jThesis.title);
}
//Check Status
/*
if(!current.getStatus().toString().equals(jThesis.status)){
changed = true;
if(ThesisStatus.STARTED.toString().equals(jThesis.status)){
current.setStatus(ThesisStatus.STARTED);
}else if(ThesisStatus.NOT_STARTED.toString().equals(jThesis.status)){
current.setStatus(ThesisStatus.NOT_STARTED);
}else if(ThesisStatus.FINISHED.toString().equals(jThesis.status)){
current.setStatus(ThesisStatus.FINISHED);
}else if(ThesisStatus.ABORTED.toString().equals(jThesis.status)){
current.setStatus(ThesisStatus.ABORTED);
}else if(ThesisStatus.LATE.toString().equals(jThesis.status)){
current.setStatus(ThesisStatus.LATE);
}else {
current.setStatus(ThesisStatus.UNKNOWN);
}
}
//Check participants
List<ThesisParticipation> participants = convertJsonThesisParticipation(jThesis.participants);
if((current.getParticipations().size() != participants.size()) || !current.getParticipations().containsAll(participants)){
changed = true;
List<ThesisParticipation> removeList = new ArrayList<ThesisParticipation>();
for(ThesisParticipation tp : current.getParticipations()){
if(!participants.contains(tp)){
removeList.add(tp);
}
}
for(ThesisParticipation tp : participants){
if(!current.getParticipations().contains(tp)){
tp = thesisParticipationDao.save(tp);
current.getParticipations().add(tp);
}
}
current.getParticipations().removeAll(removeList);
for(ThesisParticipation tp : removeList){
thesisParticipationDao.delete(tp);
}
}
//Check if match can be done
if(current.getThesisApplication() == null){
Supervisor supervisor = null;
Author author1 = null;
Author author2 = null;
for(ThesisParticipation tp : current.getParticipations()){
if(tp.getRole() == ThesisRole.SUPERVISOR){
supervisor = supervisorDao.getSupervisorBy(tp.getUser());
}else if(tp.getRole() == ThesisRole.PARTICIPANT){
if(author1 == null){
author1 = authorDao.getAuthorByUser(tp.getUser());
}else{
author2 = authorDao.getAuthorByUser(tp.getUser());
}
}
}
if(supervisor != null && author1 != null){
List<ThesisApplication> matches = thesisApplicationDao.getThesisApplicationBySupervisorAndAuthors(supervisor, author1, author2);
if(matches.size() == 1){
ThesisApplication ta = matches.get(0);
ta.setThesis(current);
thesisApplicationDao.save(ta);
}
}
}
if(changed){
numThesesChanged++;
thesisDao.save(current);
}else{
}
}*/
/*
private List<ThesisParticipation> convertJsonThesisParticipation (Set<JsonThesisParticipant> jtps){
List<ThesisParticipation> participations = new ArrayList<ThesisParticipation>();
for(JsonThesisParticipant jtp : jtps){
ThesisParticipation participation = new ThesisParticipation();
User u = userDao.getUserByIdentifier(jtp.id);
if(u != null){
participation.setUser(u);
if(ThesisRole.PARTICIPANT.toString().equals(jtp.role)){
participation.setRole(ThesisRole.PARTICIPANT);
}else if(ThesisRole.SUPERVISOR.toString().equals(jtp.role)){
participation.setRole(ThesisRole.SUPERVISOR);
}else if(ThesisRole.EXAMINER.toString().equals(jtp.role)){
participation.setRole(ThesisRole.EXAMINER);
}else if(ThesisRole.ASSISTANT_SUPERVISOR.toString().equals(jtp.role)){
participation.setRole(ThesisRole.ASSISTANT_SUPERVISOR);
}else if(ThesisRole.OPPONENT.toString().equals(jtp.role)){
participation.setRole(ThesisRole.OPPONENT);
}else if(ThesisRole.ACTIVE_PARTICIPATION.toString().equals(jtp.role)){
participation.setRole(ThesisRole.ACTIVE_PARTICIPATION);
}else {
participation.setRole(ThesisRole.UNKNOWN);
}
participations.add(participation);
}
else{
//User does not exist i db
}
}
return participations;
}*/
/*
private void createThesis(JsonThesis jThesis){
Thesis current = new Thesis();
current.setIdentifier(jThesis.thesisID);
current.setTitle(jThesis.title);
//Sätt Status
if(ThesisStatus.STARTED.toString().equals(jThesis.status)){
current.setStatus(ThesisStatus.STARTED);
}else if(ThesisStatus.NOT_STARTED.toString().equals(jThesis.status)){
current.setStatus(ThesisStatus.NOT_STARTED);
}else if(ThesisStatus.FINISHED.toString().equals(jThesis.status)){
current.setStatus(ThesisStatus.FINISHED);
}else if(ThesisStatus.ABORTED.toString().equals(jThesis.status)){
current.setStatus(ThesisStatus.ABORTED);
}else if(ThesisStatus.LATE.toString().equals(jThesis.status)){
current.setStatus(ThesisStatus.LATE);
}else {
current.setStatus(ThesisStatus.UNKNOWN);
}
//Skapa deltagande
List<ThesisParticipation> participations = new ArrayList<ThesisParticipation>();
Supervisor supervisor = null;
Author author1 = null;
Author author2 = null;
for(JsonThesisParticipant jtp : jThesis.participants){
ThesisParticipation participation = new ThesisParticipation();
User u = userDao.getUserByIdentifier(jtp.id);
if(u != null){
participation.setUser(u);
if(ThesisRole.PARTICIPANT.toString().equals(jtp.role)){
participation.setRole(ThesisRole.PARTICIPANT);
if(author1 == null){
author1 = authorDao.getAuthorByUser(u);
}else{
author2 = authorDao.getAuthorByUser(u);
}
}else if(ThesisRole.SUPERVISOR.toString().equals(jtp.role)){
participation.setRole(ThesisRole.SUPERVISOR);
supervisor = supervisorDao.getSupervisorBy(u);
}else if(ThesisRole.EXAMINER.toString().equals(jtp.role)){
participation.setRole(ThesisRole.EXAMINER);
}else if(ThesisRole.ASSISTANT_SUPERVISOR.toString().equals(jtp.role)){
participation.setRole(ThesisRole.ASSISTANT_SUPERVISOR);
}else if(ThesisRole.OPPONENT.toString().equals(jtp.role)){
participation.setRole(ThesisRole.OPPONENT);
}else if(ThesisRole.ACTIVE_PARTICIPATION.toString().equals(jtp.role)){
participation.setRole(ThesisRole.ACTIVE_PARTICIPATION);
}else {
participation.setRole(ThesisRole.UNKNOWN);
}
participation = thesisParticipationDao.save(participation);
participations.add(participation);
}
else{
//User does not exist i db
}
}
current.setParticipations(participations);
current = thesisDao.save(current);
//Hitta matchande thesisApplication
numThesesCreated++;
if(supervisor != null && author1 != null){
List<ThesisApplication> taList = thesisApplicationDao.getThesisApplicationBySupervisorAndAuthors(supervisor, author1, author2);
if(taList.size() == 1){
ThesisApplication ta = taList.get(0);
ta.setThesis(current);
thesisApplicationDao.save(ta);
}
}
}*/
/*
* Force subclasses to handle the response
*/
public abstract void handleResponse(String response);
/*
* Getters for logging
*/
public int getNumUsersCreated() {
return numUsersCreated;
}
public int getNumEmailChanges() {
return numEmailChanges;
}
public int getNumFirstNameChanges() {
return numFirstNameChanges;
}
public int getNumLastNameChanges() {
return numLastNameChanges;
}
public int getNumUsernamesAdded() {
return numUsernamesAdded;
}
public int getNumSupervisorsCreated() {
return numSupervisorsCreated;
}
public int getNumThesesCreated() {
return numThesesCreated;
}
public void setNumThesesCreated(int numThesesCreated) {
this.numThesesCreated = numThesesCreated;
}
public int getNumThesesChanged() {
return numThesesChanged;
}
public void setNumThesesChanged(int numThesesChanged) {
this.numThesesChanged = numThesesChanged;
}
/*
* Getters and setters (for spring)
*/
public UserDao getUserDao() {
return userDao;
}
public void setUserDao(UserDao userDao) {
this.userDao = userDao;
}
public UsernameDao getUsernameDao() {
return userNameDao;
}
public void setUserNameDao(UsernameDao usernameDao) {
this.userNameDao = usernameDao;
}
/*
public AuthorDao getAuthorDao() {
return authorDao;
}
public void setAuthorDao(AuthorDao authorDao) {
this.authorDao = authorDao;
}
public SupervisorDao getSupervisorDao() {
return supervisorDao;
}
public void setSupervisorDao(SupervisorDao supervisorDao) {
this.supervisorDao = supervisorDao;
}
public ThesisApplicationDao getThesisApplicationDao() {
return thesisApplicationDao;
}
public void setThesisApplicationDao(ThesisApplicationDao thesisApplicationDao) {
this.thesisApplicationDao = thesisApplicationDao;
}
public ThesisDao getThesisDao() {
return thesisDao;
}
public void setThesisDao(ThesisDao thesisDao) {
this.thesisDao = thesisDao;
}
public ThesisParticipationDao getThesisParticipationDao() {
return thesisParticipationDao;
}
public void setThesisParticipationDao(ThesisParticipationDao thesisParticipationDao) {
this.thesisParticipationDao = thesisParticipationDao;
}*/
public JpaTransactionManager getTxManager() {
return txManager;
}
public void setTxManager(JpaTransactionManager txManager) {
this.txManager = txManager;
}
public ApplicationSettings getSettings() {
return settings;
}
public void setSettings(ApplicationSettings settings) {
this.settings = settings;
}
public IUserLookup getUserLookup() {
return userLookup;
}
public void setUserLookup(IUserLookup userLookup) {
this.userLookup = userLookup;
}
}

@ -0,0 +1,98 @@
package se.su.dsv.scipro.json;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.apache.log4j.Level;
import se.su.dsv.scipro.data.dataobjects.User;
import se.su.dsv.scipro.jsonobjects.JsonUser;
import se.su.dsv.scipro.jsonobjects.JsonUserContainer;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
/**
* Handler for json responses regarding users (creating and updating)
*
* @author Dan Kjellman <dan-kjel@dsv.su.se>
*
*/
public class JsonUserFullResponseHandler extends JsonResponseHandler {
private boolean logResult = false;
public JsonUserFullResponseHandler(){
super();
}
/**
* Handles a json string
*
* If no corresponding thesis user is found, createThesisUser from the JsonResponseHandler will be called,
* if a corresponding user is found, the method will call lookForChangesInUserAndSave
*
* @param response the json string
*/
public void handleResponse(String response) {
JsonUserContainer userContainer = null;
try{
Gson gson = new Gson();
Type type = new TypeToken<JsonUserContainer>(){}.getType();
userContainer = gson.fromJson(response, type);
} catch (Exception e) {
logger.log(Level.FATAL, "Gson error when creating objects from json \n" + e.getMessage());
return;
}
int createdUsers = 0;
int changedUsers = 0;
int userCreationErrors = 0;
//Loop all users in the response and look for changes...
for(JsonUser jsonUser : userContainer.users){
//System.out.println("Checking: " + " id: " + daisyUser.id + " firstName: "+ daisyUser.firstName);
User thesisUser = userDao.getUserByIdentifier(new Long(jsonUser.id));
if(thesisUser == null){
//System.out.println("User does not exist... trying to create");
if(null == createThesisUser(jsonUser,true)){
userCreationErrors++;
} else {
createdUsers++;
}
} else {
//System.out.println("User found, looking for changes...");
if(lookForChangesInUserAndSave(jsonUser)){
changedUsers++;
}
}
}
if(logResult){
logger.log(Level.INFO, "\nResult from userimport/update:\nChecked: " + userContainer.users.size() + " users\n" +
"Changed users: " + changedUsers + "\n" +
"Created users: " + createdUsers + "\n" +
"Number of errors when creating users: " + userCreationErrors + "\n" +
"Num First name changes: " + getNumFirstNameChanges() + "\n" +
"Num last name changes: " + getNumLastNameChanges() + "\n" +
"Num Email changes: " + getNumEmailChanges() + "\n" +
"Num Usernames added: " + getNumUsernamesAdded() + "\n" +
"Num Supervisors created: " + getNumFirstNameChanges() + "\n");
}
}
public void setLogResult(boolean logResult) {
this.logResult = logResult;
}
public boolean isLogResult() {
return logResult;
}
}

@ -0,0 +1,98 @@
package se.su.dsv.scipro.json;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.apache.log4j.Level;
import se.su.dsv.scipro.data.dataobjects.User;
import se.su.dsv.scipro.jsonobjects.JsonUser;
import se.su.dsv.scipro.jsonobjects.JsonUserContainer;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
/**
* Handler for json responses regarding users (creating and updating)
*
* @author Dan Kjellman <dan-kjel@dsv.su.se>
*
*/
public class JsonUserResponseHandler extends JsonResponseHandler {
private boolean logResult = false;
public JsonUserResponseHandler(){
super();
}
/**
* Handles a json string
*
* If no corresponding thesis user is found, createThesisUser from the JsonResponseHandler will be called,
* if a corresponding user is found, the method will call lookForChangesInUserAndSave
*
* @param response the json string
*/
public void handleResponse(String response) {
JsonUserContainer userContainer = null;
try{
Gson gson = new Gson();
Type type = new TypeToken<JsonUserContainer>(){}.getType();
userContainer = gson.fromJson(response, type);
} catch (Exception e) {
logger.log(Level.FATAL, "Gson error when creating objects from json \n" + e.getMessage());
return;
}
int createdUsers = 0;
int changedUsers = 0;
int userCreationErrors = 0;
//Loop all users in the response and look for changes...
for(JsonUser jsonUser : userContainer.users){
//System.out.println("Checking: " + " id: " + daisyUser.id + " firstName: "+ daisyUser.firstName);
User thesisUser = userDao.getUserByIdentifier(new Long(jsonUser.id));
if(thesisUser == null){
//System.out.println("User does not exist... trying to create");
if(null == createThesisUser(jsonUser,false)){
userCreationErrors++;
} else {
createdUsers++;
}
} else {
//System.out.println("User found, looking for changes...");
if(lookForChangesInUserAndSave(jsonUser)){
changedUsers++;
}
}
}
if(logResult){
logger.log(Level.INFO, "\nResult from userimport/update:\nChecked: " + userContainer.users.size() + " users\n" +
"Changed users: " + changedUsers + "\n" +
"Created users: " + createdUsers + "\n" +
"Number of errors when creating users: " + userCreationErrors + "\n" +
"Num First name changes: " + getNumFirstNameChanges() + "\n" +
"Num last name changes: " + getNumLastNameChanges() + "\n" +
"Num Email changes: " + getNumEmailChanges() + "\n" +
"Num Usernames added: " + getNumUsernamesAdded() + "\n" +
"Num Supervisors created: " + getNumFirstNameChanges() + "\n");
}
}
public void setLogResult(boolean logResult) {
this.logResult = logResult;
}
public boolean isLogResult() {
return logResult;
}
}

@ -0,0 +1,166 @@
package se.su.dsv.scipro.json;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import javax.net.ssl.HttpsURLConnection;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
/**
* Class that provides a possibility to send http/https requests
*
* @author Dan Kjellman
*
*/
public class RequestSender {
public static final int REQUEST_TYPE_POST = 0;
public static final int REQUEST_TYPE_GET = 1;
public static final String[] REQUEST_METHODS = new String[]{
"POST", "GET"
};
private Logger logger;
/*
* The Handler for the response
*/
protected IResponseHandler responseHandler;
/*
* The params
*/
protected Map<String, String> parameters;
/*
* The url to call
*/
protected String url;
/*
* Type of request, use the static variables REQUEST_TYPE_POST or REQUEST_TYPE_GET
*/
protected int requestType;
public RequestSender(IResponseHandler responseHandler, String url, Map<String, String> parameters, int requestType){
logger = Logger.getRootLogger();
if(requestType != REQUEST_TYPE_GET && requestType != REQUEST_TYPE_POST){
logger.log(Level.ERROR, "Could not send request, no request type specified");
throw new IllegalArgumentException("Bad request type");
}
if(responseHandler == null){
logger.log(Level.ERROR, "Could not send request, no response handler was provided");
throw new IllegalArgumentException("You need no provide a handler for the response");
}
this.responseHandler = responseHandler;
this.url = url;
this.parameters = parameters;
this.requestType = requestType;
}
public RequestSender(IResponseHandler responseHandler, String url){
if(responseHandler == null){
throw new IllegalArgumentException("You need no provide a handler for the response");
}
this.responseHandler = responseHandler;
this.url = url;
this.parameters = new HashMap<String, String>();
this.requestType = REQUEST_TYPE_GET;
}
/**
* Start to process the request
*
* @throws IOException if a connection error occured
*/
public void processRequest() throws IOException {
String parameterData = "";
int count = 0;
for(Map.Entry<String, String> me : parameters.entrySet()){
if(count > 0){
parameterData += "&";
}
parameterData += me.getKey() + "=" + me.getValue();
count++;
}
if(requestType == REQUEST_TYPE_GET && parameters.size() > 0){
url += "?&" + parameterData;
}
HttpURLConnection conn = null;
OutputStreamWriter osr = null;
BufferedReader br = null;
try {
//This will throw an MalformedURLException if the url is not valid
URL u = new URL(url);
conn = (HttpURLConnection) u.openConnection();
conn.setRequestMethod(REQUEST_METHODS[requestType]);
/*
* Set connect timeout to 60 seconds and read timeout to 120 sec
*
* Check log for java.net.SocketTimeoutException that's what happens...
*/
conn.setConnectTimeout(1000 * 60);
conn.setReadTimeout(1000 * 120);
if(requestType == REQUEST_TYPE_POST){
conn.setDoOutput(true);
osr = new OutputStreamWriter(conn.getOutputStream());
osr.write(parameterData);
osr.flush();
}
br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line = "";
String response = "";
while((line = br.readLine()) != null){
response += line;
}
responseHandler.handleResponse(response);
} catch (IOException e){
/*
* Includes MalformedUrlException if bad url
* java.net.SocketTimeoutException if connection timed out
* java.net.UnknownHostException if host us not valid
*/
logger.log(Level.ERROR, "Could not send request: \n" + e.getMessage());
throw e;
} finally {
//Clean up...
if(conn != null){
conn.disconnect();
}
if(osr != null){
osr.close();
}
if(br != null){
br.close();
}
}
}
}

@ -0,0 +1,18 @@
package se.su.dsv.scipro.jsonobjects;
import java.util.HashSet;
import java.util.Set;
public class JsonThesis {
public long thesisID;
public String status;
public String title;
public String type;
public Set<JsonThesisParticipant> participants = new HashSet<JsonThesisParticipant>();
public JsonThesis(){}
public String toString(){
return title;
}
}

@ -0,0 +1,6 @@
package se.su.dsv.scipro.jsonobjects;
public class JsonThesisParticipant {
public long id;
public String role;
}

@ -0,0 +1,51 @@
package se.su.dsv.scipro.jsonobjects;
import java.util.HashSet;
import java.util.Set;
/**
* The user class used to parse json user objects. Requires the following json:
*
* {
* firstName: "Fake"
* id: "424752"
* email: "fugdge@dsv.su.se"
* usernames: [
* {
* username: "testing"
* realm: "dsv.su.se"
* } //array of usernames
* ]
* lastName: "Fugazi"
* }
*
*
* @author Dan Kjellman <dan-kjel@dsv.su.se>
*
*/
public class JsonUser {
public String firstName = null, lastName = null, email = null;
public long id;
public Set<JsonUsername> usernames = new HashSet<JsonUsername>();
public Set<JsonThesis> theses = new HashSet<JsonThesis>();
public Set<JsonUserRole> roles = new HashSet<JsonUserRole>();
public JsonUser(){}
public String toString(){
String uns = "";
for(JsonUsername un : usernames){
uns += " " + un + "\n";
}
String ths = "";
for(JsonThesis th : theses){
ths += " " + th.title + "\n";
}
String rls = "";
for(JsonUserRole rl : roles){
rls += " " + rl.role + "\n";
}
return firstName + " " + lastName + ": " + id + "\n" + uns + "\n" + ths +"\n"+ rls;
}
}

@ -0,0 +1,48 @@
package se.su.dsv.scipro.jsonobjects;
import java.util.ArrayList;
import java.util.List;
/**
* A container for the required user json string. Requires the following json:
*
* {
* users: [
* {
* firstName: "Carl-Gustaf R"
* id: "47"
* email: "calle@dsv.su.se"
* usernames: [
* {
* username: "calle"
* realm: "dsv.su.se"
* }
* ]
* lastName: "Jansson"
* }
* {
* firstName: "Testuser"
* id: "124124124"
* email: "svenne@dsv.su.se"
* usernames: [
* {
* username: "balle"
* realm: "dsv.su.se"
* }
* ]
* lastName: "Svensson"
* }
* ]
* }
*
* @author Dan Kjellman <dan-kjel@dsv.su.se>
*
*/
public class JsonUserContainer {
public List<JsonUser> users = new ArrayList<JsonUser>();
public JsonUserContainer(){
}
}

@ -0,0 +1,10 @@
package se.su.dsv.scipro.jsonobjects;
public class JsonUserRole {
public String role;
public JsonUserRole(){
}
}

@ -0,0 +1,24 @@
package se.su.dsv.scipro.jsonobjects;
/**
* Class used to parse json username objects. Requires the following json:
*
* {
* username: "testing"
* realm: "dsv.su.se"
* }
*
* @author Dan Kjellman <dan-kjel@dsv.su.se>
*
*/
public class JsonUsername {
public String username, realm;
public JsonUsername(){}
public String toString(){
return username + " " + realm;
}
}

@ -79,8 +79,40 @@
<!-- <bean class="se.su.dsv.scipro.DataInitialiser" init-method="dataInit" />-->
<!-- Defines global settings for the application -->
<bean id="applicationSettings" class="se.su.dsv.scipro.ApplicationSettings">
<!-- Set this line to true if you want to do lookup against daisy if username was not found in db
By default it's turned off since we don't have access to the daisy search yet
-->
<property name="enableRemoteUserLookup" value="true"></property>
<!-- This property points to the location of the daisy json search -->
<property name="remoteLookupUrl" value="https://thesis.dsv.su.se/json" />
</bean>
<!-- Defines the class used for lookup in username against a remote server -->
<bean id="userFullLookup" class="se.su.dsv.scipro.json.DefaultUserFullLookup">
<property name="userDao" ref="userDao" />
<property name="settings" ref="applicationSettings" />
<property name="userResponseHandler" ref="jsonUserFullResponseHandler" />
</bean>
<!-- The abstract handler for json responses -->
<bean id="jsonResponseHandler" abstract="true" class="se.su.dsv.scipro.json.JsonResponseHandler">
<property name="txManager" ref="transactionManager" />
<property name="settings" ref="applicationSettings" />
<property name="userLookup" ref="userLookup" />
</bean>
<!-- Defines the class used for lookup in username against a remote server -->
<bean id="userLookup" class="se.su.dsv.scipro.json.DefaultUserLookup">
<property name="userDao" ref="userDao" />
<property name="settings" ref="applicationSettings" />
<property name="userResponseHandler" ref="jsonUserResponseHandler" />
</bean>
<!-- Handler for json responses regarding users -->
<bean id="jsonUserResponseHandler" parent="jsonResponseHandler" class="se.su.dsv.scipro.json.JsonUserResponseHandler" />
<bean id="jsonUserFullResponseHandler" parent="jsonResponseHandler" class="se.su.dsv.scipro.json.JsonUserFullResponseHandler" />
<!-- <bean class="se.su.dsv.scipro.datainitializers.EventTemplatesInitializer" init-method="dataInit" /> -->
<!-- <bean class="se.su.dsv.scipro.datainitializers.ScheduleTemplateInitializer" init-method="dataInit" />-->