ca.shiftfocus.krispii.core.services

ProjectServiceDefault

Related Doc: package services

class ProjectServiceDefault extends ProjectService

Linear Supertypes
ProjectService, Service[Fail], Lifting[Fail], Serialized, FutureMonad, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. ProjectServiceDefault
  2. ProjectService
  3. Service
  4. Lifting
  5. Serialized
  6. FutureMonad
  7. AnyRef
  8. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ProjectServiceDefault(db: DB, scalaCache: ScalaCachePool, authService: AuthService, schoolService: SchoolService, courseRepository: CourseRepository, projectRepository: ProjectRepository, partRepository: PartRepository, taskRepository: TaskRepository)

Type Members

  1. case class CommonTaskArgs(taskId: UUID, version: Long, name: Option[String], description: Option[String], position: Option[Int], notesAllowed: Option[Boolean], dependencyId: Option[UUID] = None, partId: Option[UUID] = None) extends Product with Serializable

    Definition Classes
    ProjectService

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  5. val authService: AuthService

    Definition Classes
    ProjectServiceDefaultProjectService
  6. implicit def cache: ScalaCachePool

  7. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. implicit def conn: Connection

  9. val courseRepository: CourseRepository

  10. def create(courseId: UUID, name: String, slug: String, description: String, availability: String): Future[\/[Fail, Project]]

    Create a new project, with a single part and an empty task.

    Create a new project, with a single part and an empty task.

    New projects will *always* need at least one part and task to be useful, so we will simply the creation process and do it all at once.

    name

    The new name to give the project.

    slug

    The new slug to give the project.

    description

    The new description for the project.

    returns

    the updated project.

    Definition Classes
    ProjectServiceDefaultProjectService
  11. def createPart(projectId: UUID, name: String, position: Int): Future[\/[Fail, Part]]

    Create a new part.

    Create a new part.

    NB: If the new part's position interferes with the position of an existing part, the part list for the project will be updated to reflect the reordered positions. This will necessarily increment their version numbers. The client should be aware to update its part list after calling create.

    projectId

    the unique ID of the project to attach this part to

    name

    the part's name

    position

    this part's position in the project. If this position has already been taken, the existing parts will be shifted down.

    Definition Classes
    ProjectServiceDefaultProjectService
  12. def createTask(partId: UUID, taskType: Int, name: String, description: String, position: Int, dependencyId: Option[UUID]): Future[\/[Fail, Task]]

    Create a new task.

    Create a new task.

    partId

    the unique ID of the part this task belongs to

    name

    the name of this task

    description

    a brief description of this task

    position

    the position of this task in the part

    dependencyId

    optionally make this task dependent on another

    returns

    the newly created task

    Definition Classes
    ProjectServiceDefaultProjectService
  13. val db: DB

    Database connection (pool).

    Database connection (pool). Services will take connections from this pool when making repository calls.

    Definition Classes
    ProjectServiceDefaultService
  14. def delete(id: UUID, version: Long): Future[\/[Fail, Project]]

    Delete a project.

    Delete a project.

    NB: This deletes the entire project! All parts, all tasks, including all responses and scratch pads. Wrapped in a transaction.

    id

    the UUID of the project to delete

    version

    the version of the project to delete

    returns

    a boolean indicating success/failure

    Definition Classes
    ProjectServiceDefaultProjectService
  15. def deletePart(partId: UUID, version: Long): Future[\/[Fail, Part]]

    Delete a part.

    Delete a part.

    NB: When a part is removed from a project, the project's remaining parts must be re-ordered. This necessarily updates the versions of the updated parts w.r.t. optimistic offline lock.

    partId

    the unique ID of the part to delete

    version

    the current version of the part to delete

    returns

    a boolean indicator whether the operation was successful

    Definition Classes
    ProjectServiceDefaultProjectService
  16. def deleteTask(taskId: UUID, version: Long): Future[\/[Fail, Task]]

    Delete a task.

    Delete a task.

    NB: When a task is removed from a part, the part's remaining tasks must be re-ordered. This necessarily updates the versions of the updated tasks w.r.t. optimistic offline lock.

    taskId

    the unique ID of the task to delete

    version

    the current version of the task to delete

    returns

    a boolean indicator whether the operation was successful

    Definition Classes
    ProjectServiceDefaultProjectService
  17. implicit def eitherRunner[B](eithert: EitherT[Future, Fail, B]): Future[\/[Fail, B]]

    Definition Classes
    Lifting
  18. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  19. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  20. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  21. def find(projectSlug: String, userId: UUID): Future[\/[Fail, Project]]

    Find a single project by slug and UserID.

    Find a single project by slug and UserID.

    returns

    an optional project

    Definition Classes
    ProjectServiceDefaultProjectService
  22. def find(projectId: UUID, userId: UUID): Future[\/[Fail, Project]]

    Find a project *if and only if* a user has access to that project.

    Find a project *if and only if* a user has access to that project.

    projectId

    the unique id of the project to find

    userId

    the unique id of the user to filter by

    returns

    a future disjunction containing either a project, or a failure

    Definition Classes
    ProjectServiceDefaultProjectService
  23. def find(id: UUID): Future[\/[Fail, Project]]

    Find a single project by ID.

    Find a single project by ID.

    returns

    an optional project

    Definition Classes
    ProjectServiceDefaultProjectService
  24. def find(projectSlug: String): Future[\/[Fail, Project]]

    Find a single project by slug.

    Find a single project by slug.

    returns

    an optional project

    Definition Classes
    ProjectServiceDefaultProjectService
  25. def findNowTask(userId: UUID, projectId: UUID): Future[\/[Fail, Task]]

    Find the "now" task for a student in a project

    Find the "now" task for a student in a project

    userId

    the unique of the id of the student

    projectId

    the unique id of the project

    returns

    a future disjunction containing either the now task, or a failure

    Definition Classes
    ProjectServiceDefaultProjectService
  26. def findPart(partId: UUID): Future[\/[Fail, Part]]

    Find a single part.

    Find a single part.

    partId

    the id of the part

    returns

    a vector of this project's parts

    Definition Classes
    ProjectServiceDefaultProjectService
  27. def findTask(projectSlug: String, partNum: Int, taskNum: Int): Future[\/[Fail, Task]]

    Find a task by its position in a project.

    Find a task by its position in a project.

    projectSlug

    the text slug of the project this task is in

    partNum

    the number (corresponds to 'position' field) of the part that this task is in.

    taskNum

    the number (position) of the task inside the part.

    returns

    an Option[Task] if one was found.

    Definition Classes
    ProjectServiceDefaultProjectService
  28. def findTask(taskId: UUID): Future[\/[Fail, Task]]

    Find a task by its ID.

    Find a task by its ID.

    Definition Classes
    ProjectServiceDefaultProjectService
  29. implicit val futureMonad: Monad[Future]

    Definition Classes
    FutureMonad
  30. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  31. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  32. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  33. def lift[B]: (Future[\/[Fail, B]]) ⇒ EitherT[Future, Fail, B]

    Definition Classes
    Lifting
  34. def liftSeq[B](fIntermediate: Future[IndexedSeq[\/[Fail, B]]])(implicit ec: ExecutionContext): EitherT[Future, Fail, IndexedSeq[B]]

    Definition Classes
    Lifting
  35. def liftSeq[B](interList: IndexedSeq[Future[\/[Fail, B]]])(implicit ec: ExecutionContext): EitherT[Future, Fail, IndexedSeq[B]]

    Definition Classes
    Lifting
  36. def list(courseId: UUID): Future[\/[Fail, IndexedSeq[Project]]]

    Find all projects belonging to a given course

    Find all projects belonging to a given course

    courseId

    the unique id of the course to filter by

    returns

    a future disjunction containing either a vector of projects, or a failure

    Definition Classes
    ProjectServiceDefaultProjectService
  37. def list: Future[\/[Fail, IndexedSeq[Project]]]

    Lists all projects.

    Lists all projects.

    returns

    a future disjunction containing either a vector of projects, or a failure

    Definition Classes
    ProjectServiceDefaultProjectService
  38. def listPartsInComponent(componentId: UUID): Future[\/[Fail, IndexedSeq[Part]]]

    List the parts that have a component.

    List the parts that have a component.

    componentId

    the UUID of the component to filter by

    Definition Classes
    ProjectServiceDefaultProjectService
  39. def listProjectsByTeacher(userId: UUID): Future[\/[Fail, IndexedSeq[Project]]]

    Find all projects a user has access to.

    Find all projects a user has access to.

    userId

    the unique id of the user to filter by

    returns

    a future disjunction containing either a vector of projects, or a failure

    Definition Classes
    ProjectServiceDefaultProjectService
  40. def listProjectsByUser(userId: UUID): Future[\/[Fail, IndexedSeq[Project]]]

    Find all projects a user has access to.

    Find all projects a user has access to.

    userId

    the unique id of the user to filter by

    returns

    a future disjunction containing either a vector of projects, or a failure

    Definition Classes
    ProjectServiceDefaultProjectService
  41. def moveTask(partId: UUID, taskId: UUID, newPosition: Int): Future[\/[Fail, Task]]

    Moves a task from one part to another.

    Moves a task from one part to another.

    partId

    the new part that this task should belong to

    taskId

    the unique ID of the task to be moved

    newPosition

    the new position for this task

    Definition Classes
    ProjectServiceDefaultProjectService
  42. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  43. final def notify(): Unit

    Definition Classes
    AnyRef
  44. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  45. val partRepository: PartRepository

    Definition Classes
    ProjectServiceDefaultProjectService
  46. def predicate(fCondition: Future[Boolean])(fail: Fail)(implicit ec: ExecutionContext): EitherT[Future, Fail, Unit]

    Definition Classes
    Lifting
  47. def predicate(condition: Boolean)(fail: Fail): EitherT[Future, Fail, Unit]

    Definition Classes
    Lifting
  48. val projectRepository: ProjectRepository

    Definition Classes
    ProjectServiceDefaultProjectService
  49. def reorderParts(projectId: UUID, partIds: IndexedSeq[UUID]): Future[\/[Fail, Project]]

    Reorder the parts in a project.

    Reorder the parts in a project.

    projectId

    the unique id of the project to reorder parts for

    partIds

    the unique ids of the project's current parts, in the new order the parts should have

    returns

    a future disjunction containing either the updated project, or a failure

    Definition Classes
    ProjectServiceDefaultProjectService
  50. val scalaCache: ScalaCachePool

  51. val schoolService: SchoolService

    Definition Classes
    ProjectServiceDefaultProjectService
  52. def serialized[E, R, L[E] <: IndexedSeq[E]](collection: L[E])(fn: (E) ⇒ Future[R])(implicit ec: ExecutionContext): Future[IndexedSeq[R]]

    Definition Classes
    Serialized
  53. def serializedT[E, R, L[E] <: IndexedSeq[E]](collection: L[E])(fn: (E) ⇒ Future[\/[Fail, R]])(implicit ec: ExecutionContext): Future[\/[Fail, IndexedSeq[R]]]

    Definition Classes
    Lifting
  54. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  55. val taskRepository: TaskRepository

    Definition Classes
    ProjectServiceDefaultProjectService
  56. def toString(): String

    Definition Classes
    AnyRef → Any
  57. def togglePart(partId: UUID, version: Long): Future[\/[Fail, Part]]

    Enable a disabled part, and disable an enabled part.

    Enable a disabled part, and disable an enabled part.

    partId

    the unique ID of the part to toggle

    version

    the current version of the part to toggle

    returns

    a future disjunction containing either the toggled part, or a failure

    Definition Classes
    ProjectServiceDefaultProjectService
  58. def transactional[A](f: (Connection) ⇒ Future[A]): Future[A]

    Takes a function that returns a future, and runs it inside a database transaction.

    Takes a function that returns a future, and runs it inside a database transaction.

    Definition Classes
    Service
  59. def updateInfo(id: UUID, version: Long, courseId: Option[UUID], name: Option[String], description: Option[String], availability: Option[String]): Future[\/[Fail, Project]]

    Update an existing project.

    Update an existing project.

    id

    The unique ID of the project to update.

    version

    The current version of the project.

    name

    The new name to give the project.

    description

    The new description for the project.

    returns

    the updated project.

    Definition Classes
    ProjectServiceDefaultProjectService
  60. def updateLongAnswerTask(commonArgs: CommonTaskArgs): Future[\/[Fail, Task]]

    Update a LongAnswerTask.

    Update a LongAnswerTask.

    commonArgs
    returns

    Definition Classes
    ProjectServiceDefaultProjectService
  61. def updateMatchingTask(commonArgs: CommonTaskArgs, elementsLeft: Option[IndexedSeq[String]] = Some(IndexedSeq()), elementsRight: Option[IndexedSeq[String]] = Some(IndexedSeq()), answer: Option[IndexedSeq[Match]] = Some(IndexedSeq()), randomizeChoices: Option[Boolean] = Some(true)): Future[\/[Fail, Task]]

    Update a MatchingTask

    Update a MatchingTask

    commonArgs
    elementsLeft
    elementsRight
    answer
    randomizeChoices
    returns

    Definition Classes
    ProjectServiceDefaultProjectService
  62. def updateMultipleChoiceTask(commonArgs: CommonTaskArgs, choices: Option[IndexedSeq[String]] = Some(IndexedSeq()), answer: Option[IndexedSeq[Int]] = Some(IndexedSeq()), allowMultiple: Option[Boolean] = Some(false), randomizeChoices: Option[Boolean] = Some(true)): Future[\/[Fail, Task]]

    Update a MultipleChoiceTask

    Update a MultipleChoiceTask

    commonArgs
    choices
    answer
    allowMultiple
    randomizeChoices
    returns

    Definition Classes
    ProjectServiceDefaultProjectService
  63. def updateOrderingTask(commonArgs: CommonTaskArgs, elements: Option[IndexedSeq[String]] = Some(IndexedSeq()), answer: Option[IndexedSeq[Int]] = Some(IndexedSeq()), randomizeChoices: Option[Boolean] = Some(true)): Future[\/[Fail, Task]]

    Update an OrderingTask

    Update an OrderingTask

    commonArgs
    elements
    answer
    randomizeChoices
    returns

    Definition Classes
    ProjectServiceDefaultProjectService
  64. def updatePart(partId: UUID, version: Long, name: Option[String], maybePosition: Option[Int], enabled: Option[Boolean]): Future[\/[Fail, Part]]

    Update an existing part.

    Update an existing part.

    NB: If the part's updated position interferes with the position of another part, the part list for the project will be updated to reflect the reordered positions. This will necessarily increment their version numbers. The client should be aware to update its part list after calling update.

    Definition Classes
    ProjectServiceDefaultProjectService
  65. def updateShortAnswerTask(commonArgs: CommonTaskArgs, maxLength: Option[Int]): Future[\/[Fail, Task]]

    Update a ShortAnswerTask

    Update a ShortAnswerTask

    commonArgs
    maxLength
    returns

    Definition Classes
    ProjectServiceDefaultProjectService
  66. def updateSlug(id: UUID, version: Long, slug: String): Future[\/[Fail, Project]]

    Update a project's slug.

    Update a project's slug. This is a URL-friendly unique identifier for the project.

    id
    version
    slug
    returns

    Definition Classes
    ProjectServiceDefaultProjectService
  67. def userHasProject(userId: UUID, projectSlug: String): Future[\/[Fail, Boolean]]

    Checks if a user has access to a project.

    Checks if a user has access to a project.

    userId

    the UUID of the user to check

    projectSlug

    the slug of the project to look for

    returns

    a boolean indicating success or failure

    Definition Classes
    ProjectServiceDefaultProjectService
  68. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  69. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  70. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from ProjectService

Inherited from Service[Fail]

Inherited from Lifting[Fail]

Inherited from Serialized

Inherited from FutureMonad

Inherited from AnyRef

Inherited from Any

Ungrouped