minor fixes

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@158889 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2017-11-29 11:08:57 +00:00
parent 2b0ac8c0a0
commit 10bd220c53
3 changed files with 22 additions and 13 deletions

View File

@ -3,6 +3,9 @@
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<dependent-module archiveName="grsf-common-library-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/grsf-common-library/grsf-common-library">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="context-root" value="grsf-publisher-ws"/>
<property name="java-output-path" value="/grsf-publisher-ws/target/classes"/>
</wb-module>

View File

@ -433,20 +433,22 @@ public class CommonServiceUtils {
CommonServiceUtils.validateAggregatedRecord(record);
}
}
// set the domain
record.setDomain(productType.getOrigName());
// set system type (it is equal to the GRSF Type for GRSF records, "Legacy" for source records)
record.setSystemType(sourceInPath.equals(Sources.GRSF) ?
productType.equals(Product_Type.FISHERY) ? ((FisheryRecord)record).getType().getOrigName() : ((StockRecord)record).getType().getOrigName()
: Constants.SYSTEM_TYPE_FOR_SOURCES_VALUE);
logger.debug("Domain is " + productType.getOrigName() + " and system type " + record.getSystemType());
// evaluate the custom fields/tags, resources and groups
groups.add(sourceInPath.getOrigName().toLowerCase() + "-" + productType.getOrigName().toLowerCase()); //e.g. grsf-fishery
boolean skipTags = !sourceInPath.equals(Sources.GRSF); // no tags for the Original records
CommonServiceUtils.getTagsGroupsResourcesExtrasByRecord(tags, skipTags, groups, false, resources, false, customFields, record, username, sourceInPath);
// set the domain
record.setDomain(productType.getOrigName());
// set system type (it is equal to the GRSF Type for GRSF records, "Source" for source records)
record.setSystemType(sourceInPath.equals(Sources.GRSF) ?
productType.equals(Product_Type.FISHERY) ? ((FisheryRecord)record).getType().getOrigName() : ((StockRecord)record).getType().getOrigName()
: Constants.SYSTEM_TYPE_FOR_SOURCES_VALUE);
}
/**

View File

@ -145,17 +145,21 @@ public class CSVUtils {
bw.close();
// Add names of the sources to the file's name
for (String source : sources) {
relevantSources[0] += source + "_";
if(sources.isEmpty()){
relevantSources[0] = "";
}else{
for (String source : sources) {
relevantSources[0] += source + "_";
}
relevantSources[0] = relevantSources[0].substring(0, relevantSources[0].length() - 1);
}
relevantSources[0] = relevantSources[0].substring(0, relevantSources[0].length() - 1);
// on exit delete it...
file.deleteOnExit();
// file created
logger.debug("CSV file created correctly on this machine!");
return file;
}
catch(Exception e){