knguyen     2004/10/22 16:43:14 CEST

  Modified files:        (Branch: JAHIA-4-0-BRANCH)
    src/java/org/jahia/content ContentObject.java 
    src/java/org/jahia/engines/core Core_Engine.java 
    src/java/org/jahia/services/containers 
                                           JahiaContainerUtilsDB.java 
                                           JahiaContainersBaseService.java 
    src/java/org/jahia/services/pages ContentPage.java 
                                      JahiaPageUtilsDB.java 
    src/java/org/jahia/services/search 
                                       JahiaSearchResultHandlerImpl.java 
    src/java/org/jahia/services/version 
                                        ContentTreeRevisionsVisitor.java 
                                        PageRevisionsCompositor.java 
    src/java/org/jahia/utils/fileparsers CharsetDetection.java 
  Log:
  - some fixes
  
  Revision    Changes    Path
  1.35.4.6    +1 -6      jahia/src/java/org/jahia/content/ContentObject.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/src/java/org/jahia/content/ContentObject.java.diff?r1=1.35.4.5&r2=1.35.4.6&f=h
  1.16.2.1    +7 -7      jahia/src/java/org/jahia/engines/core/Core_Engine.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/src/java/org/jahia/engines/core/Core_Engine.java.diff?r1=1.16&r2=1.16.2.1&f=h
  1.56.2.2    +146 -96   
jahia/src/java/org/jahia/services/containers/JahiaContainerUtilsDB.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/src/java/org/jahia/services/containers/JahiaContainerUtilsDB.java.diff?r1=1.56.2.1&r2=1.56.2.2&f=h
  1.118.2.10  +9 -6      
jahia/src/java/org/jahia/services/containers/JahiaContainersBaseService.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/src/java/org/jahia/services/containers/JahiaContainersBaseService.java.diff?r1=1.118.2.9&r2=1.118.2.10&f=h
  1.72.2.12   +22 -0     jahia/src/java/org/jahia/services/pages/ContentPage.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/src/java/org/jahia/services/pages/ContentPage.java.diff?r1=1.72.2.11&r2=1.72.2.12&f=h
  1.39.2.6    +0 -7      jahia/src/java/org/jahia/services/pages/JahiaPageUtilsDB.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/src/java/org/jahia/services/pages/JahiaPageUtilsDB.java.diff?r1=1.39.2.5&r2=1.39.2.6&f=h
  1.2.2.3     +33 -24    
jahia/src/java/org/jahia/services/search/JahiaSearchResultHandlerImpl.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/src/java/org/jahia/services/search/JahiaSearchResultHandlerImpl.java.diff?r1=1.2.2.2&r2=1.2.2.3&f=h
  1.5.4.2     +15 -0     
jahia/src/java/org/jahia/services/version/ContentTreeRevisionsVisitor.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/src/java/org/jahia/services/version/ContentTreeRevisionsVisitor.java.diff?r1=1.5.4.1&r2=1.5.4.2&f=h
  1.2.4.3     +1 -0      
jahia/src/java/org/jahia/services/version/PageRevisionsCompositor.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/src/java/org/jahia/services/version/PageRevisionsCompositor.java.diff?r1=1.2.4.2&r2=1.2.4.3&f=h
  1.1.2.3     +2 -1      
