GithubHelp home page GithubHelp logo

Comments (10)

ioggstream avatar ioggstream commented on May 28, 2024 1

~9yrs ago... we can close as stale

from caldav4j.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 28, 2024
Hi Pascal,

how do you think to implement it? can you write a sample caldav-query?
Peace, R.

Original comment by [email protected] on 25 Mar 2008 at 2:26

  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect

from caldav4j.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 28, 2024
Hi guys,

I also faced the same problem. 
For the while, I just loop on all the calendars for a time-range and look up 
for the
good SENT_BY...Very inefficient I know :(

Generate such a query would be great.

<?xml version="1.0" encoding="utf-8" ?>
   <C:calendar-query xmlns:C="urn:ietf:params:xml:ns:caldav">
     <D:prop xmlns:D="DAV:">
       <D:getetag/>
       <C:calendar-data/>
     </D:prop>
     <C:filter>
       <C:comp-filter name="VCALENDAR">
         <C:comp-filter name="VEVENT">
           <C:prop-filter name="SENT-BY">
             <C:text-match collation="i;ascii-casemap">
              mailto:[email protected]
             </C:text-match>
           </C:prop-filter>
         </C:comp-filter>
       </C:comp-filter>
     </C:filter>
   </C:calendar-query>


Original comment by cteaudaxis on 11 Aug 2009 at 8:45

from caldav4j.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 28, 2024
did you try with GenerateQuery ?

Original comment by [email protected] on 17 Aug 2009 at 2:36

from caldav4j.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 28, 2024
[deleted comment]

from caldav4j.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 28, 2024
In fact, I made a mistake. In the above query, "SENT-BY" is not a Property, but 
a
Paramerter of "ORGANIZER". So the query should look like 

<?xml version="1.0" encoding="utf-8" ?>
   <C:calendar-query xmlns:C="urn:ietf:params:xml:ns:caldav">
     <D:prop xmlns:D="DAV:">
       <D:getetag/>
       <C:calendar-data/>
     </D:prop>
     <C:filter>
       <C:comp-filter name="VCALENDAR">
         <C:comp-filter name="VEVENT">
           <C:prop-filter name="ORGANIZER">
             <C:param-filter name="SENT-BY">
               <C:text-match collation="i;ascii-casemap">
                 mailto:[email protected]
               </C:text-match>
             </C:param-filter>
           </C:prop-filter>
         </C:comp-filter>
       </C:comp-filter>
     </C:filter>
   </C:calendar-query>

I tried to use GenerateQuery as advised, but there is no getter/setter into 
Class
ParamFilter for the variable "name"...Is it missing ? If I have this, I can 
create
the necessary "ParamFilter".


Original comment by cteaudaxis on 18 Aug 2009 at 10:15

from caldav4j.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 28, 2024
It seems it's missing. Can you create a test method ParamFilterTest too?

LetMeKnow+Peace,
R.

Original comment by [email protected] on 24 Aug 2009 at 9:54

  • Changed state: Accepted

from caldav4j.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 28, 2024
I don't really know where/how to commit (what is my login ? cteaudaxis not 
working).

Nevertheless, after adding the getter and setter for name, this is the method I 
use,
that can be used as ParamFilterTest:

 /**
   * 
   * @param property The Property name to query (i.e: Property.ORGANIZER)
   * @param param The Parameter to query (i.e: Parameter.SENT-BY)
   * @param textToMatch (i.e: "mailto:[email protected]")
   * @return <p>A query matching a given text for the given Property or Parameter of
a VEVENT 
   * (With priority to the parameter if provided !)</p>
   */

protected CalendarQuery getQueryForPropertyAndParameter(String property, String
param, String textToMatch){
         CalendarQuery query  = null;
         try {
             //Generate a basic query
             GenerateQuery genQuery = new GenerateQuery();
             genQuery.setFilterComponent(Component.VEVENT);
             query  = genQuery.generateQuery();
             CompFilter vEventCompFilter = query.getCompFilter();

             //Create the Property Filter with text match to add
             PropFilter propFilter = new PropFilter("C");
             propFilter.setName(property);
             if(!StringUtils.isEmpty(param)){
                 ParamFilter paramFilter = new ParamFilter("C");
                 paramFilter.setName(param);
                 paramFilter.setTextMatch(new TextMatch("C", null, null, null, textToMatch));
                 propFilter.addParamFilter(paramFilter);
             }else{
                 //filter on property if parameter is empty
                 propFilter.setTextMatch(new TextMatch("C", null, null, null, textToMatch));
             }

             //Add the Property filter
             vEventCompFilter.addPropFilter(propFilter);
             query.setCompFilter(vEventCompFilter);

             //Print the query
             //System.out.println(GenerateQuery.printQuery(query));
         }
         catch (CalDAV4JException e) {
             log.error(e.getMessage());
         }

         return query;
     }

Original comment by cteaudaxis on 24 Aug 2009 at 12:24

from caldav4j.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 28, 2024
thx! I'll put something like that in the GenerateQuery test. 
The game is just add getter/setter and create ae ParamFilterTest like

public class ParamFilterTest {

... testSimpleConstructor() {
 ParamFilter p = new ParamFilter("C");
 p.validate();
 }

.. testSetter() {
 ParamFilter p = new ParamFilter("C");
 p.setName("newname");
 p.validate();

 }
}


if you like to join the project you should start with posting junit+patch to 
caldav4j 
list.


Original comment by [email protected] on 24 Aug 2009 at 1:14

from caldav4j.

TheAntimist avatar TheAntimist commented on May 28, 2024

@ioggstream Any inputs?

from caldav4j.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.