View Javadoc
1   /*
2    * Copyright 2009 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.ole.module.purap.util;
17  
18  import org.kuali.ole.module.purap.PurapConstants;
19  import org.kuali.ole.sys.context.SpringContext;
20  import org.kuali.rice.coreservice.framework.parameter.ParameterService;
21  
22  import java.text.SimpleDateFormat;
23  import java.util.Locale;
24  
25  public class PurApDateFormatUtils {
26  
27      /**
28       * This method retrieves a SimpleDataFormat by format Name.
29       *
30       * @param formatName
31       * @return
32       */
33      public static final SimpleDateFormat getSimpleDateFormat(String formatName) {
34          return new SimpleDateFormat(getFormattingString(formatName), Locale.getDefault());
35      }
36  
37      public static final String getFormattingString(String formatName) {
38          return SpringContext.getBean(ParameterService.class).getParameterValueAsString(PurapConstants.PURAP_NAMESPACE, "All", formatName);
39      }
40  
41  }