]> gitweb @ CieloNegro.org - task-reporter.git/blobdiff - src/main/scala/jp/ymir/taskReporter/core/Task.scala
wip
[task-reporter.git] / src / main / scala / jp / ymir / taskReporter / core / Task.scala
index ebc869385de41335797d1b6eabc34ee6f22d7c29..7b38e0a8013f8ddbecf77d0b1e64c87642d2b7a6 100644 (file)
@@ -10,7 +10,7 @@ class Task(tsvLine: String) {
     case object DoingFine extends Status
     case object Lagging extends Status
     case object WillDelay extends Status
-    case object DeadlinePostponed extends Status
+    case object DeadlineChanged extends Status
     case object Completed extends Status
   }
 
@@ -24,7 +24,7 @@ class Task(tsvLine: String) {
     throw new InvalidNumberOfColumnsException(tsvLine)
   }
 
-  val date : Calendar = {
+  var date : Calendar = {
     val pattern = """^(?:報告日:)?(\d{4})/(\d{2})/(\d{2})$""".r
     cols(0) match {
       case pattern(year, month, day) =>
@@ -32,16 +32,58 @@ class Task(tsvLine: String) {
     }
   }
 
-  val ticketID : Int = {
+  var ticketID : Int = {
     val pattern = """^(?:チケットID:)?(\d+)$""".r
     cols(1) match {
       case pattern(id) => id.toInt
     }
   }
 
-  val title : String = {
+  var title : String = {
     val pattern = """^(?:作業名:)?(.*)$""".r
-    cols(1) match {
+    cols(2) match {
+      case pattern(title) => title
+    }
+  }
+
+  var tentativeDeadline : Option[Calendar] = {
+    val pattern = """^(?:仮期限:)?(\d{4})/(\d{2})/(\d{2})$""".r
+    cols(3) match {
+      case pattern(year, month, day) =>
+        Some(new GregorianCalendar(year.toInt, month.toInt, day.toInt))
+      case _ =>
+        None
+    }
+  }
+
+  var deadline : Option[Calendar] = {
+    val pattern = """^(?:期限:)?(\d{4})/(\d{2})/(\d{2})$""".r
+    cols(4) match {
+      case pattern(year, month, day) =>
+        Some(new GregorianCalendar(year.toInt, month.toInt, day.toInt))
+      case _ =>
+        None
+    }
+  }
+
+  var status : Status = {
+    val pattern = """^(?:状態:)?(.+)$""".r
+    cols(5) match {
+      case pattern(s) =>
+        s match {
+          case "未作業"   => Status.NoProgress
+          case "順調"     => Status.DoingFine
+          case "悪化"     => Status.Lagging
+          case "遅延"     => Status.WillDelay
+          case "期限変更" => Status.DeadlineChanged
+          case "完了"     => Status.Completed
+        }
+    }
+  }
+
+  var supplement : String = {
+    val pattern = """^(?:補足:)?(.*)$""".r
+    cols(6) match {
       case pattern(title) => title
     }
   }