Skip to content

Commit

Permalink
gh-4135 Add DB migs, regen jooq, add imp/exp handlers WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
at055612 committed Mar 6, 2024
1 parent d921d6f commit 52408b0
Show file tree
Hide file tree
Showing 62 changed files with 1,991 additions and 326 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package stroom.data.store.impl.fs.shared;

import stroom.docref.HasDocRef;
import stroom.docref.HasNameMutable;
import stroom.util.shared.GwtNullSafe;
import stroom.util.shared.HasAuditInfo;
import stroom.util.shared.HasIntegerId;

Expand All @@ -12,7 +14,15 @@
import java.util.Objects;

@JsonInclude(Include.NON_NULL)
public class FsVolumeGroup implements HasAuditInfo, HasIntegerId, HasNameMutable {
public class FsVolumeGroup implements HasAuditInfo, HasIntegerId, HasNameMutable, HasDocRef {

public static final String DOCUMENT_TYPE = "FsVolumeGroup";

// This uuid will be used for the auto created volume group.
// It is hard coded so that every stroom env that sets up a default volume
// will have the same uuid for it, which makes imp/exp between instances easier,
// similar to how context pack entities have fixed UUIDs.
private static final String DEFAULT_VOLUME_UUID = "dcf96afb-78a0-4a54-830f-0e3ae998f4af";

@JsonProperty
private Integer id;
Expand All @@ -28,6 +38,10 @@ public class FsVolumeGroup implements HasAuditInfo, HasIntegerId, HasNameMutable
private String updateUser;
@JsonProperty
private String name;
@JsonProperty
private String uuid;
@JsonProperty
private boolean defaultVolume;

public FsVolumeGroup() {
}
Expand All @@ -39,14 +53,18 @@ public FsVolumeGroup(@JsonProperty("id") final Integer id,
@JsonProperty("createUser") final String createUser,
@JsonProperty("updateTimeMs") final Long updateTimeMs,
@JsonProperty("updateUser") final String updateUser,
@JsonProperty("name") final String name) {
@JsonProperty("name") final String name,
@JsonProperty("uuid") final String uuid,
@JsonProperty("defaultVolume") final Boolean defaultVolume) {
this.id = id;
this.version = version;
this.createTimeMs = createTimeMs;
this.createUser = createUser;
this.updateTimeMs = updateTimeMs;
this.updateUser = updateUser;
this.name = name;
this.uuid = uuid;
this.defaultVolume = GwtNullSafe.requireNonNullElse(defaultVolume, false);
}

@Override
Expand Down Expand Up @@ -111,6 +129,28 @@ public void setName(String name) {
this.name = name;
}

@Override
public String getType() {
return DOCUMENT_TYPE;
}

@Override
public String getUuid() {
return uuid;
}

public void setUuid(final String uuid) {
this.uuid = uuid;
}

public boolean isDefaultVolume() {
return defaultVolume;
}

public void setDefaultVolume(final Boolean defaultVolume) {
this.defaultVolume = GwtNullSafe.requireNonNullElse(defaultVolume, false);
}

@Override
public String toString() {
return "IndexVolumeGroup{" +
Expand All @@ -121,6 +161,8 @@ public String toString() {
", updateTimeMs=" + updateTimeMs +
", updateUser='" + updateUser + '\'' +
", name='" + name + '\'' +
", uuid='" + uuid + '\'' +
", defaultVolume='" + defaultVolume + '\'' +
'}';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package stroom.docstore.shared;

import stroom.docref.DocRef;
import stroom.docref.HasDocRef;
import stroom.docref.HasType;
import stroom.docref.HasUuid;
import stroom.util.shared.HasAuditInfo;
Expand All @@ -40,7 +41,7 @@
"createUser",
"updateUser"})
@JsonInclude(Include.NON_NULL)
public abstract class Doc implements HasAuditInfo, HasUuid, HasType {
public abstract class Doc implements HasAuditInfo, HasUuid, HasType, HasDocRef {

@JsonProperty
private String type;
Expand Down
16 changes: 16 additions & 0 deletions stroom-core-shared/src/main/java/stroom/feed/shared/FeedDoc.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,12 @@ public class FeedDoc extends Doc {
private String streamType;
@JsonProperty
private FeedStatus status;
// The volume group used to be referenced by name, which is brittle, but is now done with a DocRef
@Deprecated(forRemoval = true) // Use VolumeGroupDocRef
@JsonProperty
private String volumeGroup;
@JsonProperty
private String volumeGroupDocRef;

public FeedDoc() {
}
Expand Down Expand Up @@ -218,14 +222,26 @@ public void setReference(final boolean reference) {
this.reference = reference;
}

/**
* The volume group used to be referenced by name, which is brittle, but is now done with a DocRef
*/
@Deprecated(forRemoval = true)
public String getVolumeGroup() {
return volumeGroup;
}

/**
* The volume group used to be referenced by name, which is brittle, but is now done with a DocRef
*/
@Deprecated(forRemoval = true) // Use VolumeGroupDocRef
public void setVolumeGroup(final String volumeGroup) {
this.volumeGroup = volumeGroup;
}


// --------------------------------------------------------------------------------


public enum FeedStatus implements HasDisplayValue, HasPrimitiveValue {
RECEIVE("Receive", 1),
REJECT("Reject", 2),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package stroom.index.shared;

import stroom.docref.HasDocRef;
import stroom.docref.HasNameMutable;
import stroom.util.shared.HasAuditInfo;
import stroom.util.shared.HasIntegerId;
Expand All @@ -12,7 +13,15 @@
import java.util.Objects;

@JsonInclude(Include.NON_NULL)
public class IndexVolumeGroup implements HasAuditInfo, HasIntegerId, HasNameMutable {
public class IndexVolumeGroup implements HasAuditInfo, HasIntegerId, HasNameMutable, HasDocRef {

public static final String DOCUMENT_TYPE = "IndexVolumeGroup";

// This uuid will be used for the auto created volume group.
// It is hard coded so that every stroom env that sets up a default volume
// will have the same uuid for it, which makes imp/exp between instances easier,
// similar to how context pack entities have fixed UUIDs.
public static final String DEFAULT_VOLUME_UUID = "5de2d603-cfc7-45cf-a8b4-e06bdf454f5e";

@JsonProperty
private Integer id;
Expand All @@ -28,6 +37,10 @@ public class IndexVolumeGroup implements HasAuditInfo, HasIntegerId, HasNameMuta
private String updateUser;
@JsonProperty
private String name;
@JsonProperty
private String uuid;
@JsonProperty
private boolean defaultVolume;

public IndexVolumeGroup() {
}
Expand All @@ -39,14 +52,18 @@ public IndexVolumeGroup(@JsonProperty("id") final Integer id,
@JsonProperty("createUser") final String createUser,
@JsonProperty("updateTimeMs") final Long updateTimeMs,
@JsonProperty("updateUser") final String updateUser,
@JsonProperty("name") final String name) {
@JsonProperty("name") final String name,
@JsonProperty("uuid") final String uuid,
@JsonProperty("defaultVolume") final boolean defaultVolume) {
this.id = id;
this.version = version;
this.createTimeMs = createTimeMs;
this.createUser = createUser;
this.updateTimeMs = updateTimeMs;
this.updateUser = updateUser;
this.name = name;
this.uuid = uuid;
this.defaultVolume = defaultVolume;
}

@Override
Expand Down Expand Up @@ -111,6 +128,28 @@ public void setName(String name) {
this.name = name;
}

@Override
public String getType() {
return null;
}

@Override
public String getUuid() {
return uuid;
}

public void setUuid(final String uuid) {
this.uuid = uuid;
}

public boolean isDefaultVolume() {
return defaultVolume;
}

public void setDefaultVolume(final boolean defaultVolume) {
this.defaultVolume = defaultVolume;
}

@Override
public String toString() {
return "IndexVolumeGroup{" +
Expand All @@ -121,6 +160,8 @@ public String toString() {
", updateTimeMs=" + updateTimeMs +
", updateUser='" + updateUser + '\'' +
", name='" + name + '\'' +
", uuid='" + uuid + '\'' +
", defaultVolume='" + defaultVolume + '\'' +
'}';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package stroom.processor.shared;

import stroom.docref.DocRef;
import stroom.docref.HasDocRef;
import stroom.docref.HasUuid;
import stroom.pipeline.shared.PipelineDoc;
import stroom.util.shared.HasAuditInfo;
Expand All @@ -32,7 +33,7 @@
import java.util.Objects;

@JsonInclude(Include.NON_NULL)
public class ProcessorFilter implements HasAuditInfo, HasUuid, HasIntegerId {
public class ProcessorFilter implements HasAuditInfo, HasUuid, HasIntegerId, HasDocRef {

public static final String ENTITY_TYPE = "ProcessorFilter";

Expand Down Expand Up @@ -376,6 +377,17 @@ public void setMaxMetaCreateTimeMs(final Long maxMetaCreateTimeMs) {
this.maxMetaCreateTimeMs = maxMetaCreateTimeMs;
}

@Override
public String getName() {
// Doesn't have a name
return null;
}

@Override
public String getType() {
return ENTITY_TYPE;
}

@Override
public boolean equals(final Object o) {
if (this == o) {
Expand Down Expand Up @@ -454,6 +466,10 @@ public static Builder builder() {
return new Builder();
}


// --------------------------------------------------------------------------------


public static class Builder {

private Integer id;
Expand Down
17 changes: 9 additions & 8 deletions stroom-data/stroom-data-store-impl-fs-db-jooq/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,15 @@ jooq {
// fs_volume.status is non-boolean tinyint

// Treat some tinyint columns as booleans
//forcedTypes {
//forcedType {
//name = 'BOOLEAN'
//includeExpression = ''
//// see https://github.com/jOOQ/jOOQ/issues/9405
//includeTypes = '(?i:tinyint)(\\(1\\))?'
//}
//}
forcedTypes {
forcedType {
name = 'BOOLEAN'
includeExpression = '' +
'.*\\.fs_volume_group\\.is_default'
// see https://github.com/jOOQ/jOOQ/issues/9405
includeTypes = '(?i:tinyint)(\\(1\\))?'
}
}
}
target {
packageName = 'stroom.data.store.impl.fs.db.jooq'
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 52408b0

Please sign in to comment.