TKDBGetAllTreeContentVersions.java :  » Content-Management-System » webman » com » teamkonzept » webman » mainint » db » queries » Java Open Source

Java Open Source » Content Management System » webman 
webman » com » teamkonzept » webman » mainint » db » queries » TKDBGetAllTreeContentVersions.java
package com.teamkonzept.webman.mainint.db.queries;

import com.teamkonzept.db.*;
import java.sql.*;
import com.teamkonzept.lib.templates.*;

/**
 * TKDBGetAllTreeNodeContentVersions
 * Holt alle versionen aller aktuellen Contents eines Content-Tree-Knotens
 *
 * @author  $Author: alex $
 * @version $Revision: 1.19 $
 */
public class TKDBGetAllTreeContentVersions extends TKUnprepQuery {

  public static Object[][] paramTypes =
    { {"SEARCH", new Integer(Types.VARCHAR)} };

  public static boolean[] setRelevants =
    { true };
    /** die Query */
  public static String sqlString =
    "SELECT " +
    " CV.VERSION_ID, CV.INSTANCE_ID, CI.CONTENT_NODE_ID, CV.CONTENT_ID, CV.STATUS_ID, CV.VERSION_DATE, CV.AUTHOR, CV.INFO, VS.STATUS, " +
    " CT.CONTENT_NODE_NAME, CT2.CONTENT_NODE_TYPE AS PARENT_TYPE, CT.CONTENT_NODE_PARENT, CT.CONTENT_NODE_SHORTNAME, CT.CONTENT_FORM, CT.CONTENT_NODE_TYPE, CI.NAME " +
    "FROM " +
    " CONTENT C,<TK_CASE:KENNUNG> CONTENT_VALUE CVALUE,</TK_CASE> CONTENT_TREE CT, CONTENT_TREE CT2, CONTENT_VERSION CV, VERSION_STATUS VS, CONTENT_INSTANCE CI " +
    "WHERE " +

    " CT.LEFT_NR > (SELECT LEFT_NR FROM CONTENT_TREE WHERE CONTENT_NODE_ID = <TK_CONTENT_NODE_ID>) AND " +
    " CT.RIGHT_NR < (SELECT RIGHT_NR FROM CONTENT_TREE WHERE CONTENT_NODE_ID = <TK_CONTENT_NODE_ID>) AND " +

    " CI.CONTENT_NODE_ID = CT.CONTENT_NODE_ID AND " +
    " CV.INSTANCE_ID = CI.INSTANCE_ID AND " +
    " C.CONTENT_ID = CV.CONTENT_ID AND " +
    " CV.STATUS_ID = VS.STATUS_ID AND " +
    " CT2.CONTENT_NODE_ID = CT.CONTENT_NODE_PARENT " +
    
    " <TK_CASE:KENNUNG> AND " +
    " CVALUE.CONTENT_ID = CV.CONTENT_ID " +
    " <TK_IF:KENNUNG=0> " +
    " AND (<TK_LIST:SEARCH_STRING>(CVALUE.VALUE LIKE <TK:SEARCH> " + DBStringFactory.escape() + " ) <TK:CONN> </TK_LIST>) " +
    " </TK_IF:KENNUNG=0> " +
    " <TK_IF:KENNUNG=1> " +
    " AND " +
    " ((<TK_LIST:SEARCH_STRING>(CT.CONTENT_NODE_NAME LIKE <TK:SEARCH> " + DBStringFactory.escape() + " ) <TK:CONN> </TK_LIST>) " +
    " OR " +
    " (<TK_LIST:SEARCH_STRING>(CT.CONTENT_NODE_SHORTNAME LIKE <TK:SEARCH> " + DBStringFactory.escape() + " ) <TK:CONN> </TK_LIST>)) " +
    " </TK_IF> " + 
    " </TK_CASE> " +
    
    "ORDER BY " +
    " CV.INSTANCE_ID, CV.CONTENT_ID, CV.VERSION_ID ";

  public static TKTemplateSyntax sqlTmplSyntax;    

  public void initQuery(Connection con) {
    try
    {  
      sqlTmplSyntax = new TKTemplateSyntax(sqlString,"");
    } 
    catch(com.teamkonzept.lib.TKTemplateSyntaxException e)
    {
      sqlString = sqlString;      // fr JTest
    }  
    
    super.initQuery(
      con,
      paramTypes,
      setRelevants,
      sqlTmplSyntax );
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.