View Javadoc
1   package com.foxinmy.weixin4j.qy.model;
2   
3   import java.util.ArrayList;
4   import java.util.List;
5   
6   import com.alibaba.fastjson.annotation.JSONField;
7   
8   /**
9    * 通讯录
10   * 
11   * @className Contacts
12   * @author jinyu(foxinmy@gmail.com)
13   * @date 2016年1月25日
14   * @since JDK 1.6
15   * @see
16   */
17  public class Contacts extends IdParameter {
18  
19  	private static final long serialVersionUID = -1334319915595303647L;
20  
21  	@JSONField(name = "userlist")
22  	private List<User> users;
23  	@JSONField(name = "partylist")
24  	private List<Party> partys;
25  	@JSONField(name = "taglist")
26  	private List<Tag> tags;
27  
28  	public List<User> getUsers() {
29  		return users;
30  	}
31  
32  	public void setUsers(List<User> users) {
33  		this.users = users;
34  		List<String> userIds = new ArrayList<String>();
35  		for (User user : users) {
36  			userIds.add(user.getUserId());
37  		}
38  		super.setUserIds(userIds);
39  	}
40  
41  	public List<Party> getPartys() {
42  		return partys;
43  	}
44  
45  	public void setPartys(List<Party> partys) {
46  		this.partys = partys;
47  		List<Integer> partyIds = new ArrayList<Integer>();
48  		for (Party party : partys) {
49  			partyIds.add(party.getId());
50  		}
51  		super.setPartyIds(partyIds);
52  	}
53  
54  	public List<Tag> getTags() {
55  		return tags;
56  	}
57  
58  	public void setTags(List<Tag> tags) {
59  		this.tags = tags;
60  		List<Integer> tagIds = new ArrayList<Integer>();
61  		for (Tag tag : tags) {
62  			tagIds.add(tag.getId());
63  		}
64  		super.setTagIds(tagIds);
65  	}
66  
67  	@Override
68  	public String toString() {
69  		return "Contacts [users=" + users + ", partys=" + partys + ", tags="
70  				+ tags + ", " + super.toString() + "]";
71  	}
72  }