|
23 | 23 | import ch.colabproject.colab.api.model.card.CardContent; |
24 | 24 | import ch.colabproject.colab.api.model.link.ActivityFlowLink; |
25 | 25 | import ch.colabproject.colab.api.model.project.CopyParam; |
26 | | -import ch.colabproject.colab.api.model.project.InstanceMaker; |
27 | 26 | import ch.colabproject.colab.api.model.project.Project; |
28 | 27 | import ch.colabproject.colab.api.model.team.TeamMember; |
29 | 28 | import ch.colabproject.colab.api.model.team.acl.HierarchicalPosition; |
30 | 29 | import ch.colabproject.colab.api.model.user.User; |
31 | 30 | import ch.colabproject.colab.api.persistence.jpa.project.CopyParamDao; |
32 | | -import ch.colabproject.colab.api.persistence.jpa.project.InstanceMakerDao; |
33 | 31 | import ch.colabproject.colab.api.persistence.jpa.project.ProjectDao; |
34 | 32 | import ch.colabproject.colab.api.rest.project.bean.ProjectCreationData; |
35 | 33 | import ch.colabproject.colab.api.rest.project.bean.ProjectStructure; |
36 | 34 | import ch.colabproject.colab.generator.model.exceptions.HttpErrorMessage; |
37 | 35 | import ch.colabproject.colab.generator.model.exceptions.MessageI18nKey; |
| 36 | +import org.slf4j.Logger; |
| 37 | +import org.slf4j.LoggerFactory; |
| 38 | + |
| 39 | +import javax.ejb.LocalBean; |
| 40 | +import javax.ejb.Stateless; |
| 41 | +import javax.inject.Inject; |
38 | 42 | import java.util.ArrayList; |
39 | 43 | import java.util.List; |
40 | 44 | import java.util.Optional; |
41 | 45 | import java.util.Set; |
42 | 46 | import java.util.stream.Collectors; |
43 | | -import javax.ejb.LocalBean; |
44 | | -import javax.ejb.Stateless; |
45 | | -import javax.inject.Inject; |
46 | | -import org.slf4j.Logger; |
47 | | -import org.slf4j.LoggerFactory; |
48 | 47 |
|
49 | 48 | /** |
50 | 49 | * Project specific logic |
@@ -93,12 +92,6 @@ public class ProjectManager { |
93 | 92 | @Inject |
94 | 93 | private CopyParamDao copyParamDao; |
95 | 94 |
|
96 | | - /** |
97 | | - * Instance maker persistence handler |
98 | | - */ |
99 | | - @Inject |
100 | | - private InstanceMakerDao instanceMakerDao; |
101 | | - |
102 | 95 | /** |
103 | 96 | * Team specific logic management |
104 | 97 | */ |
@@ -480,78 +473,6 @@ public Project duplicateProject(Long projectId, DuplicationParam params) { |
480 | 473 | } |
481 | 474 | } |
482 | 475 |
|
483 | | - // ********************************************************************************************* |
484 | | - // sharing |
485 | | - // ********************************************************************************************* |
486 | | - |
487 | | - /** |
488 | | - * Send a token by email to grant access to use the model. |
489 | | - * |
490 | | - * @param modelId the id of the model |
491 | | - * @param email the address to send the sharing token to |
492 | | - * |
493 | | - * @return the pending potential instance maker |
494 | | - */ |
495 | | - public InstanceMaker shareModel(Long modelId, String email) { |
496 | | - logger.debug("Share the model #{} to {}", modelId, email); |
497 | | - Project model = assertAndGetProject(modelId); |
498 | | - |
499 | | - return tokenManager.sendModelSharingToken(model, email); |
500 | | - } |
501 | | - |
502 | | - /** |
503 | | - * Create an instance maker for the model and the user and then persist it in database |
504 | | - * |
505 | | - * @param user the user |
506 | | - * @param model the model |
507 | | - * |
508 | | - * @return the brand new potential instance maker |
509 | | - */ |
510 | | - public InstanceMaker addAndPersistInstanceMaker(Project model, User user) { |
511 | | - logger.debug("Add and persist instance maker to user {} for model {}", user, model); |
512 | | - |
513 | | - InstanceMaker instanceMaker = addInstanceMaker(model, user); |
514 | | - instanceMakerDao.persistInstanceMaker(instanceMaker); |
515 | | - |
516 | | - return instanceMaker; |
517 | | - } |
518 | | - |
519 | | - /** |
520 | | - * Create an instance maker for the model and the user |
521 | | - * |
522 | | - * @param user the user |
523 | | - * @param model the model |
524 | | - * |
525 | | - * @return the brand new potential instance maker |
526 | | - */ |
527 | | - public InstanceMaker addInstanceMaker(Project model, User user) { |
528 | | - logger.debug("Add instance maker to user {} for model {}", user, model); |
529 | | - |
530 | | - if (model != null && user != null |
531 | | - && findInstanceMakerByProjectAndUser(model, user) != null) { |
532 | | - throw HttpErrorMessage.dataError(MessageI18nKey.DATA_INTEGRITY_FAILURE); |
533 | | - } |
534 | | - |
535 | | - InstanceMaker instanceMaker = new InstanceMaker(); |
536 | | - |
537 | | - instanceMaker.setUser(user); |
538 | | - instanceMaker.setProject(model); |
539 | | - |
540 | | - return instanceMaker; |
541 | | - } |
542 | | - |
543 | | - /** |
544 | | - * Find the instance maker linked to the given project and the given user. |
545 | | - * |
546 | | - * @param project the project |
547 | | - * @param user the user |
548 | | - * |
549 | | - * @return the matching instance makers |
550 | | - */ |
551 | | - public InstanceMaker findInstanceMakerByProjectAndUser(Project project, User user) { |
552 | | - return instanceMakerDao.findInstanceMakerByProjectAndUser(project, user); |
553 | | - } |
554 | | - |
555 | 476 | // ********************************************************************************************* |
556 | 477 | // retrieve the elements of a project |
557 | 478 | // ********************************************************************************************* |
@@ -661,21 +582,6 @@ public Set<ActivityFlowLink> getActivityFlowLinks(Long projectId) { |
661 | 582 | }).collect(Collectors.toSet()); |
662 | 583 | } |
663 | 584 |
|
664 | | - /** |
665 | | - * Get all instance makers linked to the given project. |
666 | | - * |
667 | | - * @param projectId the id of the project |
668 | | - * |
669 | | - * @return all instance makers linked to the project |
670 | | - */ |
671 | | - public List<InstanceMaker> getInstanceMakers(Long projectId) { |
672 | | - logger.debug("Get instance makers of project #{}", projectId); |
673 | | - |
674 | | - Project project = assertAndGetProject(projectId); |
675 | | - |
676 | | - return instanceMakerDao.findInstanceMakersByProject(project); |
677 | | - } |
678 | | - |
679 | 585 | // ********************************************************************************************* |
680 | 586 | // dedicated to access control |
681 | 587 | // ********************************************************************************************* |
|
0 commit comments