incubator-graffito-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clomb...@apache.org
Subject svn commit: r225704 [2/2] - in /incubator/graffito/trunk/components/src/java/org/apache/portals/graffito: services/ services/core/ services/core/impl/ services/dm/ services/dm/impl/ services/search/ services/search/impl/ store/impl/ojb/
Date Thu, 28 Jul 2005 05:43:59 GMT
Added: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/services/search/impl/FilterImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/services/search/impl/FilterImpl.java?rev=225704&view=auto
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/services/search/impl/FilterImpl.java
(added)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/services/search/impl/FilterImpl.java
Wed Jul 27 22:43:51 2005
@@ -0,0 +1,220 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * 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.apache.portals.graffito.services.search.impl;
+
+import java.util.Collection;
+
+import org.apache.ojb.broker.query.Criteria;
+import org.apache.portals.graffito.services.search.Filter;
+
+
+
+/**
+ *
+ * Wraps an <code>org.apache.ojb.broker.query.Criteria</code> object
+ * to provide the required functionallity for implementing <code>Filter</code>
+ * interface. 
+ * 
+ * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ * 
+ */
+public class FilterImpl implements Filter
+{
+    private Criteria criteria;
+    private String fullTextSearch; 
+    private String field = null;
+    private String scope;
+
+    /**
+     * @see org.apache.portals.graffito.search.Filter#addFullTextSearch(java.lang.String)
+     */
+    public void addFullTextSearch(String fullTextSearch)
+    {
+        this.fullTextSearch = fullTextSearch;
+    }
+
+    /**
+     * @see org.apache.portals.graffito.search.Filter#addFullTextSearch(java.lang.String)
+     */
+    public void addFullTextSearch(String fullTextSearch, String field)
+    {
+        this.fullTextSearch = fullTextSearch;
+        this.field = field;
+    }
+
+    
+    public FilterImpl()
+    {
+        criteria = new Criteria();                 
+    }
+    
+           
+    /**
+     * @see org.apache.portals.graffito.search.Filter#getScope()
+     */
+    public String getScope()
+    {        
+        return scope;
+    }
+    
+    /**
+     * @see org.apache.portals.graffito.search.Filter#setScope(java.lang.String)
+     */
+    public void setScope(String scope)
+    {
+        this.scope = scope;
+    }
+    /**
+     * @see org.apache.ojb.broker.query.Criteria#addBetween(java.lang.String, java.lang.Object,
java.lang.Object)
+     */
+    public void addBetween(String arg0, Object arg1, Object arg2)
+    {
+
+        criteria.addBetween(arg0, arg1, arg2);
+    }
+
+    /**
+     * @see org.apache.ojb.broker.query.Criteria#addEqualTo(java.lang.String, java.lang.Object)
+     */
+    public void addEqualTo(String arg0, Object arg1)
+    {
+        criteria.addEqualTo(arg0, arg1);
+    }
+
+    /**
+     * @see org.apache.ojb.broker.query.Criteria#addGreaterOrEqualThan(java.lang.String,
java.lang.Object)
+     */
+    public void addGreaterOrEqualThan(String arg0, Object arg1)
+    {
+        criteria.addGreaterOrEqualThan(arg0, arg1);
+    }
+
+    /**
+     * @see org.apache.ojb.broker.query.Criteria#addGreaterThan(java.lang.String, java.lang.Object)
+     */
+    public void addGreaterThan(String arg0, Object arg1)
+    {
+        criteria.addGreaterThan(arg0, arg1);
+    }
+    
+    /**
+     * @see org.apache.ojb.broker.query.Criteria#addIn(java.lang.String, java.util.Collection)
+     */      
+    public void addIn(String arg0, Collection arg1)
+    {
+        criteria.addIn(arg0, arg1);
+    }
+    
+    /**
+     * @see org.apache.ojb.broker.query.Criteria#addLessOrEqualThan(java.lang.String, java.lang.Object)
+     */
+    public void addLessOrEqualThan(String arg0, Object arg1)
+    {
+        criteria.addLessOrEqualThan(arg0, arg1);
+    }
+
+    /**
+     * @see org.apache.ojb.broker.query.Criteria#addLike(java.lang.Object, java.lang.Object)
+     */
+    public void addLike(Object arg0, Object arg1)
+    {
+        criteria.addLike((String)arg0, arg1);
+    }
+
+    /**
+     * @see org.apache.ojb.broker.query.Criteria#addNotBetween(java.lang.String, java.lang.Object,
java.lang.Object)
+     */
+    public void addNotBetween(String arg0, Object arg1, Object arg2)
+    {
+        criteria.addNotBetween(arg0, arg1, arg2);
+    }
+
+    /**
+     * @see org.apache.ojb.broker.query.Criteria#addNotEqualTo(java.lang.String, java.lang.Object)
+     */
+    public void addNotEqualTo(String arg0, Object arg1)
+    {
+        criteria.addNotEqualTo(arg0, arg1);
+    }
+
+    /**
+     * @see org.apache.ojb.broker.query.Criteria#addNotLike(java.lang.String, java.lang.Object)
+     */
+    public void addNotLike(String arg0, Object arg1)
+    {
+        criteria.addNotLike(arg0, arg1);
+    }
+
+    /**
+     * @see org.apache.ojb.broker.query.Criteria#addNotNull(java.lang.String)
+     */
+    public void addNotNull(String arg0)
+    {
+        criteria.addNotNull(arg0);        
+    }
+       
+    /**
+     * @see org.apache.portals.graffito.search.Filter#addIsNull(java.lang.String)
+     */
+    public void addIsNull(String arg0)
+    {
+        criteria.addIsNull(arg0);
+    }
+    
+    /**
+     * @see org.apache.ojb.broker.query.Criteria#addOrCriteria(org.apache.ojb.broker.query.Criteria)
+     */
+    public void addOrFilter(Filter arg0)
+    {
+        
+        criteria.addOrCriteria(((FilterImpl)arg0).getCriteria());        
+    }
+
+    /**
+     * @see org.apache.ojb.broker.query.Criteria#addOrderByAscending(java.lang.String)
+     */
+    public void addOrderByAscending(String arg0)
+    {
+        criteria.addOrderByAscending(arg0);
+    }
+
+    /**
+     * @see org.apache.ojb.broker.query.Criteria#addOrderByDescending(java.lang.String)
+     */
+    public void addOrderByDescending(String arg0)
+    {
+        criteria.addOrderByDescending(arg0);
+    }
+
+    public Criteria getCriteria()
+    {
+        
+        return criteria;
+    }
+    
+  
+    public String getFullTextSearch()
+    {
+        return this.fullTextSearch;
+    }
+    
+    public String getSearchField()
+    {
+        return this.field;
+    }
+   
+}

