airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sma...@apache.org
Subject [09/50] airavata git commit: adding sharedCount to entity table
Date Mon, 03 Apr 2017 16:49:42 GMT
adding sharedCount to entity table


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

Branch: refs/heads/master
Commit: c6608d8fe4045dc3cd0543d82f354e64313b367a
Parents: ebc158d
Author: scnakandala <supun.nakandala@gmail.com>
Authored: Thu Mar 16 14:17:11 2017 -0400
Committer: scnakandala <supun.nakandala@gmail.com>
Committed: Thu Mar 16 14:17:11 2017 -0400

----------------------------------------------------------------------
 .../registry/db/entities/EntityEntity.java      |  11 ++
 .../db/repositories/EntityRepository.java       |   5 +-
 .../db/repositories/SharingRepository.java      |  11 ++
 .../sharing/registry/db/utils/DBConstants.java  |   1 +
 .../server/SharingRegistryServerHandler.java    |  15 +++
 .../main/resources/sharing-registry-derby.sql   |   1 +
 .../main/resources/sharing-registry-mysql.sql   |   1 +
 .../registry/SharingRegistryServiceTest.java    |   9 +-
 .../sharing/registry/models/Entity.java         | 134 ++++++++++++++++---
 .../api-docs/sharing_models.html                |  26 +++-
 .../thrift_models/sharing_models.thrift         |   5 +-
 11 files changed, 195 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/c6608d8f/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/entities/EntityEntity.java
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/entities/EntityEntity.java
b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/entities/EntityEntity.java
index a6090e4..dba36f2 100644
--- a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/entities/EntityEntity.java
+++ b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/entities/EntityEntity.java
@@ -41,6 +41,7 @@ public class EntityEntity {
     private ByteBuffer binaryData;
     private String fullText;
     private Long originalEntityCreationTime;
+    private int sharedCount;
     private Long createdTime;
     private Long updatedTime;
 
@@ -145,6 +146,16 @@ public class EntityEntity {
     }
 
     @Basic
+    @Column(name = "SHARED")
+    public int getSharedCount() {
+        return sharedCount;
+    }
+
+    public void setSharedCount(int sharedCount) {
+        this.sharedCount = sharedCount;
+    }
+
+    @Basic
     @Column(name = "CREATED_TIME")
     public Long getCreatedTime() {
         return createdTime;

http://git-wip-us.apache.org/repos/asf/airavata/blob/c6608d8f/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/repositories/EntityRepository.java
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/repositories/EntityRepository.java
b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/repositories/EntityRepository.java
index d713124..577d17e 100644
--- a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/repositories/EntityRepository.java
+++ b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/repositories/EntityRepository.java
@@ -146,8 +146,9 @@ public class EntityRepository extends AbstractRepository<Entity, EntityEntity,
E
             entity.setBinaryData((byte[]) (rs[7]));
             entity.setFullText((String) (rs[8]));
             entity.setOriginalEntityCreationTime((long)(rs[9]));
-            entity.setCreatedTime((long)(rs[10]));
-            entity.setUpdatedTime((long)(rs[11]));
+            entity.setSharedCount((int) rs[10]);
+            entity.setCreatedTime((long) (rs[11]));
+            entity.setUpdatedTime((long) (rs[12]));
 
             //Removing duplicates. Another option is to change the query to remove duplicates.
             if (!keys.containsKey(entity + domainId + "," + entity.entityId)) {

http://git-wip-us.apache.org/repos/asf/airavata/blob/c6608d8f/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/repositories/SharingRepository.java
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/repositories/SharingRepository.java
b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/repositories/SharingRepository.java
index 7845fb1..66dd545 100644
--- a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/repositories/SharingRepository.java
+++ b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/repositories/SharingRepository.java
@@ -80,4 +80,15 @@ public class SharingRepository extends AbstractRepository<Sharing, SharingEntity
         query += " ORDER BY p.createdTime DESC";
         return select(query, 0, -1).size() > 0;
     }
+
+    public int getSharedCount(String domainId, String entityId) throws SharingRegistryException
{
+        String query = "SELECT p from " + SharingEntity.class.getSimpleName() + " as p";
+        query += " WHERE ";
+        query += "p." + DBConstants.SharingTable.DOMAIN_ID + " = '" + domainId + "' AND ";
+        query += "p." + DBConstants.SharingTable.ENTITY_ID + " = '" + entityId + "' AND ";
+        String permissionTypeIdString = (new PermissionTypeRepository()).getOwnerPermissionTypeIdForDomain(domainId);
+        query += "p." + DBConstants.SharingTable.PERMISSION_TYPE_ID + " <> '" + permissionTypeIdString
+ "' AND ";
+        query += "p." + DBConstants.SharingTable.SHARING_TYPE + " <> '" + SharingType.INDIRECT_CASCADING
+ "'";
+        return select(query, 0, -1).size();
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/c6608d8f/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/utils/DBConstants.java
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/utils/DBConstants.java
b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/utils/DBConstants.java
index b269ce1..e61c41d 100644
--- a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/utils/DBConstants.java
+++ b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/utils/DBConstants.java
@@ -91,6 +91,7 @@ public class DBConstants {
         public static final String UPDATED_TIME = "updatedTime";
         public static final String DOMAIN_ID = "domainId";
         public static final String ORIGINAL_ENTITY_CREATION_TIME = "originalEntityCreationTime";
+        public static final String SHARED = "shared";
     }
 
     public static class SharingTable {

http://git-wip-us.apache.org/repos/asf/airavata/blob/c6608d8f/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java
b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java
index 6fb2a12..c1ec8dd 100644
--- a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java
+++ b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java
@@ -738,6 +738,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             Entity oldEntity = (new EntityRepository()).get(entityPK);
             entity.setCreatedTime(oldEntity.createdTime);
             entity = getUpdatedObject(oldEntity, entity);
+            entity.setSharedCount((new SharingRepository()).getSharedCount(entity.domainId,
entity.entityId));
             (new EntityRepository()).update(entity);
             return true;
         }catch (SharingRegistryException ex) {
@@ -905,6 +906,13 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
                 }
             }
             (new SharingRepository()).create(sharings);
+
+            EntityPK entityPK = new EntityPK();
+            entityPK.setDomainId(domainId);
+            entityPK.setEntityId(entityId);
+            Entity entity = (new EntityRepository()).get(entityPK);
+            entity.setSharedCount((new SharingRepository()).getSharedCount(domainId, entityId));
+            (new EntityRepository()).update(entity);
             return true;
         }catch (SharingRegistryException ex) {
             logger.error(ex.getMessage(), ex);
@@ -989,6 +997,13 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
                     (new SharingRepository()).delete(sharingPK);
                 }
             }
