View Javadoc

1   /*
2    * Copyright 2007-2008 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kim.xml;
17  
18  import java.io.Serializable;
19  import java.sql.Date;
20  
21  import javax.xml.bind.annotation.XmlAccessType;
22  import javax.xml.bind.annotation.XmlAccessorType;
23  import javax.xml.bind.annotation.XmlElement;
24  import javax.xml.bind.annotation.XmlRootElement;
25  import javax.xml.bind.annotation.XmlTransient;
26  import javax.xml.bind.annotation.XmlType;
27  import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
28  
29  import org.kuali.rice.core.jaxb.SqlDateAdapter;
30  
31  
32  /**
33   * This is a description of what this class does - shyu don't forget to fill this in. 
34   * 
35   * @author Kuali Rice Team (rice.collab@kuali.org)
36   *
37   */
38  @XmlRootElement(name = "member", namespace = "http://rice.kuali.org/xsd/kim/group")
39  @XmlAccessorType(XmlAccessType.FIELD)
40  @XmlType(name = "Member", namespace = "http://rice.kuali.org/xsd/kim/group", propOrder = {
41      "memberId", "memberTypeCode", "activeFromDate", "activeToDate"
42  })
43  public class GroupMembershipXmlDto implements Serializable {
44  	@XmlTransient
45  	private static final long serialVersionUID = 8480290118998280178L;
46  	
47  	@XmlTransient
48  	protected String groupId;
49  	
50  	@XmlTransient
51  	protected String groupMemberId;
52  	
53  	@XmlElement(name = "memberId", namespace = "http://rice.kuali.org/xsd/kim/group")	
54  	protected String memberId;
55  	
56  	@XmlElement(name = "memberTypeCode", namespace = "http://rice.kuali.org/xsd/kim/group")
57  	String memberTypeCode;
58  	
59  	@XmlTransient
60  	protected Long versionNumber;
61  	
62  	@XmlElement(name = "activeFromDate", namespace = "http://rice.kuali.org/xsd/kim/group")	
63  	@XmlJavaTypeAdapter(value = SqlDateAdapter.class)
64  	protected Date activeFromDate;
65  	
66  	@XmlElement(name = "activeToDate", namespace = "http://rice.kuali.org/xsd/kim/group")	
67  	@XmlJavaTypeAdapter(value = SqlDateAdapter.class)
68  	protected Date activeToDate;
69  
70  	public GroupMembershipXmlDto(String groupId, String groupMemberId, String memberId, String memberTypeCode, Date activeFromDate, Date activeToDate) {
71  		super();
72  		this.groupId = groupId;
73  		this.memberId = memberId;
74  		this.memberTypeCode = memberTypeCode;
75  		this.groupMemberId = groupMemberId;
76  		this.activeFromDate = activeFromDate;
77  		this.activeToDate = activeToDate;
78  	}
79  	
80  	// for jax-ws service construction
81  	public GroupMembershipXmlDto() {}
82  	
83  	public String getMemberId() {
84  		return this.memberId;
85  	}
86  
87  
88  	public void setMemberId(String memberId) {
89  		this.memberId = memberId;
90  	}
91  
92  
93  	public String getMemberTypeCode() {
94  		return this.memberTypeCode;
95  	}
96  
97  
98  	public void setMemberTypeCode(String memberTypeCode) {
99  		this.memberTypeCode = memberTypeCode;
100 	}
101 
102 
103 	public String getGroupId() {
104 		return this.groupId;
105 	}
106 
107 
108 	public void setGroupId(String groupId) {
109 		this.groupId = groupId;
110 	}
111 
112 
113 	public String getGroupMemberId() {
114 		return this.groupMemberId;
115 	}
116 
117 
118 	public void setGroupMemberId(String groupMemberId) {
119 		this.groupMemberId = groupMemberId;
120 	}
121 
122 
123 	public Long getVersionNumber() {
124 		return this.versionNumber;
125 	}
126 
127 
128 	public void setVersionNumber(Long versionNumber) {
129 		this.versionNumber = versionNumber;
130 	}
131 
132 
133 //	@XmlJavaTypeAdapter(value = SqlDateAdapter.class) 
134 	public Date getActiveFromDate() {
135 		return this.activeFromDate;
136 	}
137 
138 
139 	public void setActiveFromDate(Date activeFromDate) {
140 		this.activeFromDate = activeFromDate;
141 	}
142 
143 
144 //	@XmlJavaTypeAdapter(value = SqlDateAdapter.class) 
145 	public Date getActiveToDate() {
146 		return this.activeToDate;
147 	}
148 
149 	public void setActiveToDate(Date activeToDate) {
150 		this.activeToDate = activeToDate;
151 	}
152 
153 	public boolean isActive() {
154 		long now = System.currentTimeMillis();		
155 		return (activeFromDate == null || now > activeFromDate.getTime()) && (activeToDate == null || now < activeToDate.getTime());
156 	}
157 
158 }