test_class.file: dal-jdbc/src/test/java/org/unidal/dal/jdbc/query/token/resolver/TablesTokenResolverTest.java
test_class.identifier: TablesTokenResolverTest
test_class.superclass: extends AbstractTokenResolverTest
test_case.body: @Test
     public void testUpdate() throws Exception {
        QueryDef query = new QueryDef("test", UserEntity.class, QueryType.UPDATE, "<TABLES/>");
        Updateset<User> updateset = UserEntity.UPDATESET_FULL;
        User user = new User();
        QueryContext ctx = getUpdateContext(query, user, updateset);
  
        try {
           m_queryResolver.resolve(ctx);
  
           Assert.fail("DalRuntimeException expected");
        } catch (DalRuntimeException e) {
           // expected
        }
     }
test_case.class_method_signature: TablesTokenResolverTest.testUpdate()
test_case.full_signature: @Test public void testUpdate()
test_case.identifier: testUpdate
test_case.invocations: getUpdateContext resolve fail
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testUpdate()
focal_class.declarator: m_manager
focal_class.modifier: @Inject
     private
focal_class.original_string: @Inject
     private TableProviderManager m_manager;
focal_class.type: TableProviderManager
focal_class.var_name: m_manager
focal_class.declarator: m_naming
focal_class.modifier: @Inject
     private
focal_class.original_string: @Inject
     private QueryNaming m_naming;
focal_class.type: QueryNaming
focal_class.var_name: m_naming
focal_class.file: dal-jdbc/src/main/java/org/unidal/dal/jdbc/query/token/resolver/TablesTokenResolver.java
focal_class.identifier: TablesTokenResolver
focal_class.interfaces: implements TokenResolver
focal_class.class_method_signature: TablesTokenResolver.getPhysicalName(QueryContext ctx, String logicalName)
focal_class.full_signature: private String getPhysicalName(QueryContext ctx, String logicalName)
focal_class.identifier: getPhysicalName
focal_class.modifiers: private
focal_class.parameters: (QueryContext ctx, String logicalName)
focal_class.return: String
focal_class.signature: String getPhysicalName(QueryContext ctx, String logicalName)
focal_class.class_method_signature: TablesTokenResolver.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.TABLES) {
           throw new DalRuntimeException("Internal error: only TABLES 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);
           String table = getPhysicalName(ctx, entityInfo.getLogicalName());
  
           sb.append(m_naming.getTable(table, entityInfo.getAlias()));
  
           if (subobject != null) {
              String[] names = subobject.value();
              Set<String> done = new HashSet<String>();
  
              done.add(entityInfo.getLogicalName());
  
              for (String name : names) {
                 if (name != null && name.length() > 0) {
                    // only include a table once
                    if (done.contains(name)) {
                       continue;
                    } else {
                       done.add(name);
                    }
  
                    Relation relation = entityInfo.getRelation(name);
  
                    sb.append(", ");
  
                    sb.append(m_naming.getTable(getPhysicalName(ctx, relation.logicalName()), relation.alias()));
                 }
              }
           }
  
           ctx.setTableResolved(true);
           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: TablesTokenResolver.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 getPhysicalName getLogicalName append getTable getAlias value add getLogicalName length contains add getRelation append append getTable getPhysicalName logicalName alias setTableResolved 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)