airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject [1/8] airavata git commit: fixing creation time and modified time issue
Date Mon, 14 Dec 2015 16:05:42 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 55a1053a5 -> d3a5a5ea6


fixing creation time and modified time issue


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/305bc044
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/305bc044
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/305bc044

Branch: refs/heads/master
Commit: 305bc04419d8376695dcfe000ad4f2814303e1e9
Parents: 55a1053
Author: scnakandala <supun.nakandala@gmail.com>
Authored: Fri Dec 11 21:41:39 2015 -0500
Committer: scnakandala <supun.nakandala@gmail.com>
Committed: Fri Dec 11 21:41:39 2015 -0500

----------------------------------------------------------------------
 .../registry/core/data/catalog/impl/DataCatalogImpl.java     | 8 ++++++++
 .../registry-core/src/main/resources/datacatalog-mysql.sql   | 8 ++++----
 2 files changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/305bc044/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/impl/DataCatalogImpl.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/impl/DataCatalogImpl.java
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/impl/DataCatalogImpl.java
index dc11f36..3d4e753 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/impl/DataCatalogImpl.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/impl/DataCatalogImpl.java
@@ -52,6 +52,8 @@ public class DataCatalogImpl implements DataCatalog {
                 r.setReplicaId(UUID.randomUUID().toString());
             });
         }
+        resourceModel.setCreationTime(System.currentTimeMillis());
+        resourceModel.setLastModifiedTime(System.currentTimeMillis());
         DataResource dataResource = ThriftDataModelConversion.getDataResource(resourceModel);
         EntityManager em = null;
         try {
@@ -109,6 +111,8 @@ public class DataCatalogImpl implements DataCatalog {
             if(dataResource == null)
                 return false;
             em.getTransaction().begin();
+            resourceModel.setCreationTime(dataResource.getCreationTime().getTime());
+            resourceModel.setLastModifiedTime(System.currentTimeMillis());
             em.merge(ThriftDataModelConversion.getUpdatedDataResource(resourceModel, dataResource));
             em.getTransaction().commit();
             em.close();
@@ -150,6 +154,8 @@ public class DataCatalogImpl implements DataCatalog {
     public String publishReplicaLocation(DataReplicaLocationModel dataReplicaLocationModel)
throws DataCatalogException {
         String replicaId = UUID.randomUUID().toString();
         dataReplicaLocationModel.setReplicaId(replicaId);
+        dataReplicaLocationModel.setCreationTime(System.currentTimeMillis());
+        dataReplicaLocationModel.setLastModifiedTime(System.currentTimeMillis());
         DataReplicaLocation replicaLocation = ThriftDataModelConversion.getDataReplicaLocation(dataReplicaLocationModel);
         EntityManager em = null;
         try {
@@ -207,6 +213,8 @@ public class DataCatalogImpl implements DataCatalog {
             if(dataReplicaLocation == null)
                 return false;
             em.getTransaction().begin();
+            dataReplicaLocationModel.setCreationTime(dataReplicaLocation.getCreationTime().getTime());
+            dataReplicaLocationModel.setLastModifiedTime(System.currentTimeMillis());
             em.merge(ThriftDataModelConversion.getUpdatedDataReplicaLocation(dataReplicaLocationModel,
dataReplicaLocation));
             em.getTransaction().commit();
             em.close();

http://git-wip-us.apache.org/repos/asf/airavata/blob/305bc044/modules/registry/registry-core/src/main/resources/datacatalog-mysql.sql
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/resources/datacatalog-mysql.sql b/modules/registry/registry-core/src/main/resources/datacatalog-mysql.sql
index c453998..0fbbc58 100644
--- a/modules/registry/registry-core/src/main/resources/datacatalog-mysql.sql
+++ b/modules/registry/registry-core/src/main/resources/datacatalog-mysql.sql
@@ -26,8 +26,8 @@ CREATE TABLE DATA_RESOURCE
         RESOURCE_DESCRIPTION VARCHAR (1024),
         OWNER_NAME VARCHAR (255),
         RESOURCE_SIZE INT,
-        CREATION_TIME TIMESTAMP DEFAULT NOW(),
-        LAST_MODIFIED_TIME TIMESTAMP DEFAULT NOW() ON UPDATE NOW(),
+        CREATION_TIME TIMESTAMP,
+        LAST_MODIFIED_TIME TIMESTAMP,
         PRIMARY KEY (RESOURCE_ID)
 );
 
@@ -38,8 +38,8 @@ CREATE TABLE DATA_REPLICA_LOCATION
         REPLICA_NAME VARCHAR (255),
         REPLICA_DESCRIPTION VARCHAR (1024),
         DATA_LOCATIONS VARCHAR (4096),
-        CREATION_TIME TIMESTAMP DEFAULT NOW(),
-        LAST_MODIFIED_TIME TIMESTAMP DEFAULT NOW() ON UPDATE NOW(),
+        CREATION_TIME TIMESTAMP,
+        LAST_MODIFIED_TIME TIMESTAMP,
         PRIMARY KEY (REPLICA_ID),
         FOREIGN KEY (RESOURCE_ID) REFERENCES DATA_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
 );


Mime
View raw message