This is an automated email from the ASF dual-hosted git repository.

smarru pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-sandbox.git

commit 03fe760eaf35d961d6847a3f2b70c0f0df5de5c6
Author: Harsha Phulwani <[email protected]>
AuthorDate: Mon Nov 13 01:56:30 2017 -0500

    Added Added initial files for entities,repositories for allocation manager 
module
---
 .../manager/db/entities/RequestStatusEntity.java   |  87 +++++++++
 .../db/entities/UserAllocationDetailEntity.java    | 202 +++++++++++++++++++++
 .../db/entities/UserAllocationDetailPKEntity.java  |  56 ++++++
 .../manager/db/entities/UserDetailEntity.java      |  75 ++++++++
 .../db/repositories/AbstractRepository.java        | 170 +++++++++++++++++
 .../db/repositories/RequestStatusRepository.java   |  14 ++
 .../UserAllocationDetailPKRepository.java          |  14 ++
 .../UserAllocationDetailRepository.java            |  14 ++
 .../db/repositories/UserDetailRepository.java      |  19 ++
 .../src/main/resources/META-INF/persistence.xml    |  11 ++
 .../main/resources/allocation-manager-mysql.sql    |  58 ++++++
 11 files changed, 720 insertions(+)

diff --git 
a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/RequestStatusEntity.java
 
