jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tobias Bocanegra" <tobias.bocane...@day.com>
Subject Re: Assign null to a Date property
Date Fri, 23 May 2008 19:40:31 GMT
hi,
you can't set null to a property. but you can remove it. so you code would be:

// reading the property:

Calendar date = null;
if (node.hasProperty("xyz")) {
  date = node.getProperty("xyz").getDate();
}

// writing the property:
if (date == null) {
  if (node.hasProperty("xyz")) {
    node.getProperty("xyz").remove();
  }
} else {
   node.setProperty("xyz", date);
}
node.save();

regards, toby


On 5/23/08, hsp_ <piccinatto@ibest.com.br> wrote:
>
>  Hi;
>  How I could assign null or blank value into a Date property?
>  For ex: I have a property that not necessary I put a value in the creation
>  of node, so at this point it is null. In other situation I get this node and
>  put some date value into the property, and this node will return in some
>  searchs. I need in some situations to clear the date in the date property of
>  the node, how?
>
>  Tks.
>
> --
>  View this message in context: http://www.nabble.com/Assign-null-to-a-Date-property-tp17430211p17430211.html
>  Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>
>

Mime
View raw message