BrightSide Workbench Full Report + Source Code
TagParticipationCatcher.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2021 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.elephant.db.ElephantPU;
22 import org.turro.elephant.db.WhereClause;
23 import org.turro.elephant.entities.db.Tag;
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 "Elephant Commons - Tag";
38  }
39 
40  @Override
41  public Dao createDao() {
42  return new ElephantPU();
43  }
44 
45  @Override
46  public WhereClause getQuery(Path entityPath) {
47  WhereClause wc = new WhereClause();
48  wc.addClause("select distinct t from Tag t");
49  wc.addClause("where t.entityPath = :path");
50  wc.addNamedValue("path", entityPath.getPath());
51  return wc;
52  }
53 
54  @Override
55  public boolean getCanDelete(Tag v) {
56  return true;
57  }
58 
59  @Override
60  public String getDescription(Tag v) {
61  return v.getTagName();
62  }
63 
64  @Override
65  public void doDelete(Tag v) {
66  getDao().deleteObject(v);
67  }
68 
69  @Override
70  public void doShow(Tag 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(Tag v) {
86  return false;
87  }
88 
89  @Override
90  public void doChangeFor(Tag v, Path toPath) {
91  // do nothing
92  }
93 
94  @Override
95  public Object getReferringEntity(Tag v) {
97  }
98 
99 }
void addNamedValue(String name, Object value)
static IElephantEntity getController(String path)
Definition: Entities.java:78
void deleteObject(Object obj)
Definition: Dao.java:162