b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/RequestStatusEntity.java
new file mode 100644
index 0000000..4263468
--- /dev/null
+++ 
b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/RequestStatusEntity.java
@@ -0,0 +1,87 @@
+package org.apache.airavata.allocation.manager.db.entities;
+
+import java.io.Serializable;
+import javax.persistence.*;
+import java.math.BigInteger;
+
+
+/**
+ * The persistent class for the request_status database table.
+ * 
+ */
+@Entity
+@Table(name="request_status")
+@NamedQuery(name="RequestStatus.findAll", query="SELECT r FROM RequestStatus 
r")
+public class RequestStatus implements Serializable {
+       private static final long serialVersionUID = 1L;
+
+       @Id
+       @Column(name="PROJECT_ID")
+       private String projectId;
+
+       @Column(name="AWARD_ALLOCATION")
+       private BigInteger awardAllocation;
+
+       @Column(name="END_DATE")
+       private BigInteger endDate;
+
+       @Lob
+       private String reviewers;
+
+       @Column(name="START_DATE")
+       private BigInteger startDate;
+
+       private String status;
+
+       public RequestStatus() {
+       }
+
+       public String getProjectId() {
+               return this.projectId;
+       }
+
+       public void setProjectId(String projectId) {
+               this.projectId = projectId;
+       }
+
+       public BigInteger getAwardAllocation() {
+               return this.awardAllocation;
+       }
+
+       public void setAwardAllocation(BigInteger awardAllocation) {
+               this.awardAllocation = awardAllocation;
+       }
+
+       public BigInteger getEndDate() {
+               return this.endDate;
+       }
+
+       public void setEndDate(BigInteger endDate) {
+               this.endDate = endDate;
+       }
+
+       public String getReviewers() {
+               return this.reviewers;
+       }
+
+       public void setReviewers(String reviewers) {
+               this.reviewers = reviewers;
+       }
+
+       public BigInteger getStartDate() {
+               return this.startDate;
+       }
+
+       public void setStartDate(BigInteger startDate) {
+               this.startDate = startDate;
+       }
+
+       public String getStatus() {
+               return this.status;
+       }
+
+       public void setStatus(String status) {
+               this.status = status;
+       }
+
+}
\ No newline at end of file
diff --git 
a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntity.java
 
b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntity.java
new file mode 100644
index 0000000..7d40899
--- /dev/null
+++ 
b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntity.java
@@ -0,0 +1,202 @@
+package org.apache.airavata.allocation.manager.db.entities;
+
+import java.io.Serializable;
+import javax.persistence.*;
+import java.math.BigInteger;
+
+
+/**
+ * The persistent class for the user_allocation_details database table.
+ * 
+ */
+@Entity
+@Table(name="user_allocation_details")
+@NamedQuery(name="UserAllocationDetail.findAll", query="SELECT u FROM 
UserAllocationDetail u")
+public class UserAllocationDetail implements Serializable {
+       private static final long serialVersionUID = 1L;
+
+       @EmbeddedId
+       private UserAllocationDetailPK id;
+
+       @Lob
+       @Column(name="APPLICATIONS_TO_BE_USED")
+       private String applicationsToBeUsed;
+
+       @Column(name="DISK_USAGE_RANGE_PER_JOB")
+       private BigInteger diskUsageRangePerJob;
+
+       @Lob
+       private byte[] documents;
+
+       @Lob
+       @Column(name="FIELD_OF_SCIENCE")
+       private String fieldOfScience;
+
+       @Lob
+       private String keywords;
+
+       @Column(name="MAX_MEMORY_PER_CPU")
+       private BigInteger maxMemoryPerCpu;
+
+       @Column(name="NUMBER_OF_CPU_PER_JOB")
+       private BigInteger numberOfCpuPerJob;
+
+       @Lob
+       @Column(name="PROJECT_DESCRIPTION")
+       private String projectDescription;
+
+       @Lob
+       @Column(name="PROJECT_REVIEWED_AND_FUNDED_BY")
+       private String projectReviewedAndFundedBy;
+
+       @Column(name="REQUESTED_DATE")
+       private BigInteger requestedDate;
+
+       @Column(name="SERVICE_UNITS")
+       private BigInteger serviceUnits;
+
+       @Lob
+       @Column(name="SPECIFIC_RESOURCE_SELECTION")
+       private String specificResourceSelection;
+
+       @Lob
+       private String title;
+
+       @Column(name="TYPE_OF_ALLOCATION")
+       private String typeOfAllocation;
+
+       @Column(name="TYPICAL_SU_PER_JOB")
+       private BigInteger typicalSuPerJob;
+
+       public UserAllocationDetail() {
+       }
+
+       public UserAllocationDetailPK getId() {
+               return this.id;
+       }
+
+       public void setId(UserAllocationDetailPK id) {
+               this.id = id;
+       }
+
+       public String getApplicationsToBeUsed() {
+               return this.applicationsToBeUsed;
+       }
+
+       public void setApplicationsToBeUsed(String applicationsToBeUsed) {
+               this.applicationsToBeUsed = applicationsToBeUsed;
+       }
+
+       public BigInteger getDiskUsageRangePerJob() {
+               return this.diskUsageRangePerJob;
+       }
+
+       public void setDiskUsageRangePerJob(BigInteger diskUsageRangePerJob) {
+               this.diskUsageRangePerJob = diskUsageRangePerJob;
+       }
+
+       public byte[] getDocuments() {
+               return this.documents;
+       }
+
+       public void setDocuments(byte[] documents) {
+               this.documents = documents;
+       }
+
+       public String getFieldOfScience() {
+               return this.fieldOfScience;
+       }
+
+       public void setFieldOfScience(String fieldOfScience) {
+               this.fieldOfScience = fieldOfScience;
+       }
+
+       public String getKeywords() {
+               return this.keywords;
+       }
+
+       public void setKeywords(String keywords) {
+               this.keywords = keywords;
+       }
+
+       public BigInteger getMaxMemoryPerCpu() {
+               return this.maxMemoryPerCpu;
+       }
+
+       public void setMaxMemoryPerCpu(BigInteger maxMemoryPerCpu) {
+               this.maxMemoryPerCpu = maxMemoryPerCpu;
+       }
+
+       public BigInteger getNumberOfCpuPerJob() {
+               return this.numberOfCpuPerJob;
+       }
+
+       public void setNumberOfCpuPerJob(BigInteger numberOfCpuPerJob) {
+               this.numberOfCpuPerJob = numberOfCpuPerJob;
+       }
+
+       public String getProjectDescription() {
+               return this.projectDescription;
+       }
+
+       public void setProjectDescription(String projectDescription) {
+               this.projectDescription = projectDescription;
+       }
+
+       public String getProjectReviewedAndFundedBy() {
+               return this.projectReviewedAndFundedBy;
+       }
+
+       public void setProjectReviewedAndFundedBy(String 
projectReviewedAndFundedBy) {
+               this.projectReviewedAndFundedBy = projectReviewedAndFundedBy;
+       }
+
+       public BigInteger getRequestedDate() {
+               return this.requestedDate;
+       }
+
+       public void setRequestedDate(BigInteger requestedDate) {
+               this.requestedDate = requestedDate;
+       }
+
+       public BigInteger getServiceUnits() {
+               return this.serviceUnits;
+       }
+
+       public void setServiceUnits(BigInteger serviceUnits) {
+               this.serviceUnits = serviceUnits;
+       }
+
+       public String getSpecificResourceSelection() {
+               return this.specificResourceSelection;
+       }
+
+       public void setSpecificResourceSelection(String 
specificResourceSelection) {
+               this.specificResourceSelection = specificResourceSelection;
+       }
+
+       public String getTitle() {
+               return this.title;
+       }
+
+       public void setTitle(String title) {
+               this.title = title;
+       }
+
+       public String getTypeOfAllocation() {
+               return this.typeOfAllocation;
+       }
+
+       public void setTypeOfAllocation(String typeOfAllocation) {
+               this.typeOfAllocation = typeOfAllocation;
+       }
+
+       public BigInteger getTypicalSuPerJob() {
+               return this.typicalSuPerJob;
+       }
+
+       public void setTypicalSuPerJob(BigInteger typicalSuPerJob) {
+               this.typicalSuPerJob = typicalSuPerJob;
+       }
+
+}
\ No newline at end of file
diff --git 
a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailPKEntity.java
 
b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailPKEntity.java
new file mode 100644
index 0000000..93f8502
--- /dev/null
+++ 
b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailPKEntity.java
@@ -0,0 +1,56 @@
+package org.apache.airavata.allocation.manager.db.entities;
+
+import java.io.Serializable;
+import javax.persistence.*;
+
+/**
+ * The primary key class for the user_allocation_details database table.
+ * 
+ */
+@Embeddable
+public class UserAllocationDetailPK implements Serializable {
+       //default serial version id, required for serializable classes.
+       private static final long serialVersionUID = 1L;
+
+       @Column(name="PROJECT_ID")
+       private String projectId;
+
+       private String username;
+
+       public UserAllocationDetailPK() {
+       }
+       public String getProjectId() {
+               return this.projectId;
+       }
+       public void setProjectId(String projectId) {
+               this.projectId = projectId;
+       }
+       public String getUsername() {
+               return this.username;
+       }
+       public void setUsername(String username) {
+               this.username = username;
+       }
+
+       public boolean equals(Object other) {
+               if (this == other) {
+                       return true;
+               }
+               if (!(other instanceof UserAllocationDetailPK)) {
+                       return false;
+               }
+               UserAllocationDetailPK castOther = 
(UserAllocationDetailPK)other;
+               return 
+                       this.projectId.equals(castOther.projectId)
+                       && this.username.equals(castOther.username);
+       }
+
+       public int hashCode() {
+               final int prime = 31;
+               int hash = 17;
+               hash = hash * prime + this.projectId.hashCode();
+               hash = hash * prime + this.username.hashCode();
+               
+               return hash;
+       }
+}
\ No newline at end of file
diff --git 
a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserDetailEntity.java
 
b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserDetailEntity.java
new file mode 100644
index 0000000..b27a6bc
--- /dev/null
+++ 
b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserDetailEntity.java
@@ -0,0 +1,75 @@
+package org.apache.airavata.allocation.manager.db.entities;
+
+import java.io.Serializable;
+import javax.persistence.*;
+
+
+/**
+ * The persistent class for the user_details database table.
+ * 
+ */
+@Entity
+@Table(name="user_details")
+@NamedQuery(name="UserDetail.findAll", query="SELECT u FROM UserDetail u")
+public class UserDetail implements Serializable {
+       private static final long serialVersionUID = 1L;
+
+       @Id
+       private String username;
+
+       @Lob
+       private String email;
+
+       @Lob
+       @Column(name="FULL_NAME")
+       private String fullName;
+
+       private String password;
+
+       @Column(name="USER_TYPE")
+       private String userType;
+
+       public UserDetail() {
+       }
+
+       public String getUsername() {
+               return this.username;
+       }
+
+       public void setUsername(String username) {
+               this.username = username;
+       }
+
+       public String getEmail() {
+               return this.email;
+       }
+
+       public void setEmail(String email) {
+               this.email = email;
+       }
+
+       public String getFullName() {
+               return this.fullName;
+       }
+
+       public void setFullName(String fullName) {
+               this.fullName = fullName;
+       }
+
+       public String getPassword() {
+               return this.password;
+       }
+
+       public void setPassword(String password) {
+               this.password = password;
+       }
+
+       public String getUserType() {
+               return this.userType;
+       }
+
+       public void setUserType(String userType) {
+               this.userType = userType;
+       }
+
+}
\ No newline at end of file
diff --git 
a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/AbstractRepository.java
 
b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/AbstractRepository.java
new file mode 100644
index 0000000..0ca393e
--- /dev/null
+++ 
b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/AbstractRepository.java
@@ -0,0 +1,170 @@
+/**
+ *
+ * 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.sharing.registry.db.repositories;
+
+import org.apache.airavata.sharing.registry.db.utils.Committer;
+import org.apache.airavata.sharing.registry.db.utils.DBConstants;
+import org.apache.airavata.sharing.registry.db.utils.JPAUtils;
+import org.apache.airavata.sharing.registry.db.utils.ObjectMapperSingleton;
+import org.apache.airavata.sharing.registry.models.SharingRegistryException;
+import org.dozer.Mapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+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;
+
+    public AbstractRepository(Class<T> thriftGenericClass, Class<E> 
dbEntityGenericClass){
+        this.thriftGenericClass = thriftGenericClass;
+        this.dbEntityGenericClass = dbEntityGenericClass;
+    }
+
+    public T create(T t) throws SharingRegistryException {
+        return update(t);
+    }
+
+    //FIXME do a bulk insert
+    public List<T> create(List<T> tList) throws SharingRegistryException {
+        return update(tList);
+    }
+    
+    public List<T> create(String query) throws SharingRegistryException {
+       // String query = "INSERT INTO " + dbEntityGenericClass.getSimpleName() 
+ " values("+values+")";
+       execute(entityManager -> {
+            javax.persistence.Query q = entityManager.createQuery(query);
+        });
+    }
+
+    public  T update(T t) throws SharingRegistryException {
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        E entity = mapper.map(t, dbEntityGenericClass);
+        E persistedCopy = execute(entityManager -> 
entityManager.merge(entity));
+        return mapper.map(persistedCopy, thriftGenericClass);
+    }
+
+    //FIXME do a bulk update
+    public  List<T> update(List<T> tList) throws SharingRegistryException {
+        List<T> returnList = new ArrayList<>();
+        for(T temp : tList)
+            returnList.add(update(temp));
+        return returnList;
+    }
+
+    public boolean delete(Id id) throws SharingRegistryException {
+        execute(entityManager -> {
+             E entity = entityManager.find(dbEntityGenericClass, id);
+             entityManager.remove(entity);
+             return entity;
+         });
+        return true;
+    }
+
+    public boolean delete(List<Id> idList) throws SharingRegistryException {
+        for(Id id : idList)
+            delete(id);
+        return true;
+    }
+
+    public T get(Id id) throws SharingRegistryException {
+        E entity = execute(entityManager -> entityManager
+                .find(dbEntityGenericClass, id));
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        if(entity == null)
+            return null;
+        return mapper.map(entity, thriftGenericClass);
+    }
+
+    public boolean isExists(Id id) throws SharingRegistryException {
+        return get(id) != null;
+    }
+
+    public List<T> get(List<Id> idList) throws SharingRegistryException {
+        List<T> returnList = new ArrayList<>();
+        for(Id id : idList)
+            returnList.add(get(id));
+        return returnList;
+    }
+
+    public List<T> select(Map<String, String> filters, int offset, int limit) 
throws SharingRegistryException {
+        String query = "SELECT DISTINCT p from " + 
dbEntityGenericClass.getSimpleName() + " as p";
+        ArrayList<String> parameters = new ArrayList<>();
+        int parameterCount = 1;
+        if (filters != null && filters.size() != 0) {
+            query += " WHERE ";
+            for (String k : filters.keySet()) {
+                query += "p." + k + " = ?" + parameterCount + " AND ";
+                parameters.add(filters.get(k));
+                parameterCount++;
+            }
+            query = query.substring(0, query.length() - 5);
+        }
+
+        query += " ORDER BY p.createdTime DESC";
+        String queryString = query;
+        int newLimit = limit < 0 ? DBConstants.SELECT_MAX_ROWS: limit;
+        List resultSet = execute(entityManager -> {
+            javax.persistence.Query q = entityManager.createQuery(queryString);
+            for (int i = 0; i < parameters.size(); i++) {
+                q.setParameter(i + 1, parameters.get(i));
+            }
+            return 
q.setFirstResult(offset).setMaxResults(newLimit).getResultList();
+        });
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        List<T> gatewayList = new ArrayList<>();
+        resultSet.stream().forEach(rs -> gatewayList.add(mapper.map(rs, 
thriftGenericClass)));
+        return gatewayList;
+    }
+
+    public List<T> select(String queryString, Map<String,Object> 
queryParameters, int offset, int limit) throws SharingRegistryException {
+        int newLimit = limit < 0 ? DBConstants.SELECT_MAX_ROWS: limit;
+        List resultSet = execute(entityManager -> {
+            Query q =  entityManager.createQuery(queryString);
+            for(Map.Entry<String, Object> queryParam : 
queryParameters.entrySet()){
+                q.setParameter(queryParam.getKey(), queryParam.getValue());
+            }
+            return 
q.setFirstResult(offset).setMaxResults(newLimit).getResultList();
+        });
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        List<T> gatewayList = new ArrayList<>();
+        resultSet.stream().forEach(rs -> gatewayList.add(mapper.map(rs, 
thriftGenericClass)));
+        return gatewayList;
+    }
+
+    public <R> R execute(Committer<EntityManager, R> committer) throws 
SharingRegistryException {
+        EntityManager entityManager = JPAUtils.getEntityManager();
+        try {
+            entityManager.getTransaction().begin();
+            R r = committer.commit(entityManager);
+            entityManager.getTransaction().commit();
+            return r;
+        } finally {
+            entityManager.close();
+        }
+    }
+}
\ No newline at end of file
diff --git 
a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/RequestStatusRepository.java
 
b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/RequestStatusRepository.java
new file mode 100644
index 0000000..52a2c4e
--- /dev/null
+++ 
b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/RequestStatusRepository.java
@@ -0,0 +1,14 @@
+package org.apache.airavata.allocation.manager.db.repositories;
+
+import org.apache.airavata.allocation.manager.db.entities.RequestStatusEntity;
+import org.apache.airavata.sharing.registry.models.RequestStatus;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RequestStatusRepository extends AbstractRepository<RequestStatus, 
RequestStatusEntity, String> {
+    private final static Logger logger = 
LoggerFactory.getLogger(DomainRepository.class);
+
+    public RequestStatusRepository(){
+        super(RequestStatus.class, RequestStatusEntity.class);
+    }
+}
\ No newline at end of file
diff --git 
a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailPKRepository.java
 
b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailPKRepository.java
new file mode 100644
index 0000000..0644f8a
--- /dev/null
+++ 
b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailPKRepository.java
@@ -0,0 +1,14 @@
+package org.apache.airavata.allocation.manager.db.repositories;
+
+import 
org.apache.airavata.allocation.manager.db.entities.UserAllocationDetailPKEntity;
+import org.apache.airavata.sharing.registry.models.UserAllocationDetailPK;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserAllocationDetailPKRepository extends 
AbstractRepository<UserAllocationDetailPK, UserAllocationDetailPKEntity, 
String> {
+    private final static Logger logger = 
LoggerFactory.getLogger(DomainRepository.class);
+
+    public UserAllocationDetailPKRepository(){
+        super(UserAllocationDetailPK.class, 
UserAllocationDetailPKEntity.class);
+    }
+}
\ No newline at end of file
diff --git 
a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailRepository.java
 
b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailRepository.java
new file mode 100644
index 0000000..35366d6
--- /dev/null
+++ 
b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailRepository.java
@@ -0,0 +1,14 @@
+package org.apache.airavata.allocation.manager.db.repositories;
+
+import 
org.apache.airavata.allocation.manager.db.entities.UserAllocationDetailEntity;
+import org.apache.airavata.sharing.registry.models.UserAllocationDetail;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserAllocationDetailRepository extends 
AbstractRepository<UserAllocationDetail, UserAllocationDetailEntity, String> {
+    private final static Logger logger = 
LoggerFactory.getLogger(DomainRepository.class);
+
+    public UserAllocationDetailRepository(){
+        super(UserAllocationDetail.class, UserAllocationDetailEntity.class);
+    }
+}
\ No newline at end of file
diff --git 
a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserDetailRepository.java
 
b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserDetailRepository.java
new file mode 100644
index 0000000..55cd888
--- /dev/null
+++ 
b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserDetailRepository.java
@@ -0,0 +1,19 @@
+package org.apache.airavata.allocation.manager.db.repositories;
+
+import org.apache.airavata.allocation.manager.db.entities.UserDetailEntity;
+import org.apache.airavata.sharing.registry.models.UserDetail;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserDetailRepository extends AbstractRepository<UserDetail, 
UserAllocationEntity, String> {
+    private final static Logger logger = 
LoggerFactory.getLogger(DomainRepository.class);
+
+    public UserDetailRepository(){
+        super(UserDetail.class, UserDetailEntity.class);
+    }
+
+    public static void main(String args[])
+    {
+
+    }
+}
\ No newline at end of file
diff --git 
a/allocation-manager/allocation-manager-server/src/main/resources/META-INF/persistence.xml
 
b/allocation-manager/allocation-manager-server/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..a006ad6
--- /dev/null
+++ 
b/allocation-manager/allocation-manager-server/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"; version="2.0">
+
+    <persistence-unit name="airavata-allocation-manager">
+        
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+        
<class>org.apache.airavata.allocation.manager.db.entities.UserAllocationDetailEntity</class>
+        
<class>org.apache.airavata.allocation.manager.db.entities.UserAllocationDetailPKEntity</class>
+        
<class>org.apache.airavata.allocation.manager.db.entities.RequestStatusEntity</class>
+        
<class>org.apache.airavata.allocation.manager.db.entities.UserDetailEntity</class>
+    </persistence-unit>
+</persistence>
diff --git 
a/allocation-manager/allocation-manager-server/src/main/resources/allocation-manager-mysql.sql
 
b/allocation-manager/allocation-manager-server/src/main/resources/allocation-manager-mysql.sql
new file mode 100644
index 0000000..20824f6
--- /dev/null
+++ 
b/allocation-manager/allocation-manager-server/src/main/resources/allocation-manager-mysql.sql
@@ -0,0 +1,58 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+CREATE TABLE IF NOT EXISTS USER_ALLOCATION_DETAILS (
+    REQUESTED_DATE BIGINT NOT NULL,
+    TITLE TEXT NOT NULL,
+    PROJECT_DESCRIPTION TEXT NOT NULL,
+    KEYWORDS TEXT,
+    FIELD_OF_SCIENCE TEXT,
+    DOCUMENTS BLOB,
+    TYPE_OF_ALLOCATION VARCHAR (255) NOT NULL,
+    USERNAME VARCHAR (255) NOT NULL,
+    PROJECT_ID VARCHAR (255) ,
+    APPLICATIONS_TO_BE_USED TEXT,
+    SPECIFIC_RESOURCE_SELECTION TEXT,
+    SERVICE_UNITS BIGINT default 1,
+    TYPICAL_SU_PER_JOB BIGINT,
+    MAX_MEMORY_PER_CPU BIGINT,
+    DISK_USAGE_RANGE_PER_JOB BIGINT,
+    NUMBER_OF_CPU_PER_JOB BIGINT,
+    PROJECT_REVIEWED_AND_FUNDED_BY TEXT,
+    PRIMARY KEY (PROJECT_ID, USERNAME)
+);
+
+CREATE TABLE IF NOT EXISTS USER_DETAILS (
+    USERNAME VARCHAR (255) PRIMARY KEY,
+    PASSWORD VARCHAR (255) NOT NULL,
+    FULL_NAME TEXT,
+    EMAIL TEXT NOT NULL,
+    USER_TYPE VARCHAR (255) NOT NULL
+);
+
+CREATE TABLE IF NOT EXISTS REQUEST_STATUS (
+    PROJECT_ID VARCHAR (255) PRIMARY KEY,
+    STATUS VARCHAR (255) NOT NULL,
+    REVIEWERS TEXT,
+    START_DATE BIGINT,
+    END_DATE BIGINT,
+    AWARD_ALLOCATION BIGINT
+);

-- 
To stop receiving notification emails like this one, please contact
"[email protected]" <[email protected]>.

Reply via email to