Skip to content
Snippets Groups Projects
Commit f042e838 authored by Mirco Nasuti's avatar Mirco Nasuti
Browse files

refactor and clean code

parent 8e6686ff
No related branches found
No related tags found
No related merge requests found
Showing
with 12 additions and 106 deletions
...@@ -23,6 +23,7 @@ package org.hbp.mip; ...@@ -23,6 +23,7 @@ package org.hbp.mip;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import org.hbp.mip.controllers.HibernateUtil;
import org.hbp.mip.model.User; import org.hbp.mip.model.User;
import org.hibernate.Session; import org.hibernate.Session;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
......
package org.hbp.mip; package org.hbp.mip.controllers;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-01-07T07:38:20.227Z") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-01-07T07:38:20.227Z")
public class ApiException extends Exception { public class ApiException extends Exception {
......
package org.hbp.mip; package org.hbp.mip.controllers;
import javax.servlet.*; import javax.servlet.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
......
package org.hbp.mip; package org.hbp.mip.controllers;
import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlTransient;
......
package org.hbp.mip; package org.hbp.mip.controllers;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.hbp.mip.MIPApplication;
import org.hbp.mip.model.Article; import org.hbp.mip.model.Article;
import org.hbp.mip.model.User; import org.hbp.mip.model.User;
import org.hibernate.Session; import org.hibernate.Session;
......
package org.hbp.mip; package org.hbp.mip.controllers;
import io.swagger.annotations.*; import io.swagger.annotations.*;
......
package org.hbp.mip; package org.hbp.mip.controllers;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* Created by mirco on 07.12.15. * Created by mirco on 07.12.15.
*/ */
package org.hbp.mip; package org.hbp.mip.controllers;
import org.hibernate.SessionFactory; import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
......
package org.hbp.mip; package org.hbp.mip.controllers;
import io.swagger.annotations.*; import io.swagger.annotations.*;
......
package org.hbp.mip; package org.hbp.mip.controllers;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-01-07T07:38:20.227Z") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-01-07T07:38:20.227Z")
public class NotFoundException extends ApiException { public class NotFoundException extends ApiException {
......
package org.hbp.mip; package org.hbp.mip.controllers;
import io.swagger.annotations.*; import io.swagger.annotations.*;
......
/**
* Created by mirco on 04.12.15.
*/
package org.hbp.mip.mock;
import org.hbp.mip.model.Article;
import org.hbp.mip.model.User;
import java.util.Date;
public class ArticleMock extends Article {
public ArticleMock(int id) {
Date currentDate = new Date();
User currentUser = new UserMock(1);
switch (id) {
case 1:
this.setTitle("Test1");
this.setStatus("published");
this.setSlug("test1");
/*this.setPublishedAt(currentDate);
this.setUpdatedAt(currentDate);
this.setTags(new LinkedList<>());*/
this.setAbstract("This is a first test article.");
this.setContent("<!DOCTYPE html><html><head></head><body><p>This is the content of my first test article.</p></body></html>");
/*this.setCreatedAt(currentDate);
this.setCreatedBy(currentUser);
this.setUpdatedBy(currentUser);*/
break;
case 2:
this.setTitle("Test2");
this.setStatus("published");
this.setSlug("test2");
/*this.setPublishedAt(currentDate);
this.setUpdatedAt(currentDate);
this.setTags(new LinkedList<>());*/
this.setAbstract("This is a second test article.");
this.setContent("<!DOCTYPE html><html><head></head><body><p>This is the content of my second test article.</p></body></html>");
/*this.setCreatedAt(currentDate);
this.setCreatedBy(currentUser);
this.setUpdatedBy(currentUser);*/
break;
}
}
}
/**
* Created by mirco on 04.12.15.
*/
package org.hbp.mip.mock;
import org.hbp.mip.model.Model;
public class ModelMock extends Model {
public ModelMock(int id) {
switch (id) {
case 1:
this.setTitle("Model1");
break;
}
}
}
/**
* Created by mirco on 04.12.15.
*/
package org.hbp.mip.mock;
import org.hbp.mip.model.User;
public class UserMock extends User {
public UserMock(int id) {
switch (id) {
case 1:
this.setFirstname("Linda");
this.setFullname("Linda DIB");
this.setLastname("DIB");
this.setPicture("images/users/Linda.jpg");
this.setWeb("http://www.hbpproject.eu");
this.setPhone("+33 6 00 00 00 00");
this.setBirthday("1982-01-22");
this.setGender("Female");
this.addLanguage("French");
this.addLanguage("English");
this.setPassword("user");
this.setEmail("l.dib@hbpproject.eu");
this.setIsActive(true);
this.setApikey("kiliaanapikey");
this.setTeam("Scientist");
this.addRole("ROLE_ADMIN");
this.addRole("ROLE_SCIENTIST");
break;
}
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment