test_class.file: dal-jdbc/src/test/java/org/unidal/dal/jdbc/query/token/resolver/JoinsTokenResolverTest.java
test_class.identifier: JoinsTokenResolverTest
test_class.superclass: extends AbstractTokenResolverTest
test_case.body: @Test
     public void testSelectOneTable() throws Exception {
        QueryDef query = new QueryDef("test", UserEntity.class, QueryType.SELECT, "<JOINS/>");
        Readset<?> readset = UserEntity.READSET_FULL;
        User user = new User();
        QueryContext ctx = getSelectContext(query, user, readset);
  
        m_queryResolver.resolve(ctx);
        Assert.assertEquals("1=1", ctx.getSqlStatement());
     }
test_case.class_method_signature: JoinsTokenResolverTest.testSelectOneTable()
test_case.full_signature: @Test public void testSelectOneTable()
test_case.identifier: testSelectOneTable
test_case.invocations: getSelectContext resolve assertEquals getSqlStatement
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testSelectOneTable()
focal_class.file: dal-jdbc/src/main/java/org/unidal/dal/jdbc/query/token/resolver/JoinsTokenResolver.java
focal_class.identifier: JoinsTokenResolver
focal_class.interfaces: implements TokenResolver
focal_class.class_method_signature: JoinsTokenResolver.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.JOINS) {
           throw new DalRuntimeException("Internal error: only JOINS token is supported by " + getClass());
        }
  
        switch (ctx.getQuery().getType()) {
        case SELECT:
           EntityInfo entityInfo = ctx.getEntityInfo();
           SubObjects subobject = entityInfo.getSubobjects(ctx.getReadset());
           StringBuilder sb = new StringBuilder(256);
  
           if (subobject != null) {
              String[] names = subobject.value();
  
              for (String name : names) {
                 if (name != null && name.length() > 0) {
                    Relation relation = entityInfo.getRelation(name);
  
                    if (sb.length() > 0) {
                       sb.append(" and ");
                    }
  
                    sb.append(relation.join());
                 }
              }
           }
  
           if (sb.length() == 0) {
              sb.append("1=1");
           }
  
           return sb.toString();
        case INSERT:
           throw new DalRuntimeException("TABLES token does not support query type: " + ctx.getQuery().getType());
        case UPDATE:
           throw new DalRuntimeException("TABLES token does not support query type: " + ctx.getQuery().getType());
        case DELETE:
           throw new DalRuntimeException("TABLES token does not support query type: " + ctx.getQuery().getType());
        default:
           throw new DalRuntimeException("TABLES token does not support query type: " + ctx.getQuery().getType());
        }
     }
focal_method.class_method_signature: JoinsTokenResolver.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 getType getQuery getEntityInfo getSubobjects getReadset value length getRelation length append append join length append toString getType getQuery getType getQuery getType getQuery getType getQuery
focal_method.modifiers: public
focal_method.parameters: (Token token, QueryContext ctx)
focal_method.return: String
focal_method.signature: String resolve(Token token, QueryContext ctx)