BrightSide Workbench Full Report + Source Code
CommentAttribute.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.proposal;
19 
20 import java.util.ArrayList;
21 import java.util.List;
22 import org.turro.contacts.Comment;
23 import org.turro.contacts.Contact;
24 import org.turro.i18n.I_;
25 
30 public class CommentAttribute extends GenericAttribute<Comment> {
31 
33  super(attribute);
35  }
36 
37  @Override
38  protected List<Comment> generateRelated() {
39  return new ArrayList<Comment>();
40  }
41 
42  @Override
43  public void addToContact(Contact contact) {
44  attribute.setContact(contact);
45  contact.getComments().add(attribute);
46  }
47 
48  @Override
49  public String getAsString() {
50  return attribute.getComment();
51  }
52 
53  @Override
54  public Contact getContact() {
55  return attribute.getContact();
56  }
57 
58  @Override
59  public String getAttributeName() {
60  return I_.get("Comment");
61  }
62 
63  @Override
65  return new IAttribute() {
66 
67  @Override
68  public String getAsString() {
69  return a.getComment();
70  }
71 
72  @Override
73  public Contact getContact() {
74  return a.getContact();
75  }
76 
77  @Override
78  public Object getValue() {
79  return a;
80  }
81  };
82 
83  }
84 
85 }
Set< Comment > getComments()
Definition: Contact.java:415
IAttribute generateAttributeAdapter(final Comment a)
static String get(String msg)
Definition: I_.java:41