- def parseField(f: Field): Calendar = {
- f match {
- case pattern(year, month, day) =>
- new GregorianCalendar(year.toInt, month.toInt, day.toInt)
- }
- }
- }
-
- implicit def StatusFromField = new FromField[Status] {
- def parseField(f: Field): Status = f match {
- case "順調" => Status.DoingFine
- case "遅延" => Status.Lagging
- case "期限変更" => Status.DeadlineChanged
- case "完了" => Status.Completed
- }
- }
-
- implicit def TaskFromRecord = new FromRecord[Task] {
- def parseRecord(r: Record): Task = {
- return Task(
- date = parseField[Calendar](r('報告日)),
- ticketID = parseField[Option[Int]](r('チケットID)),
- title = parseField[String](r('作業名)),
- expectedCompletionDate = parseField[Calendar](r('作業完了予定年月日)),
- deadline = parseField[Option[Calendar]](r('タスク期限)),
- status = parseField[Status](r('状態)),
- description = parseField[Option[String]](r('説明))
- )
- }
- }
-}
-
-/*
-class Task(tsvLine: String) {
- sealed abstract class Status
- object Status {
- case object NoProgress extends Status
- case object DoingFine extends Status
- case object Lagging extends Status
- case object WillDelay extends Status
- case object DeadlineChanged extends Status
- case object Completed extends Status
- }
-
- class InvalidNumberOfColumnsException private(e: RuntimeException) extends RuntimeException(e) {
- def this(msg: String) = this(new RuntimeException(msg))
- def this(msg: String, cause: Throwable) = this(new RuntimeException(msg, cause))
- }
-
- private val cols = tsvLine.split("\\t")
- if (cols.length != 7) {
- throw new InvalidNumberOfColumnsException(tsvLine)
- }
-
- var date : Calendar = {
- val pattern = """^(?:報告日:)?(\d{4})/(\d{2})/(\d{2})$""".r
- cols(0) match {