BrightSide Workbench Full Report + Source Code
JpaParticipation.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2011 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 package org.turro.activity;
19 
20 import org.turro.path.Path;
21 
26 public class JpaParticipation<V> implements IParticipation<V> {
27 
28  private final JpaParticipationCatcher catcher;
29  private V entity;
30  private Object referring;
31  private String description;
32  private boolean canDelete, canChangeFor;
33 
35  this.catcher = catcher;
36  }
37 
38  @Override
39  public void doDelete() {
40  if(canDelete) {
41  catcher.doDelete(entity);
42  }
43  }
44 
45  @Override
46  public void doChangeFor(Path entityPath) {
47  if(canChangeFor) {
48  catcher.doChangeFor(entity, entityPath);
49  }
50  }
51 
52  @Override
53  public boolean isCanDelete() {
54  return canDelete;
55  }
56 
57  public void setCanDelete(boolean canDelete) {
58  this.canDelete = canDelete;
59  }
60 
61  public boolean isCanChangeFor() {
62  return canChangeFor;
63  }
64 
65  public void setCanChangeFor(boolean canChangeFor) {
66  this.canChangeFor = canChangeFor;
67  }
68 
69  @Override
70  public String getDescription() {
71  return description;
72  }
73 
74  public void setDescription(String description) {
75  this.description = description;
76  }
77 
78  @Override
79  public V getEntity() {
80  return entity;
81  }
82 
83  @Override
84  public void setEntity(V entity) {
85  this.entity = entity;
86  }
87 
88  @Override
89  public Object getReferring() {
90  return referring;
91  }
92 
93  @Override
94  public void setReferring(Object referring) {
95  this.referring = referring;
96  }
97 
98  @Override
100  return catcher;
101  }
102 
103 }
JpaParticipationCatcher getCatcher()
void setDescription(String description)
void setCanChangeFor(boolean canChangeFor)
void setCanDelete(boolean canDelete)
JpaParticipation(JpaParticipationCatcher catcher)