1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* Copyright (c) 2013, Redsolution LTD. All rights reserved.
*
* This file is part of Xabber project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License, Version 3.
*
* Xabber is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License,
* along with this program. If not, see http://www.gnu.org/licenses/.
*/
package com.xabber.xmpp.vcard;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.xmlpull.v1.XmlSerializer;
import com.xabber.xmpp.Instance;
import com.xabber.xmpp.SerializerUtils;
public class Organization implements Instance {
public static final String ELEMENT_NAME = "ORG";
public static final String ORGNAME_NAME = "ORGNAME";
public static final String ORGUNIT_NAME = "ORGUNIT";
private String name;
private final List<String> units;
public Organization() {
units = new ArrayList<String>();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<String> getUnits() {
return units;
}
@Override
public boolean isValid() {
return name != null;
}
@Override
public void serialize(XmlSerializer serializer) throws IOException {
serializer.startTag(null, ELEMENT_NAME);
SerializerUtils.addTextTag(serializer, ORGNAME_NAME, name);
for (String unit : units)
SerializerUtils.addTextTag(serializer, ORGUNIT_NAME, unit);
serializer.endTag(null, ELEMENT_NAME);
}
}