@ -587,8 +587,12 @@ public class DatasetManager {
if ( this . apiContext . getOperationsContext ( ) . getElasticRepository ( ) . getDatasetRepository ( ) . getClient ( ) ! = null ) {
this . getTagsFromProfile ( datasetWizardModel , dataset ) ;
}
if ( datasetWizardModel . getStatus ( ) = = ( int ) Dataset . Status . FINALISED . getValue ( ) )
checkDatasetValidation ( dataset ) ;
if ( datasetWizardModel . getStatus ( ) = = ( int ) Dataset . Status . FINALISED . getValue ( ) ) {
String failedField = checkDatasetValidation ( dataset ) ;
if ( failedField ! = null ) {
throw new Exception ( "Field value of " + failedField + " must be filled." ) ;
}
}
UserInfo userInfo = apiContext . getOperationsContext ( ) . getBuilderFactory ( ) . getBuilder ( UserInfoBuilder . class ) . id ( principal . getId ( ) ) . build ( ) ;
dataset . setCreator ( userInfo ) ;
@ -683,7 +687,7 @@ public class DatasetManager {
}
public void checkDatasetValidation ( Dataset dataset ) throws Exception {
public String checkDatasetValidation ( Dataset dataset ) throws Exception {
List < String > datasetProfileValidators = new LinkedList < > ( ) ;
DatasetProfile profile = apiContext . getOperationsContext ( ) . getDatabaseRepository ( ) . getDatasetProfileDao ( ) . find ( dataset . getProfile ( ) . getId ( ) ) ;
DocumentBuilderFactory builderFactory = DocumentBuilderFactory . newInstance ( ) ;
@ -712,11 +716,17 @@ public class DatasetManager {
visibilityRuleService . buildVisibilityContext ( pagedDatasetProfile . getRules ( ) ) ;
String failedField = null ;
for ( String validator : datasetProfileValidators ) {
if ( obj . has ( validator ) & & isNullOrEmpty ( obj . getString ( validator ) ) & & isElementVisible ( nodeList , validator , visibilityRuleService ) ) {
throw new Exception ( "Field value of " + validator + " must be filled." ) ;
//throw new Exception("Field value of " + validator + " must be filled.");
failedField = validator ;
break ;
}
}
return failedField ;
}
private boolean isNullOrEmpty ( String value ) {