removed old log (old forum)
This commit is contained in:
parent
e6f652625a
commit
02666c6bf0
resources/db_update_scripts
src
main/java/se/su/dsv/scipro/data
dao
interfaces
jpa
dataobjects
test/java/se/su/dsv/scipro
@ -150,4 +150,7 @@ INSERT INTO `FinalSeminarSettings_punishMails` (`FinalSeminarSettings_id`, `puni
|
||||
-- Constraints for table `FinalSeminarSettings_punishMails`
|
||||
--
|
||||
ALTER TABLE `FinalSeminarSettings_punishMails`
|
||||
ADD CONSTRAINT `FK373B1D06BB47DEDF` FOREIGN KEY (`FinalSeminarSettings_id`) REFERENCES `FinalSeminarSettings` (`id`);
|
||||
ADD CONSTRAINT `FK373B1D06BB47DEDF` FOREIGN KEY (`FinalSeminarSettings_id`) REFERENCES `FinalSeminarSettings` (`id`);
|
||||
|
||||
DROP TABLE `log_entry`;
|
||||
DROP TABLE `log`;
|
@ -1,9 +0,0 @@
|
||||
package se.su.dsv.scipro.data.dao.interfaces;
|
||||
|
||||
import se.su.dsv.scipro.data.dataobjects.Log;
|
||||
|
||||
public interface LogDao extends LazyDeleteDao<Log>{
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
|
||||
package se.su.dsv.scipro.data.dao.interfaces;
|
||||
|
||||
import se.su.dsv.scipro.data.dataobjects.Log;
|
||||
import se.su.dsv.scipro.data.dataobjects.LogEntry;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface LogEntryDao extends LazyDeleteDao<LogEntry>{
|
||||
|
||||
public List<LogEntry> findAllNonDeletedByLog(final Log log);
|
||||
|
||||
}
|
@ -11,46 +11,25 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface ProjectDao extends Dao<Project>{
|
||||
|
||||
public Log getLogByProject(Project project);
|
||||
|
||||
public List<Project> getProjectsByParticipant(User user, ProjectStatus projectStatus);
|
||||
|
||||
public int countProjectsByParticipant(User user, ProjectStatus projectStatus);
|
||||
|
||||
public List<Project> findProjectsByParticipation(User user, ProjectStatus projectStatus, final QueryParams qParams);
|
||||
|
||||
public List<Project> getProjectsByHeadSupervisor(User user, ProjectStatus projectStatus);
|
||||
|
||||
public List<Project> getProjectsByHeadSupervisorAndProjectClass(User user, ProjectStatus projectStatus, ProjectClass projectClass);
|
||||
|
||||
public List<Project> getProjectsByHeadSupervisor(User user, ProjectStatus projectStatus, int first, int count);
|
||||
|
||||
public List<Project> getProjectsByProjectTeamMember(User user, ProjectStatus projectStatus, final ProjectTeamMemberRoles teamRole);
|
||||
|
||||
public List<Project> getProjectsByProjectTeamMemberAndProjectClass(User user, ProjectStatus projectStatus, final ProjectTeamMemberRoles teamRole, ProjectClass projectClass);
|
||||
|
||||
public List<Project> getProjectsByProjectTeamMember(User user, ProjectStatus projectStatus, final ProjectTeamMemberRoles teamRole, int first, int count);
|
||||
|
||||
public boolean isPartOf(User user, Project project);
|
||||
|
||||
public boolean isProjectParticipant(User user, Project project);
|
||||
|
||||
public boolean isSupervisorOrFollowerOf(User user, Project project);
|
||||
|
||||
public List<Project> searchProjectByTitle(String searchTerm);
|
||||
|
||||
public List<Project> searchProjectByTitle(String searchTerm, Integer limit, boolean includeWithoutSchedule);
|
||||
|
||||
public Project getProjectByIdentifier(Long identifier);
|
||||
|
||||
public boolean isProjectFollower(User user, Project project);
|
||||
|
||||
public int countProjectsBySupervisorParticipation(User user, ProjectStatus projectStatus);
|
||||
|
||||
/* New methods */
|
||||
public List<Project> findProjects(ProjectDao.Params params);
|
||||
|
||||
/* New methods */
|
||||
long countProjects(ProjectDao.Params params);
|
||||
|
||||
|
@ -1,15 +0,0 @@
|
||||
package se.su.dsv.scipro.data.dao.jpa;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.LogDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.Log;
|
||||
|
||||
@Repository("LogDao")
|
||||
public class LogDaoJPAImp extends LazyDeleteAbstractDaoJPAImp<Log> implements LogDao{
|
||||
|
||||
public LogDaoJPAImp() {
|
||||
super(Log.class);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
package se.su.dsv.scipro.data.dao.jpa;
|
||||
|
||||
import org.hibernate.ejb.QueryHints;
|
||||
import org.springframework.orm.jpa.JpaCallback;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.LogEntryDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.Log;
|
||||
import se.su.dsv.scipro.data.dataobjects.LogEntry;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.persistence.TypedQuery;
|
||||
import java.util.List;
|
||||
|
||||
@Repository("logEntryDao")
|
||||
public class LogEntryDaoJPAImp extends LazyDeleteAbstractDaoJPAImp<LogEntry> implements LogEntryDao{
|
||||
|
||||
public LogEntryDaoJPAImp() {
|
||||
super(LogEntry.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional( readOnly=true )
|
||||
public List<LogEntry> findAllNonDeletedByLog(final Log log) {
|
||||
return getJpaTemplate().execute(new JpaCallback<List<LogEntry>>() {
|
||||
public List<LogEntry> doInJpa(EntityManager em) throws PersistenceException {
|
||||
|
||||
//TypedQuery<LogEntry> query = em.createQuery("SELECT x FROM "+domainClassString+" x WHERE x.deleted = false", domainClass);
|
||||
TypedQuery<LogEntry> query = em.createQuery("SELECT le FROM LogEntry le WHERE le.deleted=false AND le.log = :log", LogEntry.class);
|
||||
query.setParameter("log", log);
|
||||
query.setHint(QueryHints.HINT_CACHEABLE, "true");
|
||||
return query.getResultList();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -25,24 +25,6 @@ public class ProjectDaoJPAImp extends AbstractDaoJPAImp<Project> implements Proj
|
||||
public ProjectDaoJPAImp() {
|
||||
super(Project.class);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Log getLogByProject(final Project project){
|
||||
return getJpaTemplate().execute(new JpaCallback<Log>() {
|
||||
|
||||
@Override
|
||||
public Log doInJpa(EntityManager em) throws PersistenceException {
|
||||
TypedQuery<Log> query = em.createQuery("select l FROM Log l WHERE l.project = :project", Log.class);
|
||||
query.setParameter("project", project);
|
||||
query.setHint(QueryHints.HINT_CACHEABLE, "true");
|
||||
try{
|
||||
return query.getSingleResult();
|
||||
} catch (NoResultException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Transactional( readOnly=true )
|
||||
public List<Project> getProjectsByParticipant(final User user, final ProjectStatus projectStatus) {
|
||||
|
@ -1,87 +0,0 @@
|
||||
package se.su.dsv.scipro.data.dataobjects;
|
||||
|
||||
import org.hibernate.annotations.Cache;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fred
|
||||
*
|
||||
*/
|
||||
|
||||
@Entity
|
||||
@Table(name="log")
|
||||
@Cacheable(true)
|
||||
@Cache(usage= CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
||||
public class Log extends LazyDeletableDomainObject{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private Long id;
|
||||
|
||||
@OneToMany(mappedBy="log", orphanRemoval = true)
|
||||
private List<LogEntry> logEntryList = new ArrayList<LogEntry>();
|
||||
|
||||
@OneToOne(optional=false)
|
||||
private Project project;
|
||||
|
||||
public Log(){ };
|
||||
|
||||
public Log(Project project){
|
||||
|
||||
this.project=project;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public List<LogEntry> getLogEntryList() {
|
||||
return logEntryList;
|
||||
}
|
||||
|
||||
public void setLogEntryList(List<LogEntry> logEntryList) {
|
||||
this.logEntryList = logEntryList;
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
public void setProject(Project project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Log other = (Log) obj;
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
return false;
|
||||
} else if (!id.equals(other.id))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -1,122 +0,0 @@
|
||||
|
||||
package se.su.dsv.scipro.data.dataobjects;
|
||||
|
||||
import org.hibernate.annotations.Cache;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fred
|
||||
*
|
||||
*/
|
||||
|
||||
@Entity
|
||||
@Table(name="log_entry")
|
||||
@Cacheable(true)
|
||||
@Cache(usage= CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
||||
public class LogEntry extends LazyDeletableDomainObject implements Comparable<LogEntry>{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private Long id;
|
||||
|
||||
@ManyToOne(optional=false)
|
||||
private User creator;
|
||||
|
||||
@Lob
|
||||
private String contents;
|
||||
|
||||
@ManyToOne(optional=false)
|
||||
private Log log;
|
||||
|
||||
public LogEntry(){ };
|
||||
|
||||
public LogEntry(final User creator, String contents, Log log){
|
||||
this.creator = creator;
|
||||
this.contents = contents;
|
||||
this.log=log;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public User getCreator() {
|
||||
return creator;
|
||||
}
|
||||
|
||||
public void setCreator(User creator) {
|
||||
this.creator = creator;
|
||||
}
|
||||
|
||||
public String getContents() {
|
||||
return contents;
|
||||
}
|
||||
|
||||
public void setContents(String contents) {
|
||||
this.contents = contents;
|
||||
}
|
||||
|
||||
public Log getLog() {
|
||||
return log;
|
||||
}
|
||||
|
||||
public void setLog(Log log) {
|
||||
this.log = log;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(LogEntry o) {
|
||||
if( this == o )
|
||||
return 0;
|
||||
|
||||
if(this.getDateCreated() != null && o.getDateCreated() != null){
|
||||
//Reversed from what you might expect, because normally we want to display newest comment first in listviews
|
||||
if(this.getDateCreated().equals(o.getDateCreated())){
|
||||
return this.getId().compareTo(o.getId());
|
||||
}
|
||||
return o.getDateCreated().compareTo(this.getDateCreated());
|
||||
}
|
||||
if(this.getId() != null && o.getId() != null)
|
||||
return this.getId().compareTo(o.getId());
|
||||
if(this.contents != null && o.contents != null)
|
||||
return contents.compareTo(o.contents);
|
||||
//By now we have to conclude the two objects are basically two objects full of nulls
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
LogEntry other = (LogEntry) obj;
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
return false;
|
||||
} else if (!id.equals(other.id))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -66,9 +66,6 @@ public class Project extends DomainObject implements Comparable<Project>, Iconiz
|
||||
@QueryInit({"user", "unit"})
|
||||
private Employee headSupervisor;
|
||||
|
||||
@OneToOne(mappedBy="project", orphanRemoval = true)
|
||||
private Log log;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
private ProjectStatus projectStatus = ProjectStatus.ACTIVE;
|
||||
|
||||
@ -153,14 +150,6 @@ public class Project extends DomainObject implements Comparable<Project>, Iconiz
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public Log getLog() {
|
||||
return log;
|
||||
}
|
||||
|
||||
public void setLog(Log log) {
|
||||
this.log = log;
|
||||
}
|
||||
|
||||
public SortedSet<Student> getProjectParticipants() {
|
||||
return projectParticipants;
|
||||
|
@ -75,8 +75,6 @@ public abstract class SciProTest {
|
||||
@Mock protected LanguageDao languageDao;
|
||||
@Mock protected LazyDeletable lazyDeletable;
|
||||
@Mock protected LazyDeleteDao lazyDeleteDao;
|
||||
@Mock protected LogDao logDao;
|
||||
@Mock protected LogEntryDao logEntryDao;
|
||||
@Mock protected MailEventDao mailEventDao;
|
||||
@Mock protected MessageBoardDao messageBoardDao;
|
||||
@Mock protected PrivateMessageDao privateMessageDao;
|
||||
|
Loading…
x
Reference in New Issue
Block a user