当前位置: 首页>>代码示例>>Java>>正文


Java PropsUtil.get方法代码示例

本文整理汇总了Java中com.liferay.portal.kernel.util.PropsUtil.get方法的典型用法代码示例。如果您正苦于以下问题:Java PropsUtil.get方法的具体用法?Java PropsUtil.get怎么用?Java PropsUtil.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.liferay.portal.kernel.util.PropsUtil的用法示例。


在下文中一共展示了PropsUtil.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deleteExportedCourse

import com.liferay.portal.kernel.util.PropsUtil; //导入方法依赖的package包/类
public void deleteExportedCourse(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException {
	ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
	long groupId  = ParamUtil.getLong(actionRequest, "groupId", 0);
	String fileName = ParamUtil.getString(actionRequest, "fileName", StringPool.BLANK);
	String redirect = ParamUtil.getString(actionRequest, "redirect", StringPool.BLANK);
	File f = new File(PropsUtil.get("liferay.home")+"/data/lms_exports/courses/"+themeDisplay.getCompanyId()+"/"+groupId+"/"+fileName);
	if (themeDisplay.getPermissionChecker().hasPermission(groupId, Course.class.getName(), groupId, ActionKeys.DELETE) && f != null && f.isFile()) {
		FileUtil.delete(f);
		SessionMessages.add(actionRequest, "courseadmin.delete.exported.confirmation.success");
	} else {
		SessionMessages.add(actionRequest, "courseadmin.delete.exported.confirmation.error");
	}
	if (Validator.isNotNull(redirect)) {
		actionResponse.sendRedirect(redirect);
	}
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:17,代码来源:CourseAdmin.java

示例2: loadESProperties

import com.liferay.portal.kernel.util.PropsUtil; //导入方法依赖的package包/类
/**
 * This method loads the needed properties from Elastic.props files and
 * makes necessary conversion using utility methods.
 */
public void loadESProperties() {

    /** Load Elastic server home and clustername from Portal level props*/
    this.esServerHome = PropsUtil.get(ElasticsearchPortletConstants.ES_KEY_HOME_PATH);
    this.esClusterName = PropsUtil.get(ElasticsearchPortletConstants.ES_KEY_CLUSTERNAME);

    /** Load other suggestion related props from Portlet properties*/
    this.suggestionsSize = getPortletProperty(ElasticsearchPortletConstants.SUGGESTIONS_SIZE_KEY,
            ElasticsearchPortletConstants.SUGGESTIONS_SIZE_DEFAULT_VALUE);

    this.suggestionsLength = getPortletProperty(ElasticsearchPortletConstants.SUGGESTIONS_LENGTH_KEY,
            ElasticsearchPortletConstants.SUGGESTIONS_LENGTH_DEFAULT_VALUE);

    this.suggestionsQueryMaxHits = getPortletProperty(ElasticsearchPortletConstants.SUGGESTION_QUERY_MAX_HITS_KEY,
            ElasticsearchPortletConstants.SUGGESTIONS_QUERY_MAX_HITS_DEFAULT_VALUE);


    setSuggestionQueryFields();
    setSuggestionExcludedTypes();
}
 
开发者ID:rivetlogic,项目名称:liferay-elasticsearch-integration,代码行数:25,代码来源:ElasticsearchPropsValues.java

示例3: getTransportHosts

import com.liferay.portal.kernel.util.PropsUtil; //导入方法依赖的package包/类
/**
 * Gets the transport hosts.
 * 
 * @return the transport hosts
 */
public InetSocketTransportAddress[] getTransportHosts() {
    
    String csNodeList = PropsUtil.get(ElasticsearchPortletConstants.ES_KEY_NODE);
    InetSocketTransportAddress[] transportAddresses = null;
    if (Validator.isNotNull(csNodeList)) {
        String[] nodeList = csNodeList.split(StringPool.COMMA);
        transportAddresses = new InetSocketTransportAddress[nodeList.length];
        
        /** Prepare a list of Hosts */
        for (int i = 0; i < nodeList.length; i++) {
            String[] hostnames = nodeList[i].split(StringPool.COLON);
            InetSocketTransportAddress transportAddress = new InetSocketTransportAddress(hostnames[0],
                    Integer.parseInt(hostnames[1]));
            transportAddresses[i] = transportAddress;
        }
    } else {
        _log.error("Elastic search nodes are missing from properties...");
    }
    
    return transportAddresses;
}
 
开发者ID:rivetlogic,项目名称:liferay-elasticsearch-integration,代码行数:27,代码来源:ElasticsearchPropsValues.java

示例4: saveStringToFile

import com.liferay.portal.kernel.util.PropsUtil; //导入方法依赖的package包/类
public static void saveStringToFile(String fileName, String text){
	
	StringBuffer sb = new StringBuffer(PropsUtil.get("java.io.tmpdir"));
	sb.append(File.separator);
	sb.append("custom_logs"); //Directorio para los ficheros.
	
	File dir = new File(sb.toString());
    if(!dir.exists()){
    	dir.mkdir();
    }
    	    
    //Nombre del informe
	sb.append(File.separator);
	sb.append(fileName);
	

	Calendar cal = Calendar.getInstance();

	try {
	 	BufferedWriter out = new BufferedWriter(new FileWriter(sb.toString(),true));
	 	out.append("\n"+cal.getTime()+" - "+text);
	 	out.close();
	}
	catch (IOException e){
		e.printStackTrace();
	}
	
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:29,代码来源:LiferaylmsUtil.java

示例5: setBGImage

import com.liferay.portal.kernel.util.PropsUtil; //导入方法依赖的package包/类
public void setBGImage(byte[] data,long groupId, String name) throws IOException
{
	String baseDir=PropsUtil.get("liferay.home")+"/data/compimages";
	File baseDirFile=new File(baseDir);
	if(!baseDirFile.exists())
	{
		baseDirFile.mkdir();
	}
	String fileExtension=name.substring(name.lastIndexOf('.'));
	File imageFile=new File(baseDirFile.getAbsolutePath()+"/"+Long.toString(groupId)+fileExtension.toLowerCase());
	/* Cambios de Miguel que borra imagenes */
	 String [] nameOfFiles = baseDirFile.list();
	 String [] aux = null;
	 File fileToDelete = null;
	 for (int i=0; i<nameOfFiles.length; i++){
		 aux = nameOfFiles[i].split("\\.");
		 if(aux[0].equals(Long.toString(groupId))){
			 fileToDelete = new File(baseDirFile.getAbsolutePath()+"/"+Long.toString(groupId)+"."+aux[1]);
			 fileToDelete.delete();
			 fileExtension = null;
		 }
	 }
	/* Fin de cambios de Miguel */
	
	imageFile.createNewFile();
	FileOutputStream fos=new FileOutputStream(imageFile);
	fos.write(data);
	fos.close();
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:30,代码来源:CompetenceLocalServiceImpl.java

示例6: getAuditLog

import com.liferay.portal.kernel.util.PropsUtil; //导入方法依赖的package包/类
public static AuditingLog getAuditLog() throws ClassNotFoundException, InstantiationException, IllegalAccessException
{
	if(auditLog==null)
	{
		Class<?> clase= null;
		if(PropsUtil.get("audit.implementation")!=null){
			clase=Class.forName(PropsUtil.get("audit.implementation"));
		}else{
			clase=Class.forName("com.liferay.lms.auditing.NullAuditingLog");
		}
		auditLog=(AuditingLog)clase.newInstance();
	}
	return auditLog;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:15,代码来源:AuditingLogFactory.java

示例7: convertToHttp

import com.liferay.portal.kernel.util.PropsUtil; //导入方法依赖的package包/类
/**
 * Converte a URL para HTTP
 * 
 * @param url
 * @return
 */
public static final String convertToHttp(String url) {
	if (!url.startsWith("https://"))
		return url;
	
	url = "http://" + url.substring(8);
	int slashPos = url.indexOf('/', 8);
	if (slashPos == -1)
		slashPos = url.length();
	int dotPos = url.indexOf(':', 8);
	
	// Retira a porta
	if (dotPos != -1 && dotPos < slashPos) {
		url = url.substring(0, dotPos) + url.substring(slashPos);
		slashPos = url.indexOf('/', 8);
		if (slashPos == -1)
			slashPos = url.length();
	}
	
	String portString = PropsUtil.get(PropsKeys.WEB_SERVER_HTTP_PORT);
	int port = Http.HTTP_PORT;
	if (portString != null) {
		try {
			port = Integer.parseInt(portString);
		} catch (NumberFormatException e) {
			port = Http.HTTP_PORT;
		}
	}
	if (port == -1 || port == 80)
		return url;
	
	// Acrescenta a porta
	url = url.substring(0, slashPos) + ":" + port + url.substring(slashPos);
	return url;
}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:41,代码来源:UrlRewriterUtil.java

示例8: isComunidadeEDemocracia

import com.liferay.portal.kernel.util.PropsUtil; //导入方法依赖的package包/类
private boolean isComunidadeEDemocracia(ActionResponse response, String currentUrl, Company company) throws IOException {
	String defaultWebId = PropsUtil.get(PropsKeys.COMPANY_DEFAULT_WEB_ID);
	if (!company.getWebId().equals(defaultWebId)) {
		return false;
	} else {
		return true;
	}
}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:9,代码来源:LoginPortlet.java

示例9: getRecentPosts

import com.liferay.portal.kernel.util.PropsUtil; //导入方法依赖的package包/类
/**
 * Method that get list of recent posts by users
 */
public static List<MBThread> getRecentPosts(HttpServletRequest request) throws PortalException{
	_log.debug("Entry : getRecentPosts");
	long groupThreadsUserId = ParamUtil.getLong(request, CustomConstants.GROUP_THREAD_USERID);
	_log.debug("groupThreadsUserId :=>"+groupThreadsUserId);
	List<MBThread> recentThreadList=new ArrayList<>();
	ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);
	List<Long> categoryIds=new ArrayList<Long>();
	Calendar calendar = Calendar.getInstance();
	String offset=PropsUtil.get(CustomConstants.RECENT_POST_DATE_OFFSET);
	PortletPreferences preference=(PortletPreferences)request.getAttribute(CustomConstants.PREFERENCE_REQUEST_ATTRIBUTE);
	long preferenceCatId=GetterUtil.getLong(preference.getValue(CustomConstants.PREFERENCE_CATEGORYID, String.valueOf(QueryUtil.ALL_POS)));
	calendar.add(Calendar.DATE, -(Integer.parseInt(offset)));
	List<MBThread> mbThreadList= MBThreadServiceUtil.getGroupThreads(
			themeDisplay.getScopeGroupId(),groupThreadsUserId,calendar.getTime(), WorkflowConstants.STATUS_APPROVED,QueryUtil.ALL_POS, QueryUtil.ALL_POS);
	if(preferenceCatId != QueryUtil.ALL_POS){
		categoryIds=getPreferenceCatChildList(preferenceCatId, request);
		 for(MBThread  mbThread:mbThreadList){
			 for(Long categoryId:categoryIds){
				 if(mbThread.getCategoryId() == categoryId){
					 	recentThreadList.add(mbThread);
				 }
			 }
		 }
	}
	else{
		recentThreadList=mbThreadList;
	}
		_log.debug("List Size:=>"+recentThreadList.size());
	return recentThreadList;
}
 
开发者ID:Azilen,项目名称:Discussion-Board-Liferay,代码行数:34,代码来源:CustomThreadCategoryList.java

示例10: changeSelectedCategories

import com.liferay.portal.kernel.util.PropsUtil; //导入方法依赖的package包/类
public void changeSelectedCategories(AjaxBehaviorEvent vcEvent) {
	selectedManyCategories = selectedCategories;

	// get some global objects
	LiferayFacesContext lfc = LiferayFacesContext.getInstance();
	// ThemeDisplay tD = lfc.getThemeDisplay();
	PortletRequest request = (PortletRequest) lfc.getExternalContext()
			.getRequest();

	int maxCats;
	String maxCatsStr = PropsUtil.get(PROP_CATEGORY_MAX_CHOOSE_WARN);
	try {
		maxCats = Integer.parseInt(maxCatsStr);
	} catch (NumberFormatException e) {
		maxCats = 3;
	}
	// log.info("changeSelectedCategories:maxCats==" + maxCats);
	String details = LanguageUtil.get(request.getLocale(),
			"od.category.reference.toomuch.warn.details");
	String summary = LanguageUtil.get(request.getLocale(),
			"od.category.reference.toomuch.warn.summary");
	if (selectedManyCategories.size() > maxCats) {
		FacesContext.getCurrentInstance().addMessage(
				"categorymessageskey",
				new FacesMessage(FacesMessage.SEVERITY_WARN, summary,
						details));
	} else {
		Iterator<FacesMessage> msgIterator = FacesContext
				.getCurrentInstance().getMessages();
		while (msgIterator.hasNext()) {
			msgIterator.next();
			msgIterator.remove();
		}
	}

}
 
开发者ID:fraunhoferfokus,项目名称:odp-manage-datasets-portlet,代码行数:37,代码来源:ManageController.java

示例11: getPortalProperty

import com.liferay.portal.kernel.util.PropsUtil; //导入方法依赖的package包/类
@Override
public String getPortalProperty(String propertyKey) {
    return PropsUtil.get(propertyKey);
}
 
开发者ID:finalist,项目名称:liferay-oidc-plugin,代码行数:5,代码来源:Liferay62Adapter.java

示例12: doPost

import com.liferay.portal.kernel.util.PropsUtil; //导入方法依赖的package包/类
/**
 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
 */
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
	String uri = URLDecoder.decode(request.getRequestURI(), "UTF-8");
	log.debug("uri:"+uri);
	uri = uri.substring(uri.indexOf("exports/courses/") + "exports/courses/".length());		
	String[] params = uri.split("/");
	long companyId = GetterUtil.getLong(params[0]);
	long groupId = GetterUtil.getLong(params[1]);
	String name = GetterUtil.getString(params[2]);
	
	log.debug("groupId:"+groupId);
	log.debug("name:"+name);
			
	if (Validator.isNull(name)) {
		response.sendError(HttpServletResponse.SC_BAD_REQUEST);
	}
	
	File lar = new File(PropsUtil.get("liferay.home")+"/data/lms_exports/courses/"+companyId+"/"+groupId+"/"+name);
	
	if (lar == null || !lar.isFile()) {
		response.sendError(HttpServletResponse.SC_NOT_FOUND);
	}

	OutputStream os = response.getOutputStream();
	InputStream is = new FileInputStream(lar);
	response.addHeader(HttpHeaders.CONTENT_TYPE, "application/zip");
	response.setContentType("application/zip");
	response.addHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(lar.length()));
	
	byte[] buffer = new byte[1024];
	int i = 0;

	while ((i = is.read(buffer)) > 0) {
		if (i == 1024) {
			os.write(buffer);
		} else {
			os.write(buffer, 0, i);
		}
	}

	os.flush();
	os.close();
	is.close();


}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:50,代码来源:ExportedCourseServlet.java

示例13: updateExtraContentScormActivities

import com.liferay.portal.kernel.util.PropsUtil; //导入方法依赖的package包/类
public void updateExtraContentScormActivities (ActionRequest request, ActionResponse response) throws Exception {
			
	String updateBD = ParamUtil.getString(request, "updateBD", "false");

	List<LearningActivity> learningActivityList = LearningActivityLocalServiceUtil.getLearningActivities(0, LearningActivityLocalServiceUtil.getLearningActivitiesCount());

	int conta = 1;
	String todas ="<p>Actualizado en base de datos:</p>", sqlUpdate = "";
	
	for(LearningActivity activity: learningActivityList) {
		
		//Si es un scorm y tiene etiqueta scorm.
		if (activity.getTypeId() == 9 && activity.getExtracontent().contains("<scorm>")) {
			
			String uuid = LearningActivityLocalServiceUtil.getExtraContentValue(activity.getActId(), "uuid");
			String openWindow = LearningActivityLocalServiceUtil.getExtraContentValue(activity.getActId(), "openWindow");
			String assetEntry = LearningActivityLocalServiceUtil.getExtraContentValue(activity.getActId(), "assetEntry");
			
			if (Validator.isNull(uuid) && Validator.isNotNull(assetEntry) && Validator.isNumber(assetEntry)) {
				AssetEntry entry = AssetEntryLocalServiceUtil.getEntry(Long.valueOf(assetEntry));
				AssetRenderer scorm = AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClassName(entry.getClassName()).getAssetRenderer(entry.getClassPK());
				uuid = scorm.getUuid();
				if (Validator.isNotNull(openWindow)) {
					String key = "lms.scorm.windowable."+entry.getClassName();
					if (Validator.isNull(key)) {
						key = "false";
					}
					openWindow = PropsUtil.get(key);
				}
				
			}
			
			if(updateBD.equals("false")){						
				//Componemos la consulta para actualizar.
				String newExtraContent = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <scorm>";
				if (Validator.isNotNull(openWindow)) {
					newExtraContent += "<openWindow>"+openWindow +"<openWindow/>";
				}
				if (Validator.isNotNull(uuid)) {
					newExtraContent += "<uuid>"+uuid +"<uuid/>";
				}
				if (Validator.isNotNull(assetEntry)) {
					newExtraContent += "<assetEntry>"+assetEntry +"</assetEntry>";
				}
				newExtraContent += "</scorm>";
				
				String updateQuery = "UPDATE lms_learningactivity SET extracontent = '"+newExtraContent+"' WHERE actId = "+activity.getActId()+";<br />";
				
				sqlUpdate += HtmlUtil.escape(updateQuery);
				
			}
			//Actualizamos en la bd.
			else if(updateBD.equals("true")){
				//Borramos lo que había.
				activity.setExtracontent("<scorm></scorm>");
				LearningActivityLocalServiceUtil.updateLearningActivity(activity);
				
				//Anadimos los campos.
				LearningActivityLocalServiceUtil.setExtraContentValue(activity.getActId(), "openWindow", openWindow);
				LearningActivityLocalServiceUtil.setExtraContentValue(activity.getActId(), "uuid", uuid);
				LearningActivityLocalServiceUtil.setExtraContentValue(activity.getActId(), "assetEntry", assetEntry);
				
				todas += "<p>Número: "+ (conta++) +", Activity: "+activity.getTitle(Locale.getDefault())+"<br /> openWindow: " + openWindow+"<br /> uuid: " + uuid+"<br /> assetEntry: " + assetEntry+"</p>";
			}
		}
	}
	if(updateBD.equals("true")){
		response.setRenderParameter("resultados", todas);
	}else if(updateBD.equals("false")){
		response.setRenderParameter("resultados", sqlUpdate);
	}
	
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:74,代码来源:PortalAdmin.java

示例14: doRun

import com.liferay.portal.kernel.util.PropsUtil; //导入方法依赖的package包/类
protected void doRun(HttpServletRequest request, HttpServletResponse response) throws Exception {

	Company company = PortalUtil.getCompany(request);

	// Apenas para a comunidade default (e-democracia)
	String defaultWebId = PropsUtil.get(PropsKeys.COMPANY_DEFAULT_WEB_ID);
	if (!company.getWebId().equals(defaultWebId)) {
	    return;
	}

	// Verifica se realmente está autenticado
	User user = PortalUtil.getUser(request);
	if (user.isDefaultUser())
	    return;

	Country brazil = CountryServiceUtil.getCountryByA2("BR");

	// Verirfica se tem endereço no brasil
	for (Address address : user.getAddresses()) {
	    if (address.getCountryId() == brazil.getCountryId()) {
		try {
		    Region region = RegionServiceUtil.getRegion(address.getRegionId());
		    if (region.getCountryId() == brazil.getCountryId())
			return;
		} catch (PortalException e) {
		    // Ignore: Região não encontrada
		}
	    }
	}

	HttpSession session = request.getSession();
	LastPath oldLastPath = (LastPath) session.getAttribute(WebKeys.LAST_PATH);

	// Vai para a página principal
	if (oldLastPath == null) {
	    oldLastPath = new LastPath("", "/principal", new HashMap<String, String[]>());
	}

	HashMap<String, String[]> params = new HashMap<String, String[]>();
	params.put("lp", new String[] { oldLastPath.getContextPath() + oldLastPath.getPath() });
	LastPath newLastPath = new LastPath("", "/web/public/uf", params);
	session.setAttribute(WebKeys.LAST_PATH, newLastPath);
	_log.info("User logged in, redirect to page:" + newLastPath);
	if (session.getAttribute("FACEBOOK_USER_ID") != null && !"/login/login_redirect".equals(request.getParameter("_58_struts_action"))) {
	    String lastPath = newLastPath.getPath();
	    lastPath = HttpUtil.addParameter(lastPath, "lp", params.get("lp")[0]);
	    response.sendRedirect(lastPath);
	    _log.debug("Usuário do facebook redirecionado para cadastro de UF");
	}
    }
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:51,代码来源:UFLandingPageAction.java

示例15: isLastPathEnabled

import com.liferay.portal.kernel.util.PropsUtil; //导入方法依赖的package包/类
private boolean isLastPathEnabled() {
	String saveLastPath = PropsUtil.get(PropsKeys.AUTH_FORWARD_BY_LAST_PATH);
	return saveLastPath != null ? Boolean.parseBoolean(saveLastPath) : false;
}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:5,代码来源:CadastroBean.java


注:本文中的com.liferay.portal.kernel.util.PropsUtil.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。