Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* Copyright 2010-2013 The Kuali Foundation
*
* Licensed under the Educational Community License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.opensource.org/licenses/ecl2.php
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kuali.common.util;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.kuali.common.util.property.Constants;
import org.kuali.common.util.property.PropertiesContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.PropertyPlaceholderHelper;
/**
*
*/
public class ProjectUtils {
private static final Logger logger = LoggerFactory.getLogger(ProjectUtils.class);
private static final PropertyPlaceholderHelper PPH = Constants.DEFAULT_PROPERTY_PLACEHOLDER_HELPER;
private static final String GROUP_ID_BASE_PATH_KEY = "project.groupId.base.path";
private static final String CLASSPATH = "classpath:";
@Deprecated
public static final String KUALI_COMMON_GROUP_ID = KualiProjectConstants.COMMON_GROUP_ID;
@Deprecated
public static final String KUALI_UTIL_ARTIFACT_ID = UtilProjectContext.ARTIFACT_ID;
private static final Map PROJECT_PROPERTIES_CACHE = new HashMap();
public static List loadProjects(List projectIds) {
List projects = new ArrayList();
for (String projectId : projectIds) {
Project project = ProjectUtils.loadProject(projectId);
projects.add(project);
}
return projects;
}
/**
*
*/
public static String getCommonClassPathPrefix(String artifactId) {
return getClassPathPrefix(KualiProjectConstants.COMMON_GROUP_ID, artifactId);
}
/**
* Given a groupId and artifactId, convert the groupId to groupId.base, then return the classpath prefix
*
*
*/
public static String getClassPathPrefixFromProjectId(String projectId) {
Project project = getProject(projectId);
return getClassPathPrefix(project);
}
/**
* Given a project containing groupId + artifactId, convert the groupId to groupId.base, then return the classpath prefix
*
*
*/
public static String getClassPathPrefix(Project project) {
return getClassPathPrefix(project.getGroupId(), project.getArtifactId());
}
/**
* Given a groupId and artifactId, convert the groupId to groupId.base, then return a resource path relative to directory
*
*
*/
public static File getResourceDirectory(File directory, Project project) {
String resourcePath = getResourcePath(project);
File file = new File(directory, resourcePath);
return new File(LocationUtils.getCanonicalPath(file));
}
/**
* Given a groupId and artifactId, convert the groupId to groupId.base, then return a handle to a file relative to directory with the given filename
*
*
*/
public static File getResourceFile(File directory, Project project, String filename) {
File dir = getResourceDirectory(directory, project);
return new File(dir, filename);
}
/**
* Given groupId:artifactId, convert the groupId to groupId.base, then return a resource friendly prefix
*
*