Skip to content

Commit

Permalink
[RJA-185] timestamp field
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafael Bagmanov committed Mar 13, 2013
1 parent 3b1b308 commit d9f65f0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Expand Up @@ -216,11 +216,6 @@ trait GenesisSchemaPrimitive extends GenesisSchema {
agent.port is (dbType("int")),
agent.tags is (dbType("varchar(512)"))
))

on(failedJobDetails)(jd => declare(
jd.id is (primaryKey, autoIncremented),
jd.failureDescription is (dbType("text"))
))
}

trait GenesisSchemaCustom extends GenesisSchema {
Expand All @@ -229,4 +224,10 @@ trait GenesisSchemaCustom extends GenesisSchema {
workflow.variables is (dbType("varchar(4096)")),
workflow.displayVariables is (dbType("text"))
))

on(failedJobDetails)(jd => declare(
jd.id is (primaryKey, autoIncremented),
jd.variables is (dbType("varchar(4096)")),
jd.failureDescription is (dbType("text"))
))
}
Expand Up @@ -27,6 +27,7 @@ import com.griddynamics.genesis.model.{GenesisSchema => GS, GenesisEntity, Varia
import com.griddynamics.genesis.api.ScheduledJobDetails
import org.squeryl.PrimitiveTypeMode._
import org.springframework.transaction.annotation.Transactional
import java.sql.Timestamp

trait FailedJobRepository {
def list(envId: Int): Iterable[api.ScheduledJobDetails]
Expand All @@ -37,12 +38,12 @@ trait FailedJobRepository {
class FailedJobRepositoryImpl extends AbstractGenericRepository[model.FailedJobDetails, api.ScheduledJobDetails](GS.failedJobDetails) with FailedJobRepository {
implicit def convert(model: FailedJobDetails) = {
import VariablesField.variablesFieldToMap
new api.ScheduledJobDetails(model.id.toString, model.projectId, model.envId, model.executionDate, model.workflow, model.variables, model.scheduledBy, Some(model.failureDescription))
new api.ScheduledJobDetails(model.id.toString, model.projectId, model.envId, model.executionDate.getTime, model.workflow, model.variables, model.scheduledBy, Some(model.failureDescription))
}


implicit def convert(dto: ScheduledJobDetails) = {
new FailedJobDetails(dto.id, dto.projectId, dto.envId, dto.date, dto.workflow, dto.variables, dto.scheduledBy, dto.failureDescription.getOrElse("N/A"))
new FailedJobDetails(dto.id, dto.projectId, dto.envId, new Timestamp(dto.date), dto.workflow, dto.variables, dto.scheduledBy, dto.failureDescription.getOrElse("N/A"))
}

@Transactional
Expand Down
Expand Up @@ -21,11 +21,13 @@
* Description: Continuous Delivery Platform
*/ package com.griddynamics.genesis.model

import java.sql.Timestamp

class FailedJobDetails (
val jobId: String,
val projectId: Int,
val envId: Int,
val executionDate: Long,
val executionDate: Timestamp,
val workflow: String,
val variables: VariablesField,
val scheduledBy: String,
Expand Down

0 comments on commit d9f65f0

Please sign in to comment.