BrightSide Workbench Full Report + Source Code
ValueItParticipationCatcher.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2015 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 
19 package org.turro.activity;
20 
21 import org.turro.contacts.ValueIt;
22 import org.turro.contacts.db.ContactsPU;
23 import org.turro.elephant.db.WhereClause;
24 import org.turro.entities.Entities;
25 import org.turro.jpa.Dao;
26 import org.turro.path.Path;
27 
32 @ParticipationCatcher
34 
35  @Override
36  public String getDescription() {
37  return "BrightSide Contacts - ValueIt";
38  }
39 
40  @Override
41  public Dao createDao() {
42  return new ContactsPU();
43  }
44 
45  @Override
46  public WhereClause getQuery(Path entityPath) {
47  WhereClause wc = new WhereClause();
48  wc.addClause("select distinct a from ValueIt as a");
49  wc.addClause("where a.path = :idc");
50  wc.addNamedValue("idc", entityPath.getPath());
51  return wc;
52  }
53 
54  @Override
55  public boolean getCanDelete(ValueIt v) {
56  return true;
57  }
58 
59  @Override
60  public String getDescription(ValueIt v) {
61  return v.getValue();
62  }
63 
64  @Override
65  public void doDelete(ValueIt v) {
66  getDao().deleteObject(v);
67  }
68 
69  @Override
70  public void doShow(ValueIt v) {
71  // nothing to show?
72  }
73 
74  @Override
75  public void onChange(Object entity) {
76  // do nothing
77  }
78 
79  @Override
80  public void onDelete(Object entity) {
81  // do nothing
82  }
83 
84  @Override
85  public boolean getCanChangeFor(ValueIt v) {
86  return false;
87  }
88 
89  @Override
90  public void doChangeFor(ValueIt v, Path toPath) {
91  // do nothing
92  }
93 
94  @Override
95  public Object getReferringEntity(ValueIt v) {
97  }
98 
99 }
100 
101 
void addNamedValue(String name, Object value)
static IElephantEntity getController(String path)
Definition: Entities.java:78
void deleteObject(Object obj)
Definition: Dao.java:162