Class InstanceMakerManager
- java.lang.Object
-
- ch.colabproject.colab.api.controller.team.InstanceMakerManager
-
public class InstanceMakerManager extends Object
Logic to manage model sharing- Author:
- mikkelvestergaard
-
-
Constructor Summary
Constructors Constructor Description InstanceMakerManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InstanceMaker
addAndPersistInstanceMaker(Project model, User user)
Create an instance maker for the model and the user and then persist it in databaseInstanceMaker
addInstanceMaker(Project model, User user)
Create an instance maker for the model and the userInstanceMaker
assertAndGetInstanceMaker(Long instanceMakerId)
Retrieve the instanceMaker.void
deleteInstanceMaker(Long instanceMakerId)
Delete instanceMakerInstanceMaker
findInstanceMakerByProjectAndUser(Project project, User user)
Find the instance maker linked to the given project and the given user.List<InstanceMaker>
getInstanceMakersForProject(Long projectId)
Retrieve all instanceMakers for a projectList<User>
getUsersForProject(Long projectId)
Retrieve all users of the instanceMakersInstanceMaker
shareModel(Long modelId, String email)
Send a token by email to grant access to use the model.
-
-
-
Method Detail
-
assertAndGetInstanceMaker
public InstanceMaker assertAndGetInstanceMaker(Long instanceMakerId)
Retrieve the instanceMaker. If not found, throw aHttpErrorMessage
- Parameters:
instanceMakerId
- the id of the instanceMaker- Returns:
- the instanceMaker found
- Throws:
ch.colabproject.colab.generator.model.exceptions.HttpErrorMessage
- if the instanceMaker was not found
-
getInstanceMakersForProject
public List<InstanceMaker> getInstanceMakersForProject(Long projectId)
Retrieve all instanceMakers for a project- Parameters:
projectId
- the id of the project- Returns:
- list of instanceMakers
-
getUsersForProject
public List<User> getUsersForProject(Long projectId)
Retrieve all users of the instanceMakers- Parameters:
projectId
- the id of the project- Returns:
- list of users
-
shareModel
public InstanceMaker shareModel(Long modelId, String email)
Send a token by email to grant access to use the model.- Parameters:
modelId
- the id of the modelemail
- the address to send the sharing token to- Returns:
- the pending potential instance maker
-
addAndPersistInstanceMaker
public InstanceMaker addAndPersistInstanceMaker(Project model, User user)
Create an instance maker for the model and the user and then persist it in database- Parameters:
user
- the usermodel
- the model- Returns:
- the brand-new potential instance maker
-
addInstanceMaker
public InstanceMaker addInstanceMaker(Project model, User user)
Create an instance maker for the model and the user- Parameters:
user
- the usermodel
- the model- Returns:
- the brand-new potential instance maker
-
findInstanceMakerByProjectAndUser
public InstanceMaker findInstanceMakerByProjectAndUser(Project project, User user)
Find the instance maker linked to the given project and the given user.- Parameters:
project
- the projectuser
- the user- Returns:
- the matching instance makers
-
deleteInstanceMaker
public void deleteInstanceMaker(Long instanceMakerId)
Delete instanceMaker- Parameters:
instanceMakerId
- id of instanceMaker to delete
-
-