This commit is contained in:
Fabio Sinibaldi 2017-05-30 16:13:59 +00:00
parent f0b1c6b005
commit 3c6c52240f
8 changed files with 37 additions and 8 deletions

View File

@ -20,4 +20,7 @@
<Changeset component="geonetwork.3-2-0" date="2016-11-01">
<Change>GeoNetwork 3.x compatibility</Change>
</Changeset>
<Changeset component="geonetwork.3-2-2" date="2017-04-21">
<Change>Configurable validation check</Change>
</Changeset>
</ReleaseNotes>

View File

@ -8,7 +8,7 @@
</parent>
<groupId>org.gcube.spatial.data</groupId>
<artifactId>geonetwork</artifactId>
<version>3.2.1-SNAPSHOT</version>
<version>3.2.2-SNAPSHOT</version>
<name>geonetwork</name>
<properties>

View File

@ -42,6 +42,7 @@ import org.opengis.metadata.Metadata;
import it.geosolutions.geonetwork.GNClient;
import it.geosolutions.geonetwork.exception.GNLibException;
import it.geosolutions.geonetwork.exception.GNServerException;
import it.geosolutions.geonetwork.op.gn3.GN3MetadataGetInfo.MetadataInfo;
import it.geosolutions.geonetwork.util.GNInsertConfiguration;
import it.geosolutions.geonetwork.util.GNPriv;
import it.geosolutions.geonetwork.util.GNPrivConfiguration;
@ -349,8 +350,17 @@ public class GeoNetwork implements GeoNetworkAdministration {
}
@Override
public MetadataInfo getInfo(Long id) throws GNLibException, GNServerException, MissingServiceEndpointException {
GNClient client=getClient();
return client.getInfo(id);
}
@Override
public MetadataInfo getInfo(String uuid) throws GNLibException, GNServerException, MissingServiceEndpointException {
GNClient client=getClient();
return client.getInfo(uuid);
}
/* (non-Javadoc)
@ -655,7 +665,15 @@ public class GeoNetwork implements GeoNetworkAdministration {
private void checkPublishingConfiguration(GNInsertConfiguration configuration,ScopeConfiguration toUseConfig) throws AuthorizationException, InvalidInsertConfigurationException, MissingConfigurationException, MissingServiceEndpointException{
if(getCurrentLoginLevel()==null) throw new AuthorizationException("Client is not authenticated, please use Login before publishing");
if(!configuration.getValidate()) throw new InvalidInsertConfigurationException("Validate option is mandatory");
boolean mandatoryValidation=true;
try{
mandatoryValidation=Boolean.parseBoolean(new RuntimeParameters().getProps().getProperty(RuntimeParameters.mandatoryValidation, "true"));
}catch(Exception e){
log.warn("Invalid local configuration, unable to parse mandatory validation option.",e);
}
log.debug("Mandatory validation : {} ",mandatoryValidation);
if(!configuration.getValidate()&&mandatoryValidation) throw new InvalidInsertConfigurationException("Validate option is mandatory");
// CHECK GROUP
Integer targetGroup=Integer.parseInt(configuration.getGroup());

View File

@ -14,7 +14,7 @@ import org.gcube.spatial.data.geonetwork.model.faults.AuthorizationException;
import org.gcube.spatial.data.geonetwork.model.faults.MissingConfigurationException;
import org.gcube.spatial.data.geonetwork.model.faults.MissingServiceEndpointException;
import org.opengis.metadata.Metadata;
import it.geosolutions.geonetwork.op.gn3.GN3MetadataGetInfo.MetadataInfo;
public interface GeoNetworkReader {
public GNSearchResponse query(GNSearchRequest request)
@ -37,4 +37,9 @@ public interface GeoNetworkReader {
public void login(LoginLevel level)throws AuthorizationException,MissingServiceEndpointException, MissingConfigurationException;
public void logout() throws MissingServiceEndpointException;
public MetadataInfo getInfo(Long id) throws GNLibException, GNServerException, MissingServiceEndpointException;
public MetadataInfo getInfo(String uuid) throws GNLibException, GNServerException, MissingServiceEndpointException;
}

View File

@ -37,6 +37,7 @@ public class RuntimeParameters {
public static final String geonetworkUpdateTimeout="geonetworkUpdateTimeout";
public static final String geonetworkUpdateWait="geonetworkUpdateWait";
public static final String mandatoryValidation="mandatoryValidation";
private Properties props=new Properties();

View File

@ -36,3 +36,5 @@ isMaxWaitTimeMillis=600000
geonetworkUpdateTimeout=50000
geonetworkUpdateWait=500
#Publishing
mandatoryValidation=false

View File

@ -33,8 +33,8 @@ public class ScopeTests {
// DEV
// scopes.add("/gcube");
// scopes.add("/gcube/devNext");
scopes.add("/gcube/devsec");
scopes.add("/gcube/devNext");
// scopes.add("/gcube/devsec");
//
// scopes.add("/gcube/devNext/NextNext");
//
@ -53,7 +53,7 @@ public class ScopeTests {
// scopes.add("/gcube/preprod/preVRE");
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/EGIP");
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/SIASPA");
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/InfraScience");
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/ICES_TCRE");

View File

@ -1,4 +1,4 @@
#log4j.rootLogger=DEBUG, A1,stdout
log4j.rootLogger=DEBUG, A1,stdout
log4j.appender.A1=org.apache.log4j.RollingFileAppender
log4j.appender.A1.File=log.txt
log4j.appender.A1.layout=org.apache.log4j.PatternLayout