+
+            EntityPK entityPK = new EntityPK();
+            entityPK.setDomainId(domainId);
+            entityPK.setEntityId(entityId);
+            Entity entity = (new EntityRepository()).get(entityPK);
+            entity.setSharedCount((new SharingRepository()).getSharedCount(domainId, entityId));
+            (new EntityRepository()).update(entity);
             return true;
         }catch (SharingRegistryException ex) {
             logger.error(ex.getMessage(), ex);

http://git-wip-us.apache.org/repos/asf/airavata/blob/c6608d8f/modules/sharing-registry/sharing-registry-server/src/main/resources/sharing-registry-derby.sql
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-server/src/main/resources/sharing-registry-derby.sql
b/modules/sharing-registry/sharing-registry-server/src/main/resources/sharing-registry-derby.sql
index 83ef3f3..947742f 100644
--- a/modules/sharing-registry/sharing-registry-server/src/main/resources/sharing-registry-derby.sql
+++ b/modules/sharing-registry/sharing-registry-server/src/main/resources/sharing-registry-derby.sql
@@ -102,6 +102,7 @@ CREATE TABLE ENTITY (
   BINARY_DATA BLOB,
   FULL_TEXT VARCHAR(255),
   ORIGINAL_ENTITY_CREATION_TIME BIGINT NOT NULL,
+  SHARED_COUNT INT DEFAULT 0,
   CREATED_TIME BIGINT NOT NULL,
   UPDATED_TIME BIGINT NOT NULL,
   PRIMARY KEY (ENTITY_ID, DOMAIN_ID),

http://git-wip-us.apache.org/repos/asf/airavata/blob/c6608d8f/modules/sharing-registry/sharing-registry-server/src/main/resources/sharing-registry-mysql.sql
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-server/src/main/resources/sharing-registry-mysql.sql
b/modules/sharing-registry/sharing-registry-server/src/main/resources/sharing-registry-mysql.sql
index d4ec07c..a90ff81 100644
--- a/modules/sharing-registry/sharing-registry-server/src/main/resources/sharing-registry-mysql.sql
+++ b/modules/sharing-registry/sharing-registry-server/src/main/resources/sharing-registry-mysql.sql
@@ -102,6 +102,7 @@ CREATE TABLE ENTITY (
   BINARY_DATA BLOB,
   FULL_TEXT TEXT,
   ORIGINAL_ENTITY_CREATION_TIME BIGINT NOT NULL,
+  SHARED_COUNT INT DEFAULT 0,
   CREATED_TIME BIGINT NOT NULL,
   UPDATED_TIME BIGINT NOT NULL,
   PRIMARY KEY (ENTITY_ID, DOMAIN_ID),

http://git-wip-us.apache.org/repos/asf/airavata/blob/c6608d8f/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java
b/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java
index ad5e9f3..112500e 100644
--- a/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java
+++ b/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java
@@ -28,7 +28,6 @@ import org.apache.thrift.protocol.TBinaryProtocol;
 import org.apache.thrift.protocol.TProtocol;
 import org.apache.thrift.transport.TSocket;
 import org.apache.thrift.transport.TTransport;
-import org.databene.contiperf.PerfTest;
 import org.databene.contiperf.junit.ContiPerfRule;
 import org.junit.Assert;
 import org.junit.BeforeClass;
@@ -55,7 +54,7 @@ public class SharingRegistryServiceTest {
 
 
     @Test
-    @PerfTest(invocations = 50, threads = 10)
+//    @PerfTest(invocations = 50, threads = 10)
     public void test() throws TException, InterruptedException {
         String serverHost = "localhost";
         int serverPort = 7878;
@@ -278,7 +277,13 @@ public class SharingRegistryServiceTest {
         entity4.setFullText("test input file 1 for experiment 2");
         sharingServiceClient.createEntity(entity4);
 
+        Assert.assertTrue(sharingServiceClient.getEntity(domainId, "test-project-1").getSharedCount()
== 0);
         sharingServiceClient.shareEntityWithUsers(domainId, "test-project-1", Arrays.asList("test-user-2"),
"WRITE", true);
+        Assert.assertTrue(sharingServiceClient.getEntity(domainId, "test-project-1").getSharedCount()
== 1);
+        sharingServiceClient.revokeEntitySharingFromUsers(domainId, "test-project-1", Arrays.asList("test-user-2"),
"WRITE");
+        Assert.assertTrue(sharingServiceClient.getEntity(domainId, "test-project-1").getSharedCount()
== 0);
+        sharingServiceClient.shareEntityWithUsers(domainId, "test-project-1", Arrays.asList("test-user-2"),
"WRITE", true);
+
         sharingServiceClient.shareEntityWithGroups(domainId, "test-experiment-2", Arrays.asList("test-group-2"),
"READ", true);
         sharingServiceClient.shareEntityWithGroups(domainId, "test-experiment-2", Arrays.asList("test-group-2"),
"CLONE", false);
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/c6608d8f/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/Entity.java
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/Entity.java
b/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/Entity.java
index c7bc3e1..8b8a83c 100644
--- a/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/Entity.java
+++ b/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/Entity.java
@@ -65,8 +65,9 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>,
   private static final org.apache.thrift.protocol.TField BINARY_DATA_FIELD_DESC = new org.apache.thrift.protocol.TField("binaryData",
org.apache.thrift.protocol.TType.STRING, (short)8);
   private static final org.apache.thrift.protocol.TField FULL_TEXT_FIELD_DESC = new org.apache.thrift.protocol.TField("fullText",
org.apache.thrift.protocol.TType.STRING, (short)9);
   private static final org.apache.thrift.protocol.TField ORIGINAL_ENTITY_CREATION_TIME_FIELD_DESC
= new org.apache.thrift.protocol.TField("originalEntityCreationTime", org.apache.thrift.protocol.TType.I64,
(short)10);
-  private static final org.apache.thrift.protocol.TField CREATED_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("createdTime",
org.apache.thrift.protocol.TType.I64, (short)11);
-  private static final org.apache.thrift.protocol.TField UPDATED_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("updatedTime",
org.apache.thrift.protocol.TType.I64, (short)12);
+  private static final org.apache.thrift.protocol.TField SHARED_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("sharedCount",
org.apache.thrift.protocol.TType.I64, (short)11);
+  private static final org.apache.thrift.protocol.TField CREATED_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("createdTime",
org.apache.thrift.protocol.TType.I64, (short)12);
+  private static final org.apache.thrift.protocol.TField UPDATED_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("updatedTime",
org.apache.thrift.protocol.TType.I64, (short)13);
 
   private static final Map<Class<? extends IScheme>, SchemeFactory> schemes =
new HashMap<Class<? extends IScheme>, SchemeFactory>();
   static {
@@ -84,6 +85,7 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>,
   public ByteBuffer binaryData; // optional
   public String fullText; // optional
   public long originalEntityCreationTime; // optional
+  public long sharedCount; // optional
   public long createdTime; // optional
   public long updatedTime; // optional
 
@@ -99,8 +101,9 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>,
     BINARY_DATA((short)8, "binaryData"),
     FULL_TEXT((short)9, "fullText"),
     ORIGINAL_ENTITY_CREATION_TIME((short)10, "originalEntityCreationTime"),
-    CREATED_TIME((short)11, "createdTime"),
-    UPDATED_TIME((short)12, "updatedTime");
+    SHARED_COUNT((short)11, "sharedCount"),
+    CREATED_TIME((short)12, "createdTime"),
+    UPDATED_TIME((short)13, "updatedTime");
 
     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
@@ -135,9 +138,11 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>,
           return FULL_TEXT;
         case 10: // ORIGINAL_ENTITY_CREATION_TIME
           return ORIGINAL_ENTITY_CREATION_TIME;
-        case 11: // CREATED_TIME
+        case 11: // SHARED_COUNT
+          return SHARED_COUNT;
+        case 12: // CREATED_TIME
           return CREATED_TIME;
-        case 12: // UPDATED_TIME
+        case 13: // UPDATED_TIME
           return UPDATED_TIME;
         default:
           return null;
@@ -180,10 +185,11 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>,
 
   // isset id assignments
   private static final int __ORIGINALENTITYCREATIONTIME_ISSET_ID = 0;
-  private static final int __CREATEDTIME_ISSET_ID = 1;
-  private static final int __UPDATEDTIME_ISSET_ID = 2;
+  private static final int __SHAREDCOUNT_ISSET_ID = 1;
+  private static final int __CREATEDTIME_ISSET_ID = 2;
+  private static final int __UPDATEDTIME_ISSET_ID = 3;
   private byte __isset_bitfield = 0;
-  private static final _Fields optionals[] = {_Fields.ENTITY_ID,_Fields.DOMAIN_ID,_Fields.ENTITY_TYPE_ID,_Fields.OWNER_ID,_Fields.PARENT_ENTITY_ID,_Fields.NAME,_Fields.DESCRIPTION,_Fields.BINARY_DATA,_Fields.FULL_TEXT,_Fields.ORIGINAL_ENTITY_CREATION_TIME,_Fields.CREATED_TIME,_Fields.UPDATED_TIME};
+  private static final _Fields optionals[] = {_Fields.ENTITY_ID,_Fields.DOMAIN_ID,_Fields.ENTITY_TYPE_ID,_Fields.OWNER_ID,_Fields.PARENT_ENTITY_ID,_Fields.NAME,_Fields.DESCRIPTION,_Fields.BINARY_DATA,_Fields.FULL_TEXT,_Fields.ORIGINAL_ENTITY_CREATION_TIME,_Fields.SHARED_COUNT,_Fields.CREATED_TIME,_Fields.UPDATED_TIME};
   public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
   static {
     Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields,
org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
@@ -207,6 +213,8 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>,
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
     tmpMap.put(_Fields.ORIGINAL_ENTITY_CREATION_TIME, new org.apache.thrift.meta_data.FieldMetaData("originalEntityCreationTime",
org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+    tmpMap.put(_Fields.SHARED_COUNT, new org.apache.thrift.meta_data.FieldMetaData("sharedCount",
org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
     tmpMap.put(_Fields.CREATED_TIME, new org.apache.thrift.meta_data.FieldMetaData("createdTime",
org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
     tmpMap.put(_Fields.UPDATED_TIME, new org.apache.thrift.meta_data.FieldMetaData("updatedTime",
org.apache.thrift.TFieldRequirementType.OPTIONAL, 
@@ -216,6 +224,8 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>,
   }
 
   public Entity() {
+    this.sharedCount = 0L;
+
   }
 
   /**
@@ -251,6 +261,7 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>,
       this.fullText = other.fullText;
     }
     this.originalEntityCreationTime = other.originalEntityCreationTime;
+    this.sharedCount = other.sharedCount;
     this.createdTime = other.createdTime;
     this.updatedTime = other.updatedTime;
   }
@@ -272,6 +283,8 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>,
     this.fullText = null;
     setOriginalEntityCreationTimeIsSet(false);
     this.originalEntityCreationTime = 0;
+    this.sharedCount = 0L;
+
     setCreatedTimeIsSet(false);
     this.createdTime = 0;
     setUpdatedTimeIsSet(false);
@@ -527,6 +540,29 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>,
     __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ORIGINALENTITYCREATIONTIME_ISSET_ID,
value);
   }
 
+  public long getSharedCount() {
+    return this.sharedCount;
+  }
+
+  public Entity setSharedCount(long sharedCount) {
+    this.sharedCount = sharedCount;
+    setSharedCountIsSet(true);
+    return this;
+  }
+
+  public void unsetSharedCount() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SHAREDCOUNT_ISSET_ID);
+  }
+
+  /** Returns true if field sharedCount is set (has been assigned a value) and false otherwise
*/
+  public boolean isSetSharedCount() {
+    return EncodingUtils.testBit(__isset_bitfield, __SHAREDCOUNT_ISSET_ID);
+  }
+
+  public void setSharedCountIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SHAREDCOUNT_ISSET_ID, value);
+  }
+
   public long getCreatedTime() {
     return this.createdTime;
   }
@@ -655,6 +691,14 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>,
       }
       break;
 
+    case SHARED_COUNT:
+      if (value == null) {
+        unsetSharedCount();
+      } else {
+        setSharedCount((Long)value);
+      }
+      break;
+
     case CREATED_TIME:
       if (value == null) {
         unsetCreatedTime();
@@ -706,6 +750,9 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>,
     case ORIGINAL_ENTITY_CREATION_TIME:
       return getOriginalEntityCreationTime();
 
+    case SHARED_COUNT:
+      return getSharedCount();
+
     case CREATED_TIME:
       return getCreatedTime();
 
@@ -743,6 +790,8 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>,
       return isSetFullText();
     case ORIGINAL_ENTITY_CREATION_TIME:
       return isSetOriginalEntityCreationTime();
+    case SHARED_COUNT:
+      return isSetSharedCount();
     case CREATED_TIME:
       return isSetCreatedTime();
     case UPDATED_TIME:
@@ -854,6 +903,15 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>,
         return false;
     }
 
+    boolean this_present_sharedCount = true && this.isSetSharedCount();
+    boolean that_present_sharedCount = true && that.isSetSharedCount();
+    if (this_present_sharedCount || that_present_sharedCount) {
+      if (!(this_present_sharedCount && that_present_sharedCount))
+        return false;
+      if (this.sharedCount != that.sharedCount)
+        return false;
+    }
+
     boolean this_present_createdTime = true && this.isSetCreatedTime();
     boolean that_present_createdTime = true && that.isSetCreatedTime();
     if (this_present_createdTime || that_present_createdTime) {
@@ -929,6 +987,11 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>,
     if (present_originalEntityCreationTime)
       list.add(originalEntityCreationTime);
 
+    boolean present_sharedCount = true && (isSetSharedCount());
+    list.add(present_sharedCount);
+    if (present_sharedCount)
+      list.add(sharedCount);
+
     boolean present_createdTime = true && (isSetCreatedTime());
     list.add(present_createdTime);
     if (present_createdTime)
@@ -1050,6 +1113,16 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>,
         return lastComparison;
       }
     }
+    lastComparison = Boolean.valueOf(isSetSharedCount()).compareTo(other.isSetSharedCount());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetSharedCount()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sharedCount, other.sharedCount);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
     lastComparison = Boolean.valueOf(isSetCreatedTime()).compareTo(other.isSetCreatedTime());
     if (lastComparison != 0) {
       return lastComparison;
@@ -1185,6 +1258,12 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>,
       sb.append(this.originalEntityCreationTime);
       first = false;
     }
+    if (isSetSharedCount()) {
+      if (!first) sb.append(", ");
+      sb.append("sharedCount:");
+      sb.append(this.sharedCount);
+      first = false;
+    }
     if (isSetCreatedTime()) {
       if (!first) sb.append(", ");
       sb.append("createdTime:");
@@ -1322,7 +1401,15 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>,
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
-          case 11: // CREATED_TIME
+          case 11: // SHARED_COUNT
+            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+              struct.sharedCount = iprot.readI64();
+              struct.setSharedCountIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 12: // CREATED_TIME
             if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
               struct.createdTime = iprot.readI64();
               struct.setCreatedTimeIsSet(true);
@@ -1330,7 +1417,7 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>,
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
-          case 12: // UPDATED_TIME
+          case 13: // UPDATED_TIME
             if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
               struct.updatedTime = iprot.readI64();
               struct.setUpdatedTimeIsSet(true);
@@ -1421,6 +1508,11 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>,
         oprot.writeI64(struct.originalEntityCreationTime);
         oprot.writeFieldEnd();
       }
+      if (struct.isSetSharedCount()) {
+        oprot.writeFieldBegin(SHARED_COUNT_FIELD_DESC);
+        oprot.writeI64(struct.sharedCount);
+        oprot.writeFieldEnd();
+      }
       if (struct.isSetCreatedTime()) {
         oprot.writeFieldBegin(CREATED_TIME_FIELD_DESC);
         oprot.writeI64(struct.createdTime);
@@ -1479,13 +1571,16 @@ public class Entity implements org.apache.thrift.TBase<Entity,
Entity._Fields>,
       if (struct.isSetOriginalEntityCreationTime()) {
         optionals.set(9);
       }
-      if (struct.isSetCreatedTime()) {
+      if (struct.isSetSharedCount()) {
         optionals.set(10);
       }
-      if (struct.isSetUpdatedTime()) {
+      if (struct.isSetCreatedTime()) {
         optionals.set(11);
       }
-      oprot.writeBitSet(optionals, 12);
+      if (struct.isSetUpdatedTime()) {
+        optionals.set(12);
+      }
+      oprot.writeBitSet(optionals, 13);
       if (struct.isSetEntityId()) {
         oprot.writeString(struct.entityId);
       }
@@ -1516,6 +1611,9 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>,
       if (struct.isSetOriginalEntityCreationTime()) {
         oprot.writeI64(struct.originalEntityCreationTime);
       }
+      if (struct.isSetSharedCount()) {
+        oprot.writeI64(struct.sharedCount);
+      }
       if (struct.isSetCreatedTime()) {
         oprot.writeI64(struct.createdTime);
       }
@@ -1527,7 +1625,7 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>,
     @Override
     public void read(org.apache.thrift.protocol.TProtocol prot, Entity struct) throws org.apache.thrift.TException
{
       TTupleProtocol iprot = (TTupleProtocol) prot;
-      BitSet incoming = iprot.readBitSet(12);
+      BitSet incoming = iprot.readBitSet(13);
       if (incoming.get(0)) {
         struct.entityId = iprot.readString();
         struct.setEntityIdIsSet(true);
@@ -1569,10 +1667,14 @@ public class Entity implements org.apache.thrift.TBase<Entity,
Entity._Fields>,
         struct.setOriginalEntityCreationTimeIsSet(true);
       }
       if (incoming.get(10)) {
+        struct.sharedCount = iprot.readI64();
+        struct.setSharedCountIsSet(true);
+      }
+      if (incoming.get(11)) {
         struct.createdTime = iprot.readI64();
         struct.setCreatedTimeIsSet(true);
       }
-      if (incoming.get(11)) {
+      if (incoming.get(12)) {
         struct.updatedTime = iprot.readI64();
         struct.setUpdatedTimeIsSet(true);
       }

http://git-wip-us.apache.org/repos/asf/airavata/blob/c6608d8f/modules/sharing-registry/sharing-service-docs/api-docs/sharing_models.html
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-service-docs/api-docs/sharing_models.html b/modules/sharing-registry/sharing-service-docs/api-docs/sharing_models.html
index 012356e..a696382 100644
--- a/modules/sharing-registry/sharing-service-docs/api-docs/sharing_models.html
+++ b/modules/sharing-registry/sharing-service-docs/api-docs/sharing_models.html
@@ -242,8 +242,30 @@ regarding the user.</p>
 <tr><td>8</td><td>binaryData</td><td><code>binary</code></td><td></td><td>optional</td><td></td></tr>
 <tr><td>9</td><td>fullText</td><td><code>string</code></td><td></td><td>optional</td><td></td></tr>
 <tr><td>10</td><td>originalEntityCreationTime</td><td><code>i64</code></td><td></td><td>optional</td><td></td></tr>
-<tr><td>11</td><td>createdTime</td><td><code>i64</code></td><td></td><td>optional</td><td></td></tr>
-<tr><td>12</td><td>updatedTime</td><td><code>i64</code></td><td></td><td>optional</td><td></td></tr>
+ <tr>
+  <td>11</td>
+  <td>sharedCount</td>
+  <td><code>i64</code></td>
+  <td></td>
+  <td>optional</td>
+  <td><code>0</code></td>
+ </tr>
+ <tr>
+  <td>12</td>
+  <td>createdTime</td>
+  <td><code>i64</code></td>
+  <td></td>
+  <td>optional</td>
+  <td></td>
+ </tr>
+ <tr>
+  <td>13</td>
+  <td>updatedTime</td>
+  <td><code>i64</code></td>
+  <td></td>
+  <td>optional</td>
+  <td></td>
+ </tr>
 </table><br/><p>Entity object which is used to register an entity in the
system.</p>
 <li><b>entityId</b> : Entity id provided by the client</li>
 <li><b>domainId</b> : Domain id</li>

http://git-wip-us.apache.org/repos/asf/airavata/blob/c6608d8f/modules/sharing-registry/thrift_models/sharing_models.thrift
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/thrift_models/sharing_models.thrift b/modules/sharing-registry/thrift_models/sharing_models.thrift
index c646c85..2459954 100644
--- a/modules/sharing-registry/thrift_models/sharing_models.thrift
+++ b/modules/sharing-registry/thrift_models/sharing_models.thrift
@@ -223,8 +223,9 @@ struct Entity {
     8: optional binary binaryData,
     9: optional string fullText,
     10: optional i64 originalEntityCreationTime,
-    11: optional i64 createdTime,
-    12: optional i64 updatedTime
+    11: optional i64 sharedCount = 0,
+    12: optional i64 createdTime,
+    13: optional i64 updatedTime
 }
 
 /**


Mime
View raw message