jahia/src/java/org/jahia/utils/fileparsers/CharsetDetection.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/src/java/org/jahia/utils/fileparsers/CharsetDetection.java.diff?r1=1.1.2.2&r2=1.1.2.3&f=h
  
  
  
  Index: ContentObject.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/src/java/org/jahia/content/Attic/ContentObject.java,v
  retrieving revision 1.35.4.5
  retrieving revision 1.35.4.6
  diff -u -r1.35.4.5 -r1.35.4.6
  --- ContentObject.java        20 Oct 2004 09:46:05 -0000      1.35.4.5
  +++ ContentObject.java        22 Oct 2004 14:43:11 -0000      1.35.4.6
  @@ -902,8 +902,7 @@
                   return -1;
               }
               if ( curEntryState.getWorkflowState()
  -                 == ContentObjectEntryState.WORKFLOW_STATE_VERSIONING_DELETED
  -                 && isDeletedOrDoesNotExist(curEntryState.getVersionID()) ){
  +                 == ContentObjectEntryState.WORKFLOW_STATE_VERSIONING_DELETED ){
   
                   if ( resultEntryState == null ){
                       resultEntryState = curEntryState;
  @@ -934,10 +933,6 @@
   
           int size = entryStates.size();
   
  -        if ( size == 0 && this.getStagingLanguages(false,false).size()>0){
  -            return false; // exist in staging
  -        }
  -
           ContentObjectEntryState entryState = null;
           for ( int i=0 ; i<size; i++ ){
               entryState = (ContentObjectEntryState)entryStates.get(i);
  
  
  
  Index: Core_Engine.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/src/java/org/jahia/engines/core/Attic/Core_Engine.java,v
  retrieving revision 1.16
  retrieving revision 1.16.2.1
  diff -u -r1.16 -r1.16.2.1
  --- Core_Engine.java  30 Jan 2004 17:49:42 -0000      1.16
  +++ Core_Engine.java  22 Oct 2004 14:43:11 -0000      1.16.2.1
  @@ -132,23 +132,23 @@
               throws JahiaException {
   
           if (jData.params ().getPage () == null) {
  -
               if (!jData.params().getContentPage().checkReadAccess(jData.params().
                   getUser())) {
                   throw new JahiaForbiddenAccessException();
               }
  +        }
   
  +        if (jData.params ().getPage () == null
  +            ||  jData.params ().getPage ().getPageTemplate () == null) {
               // this can happen in the page doesn't exist in this operation mode
               // in a certain language.
  +            throw new JahiaPageNotFoundException (jData.params ().getPageID (),
  +                    jData.params ().getLocale ().toString (),
  +                    jData.params ().getOperationMode ());
   
  -            if (jData.params ().getPage () == null) {
  -                throw new JahiaPageNotFoundException (jData.params ().getPageID (),
  -                        jData.params ().getLocale ().toString (),
  -                        jData.params ().getOperationMode ());
  -
  -            }
           }
   
  +
           // increment for each corerequest
           if (!(jData.params ().getEntryLoadRequest ().isVersioned () ||
                   jData.params ().getEntryLoadRequest ().isDeleted ())
  
  
  
  Index: JahiaContainerUtilsDB.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/src/java/org/jahia/services/containers/Attic/JahiaContainerUtilsDB.java,v
  retrieving revision 1.56.2.1
  retrieving revision 1.56.2.2
  diff -u -r1.56.2.1 -r1.56.2.2
  --- JahiaContainerUtilsDB.java        29 Jul 2004 15:39:52 -0000      1.56.2.1
  +++ JahiaContainerUtilsDB.java        22 Oct 2004 14:43:11 -0000      1.56.2.2
  @@ -225,12 +225,14 @@
                       oldCtnID = -1;
                       while (rs.next ()) {
                           ctnID = rs.getInt ("listid_jahia_ctn_entries");
  -                        rights = rs.getInt ("rights_jahia_ctn_entries");
  -                        versionID = rs.getInt ("version_id");
  -                        // this is a new container, we add it in the list, also it 
has not
  -                        // been deleted (verID!=-1)
  -                        if ((ctnID != oldCtnID) && (versionID != -1)) {
  -                            theList.add (new Integer (ctnID));
  +                        if ( !theList.contains(new Integer(ctnID)) ){
  +                            rights = rs.getInt("rights_jahia_ctn_entries");
  +                            versionID = rs.getInt("version_id");
  +                            // this is a new container, we add it in the list, also 
it has not
  +                            // been deleted (verID!=-1)
  +                            if ( (ctnID != oldCtnID) && (versionID != -1)) {
  +                                theList.add(new Integer(ctnID));
  +                            }
                           }
                           oldCtnID = ctnID;
                       }
  @@ -305,14 +307,17 @@
                       ctnListID = rs.getInt ("id_jahia_ctn_lists");
                       workflowState = rs.getInt ("workflow_state");
                       versionID = rs.getInt ("version_id");
  -                    // this is a new container, we add it in the list, also it has 
not
  -                    // been deleted (rights!=-1)
  -                    if (ctnListID != oldCtnListID) {
  -                        if (loadVersion.isWithMarkedForDeletion ()) {
  -                            theList.add (new Integer (ctnListID));
  -                        } else {
  -                            if (versionID != -1) {
  -                                theList.add (new Integer (ctnListID));
  +                    if ( !theList.contains(new Integer(ctnListID)) ){
  +                        // this is a new container, we add it in the list, also it 
has not
  +                        // been deleted (rights!=-1)
  +                        if (ctnListID != oldCtnListID) {
  +                            if (loadVersion.isWithMarkedForDeletion()) {
  +                                theList.add(new Integer(ctnListID));
  +                            }
  +                            else {
  +                                if (versionID != -1) {
  +                                    theList.add(new Integer(ctnListID));
  +                                }
                               }
                           }
                       }
  @@ -333,10 +338,12 @@
                           ctnListID = rs.getInt ("id_jahia_ctn_lists");
                           workflowState = rs.getInt ("workflow_state");
                           versionID = rs.getInt ("version_id");
  -                        // this is a new container, we add it in the list, also it 
has not
  -                        // been deleted (verID!=-1)
  -                        if ((ctnListID != oldCtnListID) && (versionID != -1)) {
  -                            theList.add (new Integer (ctnListID));
  +                        if ( !theList.contains(new Integer(ctnListID)) ){
  +                            // this is a new container, we add it in the list, also 
it has not
  +                            // been deleted (verID!=-1)
  +                            if ( (ctnListID != oldCtnListID) && (versionID != -1)) {
  +                                theList.add(new Integer(ctnListID));
  +                            }
                           }
                           oldCtnListID = ctnListID;
                       }
  @@ -433,16 +440,18 @@
                           ctnListID = rs.getInt("id_jahia_ctn_lists");
                           workflowState = rs.getInt("workflow_state");
                           versionID = rs.getInt("version_id");
  -                        // this is a new container, we add it in the list, also it 
has not
  -                        // been deleted (rights!=-1)
  -                        if (ctnListID != oldCtnListID) {
  -                            if (loadVersion.isWithMarkedForDeletion()) {
  -                                theList.add(new Integer(ctnListID));
  -                            }
  -                            else {
  -                                if (versionID != -1) {
  +                        if ( !theList.contains(new Integer(ctnListID)) ){
  +                            // this is a new container, we add it in the list, also 
it has not
  +                            // been deleted (rights!=-1)
  +                            if (ctnListID != oldCtnListID) {
  +                                if (loadVersion.isWithMarkedForDeletion()) {
                                       theList.add(new Integer(ctnListID));
                                   }
  +                                else {
  +                                    if (versionID != -1) {
  +                                        theList.add(new Integer(ctnListID));
  +                                    }
  +                                }
                               }
                           }
                           oldCtnListID = ctnListID;
  @@ -461,11 +470,14 @@
                           ctnListID = rs.getInt ("id_jahia_ctn_lists");
                           workflowState = rs.getInt ("workflow_state");
                           versionID = rs.getInt ("version_id");
  -                        // this is a new container, we add it in the list, also it 
has not
  -                        // been deleted (verID!=-1)
  -                        if ((ctnListID != oldCtnListID) && (versionID != -1)) {
  -                            if ( !theList.contains(new Integer (ctnListID)) ){
  -                                theList.add(new Integer(ctnListID));
  +                        if ( !theList.contains(new Integer(ctnListID)) ){
  +                            // this is a new container, we add it in the list, also 
it has not
  +                            // been deleted (verID!=-1)
  +                            if ( (ctnListID != oldCtnListID) &&
  +                                (versionID != -1)) {
  +                                if (!theList.contains(new Integer(ctnListID))) {
  +                                    theList.add(new Integer(ctnListID));
  +                                }
                               }
                           }
                           oldCtnListID = ctnListID;
  @@ -544,7 +556,9 @@
               while (rs.next ()) {
                   ctnListID = rs.getInt ("id_jahia_ctn_lists");
                   // this is a new container, we add it in the list
  -                theSet.add (new Integer (ctnListID));
  +                if ( !theSet.contains(new Integer(ctnListID)) ){
  +                    theSet.add(new Integer(ctnListID));
  +                }
               }
           } catch (SQLException se) {
               String errorMsg = "Error in getAllPageTopLevelContainerListIDs : " + 
se.getMessage ();
  @@ -609,7 +623,7 @@
                   }
               } else if (loadRequest.isCurrent ()) {
                   sqlQuery =
  -                        "SELECT id_jahia_ctn_lists, workflow_state, version_id " +
  +                        "SELECT DISTINCT id_jahia_ctn_lists, workflow_state, 
version_id " +
                           "FROM jahia_ctn_lists WHERE " +
                           "pageid_jahia_ctn_lists=" + pageID +
                           " AND parententryid_jahia_ctn_lists=0 " +
  @@ -619,7 +633,9 @@
                   int ctnListID;
                   while (rs.next ()) {
                       ctnListID = rs.getInt ("id_jahia_ctn_lists");
  -                    theSet.add (new Integer (ctnListID));
  +                    if ( !theSet.contains(new Integer(ctnListID)) ){
  +                        theSet.add(new Integer(ctnListID));
  +                    }
                   }
               } else if (loadRequest.isStaging ()) {
                   sqlQuery =
  @@ -633,7 +649,9 @@
                   int ctnListID;
                   while (rs.next ()) {
                       ctnListID = rs.getInt ("id_jahia_ctn_lists");
  -                    theSet.add (new Integer (ctnListID));
  +                    if ( !theSet.contains(new Integer(ctnListID)) ){
  +                        theSet.add(new Integer(ctnListID));
  +                    }
                   }
               } else if (loadRequest.isVersioned ()) {
                   sqlQuery =
  @@ -648,11 +666,13 @@
                   int oldCtnListID = -1;
                   while (rs.next ()) {
                       int ctnListID = rs.getInt ("id_jahia_ctn_lists");
  -                    int workflowState = rs.getInt ("workflow_state");
  -                    int versionID = rs.getInt ("version_id");
  -                    if ((oldCtnListID == -1) || (oldCtnListID != ctnListID)) {
  -                        // we only add the first version we find
  -                        theSet.add (new Integer (ctnListID));
  +                    if ( !theSet.contains(new Integer(ctnListID)) ){
  +                        int workflowState = rs.getInt("workflow_state");
  +                        int versionID = rs.getInt("version_id");
  +                        if ( (oldCtnListID == -1) || (oldCtnListID != ctnListID)) {
  +                            // we only add the first version we find
  +                            theSet.add(new Integer(ctnListID));
  +                        }
                       }
                       oldCtnListID = ctnListID;
                   }
  @@ -717,14 +737,17 @@
                       ctnID = rs.getInt ("id_jahia_ctn_lists");
                       rights = rs.getInt ("rights_jahia_ctn_lists");
                       versionID = rs.getInt ("version_id");
  -                    // this is a new container, we add it in the list, also it has 
not
  -                    // been deleted (rights!=-1)
  -                    if ((ctnID != oldCtnID)) {
  -                        if (loadVersion.isWithMarkedForDeletion ()) {
  -                            theList.add (new Integer (ctnID));
  -                        } else {
  -                            if (versionID != -1) {
  -                                theList.add (new Integer (ctnID));
  +                    if ( !theList.contains(new Integer(ctnID)) ){
  +                        // this is a new container, we add it in the list, also it 
has not
  +                        // been deleted (rights!=-1)
  +                        if ( (ctnID != oldCtnID)) {
  +                            if (loadVersion.isWithMarkedForDeletion()) {
  +                                theList.add(new Integer(ctnID));
  +                            }
  +                            else {
  +                                if (versionID != -1) {
  +                                    theList.add(new Integer(ctnID));
  +                                }
                               }
                           }
                       }
  @@ -747,10 +770,12 @@
                       ctnID = rs.getInt ("id_jahia_ctn_lists");
                       rights = rs.getInt ("rights_jahia_ctn_lists");
                       versionID = rs.getInt ("version_id");
  -                    // this is a new container, we add it in the list, also it has 
not
  -                    // been deleted (verID!=-1)
  -                    if ((ctnID != oldCtnID) && (versionID != -1)) {
  -                        theList.add (new Integer (ctnID));
  +                    if ( !theList.contains(new Integer(ctnID)) ){
  +                        // this is a new container, we add it in the list, also it 
has not
  +                        // been deleted (verID!=-1)
  +                        if ( (ctnID != oldCtnID) && (versionID != -1)) {
  +                            theList.add(new Integer(ctnID));
  +                        }
                       }
                       oldCtnID = ctnID;
                   }
  @@ -761,7 +786,10 @@
                           + " ORDER BY id_jahia_ctn_lists ASC");
                   rs = stmt.executeQuery (sqlQuery);
                   while (rs.next ()) {
  -                    theList.add (new Integer (rs.getInt ("id_jahia_ctn_lists")));
  +                    int ctnID = rs.getInt ("id_jahia_ctn_lists");
  +                    if ( !theList.contains(new Integer(ctnID)) ){
  +                        theList.add(new Integer(ctnID));
  +                    }
                   }
               }
           } catch (SQLException se) {
  @@ -962,35 +990,47 @@
                           rank = rs.getInt (2);
                           rights = rs.getInt (3);
                           versionID = rs.getInt (4);
  -                        if (previousCtnID != ctnID) {
  -                            if (loadVersion.isWithMarkedForDeletion ()) {
  -                                if (rank != 0) {
  -                                    int index = 0;
  -                                    while ((index < tempRank.size ()) &&
  -                                            (((Integer) tempRank.elementAt 
(index)).intValue () < rank)) {
  -                                        index++;
  -                                    }
  -                                    theList.insertElementAt (new Integer (ctnID), 
index);
  -                                    tempRank.insertElementAt (new Integer (rank), 
index);
  -                                } else {
  -                                    // if the ranking is at zero we add it at the 
end
  -                                    // of the list.
  -                                    theList.add (new Integer (ctnID));
  -                                }
  -                            } else {
  -                                if (versionID != -1) {
  +
  +                        if ( !theList.contains(new Integer(ctnID)) ){
  +                            if (previousCtnID != ctnID) {
  +                                if (loadVersion.isWithMarkedForDeletion()) {
                                       if (rank != 0) {
                                           int index = 0;
  -                                        while ((index < tempRank.size ()) &&
  -                                                (((Integer) tempRank.elementAt 
(index)).intValue () < rank)) {
  +                                        while ( (index < tempRank.size()) &&
  +                                               ( ( (Integer) tempRank.elementAt(
  +                                            index)).intValue() < rank)) {
                                               index++;
                                           }
  -                                        theList.insertElementAt (new Integer 
(ctnID), index);
  -                                        tempRank.insertElementAt (new Integer 
(rank), index);
  -                                    } else {
  +                                        theList.insertElementAt(new Integer(ctnID),
  +                                            index);
  +                                        tempRank.insertElementAt(new Integer(rank),
  +                                            index);
  +                                    }
  +                                    else {
                                           // if the ranking is at zero we add it at 
the end
                                           // of the list.
  -                                        theList.add (new Integer (ctnID));
  +                                        theList.add(new Integer(ctnID));
  +                                    }
  +                                }
  +                                else {
  +                                    if (versionID != -1) {
  +                                        if (rank != 0) {
  +                                            int index = 0;
  +                                            while ( (index < tempRank.size()) &&
  +                                                   ( ( (Integer) tempRank.elementAt(
  +                                                index)).intValue() < rank)) {
  +                                                index++;
  +                                            }
  +                                            theList.insertElementAt(new Integer(
  +                                                ctnID), index);
  +                                            tempRank.insertElementAt(new Integer(
  +                                                rank), index);
  +                                        }
  +                                        else {
  +                                            // if the ranking is at zero we add it 
at the end
  +                                            // of the list.
  +                                            theList.add(new Integer(ctnID));
  +                                        }
                                       }
                                   }
                               }
  @@ -1018,19 +1058,25 @@
                               rank = rs.getInt (2);
                               rights = rs.getInt (3);
                               versionID = rs.getInt (4);
  -                            if ((previousCtnID != ctnID) && (versionID != -1)) {
  -                                if (rank != 0) {
  -                                    int index = 0;
  -                                    while ((index < tempRank.size ()) &&
  -                                            (((Integer) tempRank.elementAt 
(index)).intValue () < rank)) {
  -                                        index++;
  +                            if ( !theList.contains(new Integer(ctnID)) ){
  +                                if ( (previousCtnID != ctnID) && (versionID != -1)) 
{
  +                                    if (rank != 0) {
  +                                        int index = 0;
  +                                        while ( (index < tempRank.size()) &&
  +                                               ( ( (Integer) 
tempRank.elementAt(index)).
  +                                                intValue() < rank)) {
  +                                            index++;
  +                                        }
  +                                        theList.insertElementAt(new Integer(ctnID),
  +                                            index);
  +                                        tempRank.insertElementAt(new Integer(rank),
  +                                            index);
  +                                    }
  +                                    else {
  +                                        // if the ranking is at zero we add it at 
the end
  +                                        // of the list.
  +                                        theList.add(new Integer(ctnID));
                                       }
  -                                    theList.insertElementAt (new Integer (ctnID), 
index);
  -                                    tempRank.insertElementAt (new Integer (rank), 
index);
  -                                } else {
  -                                    // if the ranking is at zero we add it at the 
end
  -                                    // of the list.
  -                                    theList.add (new Integer (ctnID));
                                   }
                               }
                               previousCtnID = ctnID;
  @@ -1098,7 +1144,7 @@
               dbConn = org.jahia.services.database.ConnectionDispenser.getConnection 
();
               stmt = dbConn.createStatement ();
   
  -            String sqlQuery = "SELECT id_jahia_ctn_entries, rank_jahia_ctn_entries 
FROM jahia_ctn_entries "
  +            String sqlQuery = "SELECT DISTINCT id_jahia_ctn_entries, 
rank_jahia_ctn_entries FROM jahia_ctn_entries "
                       + "WHERE listid_jahia_ctn_entries=" + listID
                       + " ORDER BY rank_jahia_ctn_entries, id_jahia_ctn_entries ASC";
               rs = stmt.executeQuery (sqlQuery);
  @@ -1459,7 +1505,7 @@
               dbConn = org.jahia.services.database.ConnectionDispenser.getConnection 
();
               stmt = dbConn.createStatement ();
   
  -            String sqlQuery = "SELECT id_jahia_ctn_entries FROM jahia_ctn_entries " 
+
  +            String sqlQuery = "SELECT DISTINCT id_jahia_ctn_entries FROM 
jahia_ctn_entries " +
                       "WHERE pageid_jahia_ctn_entries=" + pageID + " " +
                       "AND (workflow_state>1)" +
                       "ORDER BY id_jahia_ctn_entries ASC";
  @@ -1506,7 +1552,7 @@
               dbConn = org.jahia.services.database.ConnectionDispenser.getConnection 
();
               stmt = dbConn.createStatement ();
   
  -            String sqlQuery = "SELECT id_jahia_ctn_lists FROM jahia_ctn_lists " +
  +            String sqlQuery = "SELECT DISTINCT id_jahia_ctn_lists FROM 
jahia_ctn_lists " +
                       "WHERE pageid_jahia_ctn_lists=" + pageID + " " +
                       "AND (workflow_state>1)" +
                       "ORDER BY id_jahia_ctn_lists ASC";
  @@ -1598,7 +1644,7 @@
           ResultSet rs = null;
           Integer nb_to_insert;
           try {
  -            String sqlQuery = "SELECT id_jahia_ctn_entries FROM jahia_ctn_entries 
WHERE jahiaid_jahia_ctn_entries =" + siteID;
  +            String sqlQuery = "SELECT DISTINCT id_jahia_ctn_entries FROM 
jahia_ctn_entries WHERE jahiaid_jahia_ctn_entries =" + siteID;
   
               dbConn = org.jahia.services.database.ConnectionDispenser.getConnection 
();
               stmt = dbConn.createStatement ();
  @@ -2257,7 +2303,9 @@
                   int ctnListID;
                   while (rs.next ()) {
                       ctnListID = rs.getInt ("id_jahia_ctn_lists");
  -                    theSet.add (new Integer (ctnListID));
  +                    if ( !theSet.contains(new Integer (ctnListID)) ){
  +                        theSet.add(new Integer(ctnListID));
  +                    }
                   }
               } else if (loadRequest.isVersioned ()) {
                   sqlQuery =
  @@ -2274,9 +2322,11 @@
                       int ctnListID = rs.getInt ("id_jahia_ctn_lists");
                       int workflowState = rs.getInt ("workflow_state");
                       int versionID = rs.getInt ("version_id");
  -                    if ((oldCtnListID == -1) || (oldCtnListID != ctnListID)) {
  -                        // we only add the first version we find
  -                        theSet.add (new Integer (ctnListID));
  +                    if ( !theSet.contains(new Integer (ctnListID)) ){
  +                        if ( (oldCtnListID == -1) || (oldCtnListID != ctnListID)) {
  +                            // we only add the first version we find
  +                            theSet.add(new Integer(ctnListID));
  +                        }
                       }
                       oldCtnListID = ctnListID;
                   }
  
  
  
  Index: JahiaContainersBaseService.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/src/java/org/jahia/services/containers/Attic/JahiaContainersBaseService.java,v
  retrieving revision 1.118.2.9
  retrieving revision 1.118.2.10
  diff -u -r1.118.2.9 -r1.118.2.10
  --- JahiaContainersBaseService.java   7 Oct 2004 17:27:21 -0000       1.118.2.9
  +++ JahiaContainersBaseService.java   22 Oct 2004 14:43:12 -0000      1.118.2.10
  @@ -2363,13 +2363,16 @@
           String languageCode,
           StateModificationContext
           stateModifContext) throws JahiaException {
  -        // gets list object
  -        JahiaContainerList theList = loadContainerListInfo(listID,
  -            EntryLoadRequest.STAGED);
   
  -        ContentContainerList contentContainerList = ContentContainerList.
  -            getContainerList(
  -            listID);
  +
  +        ContentContainerList contentContainerList = null;
  +        try {
  +            contentContainerList = ContentContainerList.
  +                getContainerList(
  +                listID);
  +        } catch ( Throwable t ){
  +            return false;
  +        }
   
           /**
            * NK:
  
  
  
  Index: ContentPage.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/src/java/org/jahia/services/pages/Attic/ContentPage.java,v
  retrieving revision 1.72.2.11
  retrieving revision 1.72.2.12
  diff -u -r1.72.2.11 -r1.72.2.12
  --- ContentPage.java  20 Oct 2004 09:46:06 -0000      1.72.2.11
  +++ ContentPage.java  22 Oct 2004 14:43:12 -0000      1.72.2.12
  @@ -651,6 +651,7 @@
       public JahiaPage getPage (EntryLoadRequest loadRequest, String operationMode,
                                 JahiaUser user)
               throws JahiaException {
  +
           JahiaPage page = new JahiaPage (this,
                   this.getPageTemplate (loadRequest),
                   this.getACL (),
  @@ -2959,6 +2960,27 @@
                                                           stateModifContext);
                                           activationResults.merge (
                                                   containerActivationResult);
  +
  +                                        // It's important to active the parent 
container list too
  +                                        // to have correct versioning state
  +                                        try {
  +                                            ContentContainerList containerList =
  +                                                ContentContainerList.
  +                                                getContainerList(
  +                                                curPageFieldContainer.getListID());
  +                                            if ( containerList != null ){
  +                                                 containerActivationResult = 
ServicesRegistry.getInstance().getJahiaContainersService()
  +                                                    
.activateStagedContainerLists(languageCodes,
  +                                                                                  
getID(),
  +                                                                                  
user,
  +                                                                                  
saveVersion,
  +                                                                                  
stateModifContext);
  +                                                  activationResults.merge(
  +                                                      containerActivationResult);
  +                                            }
  +                                        } catch ( Throwable t ){
  +                                            logger.debug("Error activating 
container list ",t);
  +                                        }
                                       }
                                   } else {
                                       // field is not in a container. nothing more to 
do...
  
  
  
  Index: JahiaPageUtilsDB.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/src/java/org/jahia/services/pages/Attic/JahiaPageUtilsDB.java,v
  retrieving revision 1.39.2.5
  retrieving revision 1.39.2.6
  diff -u -r1.39.2.5 -r1.39.2.6
  --- JahiaPageUtilsDB.java     20 Oct 2004 09:46:07 -0000      1.39.2.5
  +++ JahiaPageUtilsDB.java     22 Oct 2004 14:43:13 -0000      1.39.2.6
  @@ -482,8 +482,6 @@
               int previousWS = 0;
               if (rs != null) {
                   while (rs.next ()) {
  -                    // Ordering by version DESC and workflow DESC doesn't suffice 
!!!!
  -                    // because workflow = -1 is in fact MORE RECENT THAN workflow=0 
!!!!!!!!
                       int fieldID = rs.getInt ("id_jahia_fields_data");
                       int v = rs.getInt ("version_id");
                       int ws = rs.getInt ("workflow_state");
  @@ -492,11 +490,6 @@
                       } else {
                           if (v < previousVersionID) {
                               break;
  -                        } else if (ws == -1) {
  -                            if (contentPage.isDeletedOrDoesNotExist (v)) {
  -                                result = fieldID;
  -                                break;
  -                            }
                           }
                       }
                       previousFieldID = fieldID;
  
  
  
  Index: JahiaSearchResultHandlerImpl.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/src/java/org/jahia/services/search/Attic/JahiaSearchResultHandlerImpl.java,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- JahiaSearchResultHandlerImpl.java 20 Oct 2004 09:46:08 -0000      1.2.2.2
  +++ JahiaSearchResultHandlerImpl.java 22 Oct 2004 14:43:13 -0000      1.2.2.3
  @@ -27,6 +27,7 @@
   import org.jahia.services.fields.*;
   import org.jahia.services.pages.*;
   import org.jahia.services.version.*;
  +import org.jahia.exceptions.JahiaException;
   
   /**
    * Default implementation to build JahiaSearchResult from a collection of 
ParsedObject
  @@ -93,8 +94,6 @@
          boolean found = false;
          int pagecount = 0;
          ParsedObject parsedObject = null;
  -       int now = ServicesRegistry.getInstance().getJahiaVersionService()
  -           .getCurrentVersionID();
   
          Iterator iterator = parsedObjects.iterator();
          while ( iterator.hasNext() ){
  @@ -111,17 +110,11 @@
                  fieldIDVal = 
parsedObject.getValue(JahiaSearchConstant.FIELD_FIELDID);
                  languageCodeVal = 
parsedObject.getValue(JahiaSearchConstant.FIELD_LANGUAGE_CODE);
                  workflowStateVal = 
parsedObject.getValue(JahiaSearchConstant.FIELD_WORKFLOW_STATE);
  +               int ws = Integer.parseInt (workflowStateVal);
  +
                  if (fieldIDVal != null) {
                      contentField = ContentField.getField (Integer.parseInt 
(fieldIDVal));
  -
  -                   boolean processField
  -                           = ( !contentField.isDeletedOrDoesNotExist(now) && 
(jParams.getEntryLoadRequest ().isCurrent ()
  -                           || ((Integer.parseInt (workflowStateVal) == 
EntryLoadRequest.STAGING_WORKFLOW_STATE)
  -                               && contentField.hasStagingEntryIgnoreLanguageCase 
(languageCodeVal))
  -                           || ((Integer.parseInt (workflowStateVal) == 
EntryLoadRequest.ACTIVE_WORKFLOW_STATE
  -                           && !contentField.hasStagingEntryIgnoreLanguageCase 
(languageCodeVal)
  -                           && !contentField.isMarkedForDelete()))) );
  -                   if (processField) {
  +                   if (processField(contentField,ws,languageCodeVal,jParams)) {
                          pageIDVal = 
parsedObject.getValue(JahiaSearchConstant.FIELD_PAGEID);
                          aPage = sReg.getJahiaPageService ()
                                  .lookupPage (Integer.parseInt (pageIDVal), jParams);
  @@ -258,6 +251,32 @@
          return result;
      }
   
  +   private boolean processField(ContentField contentField,
  +                                int workflowState,
  +                                String languageCodeVal,
  +                                ParamBean jParams) throws JahiaException {
  +       boolean processField = false;
  +
  +       if ( contentField.getActiveAndStagingEntryStates().size() == 0 ){
  +           return false;
  +       }
  +       if ( jParams.getEntryLoadRequest ().isCurrent ()
  +            && workflowState == EntryLoadRequest.ACTIVE_WORKFLOW_STATE ){
  +           processField = true;
  +       } else if ( jParams.getEntryLoadRequest().isStaging()
  +                  && !contentField.isMarkedForDelete() ){
  +           if (workflowState > EntryLoadRequest.ACTIVE_WORKFLOW_STATE
  +               && contentField.hasStagingEntryIgnoreLanguageCase (languageCodeVal) 
) {
  +               // accept staging only if really has staged in the given languageCode
  +               processField = true;
  +           } else if 
(!contentField.hasStagingEntryIgnoreLanguageCase(languageCodeVal)) {
  +               // accept active only if field doesn't exist in staging
  +               processField = true;
  +           }
  +       }
  +       return processField;
  +   }
  +
      //--------------------------------------------------------------------------
      /**
        * build Search result from a collection of ParsedObject instance
  @@ -290,8 +309,6 @@
          ParsedObject parsedObject = null;
          String languageCodeVal = null;
          String workflowStateVal = null;
  -       int now = ServicesRegistry.getInstance().getJahiaVersionService()
  -           .getCurrentVersionID();
   
          Iterator iterator = parsedObjects.iterator();
          while ( iterator.hasNext() ){
  @@ -301,20 +318,12 @@
                  fieldIDVal = 
parsedObject.getValue(JahiaSearchConstant.FIELD_FIELDID);
                  languageCodeVal = 
parsedObject.getValue(JahiaSearchConstant.FIELD_LANGUAGE_CODE);
                  workflowStateVal = 
parsedObject.getValue(JahiaSearchConstant.FIELD_WORKFLOW_STATE);
  +               int ws = Integer.parseInt (workflowStateVal);
   
                  if (fieldIDVal != null) {
                      ContentField contentField = ContentField.getField 
(Integer.parseInt (fieldIDVal));
  -                   boolean processField
  -                       = ( !contentField.isDeletedOrDoesNotExist(now) && 
(jParams.getEntryLoadRequest ().isCurrent ()
  -                       || ((Integer.parseInt (workflowStateVal) == 
EntryLoadRequest.STAGING_WORKFLOW_STATE)
  -                           && contentField.hasStagingEntryIgnoreLanguageCase 
(languageCodeVal))
  -                       || ((Integer.parseInt (workflowStateVal) == 
EntryLoadRequest.ACTIVE_WORKFLOW_STATE
  -                       && !contentField.hasStagingEntryIgnoreLanguageCase 
(languageCodeVal)
  -                       && !contentField.isMarkedForDelete()))) );
  -
  -                   if (processField) {
  -                       aField =
  -                               sReg.getJahiaFieldService ().loadField (
  +                   if (processField(contentField,ws,languageCodeVal,jParams)) {
  +                       aField = sReg.getJahiaFieldService ().loadField (
                                          Integer.parseInt (fieldIDVal), jParams);
                      }
                  }
  
  
  
  Index: ContentTreeRevisionsVisitor.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/src/java/org/jahia/services/version/Attic/ContentTreeRevisionsVisitor.java,v
  retrieving revision 1.5.4.1
  retrieving revision 1.5.4.2
  diff -u -r1.5.4.1 -r1.5.4.2
  --- ContentTreeRevisionsVisitor.java  28 Sep 2004 09:28:19 -0000      1.5.4.1
  +++ ContentTreeRevisionsVisitor.java  22 Oct 2004 14:43:13 -0000      1.5.4.2
  @@ -198,6 +198,21 @@
               } catch ( Throwable t ){
                   logger.debug("Exception when trying to reload Revisions", t);
               }
  +
  +            // filter out all revisions at which the rootObject is deleted
  +            ArrayList result = new ArrayList();
  +            ArrayList revisions = this.getRevisions();
  +            int size = revisions.size();
  +            RevisionEntrySet rs = null;
  +            rootObject = this.getContentTree().getRootContentObject();
  +            for ( int i=0; i<size; i++ ){
  +                rs = (RevisionEntrySet)revisions.get(i);
  +                if ( !rootObject.isDeletedOrDoesNotExist(rs.getVersionID()) ){
  +                    result.add(rs);
  +                }
  +            }
  +            this.revisionsList = result;
  +
           }
           this.hasAttributeChange = false;
       }
  
  
  
  Index: PageRevisionsCompositor.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/src/java/org/jahia/services/version/Attic/PageRevisionsCompositor.java,v
  retrieving revision 1.2.4.2
  retrieving revision 1.2.4.3
  diff -u -r1.2.4.2 -r1.2.4.3
  --- PageRevisionsCompositor.java      28 Sep 2004 09:28:19 -0000      1.2.4.2
  +++ PageRevisionsCompositor.java      22 Oct 2004 14:43:13 -0000      1.2.4.3
  @@ -111,6 +111,7 @@
                   }
   
                   if ( inDateRange(entryState) ){
  +
                       // replacing low level revisions to a higher level of revisions
                       // that are more usefull and easier to understand by the end 
user.
                       // Group all revisions as Page revisions
  
  
  
  Index: CharsetDetection.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/src/java/org/jahia/utils/fileparsers/Attic/CharsetDetection.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- CharsetDetection.java     1 Sep 2004 12:11:36 -0000       1.1.2.2
  +++ CharsetDetection.java     22 Oct 2004 14:43:14 -0000      1.1.2.3
  @@ -111,11 +111,12 @@
           det.DataEnd();
   
           String[]charSets = det.getProbableCharsets();
  +        /*
           for ( int i=0; i<charSets.length ; i++ ){
               logger.debug(
                   "Charset detection notification , PROBABLE CHARSET FOUND = "
                   + charSets[i]);
  -        }
  +        }*/
           if ( charSets.length>0 ){
               this.charSet = charSets[0]; // get the first
           }
  

Reply via email to