Skip to content

Commit

Permalink
TEIIDDES-2122 added shouldValidate() method to QueryValidator
Browse files Browse the repository at this point in the history
 * now checks for view procedure object and isFunction() == TRUE and prevents validation
  • Loading branch information
blafond committed Jun 11, 2014
1 parent f98b538 commit 274a184
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,13 @@ public enum ElementSymbolOptimization {
EObject getTransformationRoot();

void setElementSymbolOptimization(ElementSymbolOptimization status);

/**
* Returns whether or not a transformation target should be validated
*
* - User Defined Functions (virtual procedures where procedure.isFunction() == TRUE
*
* @return
*/
boolean shouldValidate();
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
Expand Down Expand Up @@ -217,6 +215,10 @@ private void validateSql(String inputSqlString, boolean doResolveAndValidate, Qu
sqlDisplayNode = DisplayNodeFactory.createUnknownQueryDisplayNode(null,BLANK);
return;
}

if( !this.queryValidator.shouldValidate() ) {
return;
}

monitor.subTask(MONITOR_CHECKING_DISPLAY_NODES);
monitor.worked(5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,14 @@ public EObject getTransformationRoot() {
public void setElementSymbolOptimization( ElementSymbolOptimization status ) {
}

@Override
public boolean shouldValidate() {
// TODO Auto-generated method stub
return true;
}



}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,10 @@ private void validateSqlTransformation( final SqlTransformationMappingRoot trans
}

EObject target = transRoot.getTarget();

// User defined functions do not need SQL and shouldn't be validated
if( !validator.shouldValidate()) return;

String targetName = ModelerCore.getModelEditor().getName(target);

// Check if sql is empty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ public TransformationValidationResult validateTransformation() {
return new TransformationValidationResult();
}
}

// User defined functions do not need SQL and shouldn't be validated
if( !shouldValidate() ) return new TransformationValidationResult();

// validate the SQLTransformation on the mapping root
// get the UUID form of the SqlTransformation
Expand Down Expand Up @@ -297,6 +300,10 @@ public QueryValidationResult validateSql( final String sql,
if (!isValidRoot()) {
return null;
}

// User defined functions do not need SQL and shouldn't be validated
if( !shouldValidate()) return null;

SqlTransformationResult commandValidationResult = null;

switch( transformType ) {
Expand Down Expand Up @@ -919,5 +926,16 @@ public EObject getTransformationRoot() {
public void setElementSymbolOptimization( ElementSymbolOptimization status ) {
this.elementSymbolOptimization = status;
}

@Override
public boolean shouldValidate() {
// User defined functions do not need SQL and shouldn't be validated
if( this.targetGroup instanceof Procedure ) {
if( ((Procedure)this.targetGroup).isFunction()) return false;
}

return true;
}


}

0 comments on commit 274a184

Please sign in to comment.