Updating hook
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry-orientdb-hooks@130938 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0c68a9601c
commit
96a6e69f7d
|
@ -3,6 +3,9 @@
|
|||
*/
|
||||
package org.gcube.informationsystem.orientdb.hooks;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.informationsystem.model.entity.Entity;
|
||||
|
@ -64,10 +67,11 @@ public class HeaderHook<OrientGraphNoTx> extends ODocumentHookAbstract
|
|||
System.out.println("Creator is unknown setting as : " + org.gcube.informationsystem.model.embedded.Header.UNKNOWN_USER);
|
||||
header.setCreator(org.gcube.informationsystem.model.embedded.Header.UNKNOWN_USER);
|
||||
|
||||
long timestamp = System.currentTimeMillis();
|
||||
System.out.println("Setting Last Update and Creation Time to " + timestamp);
|
||||
header.setCreationTime(timestamp);
|
||||
header.setLastUpdateTime(timestamp);
|
||||
Date date = Calendar.getInstance().getTime();
|
||||
SimpleDateFormat ft = new SimpleDateFormat ("E yyyy.MM.dd 'at' hh:mm:ss a zzz");
|
||||
System.out.println("Setting Last Update and Creation Time to " + ft.format(date));
|
||||
header.setCreationTime(date);
|
||||
header.setLastUpdateTime(date);
|
||||
|
||||
System.out.println("Setting newly create header " + header);
|
||||
iDocument.field(Entity.HEADER_PROPERTY, header);
|
||||
|
@ -85,7 +89,7 @@ public class HeaderHook<OrientGraphNoTx> extends ODocumentHookAbstract
|
|||
ODocument oDocument = iDocument.field(Entity.HEADER_PROPERTY);
|
||||
long timestamp = System.currentTimeMillis();
|
||||
System.out.println("Updating Last Update Time in header of " + iDocument + " to " + timestamp);
|
||||
oDocument.field(Header.LAST_UPDATE_TIME_PROPERTY, timestamp);
|
||||
oDocument.field(org.gcube.informationsystem.model.embedded.Header.LAST_UPDATE_TIME_PROPERTY, timestamp);
|
||||
|
||||
System.out.println("Updated Document is " + iDocument);
|
||||
|
||||
|
|
Loading…
Reference in New Issue