How to use created date??

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2007 04:15 AM
Hi,
I need to use the created date of the document to compare it with other date. I use the next
QName fechaComision = QName.createQName("my.new.model", "fecha");
, but I dont know attributes that I need to create QName of created date.
Sorry for my english
I need to use the created date of the document to compare it with other date. I use the next
QName fechaComision = QName.createQName("my.new.model", "fecha");
, but I dont know attributes that I need to create QName of created date.
Sorry for my english
Labels:
- Labels:
-
Archive
2 REPLIES 2

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2007 07:41 AM
This is my implementation
QName fechaComision = QName.createQName("my.new.model", "fecha");
QName fechaCreacion = ContentModel.PROP_ARCHIVED_DATE;
Map propiedades = this.nodeService.getProperties(actionedUponNodeRef);
Date fechaCo = (Date)propiedades.get(fechaComision);
Date fechaCre = (Date)propiedades.get(fechaCreacion);
//Date fechaCo=(Date)this.nodeService.getProperty(actionedUponNodeRef, fechaComision);
//Date fechaCre=(Date)this.nodeService.getProperty(actionedUponNodeRef, fechaCreacion);
System.out.println(fechaCo.toString());
System.out.println(fechaCre.toString());
long time = fechaCo.getTime() - fechaCre.getTime();
// Muestro el resultado en dÃÂas
int dias=(int)(time/(3600*24*1000));
if (dias<7)
{
this.nodeService.setProperty(actionedUponNodeRef, fechaComision, fechaCre);
}
The error is in System.out.println(fechaCre.toString()); , but I dont know why. I think that the bad line is this
QName fechaCreacion = ContentModel.PROP_ARCHIVED_DATE;
QName fechaComision = QName.createQName("my.new.model", "fecha");
QName fechaCreacion = ContentModel.PROP_ARCHIVED_DATE;
Map propiedades = this.nodeService.getProperties(actionedUponNodeRef);
Date fechaCo = (Date)propiedades.get(fechaComision);
Date fechaCre = (Date)propiedades.get(fechaCreacion);
//Date fechaCo=(Date)this.nodeService.getProperty(actionedUponNodeRef, fechaComision);
//Date fechaCre=(Date)this.nodeService.getProperty(actionedUponNodeRef, fechaCreacion);
System.out.println(fechaCo.toString());
System.out.println(fechaCre.toString());
long time = fechaCo.getTime() - fechaCre.getTime();
// Muestro el resultado en dÃÂas
int dias=(int)(time/(3600*24*1000));
if (dias<7)
{
this.nodeService.setProperty(actionedUponNodeRef, fechaComision, fechaCre);
}
The error is in System.out.println(fechaCre.toString()); , but I dont know why. I think that the bad line is this
QName fechaCreacion = ContentModel.PROP_ARCHIVED_DATE;

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2007 10:12 AM
Resolved problem, the problem is that I was confused, which was searching was not PROP_ARCHIVED_DATE, but what was looking age for the property "cm:created" of the aspect auditable, therefore only I have had to change the line
QName fechaCreacion = ContentModel. PROP_ARCHIVED_DATE;
For this other one
QName fechaCreacion = QName.createQName (" http://www.alfresco.org/model/content/1.0 ", "created");
I hope that this can serve someone in a future.
QName fechaCreacion = ContentModel. PROP_ARCHIVED_DATE;
For this other one
QName fechaCreacion = QName.createQName (" http://www.alfresco.org/model/content/1.0 ", "created");
I hope that this can serve someone in a future.
