| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.rice.kim.util; |
| 17 | |
|
| 18 | |
import org.apache.commons.beanutils.PropertyUtils; |
| 19 | |
import org.kuali.rice.kim.api.KimConstants; |
| 20 | |
import org.kuali.rice.krad.service.KRADServiceLocator; |
| 21 | |
|
| 22 | |
|
| 23 | |
|
| 24 | |
|
| 25 | |
|
| 26 | |
|
| 27 | |
|
| 28 | |
|
| 29 | |
public final class KimCommonUtilsInternal { |
| 30 | 0 | private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(KimCommonUtilsInternal.class); |
| 31 | |
|
| 32 | 0 | private KimCommonUtilsInternal() { |
| 33 | 0 | throw new UnsupportedOperationException("do not call"); |
| 34 | |
} |
| 35 | |
|
| 36 | |
public static void copyProperties(Object targetToCopyTo, Object sourceToCopyFrom){ |
| 37 | 0 | if(targetToCopyTo!=null && sourceToCopyFrom!=null) |
| 38 | |
try{ |
| 39 | 0 | PropertyUtils.copyProperties(targetToCopyTo, sourceToCopyFrom); |
| 40 | 0 | } catch(Exception ex){ |
| 41 | 0 | throw new RuntimeException("Failed to copy from source object: "+sourceToCopyFrom.getClass()+" to target object: "+targetToCopyTo,ex); |
| 42 | 0 | } |
| 43 | 0 | } |
| 44 | |
|
| 45 | |
public static String getKimBasePath(){ |
| 46 | 0 | String kimBaseUrl = KRADServiceLocator.getKualiConfigurationService().getPropertyValueAsString( |
| 47 | |
KimConstants.KimUIConstants.KIM_URL_KEY); |
| 48 | 0 | if (!kimBaseUrl.endsWith(KimConstants.KimUIConstants.URL_SEPARATOR)) { |
| 49 | 0 | kimBaseUrl = kimBaseUrl + KimConstants.KimUIConstants.URL_SEPARATOR; |
| 50 | |
} |
| 51 | 0 | return kimBaseUrl; |
| 52 | |
} |
| 53 | |
|
| 54 | |
public static String getPathWithKimContext(String path, String kimActionName){ |
| 55 | 0 | String kimContext = KimConstants.KimUIConstants.KIM_APPLICATION+KimConstants.KimUIConstants.URL_SEPARATOR; |
| 56 | 0 | String kimContextParameterized = KimConstants.KimUIConstants.KIM_APPLICATION+KimConstants.KimUIConstants.PARAMETERIZED_URL_SEPARATOR; |
| 57 | 0 | if(path.contains(kimActionName) && !path.contains(kimContext + kimActionName) |
| 58 | |
&& !path.contains(kimContextParameterized + kimActionName)) |
| 59 | 0 | path = path.replace(kimActionName, kimContext+kimActionName); |
| 60 | 0 | return path; |
| 61 | |
} |
| 62 | |
} |