GitLab's annual major release is around the corner. Along with a lot of new and exciting features, there will be a few breaking changes. Learn more here.

Commit 86f53898 authored by Michael Ritter's avatar Michael Ritter
Browse files

Implement helpers and stubbed functions

parent e49167ad
......@@ -22,7 +22,7 @@ class Node(
var restorations: Set<Restoration> = emptySet(),
@get:OneToMany(mappedBy = "node", cascade = [CascadeType.ALL], orphanRemoval = true)
var depositorDistributions: Set<DepositorNode> = emptySet(),
var depositorDistributions: MutableSet<DepositorNode> = mutableSetOf(),
var username: String = "",
var password: String = "",
......
......@@ -18,29 +18,34 @@ class Depositor(
) : UpdatableEntity(), Comparable<Depositor> {
@get:OneToMany(mappedBy = "depositor", cascade = [CascadeType.ALL], orphanRemoval = true)
lateinit var contacts: Set<DepositorContact>
lateinit var contacts: MutableSet<DepositorContact>
@get:OneToMany(mappedBy = "depositor", cascade = [CascadeType.ALL], orphanRemoval = true)
lateinit var nodeDistributions: Set<DepositorNode>
lateinit var nodeDistributions: MutableSet<DepositorNode>
// Helpers for adding/removing contacts and distributions?
fun addContact(contact: DepositorContact) {
TODO()
contact.depositor = this
contacts.add(contact)
}
fun removeContact(contact: DepositorContact) {
TODO()
contacts.remove(contact)
}
fun addNodeDistribution(node: Node) {
TODO()
val dn = DepositorNode(this, node)
nodeDistributions.add(dn)
}
fun removeNodeDistribution(node: Node) {
TODO()
val dn = DepositorNode(this, node)
nodeDistributions.remove(dn)
node.depositorDistributions.remove(dn)
// todo null out dn after?
}
// Helpers for adding/removing contacts and distributions?
override fun compareTo(other: Depositor): Int {
return namespace.compareTo(other.namespace)
}
......
......@@ -24,13 +24,13 @@ class StagingStorage(
// storage this is associated with... should probably update the schema to have a better
// understanding of the world
@get:ManyToMany(fetch = FetchType.LAZY, mappedBy = "bagStorage")
lateinit var bags: Set<Bag>
lateinit var bags: MutableSet<Bag>
@get:ManyToMany(fetch = FetchType.LAZY, mappedBy = "tokenStorage")
lateinit var tokens: Set<Bag>
lateinit var tokens: MutableSet<Bag>
@get:OneToMany(mappedBy = "storage", cascade = [CascadeType.ALL], fetch = FetchType.EAGER)
lateinit var fixities: Set<Fixity>
lateinit var fixities: MutableSet<Fixity>
// Helper function for more fluent verbage
......
......@@ -22,7 +22,7 @@ class StorageRegion(
var storageType: StorageType = StorageType.LOCAL,
@get:OneToMany(mappedBy = "region", fetch = FetchType.LAZY)
var storage: Set<StagingStorage> = emptySet(),
var storage: MutableSet<StagingStorage> = mutableSetOf(),
var capacity: Long = 0,
var note: String = ""
......
package org.chronopolis.rest.kot.models.enums
import com.google.common.collect.ImmutableListMultimap
enum class AuditStatus {
PRE, AUDITING, SUCCESS, FAIL;
companion object {
fun statusByGroup(): Set<AuditStatus> = TODO()
fun statusByGroup(): ImmutableListMultimap<String, AuditStatus> =
ImmutableListMultimap.Builder<String, AuditStatus>()
.put("Pending", PRE)
.put("Active", AUDITING)
.put("Success", SUCCESS)
.put("Failure", FAIL)
.build()
}
}
\ No newline at end of file
package org.chronopolis.rest.kot.models.enums
import com.google.common.collect.ImmutableListMultimap
import com.google.common.collect.ImmutableSet
/**
* Status types for Bags
*
* @author shake
*/
enum class BagStatus {
DEPOSITED,
INITIALIZED,
......@@ -11,9 +19,18 @@ enum class BagStatus {
ERROR;
companion object {
fun processingStates(): Set<BagStatus> = TODO()
fun preservedStates(): Set<BagStatus> = TODO()
fun inactiveStates(): Set<BagStatus> = TODO()
fun statusByGroup(): Set<BagStatus> = TODO()
fun processingStates(): Set<BagStatus> =
ImmutableSet.of(DEPOSITED, INITIALIZED, TOKENIZED, REPLICATING)
fun preservedStates(): Set<BagStatus> = ImmutableSet.of(PRESERVED)
fun inactiveStates(): Set<BagStatus> = ImmutableSet.of(DEPRECATED, DELETED, ERROR)
fun statusByGroup(): ImmutableListMultimap<String, BagStatus> =
ImmutableListMultimap.Builder<String, BagStatus>()
.putAll("Processing", processingStates())
.putAll("Preserved", preservedStates())
.putAll("Inactive", inactiveStates())
.build()
}
}
\ No newline at end of file
package org.chronopolis.rest.kot.models.enums
import com.google.common.collect.ImmutableListMultimap
enum class RepairStatus {
REQUESTED, STAGING, READY, TRANSFERRED, REPAIRED, FAILED;
companion object {
fun statusByGroup(): Set<RepairStatus> = TODO()
fun statusByGroup(): ImmutableListMultimap<String, RepairStatus> =
ImmutableListMultimap.Builder<String, RepairStatus>()
.put("Pending", REQUESTED)
.put("Active", STAGING)
.put("Active", READY)
.put("Active", TRANSFERRED)
.put("Success", REPAIRED)
.put("Failure", FAILED)
.build()
}
}
\ No newline at end of file
package org.chronopolis.rest.kot.models.enums
import com.google.common.collect.ImmutableListMultimap
import com.google.common.collect.ImmutableSet
enum class ReplicationStatus {
PENDING,
STARTED,
......@@ -29,9 +32,19 @@ enum class ReplicationStatus {
fun isOngoing(): Boolean = !(this.isFailure() || this == SUCCESS)
companion object {
fun active(): Set<ReplicationStatus> = TODO()
fun statusByGroup(): Set<ReplicationStatus> = TODO()
fun active(): Set<ReplicationStatus> = ImmutableSet.of(PENDING, STARTED, TRANSFERRED,
ACE_REGISTERED, ACE_AUDITING, ACE_TOKEN_LOADED)
fun statusByGroup(): ImmutableListMultimap<String, ReplicationStatus> =
ImmutableListMultimap.Builder<String, ReplicationStatus>()
.put("Inactive", PENDING)
.putAll("Active", active())
.put("Success", SUCCESS)
.put("Failed", FAILURE)
.put("Failed", FAILURE_ACE_AUDIT)
.put("Failed", FAILURE_TAG_MANIFEST)
.put("Failed", FAILURE_TOKEN_STORE)
.build()
}
}
\ 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