View Javadoc
1   /**
2    * Copyright 2004-2014 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.kpme.tklm.time.timeblock.service;
17  
18  import org.apache.commons.lang.StringUtils;
19  import org.kuali.kpme.tklm.api.common.TkConstants;
20  import org.kuali.rice.core.web.format.Formatter;
21  
22  public class TimeBlockActionHistoryFormatter extends Formatter {
23  
24  	/**
25  	 * 
26  	 */
27  	private static final long serialVersionUID = 1L;
28  
29  	@Override
30  	public Object format(Object value) {
31  		if (value != null) {
32  			String val = (String) value;
33  			if (StringUtils.equals(TkConstants.ACTIONS.ADD_TIME_BLOCK,
34  					(String) value)) {
35  				val = "Add";
36  			} else if (StringUtils.equals(
37  					TkConstants.ACTIONS.UPDATE_TIME_BLOCK, (String) value)) {
38  				val = "Update";
39  			} else if (StringUtils.equals(
40  					TkConstants.ACTIONS.DELETE_TIME_BLOCK, (String) value)) {
41  				val = "Delete";
42  			}
43  			return val;
44  		}
45  		return super.format(value);
46  	}
47  
48  	@Override
49  	public Object convertFromPresentationFormat(Object value) {
50  		return super.convertFromPresentationFormat(value);
51  	}
52  
53  }