test_class.file: dal-jdbc/src/test/java/org/unidal/dal/jdbc/query/token/resolver/IfTokenResolverTest.java
test_class.identifier: IfTokenResolverTest
test_class.superclass: extends AbstractTokenResolverTest
test_case.body: @Test
     public void testNotNullTrue() throws Exception {
        QueryDef query = new QueryDef("test", UserEntity.class, QueryType.SELECT,
              "<IF type='NOT_NULL' field='key-user-id'>...</IF>");
        User user = new User();
        QueryContext ctx = getSelectContext(query, user, null);
  
        user.setKeyUserId(1234);
        Assert.assertEquals(false, ctx.isWithinIfToken());
        m_queryResolver.resolve(ctx);
        Assert.assertEquals("...", ctx.getSqlStatement());
        Assert.assertEquals(false, ctx.isWithinIfToken());
     }
test_case.class_method_signature: IfTokenResolverTest.testNotNullTrue()
test_case.full_signature: @Test public void testNotNullTrue()
test_case.identifier: testNotNullTrue
test_case.invocations: getSelectContext setKeyUserId assertEquals isWithinIfToken resolve assertEquals getSqlStatement assertEquals isWithinIfToken
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testNotNullTrue()
focal_class.declarator: m_accessor
focal_class.modifier: @Inject
     private
focal_class.original_string: @Inject
     private DataObjectAccessor m_accessor;
focal_class.type: DataObjectAccessor
focal_class.var_name: m_accessor
focal_class.declarator: m_expressions = new HashMap<String, Expression>()
focal_class.modifier: private
focal_class.original_string: private Map<String, Expression> m_expressions = new HashMap<String, Expression>();
focal_class.type: Map<String, Expression>
focal_class.var_name: m_expressions
focal_class.file: dal-jdbc/src/main/java/org/unidal/dal/jdbc/query/token/resolver/IfTokenResolver.java
focal_class.identifier: IfTokenResolver
focal_class.interfaces: implements TokenResolver, Initializable
focal_class.class_method_signature: IfTokenResolver.evaluate(StartTagToken token, QueryContext ctx)
focal_class.full_signature: private boolean evaluate(StartTagToken token, QueryContext ctx)
focal_class.identifier: evaluate
focal_class.modifiers: private
focal_class.parameters: (StartTagToken token, QueryContext ctx)
focal_class.return: boolean
focal_class.signature: boolean evaluate(StartTagToken token, QueryContext ctx)
focal_class.class_method_signature: IfTokenResolver.initialize()
focal_class.full_signature: @Override public void initialize()
focal_class.identifier: initialize
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void initialize()
focal_class.class_method_signature: IfTokenResolver.resolve(Token token, QueryContext ctx)
focal_class.full_signature: public String resolve(Token token, QueryContext ctx)
focal_class.identifier: resolve
focal_class.modifiers: public
focal_class.parameters: (Token token, QueryContext ctx)
focal_class.return: String
focal_class.signature: String resolve(Token token, QueryContext ctx)
focal_method.body: public String resolve(Token token, QueryContext ctx) {
        if (token.getType() != TokenType.IF) {
           throw new DalRuntimeException("Internal error: only IF token is supported by " + getClass());
        }
  
        if (token instanceof StartTagToken) {
           if (ctx.isWithinIfToken()) {
              throw new DalRuntimeException("IF token can't be nested");
           }
  
           ctx.setWithinIfToken(true);
           ctx.setSqlResolveDisabled(!evaluate((StartTagToken) token, ctx));
           return "";
        } else if (token instanceof EndTagToken) {
           ctx.setWithinIfToken(false);
           ctx.setSqlResolveDisabled(false);
           return "";
        } else {
           throw new DalRuntimeException("Internal error: IF token can only be used as <IF ...> or </IF>");
        }
     }
focal_method.class_method_signature: IfTokenResolver.resolve(Token token, QueryContext ctx)
focal_method.full_signature: public String resolve(Token token, QueryContext ctx)
focal_method.identifier: resolve
focal_method.invocations: getType getClass isWithinIfToken setWithinIfToken setSqlResolveDisabled evaluate setWithinIfToken setSqlResolveDisabled
focal_method.modifiers: public
focal_method.parameters: (Token token, QueryContext ctx)
focal_method.return: String
focal_method.signature: String resolve(Token token, QueryContext ctx)