Added: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/ojb/OjbCmsPropertyCollection.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/ojb/OjbCmsPropertyCollection.java?rev=225704&view=auto
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/ojb/OjbCmsPropertyCollection.java
(added)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/ojb/OjbCmsPropertyCollection.java
Wed Jul 27 22:43:51 2005
@@ -0,0 +1,83 @@
+/* Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.apache.portals.graffito.store.impl.ojb;
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.ojb.broker.ManageableCollection;
+import org.apache.ojb.broker.PersistenceBroker;
+import org.apache.ojb.broker.PersistenceBrokerException;
+import org.apache.portals.graffito.model.core.impl.PropertyImpl;
+
+/**
+ * This class is used by GraffitoOJBStore (ojb implementation) in order to store CmsObject
properties in a Map.
+ * @see org.apache.portals.graffito.model.core.impl.CmsObjectImpl#getProperties()
+ * 
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart<a>
+ * @version $Id: OjbSecureArrayList.java,v 1.1 2004/12/22 20:37:00 christophe Exp $
+ */
+public class OjbCmsPropertyCollection implements ManageableCollection, Serializable
+{
+    
+    private HashMap properties = new HashMap();
+    
+    /**     
+     * @see org.apache.ojb.broker.ManageableCollection#ojbAdd(java.lang.Object)
+     */     
+    public void ojbAdd(Object object)
+    {
+        PropertyImpl property = (PropertyImpl) object;
+        properties.put(property.getName(), property);
+    }
+
+    /**
+     * @see org.apache.ojb.broker.ManageableCollection#ojbAddAll(org.apache.ojb.broker.ManageableCollection)
+     */
+    public void ojbAddAll(ManageableCollection otherCollection)
+    {
+        Iterator iterator = otherCollection.ojbIterator();
+        while (iterator.hasNext())
+        {
+            Object object = iterator.next();
+            this.ojbAdd(object);
+        }
+        
+    }
+    
+    /**
+     * 
+     * @see org.apache.ojb.broker.ManageableCollection#afterStore(org.apache.ojb.broker.PersistenceBroker)
+     */
+    public void afterStore(PersistenceBroker broker) throws PersistenceBrokerException
+    {
+        //do nothing
+    }
+
+    /**
+     * @see org.apache.ojb.broker.ManageableCollection#ojbIterator()
+     */
+    public Iterator ojbIterator()
+    {
+        return properties.values().iterator();
+    }
+    
+    public Map getProperties()
+    {
+      return properties;   
+    }
+}



Mime
View raw message