Author: sshyrkov
Date: Mon Dec  3 16:59:56 2007
New Revision: 19329

URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D19329&repname=
=3Djahia
Log:
New filter for retrieving only unpublished container IDs in the site by the=
 container definition name

Added:
    trunk/core/src/java/org/jahia/data/containers/StagedContainerFilterByCo=
ntainerDefinition.java

Added: trunk/core/src/java/org/jahia/data/containers/StagedContainerFilterB=
yContainerDefinition.java
URL: https://svndev.jahia.net/websvn/filedetails.php?path=3D/trunk/core/src=
/java/org/jahia/data/containers/StagedContainerFilterByContainerDefinition.=
java&rev=3D19329&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/core/src/java/org/jahia/data/containers/StagedContainerFilterByCo=
ntainerDefinition.java (added)
+++ trunk/core/src/java/org/jahia/data/containers/StagedContainerFilterByCo=
ntainerDefinition.java Mon Dec  3 16:59:56 2007
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2002-2007 Jahia Ltd
+ *
+ * Licensed under the JAHIA COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (J=
CDDL), =

+ * Version 1.0 (the "License"), or (at your option) any later version; you=
 may =

+ * not use this file except in compliance with the License. You should hav=
e =

+ * received a copy of the License along with this program; if not, you may=
 obtain =

+ * a copy of the License at =

+ *
+ *  http://www.jahia.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software =

+ * distributed under the License is distributed on an "AS IS" BASIS, =

+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied=
. =

+ * See the License for the specific language governing permissions and =

+ * limitations under the License.
+ */
+package org.jahia.data.containers;
+
+import java.util.BitSet;
+
+import org.jahia.exceptions.JahiaException;
+import org.jahia.services.version.EntryLoadRequest;
+import org.jahia.utils.JahiaTools;
+
+/**
+ * Retrieves the unpublished container IDs in the site by the container
+ * definition name.
+ * =

+ * @author Sergiy Shyrkov
+ */
+public class StagedContainerFilterByContainerDefinition extends
+        ContainerFilterByContainerDefinition {
+
+    private int siteId;
+
+    /**
+     * Initializes an instance of this class.
+     * =

+     * @param containerDefinitionName
+     *            target container definition name
+     * @param siteId
+     *            the site ID
+     */
+    public StagedContainerFilterByContainerDefinition(
+            String containerDefinitionName, int siteId) {
+        super(containerDefinitionName, EntryLoadRequest.STAGED);
+        this.siteId =3D siteId;
+    }
+
+    public BitSet doFilter() throws JahiaException {
+        return super.doFilterBySite(siteId, getContainerDefinitionName(), =
0);
+    }
+
+    public BitSet doFilter(int ctnListID) throws JahiaException {
+        throw new UnsupportedOperationException(
+                "Method is not supported. Use doFilter() instead.");
+    }
+
+    public BitSet doFilterBySite(int siteId, String containerDefinitionNam=
e,
+            int listId) throws JahiaException {
+        throw new UnsupportedOperationException(
+                "Method is not supported. Use doFilter() instead.");
+    }
+
+    public String getSelectBySiteID(int siteId, String containerDefinition=
Name,
+            boolean ignoreLang) {
+        StringBuffer buff =3D new StringBuffer(256);
+        buff.append("SELECT DISTINCT id_jahia_ctn_entries,workflow_state"
+                + " FROM jahia_ctn_entries a, jahia_ctn_def b WHERE "
+                + WORKFLOW_STATE + "=3D"
+                + EntryLoadRequest.STAGING_WORKFLOW_STATE
+                + " AND version_id <> -1 ");
+
+        buff.append(" AND  jahiaid_jahia_ctn_entries=3D");
+        buff.append(siteId);
+        buff.append(" AND "
+                + " a.ctndefid_jahia_ctn_entries =3D b.id_jahia_ctn_def "
+                + " AND b.name_jahia_ctn_def=3D'");
+        buff.append(JahiaTools.quote(containerDefinitionName));
+        buff.append("'");
+
+        buff.append(" ORDER BY id_jahia_ctn_entries," + WORKFLOW_STATE);
+
+        return buff.toString();
+    }
+
+}
\ No newline at end of file

_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list

Reply via email to