You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sc...@apache.org on 2016/10/03 15:39:00 UTC
[40/50] [abbrv] airavata git commit: WIP
http://git-wip-us.apache.org/repos/asf/airavata/blob/f3c365ab/airavata-gov-registry/airavata-sharing-registry-core/pom.xml
----------------------------------------------------------------------
diff --git a/airavata-gov-registry/airavata-sharing-registry-core/pom.xml b/airavata-gov-registry/airavata-sharing-registry-core/pom.xml
new file mode 100644
index 0000000..84ca5ff
--- /dev/null
+++ b/airavata-gov-registry/airavata-sharing-registry-core/pom.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>gov-registry</artifactId>
+ <groupId>org.apache.airavata</groupId>
+ <relativePath>../pom.xml</relativePath>
+ <version>${global.version}</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>airavata-gov-registry-core</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.7.10</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.thrift</groupId>
+ <artifactId>libthrift</artifactId>
+ <version>0.9.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-gov-registry-stubs</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-commons</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.dozer</groupId>
+ <artifactId>dozer</artifactId>
+ <version>5.4.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-all</artifactId>
+ <version>2.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>5.1.34</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.5.1</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-maven-plugin</artifactId>
+ <version>2.2.0</version>
+ <configuration>
+ <includes>**/entities/*.class</includes>
+ <excludes>**/entities/XML*.class</excludes>
+ <addDefaultConstructor>true</addDefaultConstructor>
+ <enforcePropertyRestrictions>true</enforcePropertyRestrictions>
+ </configuration>
+ <executions>
+ <execution>
+ <id>enhancer</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>enhance</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa</artifactId>
+ <version>2.2.0</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/f3c365ab/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/DomainEntity.java
----------------------------------------------------------------------
diff --git a/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/DomainEntity.java b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/DomainEntity.java
new file mode 100644
index 0000000..0de9d62
--- /dev/null
+++ b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/DomainEntity.java
@@ -0,0 +1,113 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gov.registry.db.entities;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "DOMAIN", schema = "" )
+public class DomainEntity {
+ private final static Logger logger = LoggerFactory.getLogger(DomainEntity.class);
+ private String domainId;
+ private String name;
+ private String description;
+ private String createdTime;
+ private String updatedTime;
+
+ @Id
+ @Column(name = "DOMAIN_ID")
+ public String getDomainId() {
+ return domainId;
+ }
+
+ public void setDomainId(String domainId) {
+ this.domainId = domainId;
+ }
+
+ @Basic
+ @Column(name = "NAME")
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Basic
+ @Column(name = "DESCRIPTION")
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ @Basic
+ @Column(name = "CREATED_TIME")
+ public String getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(String createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ @Basic
+ @Column(name = "UPDATED_TIME")
+ public String getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(String updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ DomainEntity that = (DomainEntity) o;
+
+ if (domainId != null ? !domainId.equals(that.domainId) : that.domainId != null) return false;
+ if (name != null ? !name.equals(that.name) : that.name != null) return false;
+ if (description != null ? !description.equals(that.description) : that.description != null) return false;
+ if (createdTime != null ? !createdTime.equals(that.createdTime) : that.createdTime != null) return false;
+ if (updatedTime != null ? !updatedTime.equals(that.updatedTime) : that.updatedTime != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = domainId != null ? domainId.hashCode() : 0;
+ result = 31 * result + (name != null ? name.hashCode() : 0);
+ result = 31 * result + (description != null ? description.hashCode() : 0);
+ result = 31 * result + (createdTime != null ? createdTime.hashCode() : 0);
+ result = 31 * result + (updatedTime != null ? updatedTime.hashCode() : 0);
+ return result;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/f3c365ab/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/EntityEntity.java
----------------------------------------------------------------------
diff --git a/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/EntityEntity.java b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/EntityEntity.java
new file mode 100644
index 0000000..e472790
--- /dev/null
+++ b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/EntityEntity.java
@@ -0,0 +1,186 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gov.registry.db.entities;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.*;
+import java.util.Arrays;
+
+@Entity
+@Table(name = "ENTITY", schema = "")
+public class EntityEntity {
+ private final static Logger logger = LoggerFactory.getLogger(EntityEntity.class);
+ private String entityId;
+ private String domainId;
+ private String parentEntityId;
+ private String name;
+ private String description;
+ private byte[] metadata;
+ private String fullText;
+ private String createdTime;
+ private String updatedTime;
+ private DomainEntity domainByDomainId;
+ private EntityEntity entityByParentEntityId;
+
+ @Id
+ @Column(name = "ENTITY_ID")
+ public String getEntityId() {
+ return entityId;
+ }
+
+ public void setEntityId(String entityId) {
+ this.entityId = entityId;
+ }
+
+ @Basic
+ @Column(name = "DOMAIN_ID")
+ public String getDomainId() {
+ return domainId;
+ }
+
+ public void setDomainId(String domainId) {
+ this.domainId = domainId;
+ }
+
+ @Basic
+ @Column(name = "PARENT_ENTITY_ID")
+ public String getParentEntityId() {
+ return parentEntityId;
+ }
+
+ public void setParentEntityId(String parentEntityId) {
+ this.parentEntityId = parentEntityId;
+ }
+
+ @Basic
+ @Column(name = "NAME")
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Basic
+ @Column(name = "DESCRIPTION")
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ @Basic
+ @Column(name = "METADATA")
+ public byte[] getMetadata() {
+ return metadata;
+ }
+
+ public void setMetadata(byte[] metadata) {
+ this.metadata = metadata;
+ }
+
+ @Basic
+ @Column(name = "FULL_TEXT")
+ public String getFullText() {
+ return fullText;
+ }
+
+ public void setFullText(String fullText) {
+ this.fullText = fullText;
+ }
+
+ @Basic
+ @Column(name = "CREATED_TIME")
+ public String getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(String createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ @Basic
+ @Column(name = "UPDATED_TIME")
+ public String getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(String updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ EntityEntity that = (EntityEntity) o;
+
+ if (entityId != null ? !entityId.equals(that.entityId) : that.entityId != null) return false;
+ if (domainId != null ? !domainId.equals(that.domainId) : that.domainId != null) return false;
+ if (parentEntityId != null ? !parentEntityId.equals(that.parentEntityId) : that.parentEntityId != null) return false;
+ if (name != null ? !name.equals(that.name) : that.name != null) return false;
+ if (description != null ? !description.equals(that.description) : that.description != null) return false;
+ if (!Arrays.equals(metadata, that.metadata)) return false;
+ if (fullText != null ? !fullText.equals(that.fullText) : that.fullText != null) return false;
+ if (createdTime != null ? !createdTime.equals(that.createdTime) : that.createdTime != null) return false;
+ if (updatedTime != null ? !updatedTime.equals(that.updatedTime) : that.updatedTime != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = entityId != null ? entityId.hashCode() : 0;
+ result = 31 * result + (name != null ? name.hashCode() : 0);
+ result = 31 * result + (description != null ? description.hashCode() : 0);
+ result = 31 * result + (metadata != null ? Arrays.hashCode(metadata) : 0);
+ result = 31 * result + (fullText != null ? fullText.hashCode() : 0);
+ result = 31 * result + (createdTime != null ? createdTime.hashCode() : 0);
+ result = 31 * result + (updatedTime != null ? updatedTime.hashCode() : 0);
+ return result;
+ }
+
+ @ManyToOne
+ @JoinColumn(name = "DOMAIN_ID", referencedColumnName = "DOMAIN_ID")
+ public DomainEntity getDomainByDomainId() {
+ return domainByDomainId;
+ }
+
+ public void setDomainByDomainId(DomainEntity domainByDomainId) {
+ this.domainByDomainId = domainByDomainId;
+ }
+
+ @ManyToOne
+ @JoinColumn(name = "PARENT_ENTITY_ID", referencedColumnName = "ENTITY_ID")
+ public EntityEntity getEntityByParentEntityId() {
+ return entityByParentEntityId;
+ }
+
+ public void setEntityByParentEntityId(EntityEntity entityByParentEntityId) {
+ this.entityByParentEntityId = entityByParentEntityId;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/f3c365ab/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/EntityTypeEntity.java
----------------------------------------------------------------------
diff --git a/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/EntityTypeEntity.java b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/EntityTypeEntity.java
new file mode 100644
index 0000000..63c5e2f
--- /dev/null
+++ b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/EntityTypeEntity.java
@@ -0,0 +1,136 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gov.registry.db.entities;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "ENTITY_TYPE", schema = "")
+public class EntityTypeEntity {
+ private final static Logger logger = LoggerFactory.getLogger(EntityTypeEntity.class);
+ private String entityTypeId;
+ private String domainId;
+ private String name;
+ private String description;
+ private String createdTime;
+ private String updatedTime;
+ private DomainEntity domainByDomainId;
+
+ @Id
+ @Column(name = "ENTITY_TYPE_ID")
+ public String getEntityTypeId() {
+ return entityTypeId;
+ }
+
+ public void setEntityTypeId(String entityTypeId) {
+ this.entityTypeId = entityTypeId;
+ }
+
+ @Basic
+ @Column(name = "DOMAIN_ID")
+ public String getDomainId() {
+ return domainId;
+ }
+
+ public void setDomainId(String domainId) {
+ this.domainId = domainId;
+ }
+
+ @Basic
+ @Column(name = "NAME")
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Basic
+ @Column(name = "DESCRIPTION")
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ @Basic
+ @Column(name = "CREATED_TIME")
+ public String getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(String createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ @Basic
+ @Column(name = "UPDATED_TIME")
+ public String getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(String updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ EntityTypeEntity that = (EntityTypeEntity) o;
+
+ if (entityTypeId != null ? !entityTypeId.equals(that.entityTypeId) : that.entityTypeId != null) return false;
+ if (domainId != null ? !domainId.equals(that.domainId) : that.domainId != null) return false;
+ if (name != null ? !name.equals(that.name) : that.name != null) return false;
+ if (description != null ? !description.equals(that.description) : that.description != null) return false;
+ if (createdTime != null ? !createdTime.equals(that.createdTime) : that.createdTime != null) return false;
+ if (updatedTime != null ? !updatedTime.equals(that.updatedTime) : that.updatedTime != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = entityTypeId != null ? entityTypeId.hashCode() : 0;
+ result = 31 * result + (name != null ? name.hashCode() : 0);
+ result = 31 * result + (description != null ? description.hashCode() : 0);
+ result = 31 * result + (createdTime != null ? createdTime.hashCode() : 0);
+ result = 31 * result + (updatedTime != null ? updatedTime.hashCode() : 0);
+ return result;
+ }
+
+ @ManyToOne
+ @JoinColumn(name = "DOMAIN_ID", referencedColumnName = "DOMAIN_ID")
+ public DomainEntity getDomainByDomainId() {
+ return domainByDomainId;
+ }
+
+ public void setDomainByDomainId(DomainEntity domainByDomainId) {
+ this.domainByDomainId = domainByDomainId;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/f3c365ab/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/GroupMembershipEntity.java
----------------------------------------------------------------------
diff --git a/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/GroupMembershipEntity.java b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/GroupMembershipEntity.java
new file mode 100644
index 0000000..8fd9329
--- /dev/null
+++ b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/GroupMembershipEntity.java
@@ -0,0 +1,88 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gov.registry.db.entities;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "GROUP_MEMBERSHIP", schema = "")
+@IdClass(GroupMembershipEntityPK.class)
+public class GroupMembershipEntity {
+ private final static Logger logger = LoggerFactory.getLogger(GroupMembershipEntity.class);
+ private String parentId;
+ private String childId;
+ private String childType;
+
+ @Id
+ @Column(name = "PARENT_ID")
+ public String getParentId() {
+ return parentId;
+ }
+
+ public void setParentId(String parentId) {
+ this.parentId = parentId;
+ }
+
+ @Id
+ @Column(name = "CHILD_ID")
+ public String getChildId() {
+ return childId;
+ }
+
+ public void setChildId(String childId) {
+ this.childId = childId;
+ }
+
+ @Basic
+ @Column(name = "CHILD_TYPE")
+ public String getChildType() {
+ return childType;
+ }
+
+ public void setChildType(String childType) {
+ this.childType = childType;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ GroupMembershipEntity that = (GroupMembershipEntity) o;
+
+ if (parentId != null ? !parentId.equals(that.parentId) : that.parentId != null) return false;
+ if (childId != null ? !childId.equals(that.childId) : that.childId != null) return false;
+ if (childType != null ? !childType.equals(that.childType) : that.childType != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = parentId != null ? parentId.hashCode() : 0;
+ result = 31 * result + (childId != null ? childId.hashCode() : 0);
+ result = 31 * result + (childType != null ? childType.hashCode() : 0);
+ return result;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/f3c365ab/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/GroupMembershipEntityPK.java
----------------------------------------------------------------------
diff --git a/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/GroupMembershipEntityPK.java b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/GroupMembershipEntityPK.java
new file mode 100644
index 0000000..2dfbefb
--- /dev/null
+++ b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/GroupMembershipEntityPK.java
@@ -0,0 +1,74 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gov.registry.db.entities;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+
+public class GroupMembershipEntityPK implements Serializable {
+ private final static Logger logger = LoggerFactory.getLogger(GroupMembershipEntityPK.class);
+ private String parentId;
+ private String childId;
+
+ @Column(name = "PARENT_ID")
+ @Id
+ public String getParentId() {
+ return parentId;
+ }
+
+ public void setParentId(String parentId) {
+ this.parentId = parentId;
+ }
+
+ @Column(name = "CHILD_ID")
+ @Id
+ public String getChildId() {
+ return childId;
+ }
+
+ public void setChildId(String childId) {
+ this.childId = childId;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ GroupMembershipEntityPK that = (GroupMembershipEntityPK) o;
+
+ if (parentId != null ? !parentId.equals(that.parentId) : that.parentId != null) return false;
+ if (childId != null ? !childId.equals(that.childId) : that.childId != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = parentId != null ? parentId.hashCode() : 0;
+ result = 31 * result + (childId != null ? childId.hashCode() : 0);
+ return result;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/f3c365ab/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/PermissionTypeEntity.java
----------------------------------------------------------------------
diff --git a/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/PermissionTypeEntity.java b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/PermissionTypeEntity.java
new file mode 100644
index 0000000..ecc37b6
--- /dev/null
+++ b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/PermissionTypeEntity.java
@@ -0,0 +1,124 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gov.registry.db.entities;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "PERMISSION_TYPE", schema = "")
+public class PermissionTypeEntity {
+ private final static Logger logger = LoggerFactory.getLogger(PermissionTypeEntity.class);
+ private String permissionTypeId;
+ private String domainId;
+ private String name;
+ private String createdTime;
+ private String updatedTime;
+ private DomainEntity domainByDomainId;
+
+ @Id
+ @Column(name = "PERMISSION_TYPE_ID")
+ public String getPermissionTypeId() {
+ return permissionTypeId;
+ }
+
+ public void setPermissionTypeId(String permissionTypeId) {
+ this.permissionTypeId = permissionTypeId;
+ }
+
+ @Basic
+ @Column(name = "DOMAIN_ID")
+ public String getDomainId() {
+ return domainId;
+ }
+
+ public void setDomainId(String domainId) {
+ this.domainId = domainId;
+ }
+
+ @Basic
+ @Column(name = "NAME")
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Basic
+ @Column(name = "CREATED_TIME")
+ public String getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(String createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ @Basic
+ @Column(name = "UPDATED_TIME")
+ public String getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(String updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ PermissionTypeEntity that = (PermissionTypeEntity) o;
+
+ if (permissionTypeId != null ? !permissionTypeId.equals(that.permissionTypeId) : that.permissionTypeId != null)
+ return false;
+ if (domainId != null ? !domainId.equals(that.domainId) : that.domainId != null) return false;
+ if (name != null ? !name.equals(that.name) : that.name != null) return false;
+ if (createdTime != null ? !createdTime.equals(that.createdTime) : that.createdTime != null) return false;
+ if (updatedTime != null ? !updatedTime.equals(that.updatedTime) : that.updatedTime != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = permissionTypeId != null ? permissionTypeId.hashCode() : 0;
+ result = 31 * result + (name != null ? name.hashCode() : 0);
+ result = 31 * result + (createdTime != null ? createdTime.hashCode() : 0);
+ result = 31 * result + (updatedTime != null ? updatedTime.hashCode() : 0);
+ return result;
+ }
+
+ @ManyToOne
+ @JoinColumn(name = "DOMAIN_ID", referencedColumnName = "DOMAIN_ID")
+ public DomainEntity getDomainByDomainId() {
+ return domainByDomainId;
+ }
+
+ public void setDomainByDomainId(DomainEntity domainByDomainId) {
+ this.domainByDomainId = domainByDomainId;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/f3c365ab/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/SharingEntity.java
----------------------------------------------------------------------
diff --git a/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/SharingEntity.java b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/SharingEntity.java
new file mode 100644
index 0000000..e9b949d
--- /dev/null
+++ b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/SharingEntity.java
@@ -0,0 +1,111 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gov.registry.db.entities;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "SHARING", schema = "")
+@IdClass(SharingEntityPK.class)
+public class SharingEntity {
+ private final static Logger logger = LoggerFactory.getLogger(SharingEntity.class);
+ private String permissionTypeId;
+ private String entityId;
+ private String groupId;
+ private PermissionTypeEntity permissionTypeByPermissionTypeId;
+ private EntityTypeEntity entityTypeByEntityTypeId;
+
+ @Id
+ @Column(name = "PERMISSION_TYPE_ID")
+ public String getPermissionTypeId() {
+ return permissionTypeId;
+ }
+
+ public void setPermissionTypeId(String permissionTypeId) {
+ this.permissionTypeId = permissionTypeId;
+ }
+
+ @Id
+ @Column(name = "ENTITY_ID")
+ public String getEntityId() {
+ return entityId;
+ }
+
+ public void setEntityId(String entityId) {
+ this.entityId = entityId;
+ }
+
+ @Id
+ @Column(name = "GROUP_ID")
+ public String getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId(String groupId) {
+ this.groupId = groupId;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ SharingEntity that = (SharingEntity) o;
+
+ if (permissionTypeId != null ? !permissionTypeId.equals(that.permissionTypeId) : that.permissionTypeId != null)
+ return false;
+ if (entityId != null ? !entityId.equals(that.entityId) : that.entityId != null) return false;
+ if (groupId != null ? !groupId.equals(that.groupId) : that.groupId != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = permissionTypeId != null ? permissionTypeId.hashCode() : 0;
+ result = 31 * result + (entityId != null ? entityId.hashCode() : 0);
+ result = 31 * result + (groupId != null ? groupId.hashCode() : 0);
+ return result;
+ }
+
+ @ManyToOne
+ @JoinColumn(name = "PERMISSION_TYPE_ID", referencedColumnName = "PERMISSION_TYPE_ID", nullable = false)
+ public PermissionTypeEntity getPermissionTypeByPermissionTypeId() {
+ return permissionTypeByPermissionTypeId;
+ }
+
+ public void setPermissionTypeByPermissionTypeId(PermissionTypeEntity permissionTypeByPermissionTypeId) {
+ this.permissionTypeByPermissionTypeId = permissionTypeByPermissionTypeId;
+ }
+
+ @ManyToOne
+ @JoinColumn(name = "ENTITY_TYPE_ID", referencedColumnName = "ENTITY_TYPE_ID")
+ public EntityTypeEntity getEntityTypeByEntityTypeId() {
+ return entityTypeByEntityTypeId;
+ }
+
+ public void setEntityTypeByEntityTypeId(EntityTypeEntity entityTypeByEntityTypeId) {
+ this.entityTypeByEntityTypeId = entityTypeByEntityTypeId;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/f3c365ab/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/SharingEntityPK.java
----------------------------------------------------------------------
diff --git a/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/SharingEntityPK.java b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/SharingEntityPK.java
new file mode 100644
index 0000000..8274904
--- /dev/null
+++ b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/SharingEntityPK.java
@@ -0,0 +1,88 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gov.registry.db.entities;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+
+public class SharingEntityPK implements Serializable {
+ private final static Logger logger = LoggerFactory.getLogger(SharingEntityPK.class);
+ private String permissionTypeId;
+ private String entityId;
+ private String groupId;
+
+ @Column(name = "PERMISSION_TYPE_ID")
+ @Id
+ public String getPermissionTypeId() {
+ return permissionTypeId;
+ }
+
+ public void setPermissionTypeId(String permissionTypeId) {
+ this.permissionTypeId = permissionTypeId;
+ }
+
+ @Column(name = "ENTITY_ID")
+ @Id
+ public String getEntityId() {
+ return entityId;
+ }
+
+ public void setEntityId(String entityId) {
+ this.entityId = entityId;
+ }
+
+ @Column(name = "GROUP_ID")
+ @Id
+ public String getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId(String groupId) {
+ this.groupId = groupId;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ SharingEntityPK that = (SharingEntityPK) o;
+
+ if (permissionTypeId != null ? !permissionTypeId.equals(that.permissionTypeId) : that.permissionTypeId != null)
+ return false;
+ if (entityId != null ? !entityId.equals(that.entityId) : that.entityId != null) return false;
+ if (groupId != null ? !groupId.equals(that.groupId) : that.groupId != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = permissionTypeId != null ? permissionTypeId.hashCode() : 0;
+ result = 31 * result + (entityId != null ? entityId.hashCode() : 0);
+ result = 31 * result + (groupId != null ? groupId.hashCode() : 0);
+ return result;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/f3c365ab/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/UserEntity.java
----------------------------------------------------------------------
diff --git a/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/UserEntity.java b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/UserEntity.java
new file mode 100644
index 0000000..7201651
--- /dev/null
+++ b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/UserEntity.java
@@ -0,0 +1,123 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gov.registry.db.entities;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "USER", schema = "")
+public class UserEntity {
+ private final static Logger logger = LoggerFactory.getLogger(UserEntity.class);
+ private String userId;
+ private String domainId;
+ private String userName;
+ private String createdTime;
+ private String updatedTime;
+ private DomainEntity domainByDomainId;
+
+ @Id
+ @Column(name = "USER_ID")
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ @Basic
+ @Column(name = "DOMAIN_ID")
+ public String getDomainId() {
+ return domainId;
+ }
+
+ public void setDomainId(String domainId) {
+ this.domainId = domainId;
+ }
+
+ @Basic
+ @Column(name = "USER_NAME")
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ @Basic
+ @Column(name = "CREATED_TIME")
+ public String getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(String createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ @Basic
+ @Column(name = "UPDATED_TIME")
+ public String getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(String updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ UserEntity that = (UserEntity) o;
+
+ if (userId != null ? !userId.equals(that.userId) : that.userId != null) return false;
+ if (domainId != null ? !domainId.equals(that.domainId) : that.domainId != null) return false;
+ if (userName != null ? !userName.equals(that.userName) : that.userName != null) return false;
+ if (createdTime != null ? !createdTime.equals(that.createdTime) : that.createdTime != null) return false;
+ if (updatedTime != null ? !updatedTime.equals(that.updatedTime) : that.updatedTime != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = userId != null ? userId.hashCode() : 0;
+ result = 31 * result + (userName != null ? userName.hashCode() : 0);
+ result = 31 * result + (createdTime != null ? createdTime.hashCode() : 0);
+ result = 31 * result + (updatedTime != null ? updatedTime.hashCode() : 0);
+ return result;
+ }
+
+ @ManyToOne
+ @JoinColumn(name = "DOMAIN_ID", referencedColumnName = "DOMAIN_ID")
+ public DomainEntity getDomainByDomainId() {
+ return domainByDomainId;
+ }
+
+ public void setDomainByDomainId(DomainEntity domainByDomainId) {
+ this.domainByDomainId = domainByDomainId;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/f3c365ab/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/UserGroupEntity.java
----------------------------------------------------------------------
diff --git a/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/UserGroupEntity.java b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/UserGroupEntity.java
new file mode 100644
index 0000000..aacf263
--- /dev/null
+++ b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/entities/UserGroupEntity.java
@@ -0,0 +1,172 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gov.registry.db.entities;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "USER_GROUP", schema = "")
+public class UserGroupEntity {
+ private final static Logger logger = LoggerFactory.getLogger(UserGroupEntity.class);
+ private String groupId;
+ private String domainId;
+ private String name;
+ private String description;
+ private String ownerId;
+ private String type;
+ private String createdTime;
+ private String updatedTime;
+ private DomainEntity domainByDomainId;
+ private UserEntity userByOwnerId;
+
+ @Id
+ @Column(name = "GROUP_ID")
+ public String getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId(String groupId) {
+ this.groupId = groupId;
+ }
+
+ @Basic
+ @Column(name = "DOMAIN_ID")
+ public String getDomainId() {
+ return domainId;
+ }
+
+ public void setDomainId(String domainId) {
+ this.domainId = domainId;
+ }
+
+ @Basic
+ @Column(name = "OWNER_ID")
+ public String getOwnerId() {
+ return ownerId;
+ }
+
+ public void setOwnerId(String ownerId) {
+ this.ownerId = ownerId;
+ }
+
+ @Basic
+ @Column(name = "NAME")
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Basic
+ @Column(name = "DESCRIPTION")
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ @Basic
+ @Column(name = "TYPE")
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ @Basic
+ @Column(name = "CREATED_TIME")
+ public String getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(String createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ @Basic
+ @Column(name = "UPDATED_TIME")
+ public String getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(String updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ UserGroupEntity that = (UserGroupEntity) o;
+
+ if (groupId != null ? !groupId.equals(that.groupId) : that.groupId != null) return false;
+ if (domainId != null ? !domainId.equals(that.domainId) : that.domainId != null) return false;
+ if (ownerId != null ? !ownerId.equals(that.ownerId) : that.ownerId != null) return false;
+ if (name != null ? !name.equals(that.name) : that.name != null) return false;
+ if (description != null ? !description.equals(that.description) : that.description != null) return false;
+ if (type != null ? !type.equals(that.type) : that.type != null) return false;
+ if (createdTime != null ? !createdTime.equals(that.createdTime) : that.createdTime != null) return false;
+ if (updatedTime != null ? !updatedTime.equals(that.updatedTime) : that.updatedTime != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = groupId != null ? groupId.hashCode() : 0;
+ result = 31 * result + (name != null ? name.hashCode() : 0);
+ result = 31 * result + (description != null ? description.hashCode() : 0);
+ result = 31 * result + (type != null ? type.hashCode() : 0);
+ result = 31 * result + (createdTime != null ? createdTime.hashCode() : 0);
+ result = 31 * result + (updatedTime != null ? updatedTime.hashCode() : 0);
+ return result;
+ }
+
+ @ManyToOne
+ @JoinColumn(name = "DOMAIN_ID", referencedColumnName = "DOMAIN_ID")
+ public DomainEntity getDomainByDomainId() {
+ return domainByDomainId;
+ }
+
+ public void setDomainByDomainId(DomainEntity domainByDomainId) {
+ this.domainByDomainId = domainByDomainId;
+ }
+
+ @ManyToOne
+ @JoinColumn(name = "OWNER_ID", referencedColumnName = "USER_ID")
+ public UserEntity getUserByOwnerId() {
+ return userByOwnerId;
+ }
+
+ public void setUserByOwnerId(UserEntity userByOwnerId) {
+ this.userByOwnerId = userByOwnerId;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/f3c365ab/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/repositories/AbstractRepository.java
----------------------------------------------------------------------
diff --git a/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/repositories/AbstractRepository.java b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/repositories/AbstractRepository.java
new file mode 100644
index 0000000..b78060c
--- /dev/null
+++ b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/repositories/AbstractRepository.java
@@ -0,0 +1,85 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gov.registry.db.repositories;
+
+import org.apache.airavata.gov.registry.db.utils.JPAUtils;
+import org.apache.airavata.gov.registry.db.utils.ObjectMapperSingleton;
+import org.apache.airavata.gov.registry.db.utils.QueryGenerator;
+import org.apache.airavata.gov.registry.models.GovRegistryException;
+import org.dozer.Mapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public abstract class AbstractRepository<T, E, Id> {
+ private final static Logger logger = LoggerFactory.getLogger(AbstractRepository.class);
+
+ private Class<T> thriftGenericClass;
+ private Class<E> dbEntityGenericClass;
+ private QueryGenerator queryGenerator;
+
+ public AbstractRepository(Class<T> thriftGenericClass, Class<E> dbEntityGenericClass){
+ this.thriftGenericClass = thriftGenericClass;
+ this.dbEntityGenericClass = dbEntityGenericClass;
+ this.queryGenerator = new QueryGenerator(dbEntityGenericClass.getSimpleName());
+ }
+
+ public T create(T t) throws GovRegistryException {
+ return update(t);
+ }
+
+ public T update(T t) throws GovRegistryException {
+ Mapper mapper = ObjectMapperSingleton.getInstance();
+ E entity = mapper.map(t, dbEntityGenericClass);
+ E persistedCopy = JPAUtils.execute(entityManager -> entityManager.merge(entity));
+ return mapper.map(persistedCopy, thriftGenericClass);
+ }
+
+ public boolean delete(Id id) throws GovRegistryException {
+ JPAUtils.execute(entityManager -> {
+ E entity = entityManager.find(dbEntityGenericClass, id);
+ entityManager.remove(entity);
+ return entity;
+ });
+ return true;
+ }
+
+ public T get(Id id) throws GovRegistryException {
+ E entity = JPAUtils.execute(entityManager -> entityManager
+ .find(dbEntityGenericClass, id));
+ Mapper mapper = ObjectMapperSingleton.getInstance();
+ return mapper.map(entity, thriftGenericClass);
+ }
+
+ public List<T> select(Map<String, String> filters, int offset, int limit) throws GovRegistryException {
+ String queryString = queryGenerator.getSelectQuery(filters);
+
+ List resultSet = JPAUtils.execute(entityManager -> entityManager.createQuery(queryString).setFirstResult(offset)
+ .setMaxResults(limit).getResultList());
+ Mapper mapper = ObjectMapperSingleton.getInstance();
+ List<T> gatewayList = new ArrayList<>();
+ resultSet.stream().forEach(rs -> gatewayList.add(mapper.map(rs, thriftGenericClass)));
+ return gatewayList;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/f3c365ab/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/repositories/DomainRepository.java
----------------------------------------------------------------------
diff --git a/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/repositories/DomainRepository.java b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/repositories/DomainRepository.java
new file mode 100644
index 0000000..5442c58
--- /dev/null
+++ b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/repositories/DomainRepository.java
@@ -0,0 +1,34 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gov.registry.db.repositories;
+
+import org.apache.airavata.gov.registry.db.entities.DomainEntity;
+import org.apache.airavata.gov.registry.models.Domain;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DomainRepository extends AbstractRepository<Domain, DomainEntity, String> {
+ private final static Logger logger = LoggerFactory.getLogger(DomainRepository.class);
+
+ public DomainRepository(Class<Domain> thriftGenericClass, Class<DomainEntity> dbEntityGenericClass) {
+ super(thriftGenericClass, dbEntityGenericClass);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/f3c365ab/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/repositories/UserGroupRepository.java
----------------------------------------------------------------------
diff --git a/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/repositories/UserGroupRepository.java b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/repositories/UserGroupRepository.java
new file mode 100644
index 0000000..c1a8bae
--- /dev/null
+++ b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/repositories/UserGroupRepository.java
@@ -0,0 +1,34 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gov.registry.db.repositories;
+
+import org.apache.airavata.gov.registry.db.entities.UserGroupEntity;
+import org.apache.airavata.gov.registry.models.UserGroup;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserGroupRepository extends AbstractRepository<UserGroup, UserGroupEntity, String> {
+ private final static Logger logger = LoggerFactory.getLogger(UserGroupRepository.class);
+
+ public UserGroupRepository(Class<UserGroup> thriftGenericClass, Class<UserGroupEntity> dbEntityGenericClass) {
+ super(thriftGenericClass, dbEntityGenericClass);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/f3c365ab/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/repositories/UserRepository.java
----------------------------------------------------------------------
diff --git a/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/repositories/UserRepository.java b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/repositories/UserRepository.java
new file mode 100644
index 0000000..44af810
--- /dev/null
+++ b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/repositories/UserRepository.java
@@ -0,0 +1,34 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gov.registry.db.repositories;
+
+import org.apache.airavata.gov.registry.db.entities.UserEntity;
+import org.apache.airavata.gov.registry.models.User;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserRepository extends AbstractRepository<User, UserEntity, String> {
+ private final static Logger logger = LoggerFactory.getLogger(UserRepository.class);
+
+ public UserRepository(Class<User> thriftGenericClass, Class<UserEntity> dbEntityGenericClass) {
+ super(thriftGenericClass, dbEntityGenericClass);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/f3c365ab/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/utils/Committer.java
----------------------------------------------------------------------
diff --git a/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/utils/Committer.java b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/utils/Committer.java
new file mode 100644
index 0000000..ae9feda
--- /dev/null
+++ b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/utils/Committer.java
@@ -0,0 +1,27 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gov.registry.db.utils;
+
+@FunctionalInterface
+public interface Committer<T, R> {
+
+ R commit(T t);
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/f3c365ab/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/utils/DBConstants.java
----------------------------------------------------------------------
diff --git a/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/utils/DBConstants.java b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/utils/DBConstants.java
new file mode 100644
index 0000000..6045806
--- /dev/null
+++ b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/utils/DBConstants.java
@@ -0,0 +1,40 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gov.registry.db.utils;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DBConstants {
+ private final static Logger logger = LoggerFactory.getLogger(DBConstants.class);
+
+ public static class DomainTable {
+ public static String DOMAIN_ID = "domainId";
+ public static String NAME = "name";
+ public static String DESCRIPTION = "description";
+ }
+
+ public static class UserTable {
+ public static String USER_ID = "userId";
+ public static String DOMAIN_ID = "domainId";
+ public static String USER_NAME = "userName";
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/f3c365ab/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/utils/JPAUtils.java
----------------------------------------------------------------------
diff --git a/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/utils/JPAUtils.java b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/utils/JPAUtils.java
new file mode 100644
index 0000000..6e8d11c
--- /dev/null
+++ b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/utils/JPAUtils.java
@@ -0,0 +1,111 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gov.registry.db.utils;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.gov.registry.models.GovRegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.*;
+import java.util.HashMap;
+import java.util.Map;
+
+public class JPAUtils {
+ private final static Logger logger = LoggerFactory.getLogger(JPAUtils.class);
+
+ private static final String PERSISTENCE_UNIT_NAME = "airavata-gov-registry";
+ private static final String GOV_REG_JDBC_DRIVER = "appcatalog.jdbc.driver";
+ private static final String GOV_REG_JDBC_URL = "appcatalog.jdbc.url";
+ private static final String GOV_REG_JDBC_USER = "appcatalog.jdbc.user";
+ private static final String GOV_REG_JDBC_PWD = "appcatalog.jdbc.password";
+ private static final String GOV_REG_VALIDATION_QUERY = "appcatalog.validationQuery";
+ private static final String JPA_CACHE_SIZE = "jpa.cache.size";
+ private static final String JPA_CACHE_ENABLED = "cache.enable";
+
+ @PersistenceUnit(unitName = PERSISTENCE_UNIT_NAME)
+ protected static EntityManagerFactory factory;
+ @PersistenceContext(unitName = PERSISTENCE_UNIT_NAME)
+ private static EntityManager entityManager;
+
+ public static EntityManager getEntityManager() {
+ if (factory == null) {
+// String connectionProperties = "DriverClassName=" + readServerProperties(GOV_REG_JDBC_DRIVER) + "," +
+// "Url=" + readServerProperties(GOV_REG_JDBC_URL) + "?autoReconnect=true," +
+// "Username=" + readServerProperties(GOV_REG_JDBC_USER) + "," +
+// "Password=" + readServerProperties(GOV_REG_JDBC_PWD) +
+// ",validationQuery=" + readServerProperties(GOV_REG_VALIDATION_QUERY);
+//
+
+ String connectionProperties = "DriverClassName=com.mysql.jdbc.Driver," +
+ "Url=jdbc:mysql://localhost:3306/airavata_gov_registry?autoReconnect=true," +
+ "Username=root," +
+ "Password=," +
+ ",validationQuery=SELECT 1 FROM CONFIGURATION";
+
+ Map<String, String> properties = new HashMap<String, String>();
+ properties.put("openjpa.ConnectionDriverName", "org.apache.commons.dbcp.BasicDataSource");
+ properties.put("openjpa.ConnectionProperties", connectionProperties);
+ properties.put("openjpa.DynamicEnhancementAgent", "true");
+ properties.put("openjpa.RuntimeUnenhancedClasses", "unsupported");
+ // For app catalog, we don't need caching
+// properties.put("openjpa.DataCache","" + readServerProperties(JPA_CACHE_ENABLED) + "(CacheSize=" + Integer.valueOf(readServerProperties(JPA_CACHE_SIZE)) + ", SoftReferenceSize=0)");
+// properties.put("openjpa.QueryCache","" + readServerProperties(JPA_CACHE_ENABLED) + "(CacheSize=" + Integer.valueOf(readServerProperties(JPA_CACHE_SIZE)) + ", SoftReferenceSize=0)");
+ properties.put("openjpa.RemoteCommitProvider", "sjvm");
+ properties.put("openjpa.Log", "DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO");
+ properties.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
+ properties.put("openjpa.jdbc.QuerySQLCache", "false");
+ properties.put("openjpa.ConnectionFactoryProperties", "PrettyPrint=true, PrettyPrintLineLength=72," +
+ " PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=31536000, autoReconnect=true");
+ properties.put("openjpa.RuntimeUnenhancedClasses", "warn");
+ factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME, properties);
+ }
+ entityManager = factory.createEntityManager();
+ return entityManager;
+ }
+
+ private static String readServerProperties(String propertyName) throws GovRegistryException {
+ try {
+ return ServerSettings.getSetting(propertyName);
+ } catch (ApplicationSettingsException e) {
+ logger.error("Unable to read airavata-server.properties...", e);
+ throw new GovRegistryException("Unable to read airavata-server.properties...");
+ }
+ }
+
+ public static <R> R execute(Committer<EntityManager, R> committer) throws GovRegistryException {
+ EntityManager entityManager = JPAUtils.getEntityManager();
+ try {
+ entityManager.getTransaction().begin();
+ R r = committer.commit(entityManager);
+ entityManager.getTransaction().commit();
+ return r;
+ }finally {
+ if (entityManager != null && entityManager.isOpen()) {
+ if (entityManager.getTransaction().isActive()) {
+ entityManager.getTransaction().rollback();
+ }
+ entityManager.close();
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/f3c365ab/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/utils/ObjectMapperSingleton.java
----------------------------------------------------------------------
diff --git a/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/utils/ObjectMapperSingleton.java b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/utils/ObjectMapperSingleton.java
new file mode 100644
index 0000000..d6c4d4d
--- /dev/null
+++ b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/utils/ObjectMapperSingleton.java
@@ -0,0 +1,39 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gov.registry.db.utils;
+
+import org.dozer.DozerBeanMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ObjectMapperSingleton extends DozerBeanMapper{
+ private final static Logger logger = LoggerFactory.getLogger(ObjectMapperSingleton.class);
+
+ private static ObjectMapperSingleton instance;
+
+ private ObjectMapperSingleton(){}
+
+ public static ObjectMapperSingleton getInstance(){
+ if(instance == null)
+ instance = new ObjectMapperSingleton();
+ return instance;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/f3c365ab/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/utils/QueryGenerator.java
----------------------------------------------------------------------
diff --git a/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/utils/QueryGenerator.java b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/utils/QueryGenerator.java
new file mode 100644
index 0000000..2844a4a
--- /dev/null
+++ b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/db/utils/QueryGenerator.java
@@ -0,0 +1,53 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gov.registry.db.utils;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Map;
+
+public class QueryGenerator {
+ private final static Logger logger = LoggerFactory.getLogger(QueryGenerator.class);
+
+ private String tableName;
+
+
+ public QueryGenerator(String tableName){
+ this.tableName = tableName;
+ }
+
+ public String getSelectQuery(Map<String, String> filters){
+ String query = "SELECT p from " + tableName + " as p WHERE ";
+ if(filters == null || filters.size() == 0){
+ query += "1";
+ }else{
+ for(String k : filters.keySet()){
+ query += "p." + k + " LIKE '%" + filters.get(k) + "%' AND ";
+ }
+ query = query.substring(0, query.length()-5);
+ }
+
+ query += " ORDER BY p.createdTime DESC";
+
+ return query;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/f3c365ab/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/server/GovRegistryServer.java
----------------------------------------------------------------------
diff --git a/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/server/GovRegistryServer.java b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/server/GovRegistryServer.java
new file mode 100644
index 0000000..276c99e
--- /dev/null
+++ b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/server/GovRegistryServer.java
@@ -0,0 +1,28 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gov.registry.server;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GovRegistryServer {
+ private final static Logger logger = LoggerFactory.getLogger(GovRegistryServer.class);
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/f3c365ab/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/server/GovRegistryServerHandler.java
----------------------------------------------------------------------
diff --git a/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/server/GovRegistryServerHandler.java b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/server/GovRegistryServerHandler.java
new file mode 100644
index 0000000..57d9093
--- /dev/null
+++ b/airavata-gov-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/gov/registry/server/GovRegistryServerHandler.java
@@ -0,0 +1,223 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gov.registry.server;
+
+import org.apache.airavata.gov.registry.models.*;
+import org.apache.airavata.gov.registry.service.cpi.GovRegistryService;
+import org.apache.thrift.TException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+import java.util.Map;
+
+public class GovRegistryServerHandler implements GovRegistryService.Iface{
+ private final static Logger logger = LoggerFactory.getLogger(GovRegistryServerHandler.class);
+
+ /**
+ * * Domain Operations
+ * *
+ */
+ @Override
+ public boolean createDomain(Domain domain) throws GovRegistryException, TException {
+ return false;
+ }
+
+ @Override
+ public boolean updateDomain(Domain domain) throws GovRegistryException, TException {
+ return false;
+ }
+
+ @Override
+ public boolean deleteDomain(String domainId) throws GovRegistryException, TException {
+ return false;
+ }
+
+ @Override
+ public Domain getDomain(String domainId) throws GovRegistryException, TException {
+ return null;
+ }
+
+ @Override
+ public List<Domain> getDomains(int offset, int limit) throws TException {
+ return null;
+ }
+
+ /**
+ * * User Operations
+ * *
+ */
+ @Override
+ public boolean registerUser(User user) throws GovRegistryException, TException {
+ return false;
+ }
+
+ @Override
+ public boolean updatedUser(User user) throws GovRegistryException, TException {
+ return false;
+ }
+
+ @Override
+ public boolean deleteUser(String userId) throws GovRegistryException, TException {
+ return false;
+ }
+
+ @Override
+ public User getUser(String userId) throws GovRegistryException, TException {
+ return null;
+ }
+
+ @Override
+ public List<User> getUsers(String domain, int offset, int limit) throws TException {
+ return null;
+ }
+
+ /**
+ * * Group Operations
+ * *
+ */
+ @Override
+ public boolean createGroup(Group group) throws GovRegistryException, TException {
+ return false;
+ }
+
+ @Override
+ public boolean updateGroup(Group group) throws GovRegistryException, TException {
+ return false;
+ }
+
+ @Override
+ public boolean deleteGroup(String groupId) throws GovRegistryException, TException {
+ return false;
+ }
+
+ @Override
+ public Group getGroup(String groupId) throws GovRegistryException, TException {
+ return null;
+ }
+
+ @Override
+ public List<Group> getGroups(String domain, int offset, int limit) throws TException {
+ return null;
+ }
+
+ @Override
+ public boolean addUsersToGroup(List<String> userIds, String groupId) throws GovRegistryException, TException {
+ return false;
+ }
+
+ @Override
+ public boolean removeUsersFromGroup(List<String> userIds, String groupId) throws GovRegistryException, TException {
+ return false;
+ }
+
+ @Override
+ public Map<String, GroupType> getGroupMembers(String groupId) throws TException {
+ return null;
+ }
+
+ /**
+ * * EntityType Operations
+ * *
+ */
+ @Override
+ public boolean createEntityType(EntityType entityType) throws GovRegistryException, TException {
+ return false;
+ }
+
+ @Override
+ public boolean updateEntityType(EntityType entityType) throws GovRegistryException, TException {
+ return false;
+ }
+
+ @Override
+ public boolean deleteEntityType(String entityTypeId) throws GovRegistryException, TException {
+ return false;
+ }
+
+ @Override
+ public EntityType getEntityType(String entityTypeId) throws GovRegistryException, TException {
+ return null;
+ }
+
+ @Override
+ public List<EntityType> getEntityTypes(String domain, int offset, int limit) throws TException {
+ return null;
+ }
+
+ /**
+ * * Entity Operations
+ * *
+ */
+ @Override
+ public boolean registerEntity(Entity entity) throws GovRegistryException, TException {
+ return false;
+ }
+
+ @Override
+ public boolean updateEntity(Entity entity) throws GovRegistryException, TException {
+ return false;
+ }
+
+ @Override
+ public boolean deleteEntity(String entityId) throws GovRegistryException, TException {
+ return false;
+ }
+
+ @Override
+ public Entity getEntity(String entityId) throws GovRegistryException, TException {
+ return null;
+ }
+
+ @Override
+ public List<Entity> searchEntities(String domain, String entityType, Map<String, String> filters, int offset, int limit) throws GovRegistryException, TException {
+ return null;
+ }
+
+ /**
+ * * EntityType Operations
+ * *
+ */
+ @Override
+ public boolean createPermissionType(PermissionType permisionType) throws GovRegistryException, TException {
+ return false;
+ }
+
+ @Override
+ public boolean updatePermissionType(PermissionType permisionType) throws GovRegistryException, TException {
+ return false;
+ }
+
+ @Override
+ public boolean deletePermissionType(String entityTypeId) throws GovRegistryException, TException {
+ return false;
+ }
+
+ @Override
+ public PermissionType getPermissionType(String permisionTypeId) throws GovRegistryException, TException {
+ return null;
+ }
+
+ @Override
+ public List<PermissionType> getPermissionTypes(String domain, int offset, int limit) throws GovRegistryException, TException {
+ return null;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/f3c365ab/airavata-gov-registry/airavata-sharing-registry-core/src/main/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/airavata-gov-registry/airavata-sharing-registry-core/src/main/resources/META-INF/persistence.xml b/airavata-gov-registry/airavata-sharing-registry-core/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..4a89174
--- /dev/null
+++ b/airavata-gov-registry/airavata-sharing-registry-core/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
+
+ <persistence-unit name="airavata-gov-registry">
+ <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+ <class>org.apache.airavata.gov.registry.db.entities.DomainEntity</class>
+ <class>org.apache.airavata.gov.registry.db.entities.EntityEntity</class>
+ <class>org.apache.airavata.gov.registry.db.entities.EntityTypeEntity</class>
+ <class>org.apache.airavata.gov.registry.db.entities.GroupMembershipEntity</class>
+ <class>org.apache.airavata.gov.registry.db.entities.PermissionTypeEntity</class>
+ <class>org.apache.airavata.gov.registry.db.entities.SharingEntity</class>
+ <class>org.apache.airavata.gov.registry.db.entities.UserEntity</class>
+ <class>org.apache.airavata.gov.registry.db.entities.UserGroupEntity</class>
+ </persistence-unit>
+</persistence>