forked from snyk-cs-goof-org/java-monorepo-goof
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SAK-46436 Add ability for instructors to manually create Tasks that a…
…ren't automatically added via tools
- Loading branch information
Showing
26 changed files
with
610 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
kernel/api/src/main/java/org/sakaiproject/tasks/api/AssignationType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package org.sakaiproject.tasks.api; | ||
|
||
public enum AssignationType { | ||
user, site, group | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
kernel/api/src/main/java/org/sakaiproject/tasks/api/TaskAssigned.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package org.sakaiproject.tasks.api; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.Entity; | ||
import javax.persistence.EnumType; | ||
import javax.persistence.Enumerated; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.Index; | ||
import javax.persistence.JoinColumn; | ||
import javax.persistence.ManyToOne; | ||
import javax.persistence.SequenceGenerator; | ||
import javax.persistence.Table; | ||
|
||
import org.sakaiproject.springframework.data.PersistableEntity; | ||
|
||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
|
||
@Data | ||
@Entity | ||
@EqualsAndHashCode(onlyExplicitlyIncluded = true) | ||
@Table(name = "TASKS_ASSIGNED", indexes = { | ||
@Index(name = "IDX_TASKS_ASSIGNED", columnList = "TASK_ID") | ||
}) | ||
public class TaskAssigned implements PersistableEntity<Long> { | ||
|
||
@Id | ||
@Column(name = "ID") | ||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "tasks_assigned_id_sequence") | ||
@SequenceGenerator(name = "tasks_assigned_id_sequence", sequenceName = "TASKS_ASSIGNED_S") | ||
@EqualsAndHashCode.Include | ||
private Long id; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "TASK_ID", nullable = false) | ||
private Task task; | ||
|
||
@Column(name = "ASSIGNATION_TYPE", nullable = false) | ||
@Enumerated(EnumType.STRING) | ||
private AssignationType type; | ||
|
||
@Column(name = "OBJECT_ID", length = 99, nullable = true) | ||
private String objectId; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
kernel/api/src/main/java/org/sakaiproject/tasks/api/repository/TaskAssignedRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.sakaiproject.tasks.api.repository; | ||
|
||
import java.util.List; | ||
|
||
import org.sakaiproject.springframework.data.SpringCrudRepository; | ||
import org.sakaiproject.tasks.api.Task; | ||
import org.sakaiproject.tasks.api.TaskAssigned; | ||
|
||
public interface TaskAssignedRepository extends SpringCrudRepository<TaskAssigned, Long>{ | ||
|
||
List<TaskAssigned> findByTaskId(Long taskId); | ||
void deleteByTask(Task task); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...impl/src/main/java/org/sakaiproject/tasks/impl/repository/TaskAssignedRepositoryImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.sakaiproject.tasks.impl.repository; | ||
|
||
import java.util.List; | ||
|
||
import org.hibernate.Session; | ||
import org.sakaiproject.springframework.data.SpringCrudRepositoryImpl; | ||
import org.sakaiproject.tasks.api.Task; | ||
import org.sakaiproject.tasks.api.TaskAssigned; | ||
import org.sakaiproject.tasks.api.repository.TaskAssignedRepository; | ||
|
||
public class TaskAssignedRepositoryImpl extends SpringCrudRepositoryImpl<TaskAssigned, Long> implements TaskAssignedRepository { | ||
|
||
@Override | ||
public List<TaskAssigned> findByTaskId(Long taskId) { | ||
Session session = sessionFactory.getCurrentSession(); | ||
return session.createQuery("select u from TaskAssigned u where task.id = :taskId") | ||
.setParameter("taskId", taskId).list(); | ||
} | ||
|
||
@Override | ||
public void deleteByTask(Task task) { | ||
Session session = sessionFactory.getCurrentSession(); | ||
session.createQuery("delete from TaskAssigned where task = :task") | ||
.setParameter("task", task).executeUpdate(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.