diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..4214a97 --- /dev/null +++ b/.classpath @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..936dba4 --- /dev/null +++ b/.project @@ -0,0 +1,23 @@ + + + grsf-publisher-ws + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..f9fe345 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..ec4300d --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..e2e7e0e --- /dev/null +++ b/pom.xml @@ -0,0 +1,193 @@ + + 4.0.0 + + + maven-parent + org.gcube.tools + 1.0.0 + + + + org.gcube.data-catalogue + grsf-publisher-ws + 1.0.0-SNAPSHOT + jar + grsf-publisher-ws + + + Utility library to publish GRSF products on data catalogue. + + + + scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/${serviceClass}/${project.artifactId} + scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/${serviceClass}/${project.artifactId} + https://svn.d4science.research-infrastructures.eu/gcube/trunk/${serviceClass}/${project.artifactId} + + + + + + org.gcube.distribution + maven-portal-bom + LATEST + pom + import + + + org.gcube.distribution + maven-smartgears-bom + LATEST + pom + import + + + + + + UTF-8 + 2.22.1 + ${project.basedir}/distro + ${project.build.directory}/${project.build.finalName} + distro + UTF-8 + + + + + org.slf4j + slf4j-log4j12 + provided + + + org.slf4j + slf4j-api + provided + + + org.gcube.data-catalogue + ckan-util-library + [2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT) + compile + + + org.gcube.common + authorization-client + provided + + + org.gcube.common + common-authorization + provided + + + org.glassfish.jersey.containers + + jersey-container-servlet-core + ${version.jersey} + + + org.glassfish.jersey.media + jersey-media-json-jackson + ${version.jersey} + + + org.glassfish.jersey.media + jersey-media-json-processing + ${version.jersey} + + + org.glassfish.jersey.media + jersey-media-multipart + ${version.jersey} + + + org.glassfish.jersey.media + jersey-media-sse + ${version.jersey} + + + + org.gcube.core + common-smartgears + provided + + + + + ${name} + + + org.apache.maven.plugins + maven-war-plugin + 2.1.1 + + + compile + + + + + + + ${webappDirectory} + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + 1.7 + 1.7 + + + + + org.apache.maven.plugins + maven-assembly-plugin + 2.2 + + + ${distroDirectory}/descriptor.xml + + + + + servicearchive + install + + single + + + + + + org.apache.maven.plugins + maven-resources-plugin + 2.5 + + + copy-profile + install + + copy-resources + + + target + + + ${distroDirectory} + true + + profile.xml + + + + + + + + + + diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/json/Common.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/json/Common.java new file mode 100644 index 0000000..adb83ab --- /dev/null +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/json/Common.java @@ -0,0 +1,210 @@ +package org.gcube.data_catalogue.grsf_publish_ws.json; + +import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Source; +import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Status; +import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Type; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information that both Stock and Fishery must contain + * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) + */ +public class Common { + + @JsonProperty("description") + private String description; + + @JsonProperty("license") + private String license; + + @JsonProperty("author") + private String author; // this will be filled with the username of the token's owner + + @JsonProperty("version") + private long version; + + @JsonProperty("author_contact") + private String authorContact; + + @JsonProperty("maintainer") + private String maintainer; + + @JsonProperty("maintainer_contact") + private String maintainerContact; + + @JsonProperty("catches_or_landings") + private String catchesOrLandings; + + @JsonProperty("database_sources") + private Source databaseSources; + + @JsonProperty("source_of_information") + private String sourceOfInformation; + + @JsonProperty("data_owner") + private String dataOwner; + + @JsonProperty("type") + private Type type; + + @JsonProperty("status") + private Status status; + + public Common() { + super(); + } + + /** + * @param description + * @param license + * @param author + * @param version + * @param authorContact + * @param maintainer + * @param maintainerContact + * @param catchesOrLandings + * @param databaseSources + * @param sourceOfInformation + * @param dataOwner + * @param type + * @param status + */ + public Common(String description, String license, String author, + long version, String authorContact, String maintainer, + String maintainerContact, String catchesOrLandings, + Source databaseSources, String sourceOfInformation, + String dataOwner, Type type, Status status) { + super(); + this.description = description; + this.license = license; + this.author = author; + this.version = version; + this.authorContact = authorContact; + this.maintainer = maintainer; + this.maintainerContact = maintainerContact; + this.catchesOrLandings = catchesOrLandings; + this.databaseSources = databaseSources; + this.sourceOfInformation = sourceOfInformation; + this.dataOwner = dataOwner; + this.type = type; + this.status = status; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getLicense() { + return license; + } + + public void setLicense(String license) { + this.license = license; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } + + public long getVersion() { + return version; + } + + public void setVersion(long version) { + this.version = version; + } + + public String getAuthorContact() { + return authorContact; + } + + public void setAuthorContact(String authorContact) { + this.authorContact = authorContact; + } + + public String getMaintainer() { + return maintainer; + } + + public void setMaintainer(String maintainer) { + this.maintainer = maintainer; + } + + public String getMaintainerContact() { + return maintainerContact; + } + + public void setMaintainerContact(String maintainerContact) { + this.maintainerContact = maintainerContact; + } + + public String getCatchesOrLandings() { + return catchesOrLandings; + } + + public void setCatchesOrLandings(String catchesOrLandings) { + this.catchesOrLandings = catchesOrLandings; + } + + public Source getDatabaseSources() { + return databaseSources; + } + + public void setDatabaseSources(Source databaseSources) { + this.databaseSources = databaseSources; + } + + public String getSourceOfInformation() { + return sourceOfInformation; + } + + public void setSourceOfInformation(String sourceOfInformation) { + this.sourceOfInformation = sourceOfInformation; + } + + public String getDataOwner() { + return dataOwner; + } + + public void setDataOwner(String dataOwner) { + this.dataOwner = dataOwner; + } + + public Type getType() { + return type; + } + + public void setType(Type type) { + this.type = type; + } + + public Status getStatus() { + return status; + } + + public void setStatus(Status status) { + this.status = status; + } + + @Override + public String toString() { + return "Common [description=" + description + ", license=" + license + + ", author=" + author + ", version=" + version + + ", authorContact=" + authorContact + ", maintainer=" + + maintainer + ", maintainerContact=" + maintainerContact + + ", catchesOrLandings=" + catchesOrLandings + + ", databaseSources=" + databaseSources + + ", sourceOfInformation=" + sourceOfInformation + + ", dataOwner=" + dataOwner + ", type=" + type + ", status=" + + status + "]"; + } +} diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/json/FisheryRecord.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/json/FisheryRecord.java new file mode 100644 index 0000000..6746784 --- /dev/null +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/json/FisheryRecord.java @@ -0,0 +1,169 @@ +package org.gcube.data_catalogue.grsf_publish_ws.json; + +import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Production_System_Type; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A fishery record bean + * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) + */ +public class FisheryRecord extends Common{ + + @JsonProperty("fishery_name") + private String fisheryName; + + @JsonProperty("fishery_id") + private String fisheryId; + + @JsonProperty("scientific_name") + private String scientificName; + + @JsonProperty("fishing_area") + private String fishingArea; + + @JsonProperty("exploiting_stocks") + private String exploitingStocks; + + @JsonProperty("management_entity") + private String managementEntity; + + @JsonProperty("jurisdiction_area") + private String jurisdictionArea; + + @JsonProperty("production_system_type") + private Production_System_Type productionSystemType; + + @JsonProperty("flag_state") + private String flagState; + + @JsonProperty("fishing_gear") + private String fishingGear; + + public FisheryRecord() { + super(); + } + + /** + * @param fisheryName + * @param fisheryId + * @param scientificName + * @param fishingArea + * @param exploitingStocks + * @param managementEntity + * @param jurisdictionArea + * @param productionSystemType + * @param flagState + * @param fishingGear + */ + public FisheryRecord(String fisheryName, String fisheryId, + String scientificName, String fishingArea, String exploitingStocks, + String managementEntity, String jurisdictionArea, + Production_System_Type productionSystemType, String flagState, + String fishingGear) { + super(); + this.fisheryName = fisheryName; + this.fisheryId = fisheryId; + this.scientificName = scientificName; + this.fishingArea = fishingArea; + this.exploitingStocks = exploitingStocks; + this.managementEntity = managementEntity; + this.jurisdictionArea = jurisdictionArea; + this.productionSystemType = productionSystemType; + this.flagState = flagState; + this.fishingGear = fishingGear; + } + + public String getFisheryName() { + return fisheryName; + } + + public void setFisheryName(String fisheryName) { + this.fisheryName = fisheryName; + } + + public String getFisheryId() { + return fisheryId; + } + + public void setFisheryId(String fisheryId) { + this.fisheryId = fisheryId; + } + + public String getScientificName() { + return scientificName; + } + + public void setScientificName(String scientificName) { + this.scientificName = scientificName; + } + + public String getFishingArea() { + return fishingArea; + } + + public void setFishingArea(String fishingArea) { + this.fishingArea = fishingArea; + } + + public String getExploitingStocks() { + return exploitingStocks; + } + + public void setExploitingStocks(String exploitingStocks) { + this.exploitingStocks = exploitingStocks; + } + + public String getManagementEntity() { + return managementEntity; + } + + public void setManagementEntity(String managementEntity) { + this.managementEntity = managementEntity; + } + + public String getJurisdictionArea() { + return jurisdictionArea; + } + + public void setJurisdictionArea(String jurisdictionArea) { + this.jurisdictionArea = jurisdictionArea; + } + + public Production_System_Type getProductionSystemType() { + return productionSystemType; + } + + public void setProductionSystemType(Production_System_Type productionSystemType) { + this.productionSystemType = productionSystemType; + } + + public String getFlagState() { + return flagState; + } + + public void setFlagState(String flagState) { + this.flagState = flagState; + } + + public String getFishingGear() { + return fishingGear; + } + + public void setFishingGear(String fishingGear) { + this.fishingGear = fishingGear; + } + + @Override + public String toString() { + return "FisheryRecord [fisheryName=" + fisheryName + ", fisheryId=" + + fisheryId + ", scientificName=" + scientificName + + ", fishingArea=" + fishingArea + ", exploitingStocks=" + + exploitingStocks + ", managementEntity=" + managementEntity + + ", jurisdictionArea=" + jurisdictionArea + + ", productionSystemType=" + productionSystemType + + ", flagState=" + flagState + ", fishingGear=" + fishingGear + + "]"; + } + +} diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/json/StockRecord.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/json/StockRecord.java new file mode 100644 index 0000000..2c1640b --- /dev/null +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/json/StockRecord.java @@ -0,0 +1,230 @@ +package org.gcube.data_catalogue.grsf_publish_ws.json; + +import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Abundance_Level; +import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Exploitation_Rate; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A stock record bean + * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) + */ +public class StockRecord extends Common{ + + @JsonProperty("stock_name") + private String stockName; + + @JsonProperty("stock_id") + private String stockID; + + @JsonProperty("species_scientific_name") + private String speciesScientificName; + + @JsonProperty("area") + private String area; + + @JsonProperty("exploiting_fishery") + private String exploitingFishery; + + @JsonProperty("management_entity") + private String managementEntity; + + @JsonProperty("assessment_methods") + private String assessmentMethods; + + @JsonProperty("state_of_marine_resource") + private String stateOfMarineResource; + + @JsonProperty("exploitation_rate") + private Exploitation_Rate exploitationRate; + + @JsonProperty("abundance_level") + private Abundance_Level abundanceLevel; + + @JsonProperty("narrative_state_and_trend") + private String narrativeStateAndTrend; + + @JsonProperty("scientific_advice") + private String scientificAdvice; + + @JsonProperty("reporting_entity") + private String reportingEntity; + + @JsonProperty("reporting_year") + private long reportingYear; + + /** + * + */ + public StockRecord() { + super(); + } + + /** + * @param stockName + * @param stockID + * @param speciesScientificName + * @param area + * @param exploitingFishery + * @param managementEntity + * @param assessmentMethods + * @param stateOfMarineResource + * @param exploitationRate + * @param abundanceLevel + * @param narrativeStateAndTrend + * @param scientificAdvice + * @param reportingEntity + * @param reportingYear + */ + public StockRecord(String stockName, String stockID, + String speciesScientificName, String area, + String exploitingFishery, String managementEntity, + String assessmentMethods, String stateOfMarineResource, + Exploitation_Rate exploitationRate, Abundance_Level abundanceLevel, + String narrativeStateAndTrend, String scientificAdvice, + String reportingEntity, long reportingYear) { + super(); + this.stockName = stockName; + this.stockID = stockID; + this.speciesScientificName = speciesScientificName; + this.area = area; + this.exploitingFishery = exploitingFishery; + this.managementEntity = managementEntity; + this.assessmentMethods = assessmentMethods; + this.stateOfMarineResource = stateOfMarineResource; + this.exploitationRate = exploitationRate; + this.abundanceLevel = abundanceLevel; + this.narrativeStateAndTrend = narrativeStateAndTrend; + this.scientificAdvice = scientificAdvice; + this.reportingEntity = reportingEntity; + this.reportingYear = reportingYear; + } + + public String getStockName() { + return stockName; + } + + public void setStockName(String stockName) { + this.stockName = stockName; + } + + public String getStockID() { + return stockID; + } + + public void setStockID(String stockID) { + this.stockID = stockID; + } + + public String getSpeciesScientificName() { + return speciesScientificName; + } + + public void setSpeciesScientificName(String speciesScientificName) { + this.speciesScientificName = speciesScientificName; + } + + public String getArea() { + return area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getExploitingFishery() { + return exploitingFishery; + } + + public void setExploitingFishery(String exploitingFishery) { + this.exploitingFishery = exploitingFishery; + } + + public String getManagementEntity() { + return managementEntity; + } + + public void setManagementEntity(String managementEntity) { + this.managementEntity = managementEntity; + } + + public String getAssessmentMethods() { + return assessmentMethods; + } + + public void setAssessmentMethods(String assessmentMethods) { + this.assessmentMethods = assessmentMethods; + } + + public String getStateOfMarineResource() { + return stateOfMarineResource; + } + + public void setStateOfMarineResource(String stateOfMarineResource) { + this.stateOfMarineResource = stateOfMarineResource; + } + + public Exploitation_Rate getExploitationRate() { + return exploitationRate; + } + + public void setExploitationRate(Exploitation_Rate exploitationRate) { + this.exploitationRate = exploitationRate; + } + + public Abundance_Level getAbundanceLevel() { + return abundanceLevel; + } + + public void setAbundanceLevel(Abundance_Level abundanceLevel) { + this.abundanceLevel = abundanceLevel; + } + + public String getNarrativeStateAndTrend() { + return narrativeStateAndTrend; + } + + public void setNarrativeStateAndTrend(String narrativeStateAndTrend) { + this.narrativeStateAndTrend = narrativeStateAndTrend; + } + + public String getScientificAdvice() { + return scientificAdvice; + } + + public void setScientificAdvice(String scientificAdvice) { + this.scientificAdvice = scientificAdvice; + } + + public String getReportingEntity() { + return reportingEntity; + } + + public void setReportingEntity(String reportingEntity) { + this.reportingEntity = reportingEntity; + } + + public long getReportingYear() { + return reportingYear; + } + + public void setReportingYear(long reportingYear) { + this.reportingYear = reportingYear; + } + + @Override + public String toString() { + return "StockRecord [stockName=" + stockName + ", stockID=" + stockID + + ", speciesScientificName=" + speciesScientificName + + ", area=" + area + ", exploitingFishery=" + exploitingFishery + + ", managementEntity=" + managementEntity + + ", assessmentMethods=" + assessmentMethods + + ", stateOfMarineResource=" + stateOfMarineResource + + ", exploitationRate=" + exploitationRate + + ", abundanceLevel=" + abundanceLevel + + ", narrativeStateAndTrend=" + narrativeStateAndTrend + + ", scientificAdvice=" + scientificAdvice + + ", reportingEntity=" + reportingEntity + ", reportingYear=" + + reportingYear + "]"; + } +} diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/HelperMethods.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/HelperMethods.java new file mode 100644 index 0000000..12a39ff --- /dev/null +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/HelperMethods.java @@ -0,0 +1,19 @@ +package org.gcube.data_catalogue.grsf_publish_ws.utils; + + +/** + * Helper methods + * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) + */ +public abstract class HelperMethods { + + public static String getGroupNameOnCkan(String origName){ + + if(origName == null) + throw new IllegalArgumentException("origName cannot be null"); + + return origName.trim().toLowerCase().replaceAll("[^A-Za-z0-9_.]", "_"); + + } + +} diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/groups/Abundance_Level.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/groups/Abundance_Level.java new file mode 100644 index 0000000..586c13e --- /dev/null +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/groups/Abundance_Level.java @@ -0,0 +1,38 @@ +package org.gcube.data_catalogue.grsf_publish_ws.utils.groups; + +import org.gcube.data_catalogue.grsf_publish_ws.utils.HelperMethods; + +/** + * Abundance_Level for Stock records + * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) + */ +public enum Abundance_Level { + + Intermediate_Abundance("Intermediate abundance"), + Low_Abundance("Low abundance"), + Uncertain_Not_Assesed("Uncertain/Not assesed"); + + private String subGroupNameOrig; + private String subGroupNameOnCkan; + + private Abundance_Level(String origName) { + this.subGroupNameOrig = origName; + this.subGroupNameOnCkan = HelperMethods.getGroupNameOnCkan(origName); + } + + /** + * Return the name the group has on ckan + * @return + */ + public String getNameCkan(){ + return subGroupNameOnCkan; + } + + /** + * Return the original name + * @return + */ + public String getOrigName(){ + return subGroupNameOrig; + } +} diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/groups/Exploitation_Rate.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/groups/Exploitation_Rate.java new file mode 100644 index 0000000..5b528a0 --- /dev/null +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/groups/Exploitation_Rate.java @@ -0,0 +1,38 @@ +package org.gcube.data_catalogue.grsf_publish_ws.utils.groups; + +import org.gcube.data_catalogue.grsf_publish_ws.utils.HelperMethods; + +/** + * Exploitation_Rate for Stock records + * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) + */ +public enum Exploitation_Rate { + + Moderate_Fishing_Mortality("Moderate fishing mortality"), + High_Fishing_Mortality("High fishing mortality"), + No_Or_Low_Fishing_Mortality("No or low fishing mortality"); + + private String subGroupNameOrig; + private String subGroupNameOnCkan; + + private Exploitation_Rate(String origName) { + this.subGroupNameOrig = origName; + this.subGroupNameOnCkan = HelperMethods.getGroupNameOnCkan(origName); + } + + /** + * Return the name the group has on ckan + * @return + */ + public String getNameCkan(){ + return subGroupNameOnCkan; + } + + /** + * Return the original name + * @return + */ + public String getOrigName(){ + return subGroupNameOrig; + } +} diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/groups/Production_System_Type.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/groups/Production_System_Type.java new file mode 100644 index 0000000..bd2ae7c --- /dev/null +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/groups/Production_System_Type.java @@ -0,0 +1,44 @@ +package org.gcube.data_catalogue.grsf_publish_ws.utils.groups; + +import org.gcube.data_catalogue.grsf_publish_ws.utils.HelperMethods; + +/** + * Production_System_Type for Fishery records + * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) + */ +public enum Production_System_Type { + + Subsistence("Subsistence"), + Recreational("Recreational"), + Commercial("Commercial"), + Artisanal("Artisanal"), + Semi_Industrial("Semi-industrial"), + Industrial("Industrial"), + Exploratory_fisher("Exploratory_fisher"), + Unspecified("Unspecified"); + + private String subGroupNameOrig; + private String subGroupNameOnCkan; + + private Production_System_Type(String origName) { + this.subGroupNameOrig = origName; + this.subGroupNameOnCkan = HelperMethods.getGroupNameOnCkan(origName); + } + + /** + * Return the name the group has on ckan + * @return + */ + public String getNameCkan(){ + return subGroupNameOnCkan; + } + + /** + * Return the original name + * @return + */ + public String getOrigName(){ + return subGroupNameOrig; + } + +} diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/groups/Source.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/groups/Source.java new file mode 100644 index 0000000..050546d --- /dev/null +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/groups/Source.java @@ -0,0 +1,38 @@ +package org.gcube.data_catalogue.grsf_publish_ws.utils.groups; + +import org.gcube.data_catalogue.grsf_publish_ws.utils.HelperMethods; + +/** + * Source Group and sub groups (for both Stock and Fishery) -> look at "Database Sources" + * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) + */ +public enum Source { + + FIRMS("FIRMS"), + RAM("RAM"), + FishSource("FishSource"); + + private String subGroupNameOrig; + private String subGroupNameOnCkan; + + private Source(String origName) { + this.subGroupNameOrig = origName; + this.subGroupNameOnCkan = HelperMethods.getGroupNameOnCkan(origName); + } + + /** + * Return the name the group has on ckan + * @return + */ + public String getNameCkan(){ + return subGroupNameOnCkan; + } + + /** + * Return the original name + * @return + */ + public String getOrigName(){ + return subGroupNameOrig; + } +} diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/groups/Status.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/groups/Status.java new file mode 100644 index 0000000..cea092c --- /dev/null +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/groups/Status.java @@ -0,0 +1,38 @@ +package org.gcube.data_catalogue.grsf_publish_ws.utils.groups; + +import org.gcube.data_catalogue.grsf_publish_ws.utils.HelperMethods; + +/** + * Status Group and sub groups (for both Stock and Fishery) + * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) + */ +public enum Status { + + Pending("Pending"), + Confirmed("Confirmed"); + + private String subGroupNameOrig; + private String subGroupNameOnCkan; + + private Status(String origName) { + this.subGroupNameOrig = origName; + this.subGroupNameOnCkan = HelperMethods.getGroupNameOnCkan(origName); + } + + /** + * Return the name the group has on ckan + * @return + */ + public String getNameCkan(){ + return subGroupNameOnCkan; + } + + /** + * Return the original name + * @return + */ + public String getOrigName(){ + return subGroupNameOrig; + } + +} diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/groups/Type.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/groups/Type.java new file mode 100644 index 0000000..0097845 --- /dev/null +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/groups/Type.java @@ -0,0 +1,42 @@ +package org.gcube.data_catalogue.grsf_publish_ws.utils.groups; + +import org.gcube.data_catalogue.grsf_publish_ws.utils.HelperMethods; + + +/** + * Type for Stock/Fishery records + * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) + */ +public enum Type { + + Assesment_Unit("Assesment Unit"), + Resource("Resource"), + Fishing_Activity("Fishing Activity"), // for fishery + Fishing_Description("Fishing Description") // for fishery + ; + + private String subGroupNameOrig; + private String subGroupNameOnCkan; + + private Type(String origName) { + this.subGroupNameOrig = origName; + this.subGroupNameOnCkan = HelperMethods.getGroupNameOnCkan(origName); + } + + /** + * Return the name the group has on ckan + * @return + */ + public String getNameCkan(){ + return subGroupNameOnCkan; + } + + /** + * Return the original name + * @return + */ + public String getOrigName(){ + return subGroupNameOrig; + } + +}