Class DataManager
- java.lang.Object
-
- fi.tut.mei.matchmaking.dataproviders.DataManager
-
public final class DataManager extends Object
This is DataManager singleton class, which will be used as the interface to handle DB operations for most of the entities. If this class seems to be growing, it would be better to go for a logical classification of handling entities.- Author:
- Janaka Nawagamuwa
-
-
Field Summary
Fields Modifier and Type Field Description static javax.persistence.EntityManagerFactory
entityManagerFactory
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addProductDesc(ProductDescription productDesc)
Saving a product description to the databsestatic void
closeEntityManagerFactory()
fi.tut.mei.matchmaking.model.xml.msg.PRDData
getAllProductDescriptions()
Read all product description from database.static DataManager
getInstance(Properties properties)
Singleton get instance of the DataManager.fi.tut.mei.matchmaking.model.xml.msg.ProcessStepData
getProcessSteps(String prdId, Properties properties)
This method used to fetch all the process steps data from the product response.fi.tut.mei.matchmaking.model.xml.msg.ResourcePoolData
getResourcePools()
Data manager method to fetch all the resource poolsfi.tut.mei.matchmaking.model.xml.msg.SystemLayoutData
getSystemLayouts()
This method is returning the system layouts list as a data service.void
init(Properties properties)
Properties required to get the dataList<SystemLayout>
persistedLayoutList()
Fetch database saved system layoutsList<ProductDescription>
persistedPRDDataList()
This method is used to return all the PRD data fetched from database.List<ResourcePool>
persistedResourcePoolsList()
Utility method to get all the resource pools stored in the databasevoid
saveProductDescList(List<ProductDescription> productDescriptionList)
Utility function to save product description listvoid
saveResourcePoolsList(List<ResourcePool> resourcePoolList)
Utility function to save list of resource poolsvoid
saveSystemLayoutsList(List<SystemLayout> systemLayoutList)
Saving system layouts list to the databasevoid
setMockdataMode(boolean isMockDataMode)
-
-
-
Method Detail
-
getInstance
public static DataManager getInstance(Properties properties)
Singleton get instance of the DataManager.- Parameters:
properties
- "matchmakingProperties" read from the file. to get details related to DB.- Returns:
-
closeEntityManagerFactory
public static void closeEntityManagerFactory()
-
init
public void init(Properties properties)
Properties required to get the data- Parameters:
properties
-
-
saveProductDescList
public void saveProductDescList(List<ProductDescription> productDescriptionList)
Utility function to save product description list- Parameters:
productDescriptionList
-
-
addProductDesc
public void addProductDesc(ProductDescription productDesc)
Saving a product description to the databse- Parameters:
productDesc
-
-
getAllProductDescriptions
public fi.tut.mei.matchmaking.model.xml.msg.PRDData getAllProductDescriptions()
Read all product description from database.- Returns:
- List of ProductDescription
-
persistedPRDDataList
public List<ProductDescription> persistedPRDDataList()
This method is used to return all the PRD data fetched from database.- Returns:
-
getProcessSteps
public fi.tut.mei.matchmaking.model.xml.msg.ProcessStepData getProcessSteps(String prdId, Properties properties)
This method used to fetch all the process steps data from the product response.- Parameters:
prdId
-- Returns:
-
getSystemLayouts
public fi.tut.mei.matchmaking.model.xml.msg.SystemLayoutData getSystemLayouts()
This method is returning the system layouts list as a data service.- Returns:
-
saveSystemLayoutsList
public void saveSystemLayoutsList(List<SystemLayout> systemLayoutList)
Saving system layouts list to the database- Parameters:
systemLayoutList
-
-
persistedLayoutList
public List<SystemLayout> persistedLayoutList()
Fetch database saved system layouts- Returns:
-
getResourcePools
public fi.tut.mei.matchmaking.model.xml.msg.ResourcePoolData getResourcePools()
Data manager method to fetch all the resource pools- Returns:
-
persistedResourcePoolsList
public List<ResourcePool> persistedResourcePoolsList()
Utility method to get all the resource pools stored in the database- Returns:
-
saveResourcePoolsList
public void saveResourcePoolsList(List<ResourcePool> resourcePoolList)
Utility function to save list of resource pools- Parameters:
resourcePoolList
-
-
setMockdataMode
public void setMockdataMode(boolean isMockDataMode)
-
-