| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| PagingBannerUtils | 
 | 
 | 3.5;3.5 | 
| 1 |  /* | |
| 2 |   * Copyright 2007-2010 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.krad.util; | |
| 17 | ||
| 18 |  import java.util.Enumeration; | |
| 19 | ||
| 20 |  import org.apache.commons.lang.StringUtils; | |
| 21 |  import org.kuali.rice.core.util.CollectionUtils; | |
| 22 | ||
| 23 |  /** | |
| 24 |   * Utility for that is used along with the tableRenderPagingBanner.tag. | |
| 25 |   *  | |
| 26 |   * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 27 |   * | |
| 28 |   */ | |
| 29 | public final class PagingBannerUtils { | |
| 30 | ||
| 31 |          /** do not call. */ | |
| 32 | 0 |          private PagingBannerUtils() { | 
| 33 | 0 |                  throw new UnsupportedOperationException("do not call"); | 
| 34 | } | |
| 35 | ||
| 36 |      /** | |
| 37 |       * find the number string in a method to call parameter with the following format parameterPrefix.1 or | |
| 38 |       * parameterPrefix.1.bleh | |
| 39 |       *  | |
| 40 |       * @param paramPrefix the  | |
| 41 |       * @param parameterNames the parameter names. | |
| 42 |       * @return the numerical value or -1 | |
| 43 |       */ | |
| 44 | public static int getNumbericalValueAfterPrefix(String paramPrefix, Enumeration<String> parameterNames) { | |
| 45 | ||
| 46 | 0 |              for (String parameterName : CollectionUtils.toIterable(parameterNames)) { | 
| 47 | 0 |                      if (parameterName.startsWith(paramPrefix)) { | 
| 48 | 0 |                      parameterName = WebUtils.endsWithCoordinates(parameterName) ? parameterName : parameterName + ".x"; | 
| 49 | 0 |                      String numberStr = StringUtils.substringBetween(parameterName, paramPrefix, "."); | 
| 50 | 0 |                  return Integer.parseInt(numberStr); | 
| 51 | } | |
| 52 | } | |
| 53 | ||
| 54 | 0 |              return -1; | 
| 55 | } | |
| 56 | } |