Commit a78e9ee9 authored by Michael Ritter's avatar Michael Ritter
Browse files

Remaining models

parent 79e474d0
......@@ -23,11 +23,6 @@
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test</artifactId>
<scope>test</scope>
</dependency>
<!-- todo: the kotlin versions are out of sync between jackson and us...needs resolution -->
<dependency>
......@@ -58,8 +53,6 @@
</dependencies>
<build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
......@@ -72,6 +65,11 @@
<goals>
<goal>compile</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>src/main/kotlin</sourceDir>
</sourceDirs>
</configuration>
</execution>
<execution>
<id>test-compile</id>
......@@ -79,6 +77,11 @@
<goals>
<goal>test-compile</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>src/test/kotlin</sourceDir>
</sourceDirs>
</configuration>
</execution>
</executions>
<configuration>
......@@ -87,6 +90,4 @@
</plugin>
</plugins>
</build>
</project>
package org.chronopolis.rest.kot.models
import org.hibernate.validator.constraints.NotBlank
import java.time.ZonedDateTime
import javax.validation.constraints.NotNull
data class AceToken(val id: Long,
val bagId: Long,
@NotNull
val round: Long,
@NotBlank
val proof: String,
@NotBlank
val imsHost: String,
@NotBlank
val filename: String,
@NotBlank
val algorithm: String,
@NotBlank
val imsService: String,
@NotNull
val createDate: ZonedDateTime)
package org.chronopolis.rest.kot.models
import org.chronopolis.rest.kot.models.enums.BagStatus
import java.time.ZonedDateTime
data class Bag(val id: Long,
val size: Long,
val totalFiles: Long,
val bagStorage: StagingStorage,
val tokenStorage: StagingStorage,
val createdAt: ZonedDateTime,
val updatedAt: ZonedDateTime,
val name: String,
val creator: String,
val depositor: String,
val status: BagStatus,
val replicatingNodes: Set<String>)
package org.chronopolis.rest.kot.models
import java.time.ZonedDateTime
data class Depositor(val id: Long,
val namespace: String,
val sourceOrganization: String,
val organizationAddress: String,
val createdAt: ZonedDateTime,
val updatedAt: ZonedDateTime,
val replicatingNodes: Set<String>,
val contacts: Set<DepositorContact>)
package org.chronopolis.rest.kot.models
data class DepositorContact(val contactName: String,
val contactEmail: String,
val contactPhone: String)
package org.chronopolis.rest.kot.models
import java.time.ZonedDateTime
data class Fixity(val value: String,
// enum instead? we have the digest type...
val algorithm: String,
val createdAt: ZonedDateTime)
package org.chronopolis.rest.kot.models
import org.chronopolis.rest.kot.models.enums.FulfillmentType
/**
* The types of Fulfillments possible
*
* Note: We might need some more fancy boy modeling school annotations in order to have polymorphic
* serialization and deserialization
*
*/
sealed class FulfillmentStrategy
data class AceStrategy(val fulfillmentType: FulfillmentType,
val apiKey: String,
val url: String) : FulfillmentStrategy()
data class RsyncStrategy(val fulfillmentType: FulfillmentType,
val link: String): FulfillmentStrategy()
package org.chronopolis.rest.kot.models
import org.chronopolis.rest.kot.models.enums.AuditStatus
import org.chronopolis.rest.kot.models.enums.FulfillmentType
import org.chronopolis.rest.kot.models.enums.RepairStatus
import java.time.ZonedDateTime
data class Repair(val id: Long,
val createdAt: ZonedDateTime,
val updatedAt: ZonedDateTime,
val cleaned: Boolean,
val replaced: Boolean,
val validated: Boolean,
val audit: AuditStatus,
val status: RepairStatus,
val to: String,
val requester: String,
val depositor: String,
val collection: String,
val files: List<String>,
// Should we have any extra information in the credentials?
// like if the fulfilling node has cleaned it yet?
val from: String,
val type: FulfillmentType,
val credentials: FulfillmentStrategy)
package org.chronopolis.rest.kot.models
import org.chronopolis.rest.kot.models.enums.ReplicationStatus
import java.time.ZonedDateTime
data class Replication(val id: Long,
val createdAt: ZonedDateTime,
val updatedAt: ZonedDateTime,
val status: ReplicationStatus,
val bagLink: String,
val tokenLink: String,
val protocol: String,
val receivedTagFixity: String,
val receivedTokenFixity: String,
val node: String,
val bag: Bag)
package org.chronopolis.rest.kot.models
data class ReplicationConfig(val region: Long,
val path: String,
val server: String,
val username: String)
package org.chronopolis.rest.kot.models
data class StagingStorage(val active: Boolean,
val size: Long,
val region: Long,
val totalFiles: Long,
val path: String,
val fixities: Set<Fixity>)
package org.chronopolis.rest.kot.models
import org.chronopolis.rest.kot.models.enums.DataType
import org.chronopolis.rest.kot.models.enums.StorageType
data class StorageRegion(val id: Long,
val node: String,
val note: String,
val capacity: Long,
val dataType: DataType,
val storageType: StorageType,
val replicationConfig: ReplicationConfig)
package org.chronopolis.rest.kot.models.create
import org.hibernate.validator.constraints.Email
import org.hibernate.validator.constraints.NotBlank
/**
* Is this needed? Or can we just use the [DepositorContact]
*
*/
data class DepositorContactCreate(@get:NotBlank val contactName: String,
@get:Email val contactEmail: String,
@get:NotBlank val contactPhone: String)
\ No newline at end of file
package org.chronopolis.rest.kot.models.create
import org.hibernate.validator.constraints.NotBlank
import javax.validation.Valid
data class DepositorCreate(@get:NotBlank val namespace: String,
@get:NotBlank val sourceOrganization: String,
@get:NotBlank val organizationAddress: String,
@get:Valid val contacts: List<DepositorContactCreate>,
val replicatingNodes: List<String>)
\ No newline at end of file
package org.chronopolis.rest.kot.models.create
import org.chronopolis.rest.kot.models.enums.DataType
import org.chronopolis.rest.kot.models.enums.StorageType
import org.chronopolis.rest.kot.models.enums.StorageUnit
import org.hibernate.validator.constraints.NotEmpty
import javax.validation.constraints.Min
data class RegionCreate(val note: String,
val node: String,
@get:Min(1) val capacity: Long,
val dataType: DataType,
val storageUnit: StorageUnit,
val storageType: StorageType,
@get:NotEmpty val replicationPath: String,
@get:NotEmpty val replicationServer: String,
val replicationUser: String?)
\ No newline at end of file
package org.chronopolis.rest.kot.models.create
import org.chronopolis.rest.kot.models.enums.StorageUnit
import org.hibernate.validator.constraints.NotBlank
import javax.validation.constraints.Min
data class StagingCreate(@get:NotBlank val location: String,
val storageRegion: Long,
@get:Min(1) val totalFiles: Long,
@get:Min(1) val size: Long,
val storageUnit: StorageUnit)
\ No newline at end of file
package org.chronopolis.rest.kot.models.enums
enum class AuditStatus {
PRE, AUDITING, SUCCESS, FAIL;
companion object {
fun statusByGroup(): Set<AuditStatus> = TODO()
}
}
\ No newline at end of file
package org.chronopolis.rest.kot.models.enums
enum class BagStatus {
DEPOSITED,
INITIALIZED,
TOKENIZED,
REPLICATING,
PRESERVED,
DEPRECATED,
DELETED,
ERROR;
companion object {
fun processingStates(): Set<BagStatus> = TODO()
fun preservedStates(): Set<BagStatus> = TODO()
fun inactiveStates(): Set<BagStatus> = TODO()
fun statusByGroup(): Set<BagStatus> = TODO()
}
}
\ No newline at end of file
package org.chronopolis.rest.kot.models.enums
enum class DataType {
BAG, TOKEN;
}
\ No newline at end of file
package org.chronopolis.rest.kot.models.enums
enum class FulfillmentType {
ACE, NODE_TO_NODE, INGEST
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment