Skip to content

Commit

Permalink
change sequence of props in Campaign entity
Browse files Browse the repository at this point in the history
  • Loading branch information
andi-huber committed Jun 13, 2024
1 parent f9a811a commit 7f832bc
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 38 deletions.
16 changes: 8 additions & 8 deletions globodiet/schema/src/main/resources/gd-survey.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ survey.dom.Campaign:
Campaigns can be defined to be the whole study,
a seasonal part of a study, a regional part of a study etc.
fields:
code:
column: CODE
column-type: nvarchar(20)
required: true
unique: false
description: |
Unique (survey scoped) campaign identifier.
surveyCode:
column: SURVEY
column-type: nvarchar(20)
Expand All @@ -45,7 +38,14 @@ survey.dom.Campaign:
foreignKeys: |
SURVEY.CODE
description: |
Survey code
Survey code
code:
column: CODE
column-type: nvarchar(20)
required: true
unique: false
description: |
Unique (survey scoped) campaign identifier.
name:
column: NAME
column-type: nvarchar(120)
Expand Down
17 changes: 9 additions & 8 deletions globodiet/schema/src/main/resources/survey/Campaign.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ Campaign:
Campaigns can be defined to be the whole study,
a seasonal part of a study, a regional part of a study etc.
fields:
code:
column: CODE
column-type: nvarchar(20)
required: true
unique: false
description: |
Unique (survey scoped) campaign identifier.
surveyCode:
column: SURVEY
column-type: nvarchar(20)
Expand All @@ -45,7 +38,14 @@ Campaign:
foreignKeys: |
SURVEY.CODE
description: |
Survey code
Survey code
code:
column: CODE
column-type: nvarchar(20)
required: true
unique: false
description: |
Unique (survey scoped) campaign identifier.
name:
column: NAME
column-type: nvarchar(120)
Expand All @@ -66,6 +66,7 @@ Campaign:
column-type: nvarchar(64000)
required: false
unique: false
hiddenWhere: TABLES
multiLine: 24
description: |
Yaml formatted interview data corrections.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
import java.io.File;
import java.util.Optional;

import io.github.causewaystuff.companion.codegen.domgen.LicenseHeader;
import io.github.causewaystuff.companion.codegen.model.OrmModel;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIfSystemProperty;

Expand All @@ -39,6 +37,8 @@
import dita.commons.types.TabularData;
import dita.globodiet.schema.transform.EntityToTableTransformerFromSchema;
import dita.globodiet.schema.transform.TableToEntityTransformerFromSchema;
import io.github.causewaystuff.companion.codegen.domgen.LicenseHeader;
import io.github.causewaystuff.companion.codegen.model.OrmModel;

class TableDataRoundtripTest {

Expand Down Expand Up @@ -174,7 +174,7 @@ void nullableAutodetect() {
}));
});

schema.splitIntoFiles(new File("d:/tmp/", "gd-schema"), LicenseHeader.ASF_V2);
schema.writeEntitiesToIndividualFiles(new File("d:/tmp/", "gd-schema"), LicenseHeader.ASF_V2);

System.out.println("done.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,46 +92,46 @@ public class Campaign implements Cloneable<Campaign>, HasSecondaryKey<Campaign>
SearchService searchService;

/**
* Unique (survey scoped) campaign identifier.
* Survey code
*/
@Property(
optionality = Optionality.MANDATORY
)
@PropertyLayout(
fieldSetId = "identity",
sequence = "1",
describedAs = "Unique (survey scoped) campaign identifier.",
hidden = Where.NOWHERE
describedAs = "Survey code",
hidden = Where.ALL_TABLES
)
@Column(
name = "CODE",
name = "SURVEY",
allowsNull = "false",
length = 20
)
@Getter
@Setter
private String code;
private String surveyCode;

/**
* Survey code
* Unique (survey scoped) campaign identifier.
*/
@Property(
optionality = Optionality.MANDATORY
)
@PropertyLayout(
fieldSetId = "identity",
sequence = "2",
describedAs = "Survey code",
hidden = Where.ALL_TABLES
describedAs = "Unique (survey scoped) campaign identifier.",
hidden = Where.NOWHERE
)
@Column(
name = "SURVEY",
name = "CODE",
allowsNull = "false",
length = 20
)
@Getter
@Setter
private String surveyCode;
private String code;

/**
* Descriptive campaign name.
Expand Down Expand Up @@ -208,8 +208,8 @@ public String title() {

@Override
public String toString() {
return "Campaign(" + "code=" + getCode() + ","
+"surveyCode=" + getSurveyCode() + ","
return "Campaign(" + "surveyCode=" + getSurveyCode() + ","
+"code=" + getCode() + ","
+"name=" + getName() + ","
+"description=" + getDescription() + ","
+"correction=" + getCorrection() + ")";
Expand All @@ -219,8 +219,8 @@ public String toString() {
@Override
public Campaign copy() {
var copy = repositoryService.detachedEntity(new Campaign());
copy.setCode(getCode());
copy.setSurveyCode(getSurveyCode());
copy.setCode(getCode());
copy.setName(getName());
copy.setDescription(getDescription());
copy.setCorrection(getCorrection());
Expand Down Expand Up @@ -292,8 +292,8 @@ public final String viewModelMemento() {

/**
* Parameter model for @{link Campaign}
* @param code Unique (survey scoped) campaign identifier.
* @param survey Survey code
* @param code Unique (survey scoped) campaign identifier.
* @param name Descriptive campaign name.
* @param description Detailed information for this campaign.
* @param correction Yaml formatted interview data corrections.
Expand All @@ -305,17 +305,17 @@ public final record Params(
optionality = Optionality.MANDATORY
)
@ParameterLayout(
describedAs = "Unique (survey scoped) campaign identifier."
describedAs = "Survey code"
)
String code,
Survey survey,
@Parameter(
precedingParamsPolicy = PrecedingParamsPolicy.PRESERVE_CHANGES,
optionality = Optionality.MANDATORY
)
@ParameterLayout(
describedAs = "Survey code"
describedAs = "Unique (survey scoped) campaign identifier."
)
Survey survey,
String code,
@Parameter(
precedingParamsPolicy = PrecedingParamsPolicy.PRESERVE_CHANGES,
optionality = Optionality.MANDATORY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
)
@PropertyLayout(
fieldSetId = "details",
sequence = "2.1",
sequence = "1.1",
describedAs = "Survey code",
hidden = Where.REFERENCES_PARENT
)
Expand Down

0 comments on commit 7f832bc

Please sign in to comment.