Class GreenhouseRepository
- java.lang.Object
- 
- com.inhousegreenhouse.ch.backend.repository.GreenhouseRepository
 
- 
- All Implemented Interfaces:
- IRepository
 
 public class GreenhouseRepository extends java.lang.Object implements IRepository A GreenhouseRepository is a repository that manage data related to the current Greenhouse.
- 
- 
Constructor SummaryConstructors Constructor Description GreenhouseRepository(java.lang.String repositoryPath, java.lang.String proxyUrl)Constructor.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddGreenhouse(java.lang.String name, java.lang.String description, java.lang.String userToken)Register a new greenhouse to the API.GreenhousegetGreenhouse()Get the locally saved greenhouse.booleaninitializeRepository()Initialize an empty repository.voidload()Load the greenhouse from the repository.
 
- 
- 
- 
Method Detail- 
initializeRepositorypublic boolean initializeRepository() throws RepositoryLoadExceptionInitialize an empty repository.- Returns:
- True if the repository was initialized, false otherwise.
- Throws:
- RepositoryLoadException- If the repository cannot be initialized.
 
 - 
loadpublic void load() throws RepositoryLoadExceptionLoad the greenhouse from the repository.- Specified by:
- loadin interface- IRepository
- Throws:
- RepositoryLoadException- If the repository cannot be loaded.
 
 - 
addGreenhousepublic void addGreenhouse(java.lang.String name, java.lang.String description, java.lang.String userToken) throws ProxyRequestFailException, RepositoryLoadExceptionRegister a new greenhouse to the API.- Parameters:
- name- The name of the greenhouse.
- description- The description of the greenhouse.
- userToken- The user token.
- Throws:
- ProxyRequestFailException- If the request to the API fails.
- RepositoryLoadException- If the repository is not initialized.
 
 - 
getGreenhousepublic Greenhouse getGreenhouse() Get the locally saved greenhouse.- Returns:
- The locally saved greenhouse.
 
 
- 
 
-