From mfortun@users.nuiton.org Tue May 17 16:01:38 2011
From: mfortun@users.nuiton.org
To: wikitty-commits@list.nuiton.org
Subject: [Wikitty-commits] r896 -
	trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication
Date: Tue, 17 May 2011 16:01:38 +0200
Message-ID: <20110517140138.9DCD216F81@nuiton.codelutin.com>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============2887464391440314945=="

--===============2887464391440314945==
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Author: mfortun
Date: 2011-05-17 16:01:38 +0200 (Tue, 17 May 2011)
New Revision: 896

Url: http://nuiton.org/repositories/revision/wikitty/896

Log:
* add multicontext for pagedresult's methods


Modified:
   trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/Wik=
ittyPublicationProxy.java

Modified: trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publicat=
ion/WikittyPublicationProxy.java
=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/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/Wi=
kittyPublicationProxy.java	2011-05-16 16:03:53 UTC (rev 895)
+++ trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/Wi=
kittyPublicationProxy.java	2011-05-17 14:01:38 UTC (rev 896)
@@ -301,7 +301,7 @@
     }
=20
     public List<Wikitty> storeWikitty(List<Wikitty> wikitties) {
-       =20
+
         List<Wikitty> result =3D new ArrayList<Wikitty>();
=20
         List<Wikitty> tempObject =3D new ArrayList<Wikitty>();
@@ -472,7 +472,54 @@
=20
     public <E extends BusinessEntityImpl> PagedResult<E> findAllByExample(E =
e,
             int firstIndex, int endIndex, String... fieldFacet) {
-        return mainProxy.findAllByExample(e, firstIndex, endIndex, fieldFace=
t);
+
+        PagedResult<E> result =3D mainProxy.findAllByExample(e, firstIndex,
+                endIndex, fieldFacet);
+
+        int resultSizeExpected =3D endIndex - firstIndex;
+        if (isFallbackService() && result.size() < resultSizeExpected) {
+
+            if (result.size() =3D=3D 0) {
+                String oldRequest =3D result.getQueryString();
+
+                /*
+                 * change the param because we search on the beginning of the
+                 * content of the otherLike they were the same collection
+                 */
+                result =3D fallbackProxy.findAllByExample(e, 0,
+                        resultSizeExpected, fieldFacet);
+
+                // reform the result
+                PagedResult<E> reformResult =3D new PagedResult<E>(firstInde=
x,
+                        result.getNumFound(), oldRequest, result.getFacets(),
+                        result.getAll());
+                result =3D reformResult;
+            } else {
+
+                /*
+                 * Calculate the number of missing element and search then on
+                 * the fallback wikitty service, and then add this result to=
 the
+                 * final result;
+                 */
+                int missingNumber =3D resultSizeExpected - result.size();
+
+                PagedResult<E> resultTempFromFall =3D fallbackProxy
+                        .findAllByExample(e, 0, missingNumber, fieldFacet);
+
+                List<E> completedResultList =3D result.getAll();
+                completedResultList.addAll(resultTempFromFall.getAll());
+
+                int totalNumberofFound =3D result.getNumFound()
+                        + resultTempFromFall.getNumFound();
+
+                PagedResult<E> reformResult =3D new PagedResult<E>(firstInde=
x,
+                        totalNumberofFound, result.getQueryString(),
+                        result.getFacets(), completedResultList);
+                result =3D reformResult;
+            }
+        }
+
+        return result;
     }
=20
     public <E extends BusinessEntityImpl> E findByExample(E e) {
@@ -487,95 +534,538 @@
=20
     public <E extends BusinessEntity> List<PagedResult<E>> findAllByCriteria(
             Class<E> clazz, List<Criteria> criterias) {
-        return mainProxy.findAllByCriteria(clazz, criterias);
+
+        List<PagedResult<E>> result =3D mainProxy.findAllByCriteria(clazz,
+                criterias);
+
+        if (isFallbackService()) {
+
+            for (int i =3D 0; i < result.size(); i++) {
+
+                /*
+                 * get the curent criteria and corresponding result to check=
 if
+                 * the expected number of result is match
+                 */
+                Criteria currentCrit =3D criterias.get(i);
+                PagedResult<E> currentResult =3D result.get(i);
+
+                int resultSizeExpected =3D currentCrit.getEndIndex()
+                        - currentCrit.getFirstIndex();
+                if (currentResult.size() < resultSizeExpected) {
+                    /*
+                     * if result empty, just put the result of the fallback's
+                     * requestresult
+                     */
+
+                    /*
+                     * rebuild the criteria to search properly on the second
+                     * service we search for wikitty not in the same positio=
n,
+                     * but in the beginning
+                     */
+                    Criteria critFallback =3D Search.query(currentCrit)
+                            .criteria();
+                    critFallback.setFirstIndex(0);
+                    critFallback.setEndIndex(currentCrit.getEndIndex()
+                            - currentCrit.getFirstIndex());
+
+                    if (result.size() =3D=3D 0) {
+
+                        PagedResult<E> tempPagedResult =3D fallbackProxy
+                                .findAllByCriteria(clazz, critFallback);
+
+                        // rebuild the result to match the expected criteria
+                        tempPagedResult =3D new PagedResult<E>(
+                                currentCrit.getFirstIndex(),
+                                tempPagedResult.getNumFound(),
+                                currentCrit.toString(),
+                                tempPagedResult.getFacets(),
+                                tempPagedResult.getAll());
+
+                        result.set(i, tempPagedResult);
+                    } else {
+
+                        /*
+                         * we will search to complete the result with id from
+                         * the fallback service so we reduce the number of
+                         * element requested on the fallback service and we =
add
+                         * a restriction on wikitty id to exclude id already=
 in
+                         * the first part of the result
+                         *=20
+                         * it not assume that wikitty id found does not exis=
t on
+                         * the first part of a criteria, for example if first
+                         * index where 12, nothing assure that we found wiki=
tty
+                         * in the fall back that aren't in the 11 first wiki=
tty
+                         * of the main service
+                         */
+                        PagedResult<String> idFromMain =3D mainProxy
+                                .findAllIdByCriteria(currentCrit);
+
+                        Criteria excluding =3D idNotInCriteriaConstructor(
+                                critFallback, idFromMain.getAll());
+
+                        excluding.setEndIndex(resultSizeExpected
+                                - result.size());
+
+                        PagedResult<E> resultFallback =3D fallbackProxy
+                                .findAllByCriteria(clazz, excluding);
+
+                        List<E> allresult =3D currentResult.getAll();
+                        allresult.addAll(resultFallback.getAll());
+                        int number =3D currentResult.getNumFound()
+                                + resultFallback.getNumFound();
+
+                        // rebuilt the result
+                        PagedResult<E> tempPagedResult =3D new PagedResult<E=
>(
+                                currentCrit.getFirstIndex(), number,
+                                currentCrit.toString(),
+                                currentResult.getFacets(), allresult);
+                        // re set the result in the list
+                        result.set(i, tempPagedResult);
+                    }
+                }
+
+            }
+        }
+
+        return result;
     }
=20
     public <E extends BusinessEntity> PagedResult<E> findAllByCriteria(
             Class<E> clazz, Criteria criteria) {
=20
-        PagedResult<E> result =3D mainProxy.findAllByCriteria(clazz, criteri=
a);=20
-       =20
-       =20
-        if (isFallbackService()) {
+        PagedResult<E> result =3D mainProxy.findAllByCriteria(clazz, criteri=
a);
+
+        // PagedResult<String> result =3D mainProxy.findAllIdByCriteria(crit=
eria);
+
+        int resultSizeExpected =3D criteria.getEndIndex()
+                - criteria.getFirstIndex();
+        if (isFallbackService() && result.size() < resultSizeExpected) {
+            // if result empty, just put the result of the fallback's request
+            // result
+
             /*
-             * TODO mfortun-2011-05-16 algo
-             *=20
-             * search id on the main,
-             * search id on the fallback
-             * fallbackid-mainid
-             *=20
-             * restore id from fallback
-             * complete pagedresult=20
-             *=20
-             *=20
-             *
+             * rebuild the criteria to search properly on the second service=
 we
+             * search for wikitty not in the same position, but in the begin=
ning
              */
-           =20
+            Criteria critFallback =3D Search.query(criteria).criteria();
+            critFallback.setFirstIndex(0);
+            critFallback.setEndIndex(criteria.getEndIndex()
+                    - criteria.getFirstIndex());
+
+            if (result.size() =3D=3D 0) {
+
+                result =3D fallbackProxy.findAllByCriteria(clazz, critFallba=
ck);
+                // rebuild the result to match the expected criteria
+                result =3D new PagedResult<E>(criteria.getFirstIndex(),
+                        result.getNumFound(), criteria.toString(),
+                        result.getFacets(), result.getAll());
+            } else {
+
+                PagedResult<String> idFromMain =3D mainProxy
+                        .findAllIdByCriteria(criteria);
+
+                /*
+                 * we will search to complete the result with id from the
+                 * fallback service so we reduce the number of element reque=
sted
+                 * on the fallback service and we add a restriction on wikit=
ty
+                 * id to exclude id already in the first part of the result
+                 *=20
+                 * it not assume that wikitty id found does not exist on the
+                 * first part of a criteria, for example if first index where
+                 * 12, nothing assure that we found wikitty in the fall back
+                 * that aren't in the 11 first wikitty of the main service
+                 */
+                Criteria excluding =3D idNotInCriteriaConstructor(critFallba=
ck,
+                        idFromMain.getAll());
+
+                excluding.setEndIndex(resultSizeExpected - result.size());
+
+                PagedResult<E> resultFallback =3D fallbackProxy
+                        .findAllByCriteria(clazz, excluding);
+
+                List<E> allresult =3D result.getAll();
+                allresult.addAll(resultFallback.getAll());
+                int number =3D result.getNumFound()
+                        + resultFallback.getNumFound();
+
+                result =3D new PagedResult<E>(criteria.getFirstIndex(), numb=
er,
+                        criteria.toString(), result.getFacets(), allresult);
+            }
         }
-       =20
-       =20
-       =20
+
         return result;
     }
=20
     public <E extends BusinessEntity> PagedResult<E>[] findAllByCriteria(
             Class<E> clazz, Criteria c1, Criteria c2, Criteria... otherCrite=
ria) {
-       =20
+
         List<Criteria> criterias =3D new ArrayList<Criteria>();
         criterias.add(c1);
         criterias.add(c2);
         CollectionUtil.addAll(criterias, otherCriteria);
-       =20
+
         // deleguate to easily handle multicontext
-        return (PagedResult<E>[]) this.findAllByCriteria(clazz, criterias).t=
oArray();
+        return (PagedResult<E>[]) this.findAllByCriteria(clazz, criterias)
+                .toArray();
     }
=20
     public List<PagedResult<Wikitty>> findAllByCriteria(List<Criteria> crite=
ria) {
-        return mainProxy.findAllByCriteria(criteria);
+
+        List<PagedResult<Wikitty>> result =3D mainProxy
+                .findAllByCriteria(criteria);
+
+        if (isFallbackService()) {
+
+            for (int i =3D 0; i < result.size(); i++) {
+
+                /*
+                 * get the curent criteria and corresponding result to check=
 if
+                 * the expected number of result is match
+                 */
+                Criteria currentCrit =3D criteria.get(i);
+                PagedResult<Wikitty> currentResult =3D result.get(i);
+
+                int resultSizeExpected =3D currentCrit.getEndIndex()
+                        - currentCrit.getFirstIndex();
+                if (currentResult.size() < resultSizeExpected) {
+                    /*
+                     * if result empty, just put the result of the fallback's
+                     * requestresult
+                     */
+
+                    /*
+                     * rebuild the criteria to search properly on the second
+                     * service we search for wikitty not in the same positio=
n,
+                     * but in the beginning
+                     */
+                    Criteria critFallback =3D Search.query(currentCrit)
+                            .criteria();
+                    critFallback.setFirstIndex(0);
+                    critFallback.setEndIndex(currentCrit.getEndIndex()
+                            - currentCrit.getFirstIndex());
+
+                    if (result.size() =3D=3D 0) {
+
+                        PagedResult<Wikitty> tempPagedResult =3D fallbackPro=
xy
+                                .findAllByCriteria(critFallback);
+
+                        // rebuild the result to match the expected criteria
+                        tempPagedResult =3D new PagedResult<Wikitty>(
+                                currentCrit.getFirstIndex(),
+                                tempPagedResult.getNumFound(),
+                                currentCrit.toString(),
+                                tempPagedResult.getFacets(),
+                                tempPagedResult.getAll());
+
+                        result.set(i, tempPagedResult);
+                    } else {
+
+                        /*
+                         * we will search to complete the result with id from
+                         * the fallback service so we reduce the number of
+                         * element requested on the fallback service and we =
add
+                         * a restriction on wikitty id to exclude id already=
 in
+                         * the first part of the result
+                         *=20
+                         * it not assume that wikitty id found does not exis=
t on
+                         * the first part of a criteria, for example if first
+                         * index where 12, nothing assure that we found wiki=
tty
+                         * in the fall back that aren't in the 11 first wiki=
tty
+                         * of the main service
+                         */
+                        PagedResult<String> idFromMain =3D mainProxy
+                                .findAllIdByCriteria(currentCrit);
+
+                        Criteria excluding =3D idNotInCriteriaConstructor(
+                                critFallback, idFromMain.getAll());
+
+                        excluding.setEndIndex(resultSizeExpected
+                                - result.size());
+
+                        PagedResult<Wikitty> resultFallback =3D fallbackProxy
+                                .findAllByCriteria(excluding);
+
+                        List<Wikitty> allresult =3D currentResult.getAll();
+                        allresult.addAll(resultFallback.getAll());
+                        int number =3D currentResult.getNumFound()
+                                + resultFallback.getNumFound();
+
+                        // rebuilt the result
+                        PagedResult<Wikitty> tempPagedResult =3D new PagedRe=
sult<Wikitty>(
+                                currentCrit.getFirstIndex(), number,
+                                currentCrit.toString(),
+                                currentResult.getFacets(), allresult);
+                        // re set the result in the list
+                        result.set(i, tempPagedResult);
+                    }
+                }
+
+            }
+        }
+
+        return result;
+
     }
=20
     public PagedResult<Wikitty> findAllByCriteria(Criteria criteria) {
-        return mainProxy.findAllByCriteria(criteria);
+
+        PagedResult<Wikitty> result =3D mainProxy.findAllByCriteria(criteria=
);
+
+        // PagedResult<String> result =3D mainProxy.findAllIdByCriteria(crit=
eria);
+
+        int resultSizeExpected =3D criteria.getEndIndex()
+                - criteria.getFirstIndex();
+        if (isFallbackService() && result.size() < resultSizeExpected) {
+            // if result empty, just put the result of the fallback's request
+            // result
+
+            /*
+             * rebuild the criteria to search properly on the second service=
 we
+             * search for wikitty not in the same position, but in the begin=
ning
+             */
+            Criteria critFallback =3D Search.query(criteria).criteria();
+            critFallback.setFirstIndex(0);
+            critFallback.setEndIndex(criteria.getEndIndex()
+                    - criteria.getFirstIndex());
+
+            if (result.size() =3D=3D 0) {
+
+                result =3D fallbackProxy.findAllByCriteria(critFallback);
+                // rebuild the result to match the expected criteria
+                result =3D new PagedResult<Wikitty>(criteria.getFirstIndex(),
+                        result.getNumFound(), criteria.toString(),
+                        result.getFacets(), result.getAll());
+            } else {
+
+                PagedResult<String> idFromMain =3D mainProxy
+                        .findAllIdByCriteria(criteria);
+
+                /*
+                 * we will search to complete the result with id from the
+                 * fallback service so we reduce the number of element reque=
sted
+                 * on the fallback service and we add a restriction on wikit=
ty
+                 * id to exclude id already in the first part of the result
+                 *=20
+                 * it not assume that wikitty id found does not exist on the
+                 * first part of a criteria, for example if first index where
+                 * 12, nothing assure that we found wikitty in the fall back
+                 * that aren't in the 11 first wikitty of the main service
+                 */
+                Criteria excluding =3D idNotInCriteriaConstructor(critFallba=
ck,
+                        idFromMain.getAll());
+
+                excluding.setEndIndex(resultSizeExpected - result.size());
+
+                PagedResult<Wikitty> resultFallback =3D fallbackProxy
+                        .findAllByCriteria(excluding);
+
+                List<Wikitty> allresult =3D result.getAll();
+                allresult.addAll(resultFallback.getAll());
+                int number =3D result.getNumFound()
+                        + resultFallback.getNumFound();
+
+                result =3D new PagedResult<Wikitty>(criteria.getFirstIndex(),
+                        number, criteria.toString(), result.getFacets(),
+                        allresult);
+            }
+        }
+
+        return result;
+
     }
=20
     public PagedResult<Wikitty>[] findAllByCriteria(Criteria c1, Criteria c2,
             Criteria... otherCriteria) {
-       =20
+
         List<Criteria> criterias =3D new ArrayList<Criteria>();
         criterias.add(c1);
         criterias.add(c2);
         CollectionUtil.addAll(criterias, otherCriteria);
-       =20
+
         // deleguate to easily handle multicontext
-        return (PagedResult<Wikitty>[]) this.findAllByCriteria(criterias).to=
Array();
+        return (PagedResult<Wikitty>[]) this.findAllByCriteria(criterias)
+                .toArray();
     }
=20
     public List<PagedResult<String>> findAllIdByCriteria(List<Criteria> crit=
eria) {
-        return mainProxy.findAllIdByCriteria(criteria);
+
+        List<PagedResult<String>> result =3D mainProxy
+                .findAllIdByCriteria(criteria);
+
+        if (isFallbackService()) {
+
+            for (int i =3D 0; i < result.size(); i++) {
+
+                /*
+                 * get the curent criteria and corresponding result to check=
 if
+                 * the expected number of result is match
+                 */
+                Criteria currentCrit =3D criteria.get(i);
+                PagedResult<String> currentResult =3D result.get(i);
+
+                int resultSizeExpected =3D currentCrit.getEndIndex()
+                        - currentCrit.getFirstIndex();
+                if (currentResult.size() < resultSizeExpected) {
+                    /*
+                     * if result empty, just put the result of the fallback's
+                     * requestresult
+                     */
+
+                    /*
+                     * rebuild the criteria to search properly on the second
+                     * service we search for wikitty not in the same positio=
n,
+                     * but in the beginning
+                     */
+                    Criteria critFallback =3D Search.query(currentCrit)
+                            .criteria();
+                    critFallback.setFirstIndex(0);
+                    critFallback.setEndIndex(currentCrit.getEndIndex()
+                            - currentCrit.getFirstIndex());
+
+                    if (result.size() =3D=3D 0) {
+
+                        PagedResult<String> tempPagedResult =3D fallbackProxy
+                                .findAllIdByCriteria(critFallback);
+
+                        // rebuild the result to match the expected criteria
+                        tempPagedResult =3D new PagedResult<String>(
+                                currentCrit.getFirstIndex(),
+                                tempPagedResult.getNumFound(),
+                                currentCrit.toString(),
+                                tempPagedResult.getFacets(),
+                                tempPagedResult.getAll());
+
+                        result.set(i, tempPagedResult);
+                    } else {
+
+                        /*
+                         * we will search to complete the result with id from
+                         * the fallback service so we reduce the number of
+                         * element requested on the fallback service and we =
add
+                         * a restriction on wikitty id to exclude id already=
 in
+                         * the first part of the result
+                         *=20
+                         * it not assume that wikitty id found does not exis=
t on
+                         * the first part of a criteria, for example if first
+                         * index where 12, nothing assure that we found wiki=
tty
+                         * in the fall back that aren't in the 11 first wiki=
tty
+                         * of the main service
+                         */
+                        Criteria excluding =3D idNotInCriteriaConstructor(
+                                critFallback, currentResult.getAll());
+
+                        excluding.setEndIndex(resultSizeExpected
+                                - result.size());
+
+                        PagedResult<String> resultFallback =3D fallbackProxy
+                                .findAllIdByCriteria(excluding);
+
+                        List<String> allresult =3D currentResult.getAll();
+                        allresult.addAll(resultFallback.getAll());
+                        int number =3D currentResult.getNumFound()
+                                + resultFallback.getNumFound();
+
+                        // rebuilt the result
+                        PagedResult<String> tempPagedResult =3D new PagedRes=
ult<String>(
+                                currentCrit.getFirstIndex(), number,
+                                currentCrit.toString(),
+                                currentResult.getFacets(), allresult);
+                        // re set the result in the list
+                        result.set(i, tempPagedResult);
+                    }
+                }
+
+            }
+        }
+
+        return result;
+
     }
=20
     public PagedResult<String> findAllIdByCriteria(Criteria criteria) {
-        return mainProxy.findAllIdByCriteria(criteria);
+
+        PagedResult<String> result =3D mainProxy.findAllIdByCriteria(criteri=
a);
+
+        int resultSizeExpected =3D criteria.getEndIndex()
+                - criteria.getFirstIndex();
+        if (isFallbackService() && result.size() < resultSizeExpected) {
+            // if result empty, just put the result of the fallback's request
+            // result
+
+            /*
+             * rebuild the criteria to search properly on the second service=
 we
+             * search for wikitty not in the same position, but in the begin=
ning
+             */
+            Criteria critFallback =3D Search.query(criteria).criteria();
+            critFallback.setFirstIndex(0);
+            critFallback.setEndIndex(criteria.getEndIndex()
+                    - criteria.getFirstIndex());
+
+            if (result.size() =3D=3D 0) {
+
+                result =3D fallbackProxy.findAllIdByCriteria(critFallback);
+                // rebuild the result to match the expected criteria
+                result =3D new PagedResult<String>(criteria.getFirstIndex(),
+                        result.getNumFound(), criteria.toString(),
+                        result.getFacets(), result.getAll());
+            } else {
+
+                /*
+                 * we will search to complete the result with id from the
+                 * fallback service so we reduce the number of element reque=
sted
+                 * on the fallback service and we add a restriction on wikit=
ty
+                 * id to exclude id already in the first part of the result
+                 *=20
+                 * it not assume that wikitty id found does not exist on the
+                 * first part of a criteria, for example if first index where
+                 * 12, nothing assure that we found wikitty in the fall back
+                 * that aren't in the 11 first wikitty of the main service
+                 */
+                Criteria excluding =3D idNotInCriteriaConstructor(critFallba=
ck,
+                        result.getAll());
+
+                excluding.setEndIndex(resultSizeExpected - result.size());
+
+                PagedResult<String> resultFallback =3D fallbackProxy
+                        .findAllIdByCriteria(excluding);
+
+                List<String> allresult =3D result.getAll();
+                allresult.addAll(resultFallback.getAll());
+                int number =3D result.getNumFound()
+                        + resultFallback.getNumFound();
+
+                result =3D new PagedResult<String>(criteria.getFirstIndex(),
+                        number, criteria.toString(), result.getFacets(),
+                        allresult);
+            }
+        }
+
+        return result;
     }
=20
     public PagedResult<String>[] findAllIdByCriteria(Criteria c1, Criteria c=
2,
             Criteria... otherCriteria) {
-       =20
-       =20
+
         List<Criteria> criterias =3D new ArrayList<Criteria>();
         criterias.add(c1);
         criterias.add(c2);
         CollectionUtil.addAll(criterias, otherCriteria);
-       =20
+
         // deleguate to easily handle multicontext
-        return (PagedResult<String>[]) this.findAllIdByCriteria( criterias).=
toArray();
+        return (PagedResult<String>[]) this.findAllIdByCriteria(criterias)
+                .toArray();
     }
=20
     public List<String> findIdByCriteria(List<Criteria> criteria) {
=20
         List<String> result =3D mainProxy.findIdByCriteria(criteria);
=20
+        // TODO mfortun-2011-05-17 reform criteria
+
         if (isFallbackService()) {
+           =20
+           =20
+           =20
             if (result =3D=3D null) {
                 result =3D fallbackProxy.findIdByCriteria(criteria);
             } else {
@@ -973,4 +1463,19 @@
         return result;
     }
=20
+    protected Criteria idNotInCriteriaConstructor(Criteria origin,
+            List<String> toExclude) {
+        Criteria result =3D null;
+
+        Search search =3D Search.query(origin);
+
+        for (String id : toExclude) {
+            search.idneq(id);
+        }
+
+        result =3D search.criteria();
+
+        return result;
+    }
+
 }


--===============2887464391440314945==--


