View Javadoc

1   /**
2    * Copyright 2011 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   */
15  
16  package org.kuali.mobility.dining.entity;
17  
18  import java.io.Serializable;
19  import java.text.SimpleDateFormat;
20  import java.util.ArrayList;
21  import java.util.Date;
22  import java.util.List;
23  
24  import javax.xml.bind.annotation.XmlElement;
25  import javax.xml.bind.annotation.XmlRootElement;
26  import javax.xml.bind.annotation.XmlSeeAlso;
27  
28  @XmlRootElement( name="menu" )
29  public class Menu implements Serializable {
30  
31  	private static final long serialVersionUID = -2096908398187406294L;
32  
33  	private Date date;
34  	
35  	private List<FoodItem> items;
36  	
37  	public Menu() {
38  		this.items = new ArrayList<FoodItem>();
39  	}
40  
41  	public Date getDate() {
42  		return date;
43  	}
44  
45  	public void setDate(Date date) {
46  		this.date = date;
47  	}
48  
49  	@XmlElement( name="items" )
50  	public List<FoodItem> getItems() {
51  		return items;
52  	}
53  
54  	public void setItems(List<FoodItem> items) {
55  		this.items = items;
56  	}
57  	
58  	public String getDateFormatted() {
59  		if (this.getDate() != null) {
60  			SimpleDateFormat sdf = new SimpleDateFormat("MMM dd, yyyy");
61  			String date = sdf.format(new Date(this.getDate().getTime()));
62  			return date;			
63  		} 
64  		return "";
65  	}
66  	
67  }