BrightSide Workbench Full Report + Source Code
ContactId.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.contacts.util;
19 
20 import org.turro.contacts.Contact;
21 import org.turro.contacts.db.ContactsPU;
22 import org.turro.plugin.contacts.IContact;
23 
29 @Deprecated
30 public class ContactId implements java.io.Serializable {
31 
32  private static final long serialVersionUID = -1;
33 
34  private String object;
35 
36  public ContactId(String object) {
37  this.object = object;
38  }
39 
40  public String getRealValue() {
41  return object;
42  }
43 
44  public void setRealValue(String value) {
45  this.object = value;
46  }
47 
48  public Object getObject() {
49  if(object == null) return null;
50  return new ContactsPU().find(Contact.class, object);
51  }
52 
53  public void setObject(Object object) {
54  if(object instanceof Contact) {
55  this.object = ((Contact) object).getId();
56  }
57  }
58 
59  public Object getValue() {
60  Contact contact = (Contact) getObject();
61  if(contact != null) {
62  return contact.getName();
63  }
64  return null;
65  }
66 
67  public IContact getIContact() {
68  Contact c = (Contact) getObject();
69  if(c != null) {
70  return new DefaultContact(c);
71  }
72  return null;
73  }
74 
75 }
void setRealValue(String value)
Definition: ContactId.java:44
void setObject(Object object)
Definition: ContactId.java:53