BrightSide Workbench Full Report + Source Code
DossierIds.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.dossier.search;
20 
21 import java.util.Collection;
22 import org.turro.dossier.entity.Category;
23 import org.turro.dossier.entity.Dossier;
24 import org.turro.jpa.Dao;
25 
30  public class DossierIds {
31 
32  public long dossierId, categoryId;
33  public String categoryPath;
34 
35  private Dao dao;
36  private Dossier dossier;
37  private Category category;
38 
39  public DossierIds(Long dossierId, Long categoryId, String categoryPath) {
40  this.dossierId = dossierId;
41  this.categoryId = categoryId;
42  this.categoryPath = categoryPath;
43  }
44 
45  public void setDao(Dao dao) {
46  this.dao = dao;
47  }
48 
49  public Dossier getDossier() {
50  if(dossier == null) {
51  if(dao != null) {
52  dossier = dao.find(Dossier.class, Long.valueOf(dossierId));
53  }
54  }
55  return dossier;
56  }
57 
58  public Category getCategory() {
59  if(category == null) {
60  if(dao != null) {
61  category = dao.find(Category.class, Long.valueOf(categoryId));
62  }
63  }
64  return category;
65  }
66 
67  public static void initDaoList(Dao dao,Collection<DossierIds> list) {
68  for(DossierIds di : list) {
69  di.setDao(dao);
70  }
71  }
72 
73  }
74 
static void initDaoList(Dao dao, Collection< DossierIds > list)
Definition: DossierIds.java:67
DossierIds(Long dossierId, Long categoryId, String categoryPath)
Definition: DossierIds.java:39