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


Java PropsUtil类代码示例

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


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

示例1: uploadImage

import com.liferay.portal.kernel.util.PropsUtil; //导入依赖的package包/类
/**
 * Upload image.
 * 
 * @param image
 *            the image
 * @return the uri
 * @throws SystemException
 *             the system exception
 * @throws URISyntaxException
 *             the uRI syntax exception
 * @throws IOException
 * @throws PortalException
 */
public static URI uploadImage(UploadedFile image) throws SystemException, URISyntaxException, IOException, PortalException,
        NullPointerException {

    LiferayFacesContext lfc = LiferayFacesContext.getInstance();
    ThemeDisplay td = lfc.getThemeDisplay();

    ServiceContext serviceContext = new ServiceContext();
    serviceContext.setScopeGroupId(td.getScopeGroupId());

    long imageFolderId = Long.parseLong(PropsUtil.get("image.folder.id"));
    DLFolder folder;

    try {
        /* Check if folder for image exists */
        folder = DLFolderLocalServiceUtil.getDLFolder(imageFolderId);
        LOG.debug("Folder for app images exists.");
    } catch (PortalException e) {
        /* If not -> create */
        folder = DLFolderLocalServiceUtil.createDLFolder(imageFolderId);
        folder.setName("App-Images");
        DLFolderLocalServiceUtil.addDLFolder(folder);
        LOG.debug("Created folder for app images.");
    }

    String uuidExt = null;
    FileEntry file = null;

    uuidExt = td.getUser().getScreenName() + "_" + UUID.randomUUID().toString() + "_" + new Date().getTime() + "_";

    file = DLAppLocalServiceUtil.addFileEntry(td.getUserId(), td.getScopeGroupId(), folder.getFolderId(), uuidExt + image.getName(),
            MimeTypesUtil.getContentType(image.getName()), uuidExt + image.getName(), uuidExt + image.getName(), "new",
            image.getBytes(), serviceContext);

    return new URI(td.getPortalURL() + "/c/document_library/get_file?uuid=" + file.getUuid() + "&groupId=" + td.getScopeGroupId());
}
 
开发者ID:fraunhoferfokus,项目名称:odp-manage-datasets-portlet,代码行数:49,代码来源:ImageGalleryUtils.java

示例2: register

import com.liferay.portal.kernel.util.PropsUtil; //导入依赖的package包/类
@Override
public void register(DynamicIncludeRegistry dynamicIncludeRegistry) {

	boolean singlePageApplicationEnabled = GetterUtil.getBoolean(
		PropsUtil.get(
			PropsKeys.JAVASCRIPT_SINGLE_PAGE_APPLICATION_ENABLED));

	if (singlePageApplicationEnabled) {
		dynamicIncludeRegistry.register(
			"/html/common/themes/top_head.jsp#post");
	}
}
 
开发者ID:smclab,项目名称:liferay-7-workspace,代码行数:13,代码来源:SPATransitionsTopHeadJSPDynamicInclude.java

示例3: userTimeFinished

import com.liferay.portal.kernel.util.PropsUtil; //导入依赖的package包/类
public boolean userTimeFinished(long moduleId,long userId) throws SystemException, PortalException
{
	Module theModule=ModuleLocalServiceUtil.getModule(moduleId);
	ModuleResult mr=ModuleResultLocalServiceUtil.getByModuleAndUser(theModule.getModuleId(), userId);
	if(mr!=null && !mr.getPassed()&&mr.getStartDate()!=null)
	{
		long courtesyTime=GetterUtil.getLong(PropsUtil.get("lms.module.courtesytime.miliseconds"),0);
		long usedTime=System.currentTimeMillis()-mr.getStartDate().getTime();
		if(theModule.getAllowedTime()!=0)
		{
			if ( theModule.getAllowedTime() + courtesyTime - usedTime < 0)
			{
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:19,代码来源:ModuleLocalServiceImpl.java

示例4: 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

示例5: getClassTypes

import com.liferay.portal.kernel.util.PropsUtil; //导入依赖的package包/类
@Override
public Map<Long, String> getClassTypes(long[] groupId, Locale locale)
		throws Exception {

	Map<Long, String> classTypes = new LinkedHashMap<Long, String>();
	if(CourseLocalServiceUtil.dynamicQueryCount(CourseLocalServiceUtil.dynamicQuery().
			add(PropertyFactoryUtil.forName("groupCreatedId").in(ArrayUtil.toArray(groupId))))>0){
		LearningActivityTypeRegistry learningActivityTypeRegistry = new LearningActivityTypeRegistry();
		ResourceBundle resourceBundle = PortletBagPool.get(getPortletId()).getResourceBundle(locale);		
		long[] invisibleTypes = StringUtil.split(PropsUtil.get("lms.learningactivity.invisibles"), StringPool.COMMA,-1L);
		for(LearningActivityType learningActivityType:learningActivityTypeRegistry.getLearningActivityTypesForCreating()){
			if(learningActivityType != null && !ArrayUtil.contains(invisibleTypes, learningActivityType.getTypeId())){
				String learningActivityTypeName = learningActivityTypeRegistry.getLearningActivityType(learningActivityType.getTypeId()).getName();
				classTypes.put(learningActivityType.getTypeId(), (resourceBundle.containsKey(learningActivityTypeName)?
						resourceBundle.getString(learningActivityTypeName):learningActivityTypeName));
			}
		}	
	}
	return classTypes;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:21,代码来源:LearningActivityAssetRendererFactory.java

示例6: refreshCfg

import com.liferay.portal.kernel.util.PropsUtil; //导入依赖的package包/类
/**
 * Refresh cfg.
 */
public void refreshCfg() {
	try {
		this.m_strPortalName = CustomPortalServiceHandler
		        .getConfigValue(E_ConfigKey.MGMT_CONTACT_NAME);
		this.m_strOfferPermaBase = CustomPortalServiceHandler
		        .getConfigValue(E_ConfigKey.MGMT_PATH_OFFER_PERMALINK);
		this.m_objDefCompany = CompanyLocalServiceUtil
		        .getCompany(PortalUtil
		                .getDefaultCompanyId());
		if (this.m_objDefCompany == null)
			this.m_objDefCompany = CompanyLocalServiceUtil.getCompanyByMx(PropsUtil.get(PropsKeys.COMPANY_DEFAULT_WEB_ID));
		this.m_strPortalURL = PortalUtil.getPortalURL(
		        this.m_objDefCompany.getVirtualHostname(),
		        PortalUtil.getPortalPort(), false);
		// FIX: #5 - somethimes portal port is -1 for unknown reasons
		if (this.m_strPortalURL.contains(":-1"))
			this.m_strPortalURL = this.m_strPortalURL.replace(":-1", "");
		m_objLog.info("Portal URL is "+this.m_strPortalURL);
	} catch (final Throwable e) {
		m_objLog.error(e);
	}
}
 
开发者ID:fraunhoferfokus,项目名称:particity,代码行数:26,代码来源:MessageComposer.java

示例7: handleYoutube

import com.liferay.portal.kernel.util.PropsUtil; //导入依赖的package包/类
protected void handleYoutube(
	StringBundler sb, List<BBCodeItem> bbCodeItems, Stack<String> tags, IntegerWrapper marker) {
	
    	String videoId = extractData(
		bbCodeItems, marker, "youtube", BBCodeParser.TYPE_DATA, true);
	
	if (videoId.length() > 0) {
		int videoHeight = GetterUtil.get(PropsUtil.get("forum.video.height"), 349);
		int videoWidth = GetterUtil.get(PropsUtil.get("forum.video.width"), 560);
		// Extrai o identificador do video, parar criar o embbed
		for (Pattern p : YOUTUBE_PATTERNS) {
			Matcher m = p.matcher(videoId);
			if (m.find()) {
				sb.append("<iframe ");
				sb.append("width=\"").append(videoWidth).append("\" ");
				sb.append("height=\"").append(videoHeight).append("\" ");
				sb.append("src=\"http://www.youtube.com/embed/");
				sb.append(HtmlUtil.escapeAttribute(m.group(1)));
				sb.append("\" frameborder=\"0\" allowfullscreen></iframe>");
				break;
			}
		}
	}
}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:25,代码来源:HtmlBBCodeTranslatorImpl.java

示例8: addDDMStructures

import com.liferay.portal.kernel.util.PropsUtil; //导入依赖的package包/类
protected void addDDMStructures(
		String parentDDMStructureKey, String fileName,
		InputStream inputStream)
	throws Exception {

	String ddmStructureKey = getJournalId(fileName);

	String name = FileUtil.stripExtension(fileName);

	Map<Locale, String> nameMap = getMap(name);

	String xsd = StringUtil.read(inputStream);

	if (isJournalStructureXSD(xsd)) {
		xsd = JournalConverterUtil.getDDMXSD(xsd);
	}

	setServiceContext(fileName);

	DDMStructure ddmStructure = DDMStructureLocalServiceUtil.addStructure(
		userId, groupId, parentDDMStructureKey,
		PortalUtil.getClassNameId(JournalArticle.class), ddmStructureKey,
		nameMap, null, xsd,
		PropsUtil.get(PropsKeys.JOURNAL_ARTICLE_STORAGE_TYPE),
		DDMStructureConstants.TYPE_DEFAULT, serviceContext);

	addDDMTemplates(
		ddmStructure.getStructureKey(),
		_JOURNAL_DDM_TEMPLATES_DIR_NAME + name);

	if (Validator.isNull(parentDDMStructureKey)) {
		addDDMStructures(
			ddmStructure.getStructureKey(),
			_JOURNAL_DDM_STRUCTURES_DIR_NAME + name);
	}
}
 
开发者ID:rivetlogic,项目名称:liferay-evernote,代码行数:37,代码来源:FileSystemImporter.java

示例9: 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

示例10: 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

示例11: addDDMStructures

import com.liferay.portal.kernel.util.PropsUtil; //导入依赖的package包/类
protected void addDDMStructures(String fileName, InputStream inputStream)
	throws Exception {

	fileName = FileUtil.stripExtension(fileName);

	String name = getName(fileName);

	DDMStructure ddmStructure = DDMStructureLocalServiceUtil.fetchStructure(
		groupId, PortalUtil.getClassNameId(DDLRecordSet.class),
		getKey(fileName));

	if (ddmStructure != null) {
		if (!developerModeEnabled) {
			if (_log.isInfoEnabled()) {
				_log.info(
					"DDM structure with name " + name + " and version " +
						version + " already exists");
			}

			return;
		}

		DDMStructureLocalServiceUtil.deleteDDMStructure(ddmStructure);
	}

	ddmStructure = DDMStructureLocalServiceUtil.addStructure(
		userId, groupId, DDMStructureConstants.DEFAULT_PARENT_STRUCTURE_ID,
		PortalUtil.getClassNameId(DDLRecordSet.class), getKey(fileName),
		getMap(name), null, StringUtil.read(inputStream),
		PropsUtil.get(PropsKeys.DYNAMIC_DATA_LISTS_STORAGE_TYPE),
		DDMStructureConstants.TYPE_DEFAULT, serviceContext);

	addDDLDisplayTemplates(
		ddmStructure.getStructureKey(),
		_DDL_STRUCTURE_DISPLAY_TEMPLATE_DIR_NAME, fileName);

	addDDLFormTemplates(
		ddmStructure.getStructureKey(),
		_DDL_STRUCTURE_FORM_TEMPLATE_DIR_NAME, fileName);
}
 
开发者ID:rivetlogic,项目名称:liferay-voice-command,代码行数:41,代码来源:FileSystemImporter.java

示例12: init

import com.liferay.portal.kernel.util.PropsUtil; //导入依赖的package包/类
/**
 * Inits the.
 */
@PostConstruct
public void init() {

    Properties props = new Properties();
    props.setProperty("ckan.authorization.key", PropsUtil.get("authenticationKey"));
    props.setProperty("ckan.url", PropsUtil.get("cKANurl"));

    LOG.debug("odRClient props:" + props.toString());

    odrClient = OpenDataRegistry.getClient();
    odrClient.init(props);

    PortletRequest request = (PortletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
    @SuppressWarnings("unchecked")
    Map<String, String> userInfo = (Map<String, String>) request.getAttribute(PortletRequest.USER_INFO);
    if (userInfo != null) {
        String loginid = userInfo.get("user.login.id");
        if (loginid != null) {
            currentUser = odrClient.findUser(loginid);
        }
    }
}
 
开发者ID:fraunhoferfokus,项目名称:odp-manage-datasets-portlet,代码行数:26,代码来源:CurrentUser.java

示例13: getAUIValidatorJS

import com.liferay.portal.kernel.util.PropsUtil; //导入依赖的package包/类
/**
 * Returns the JavaScript function to validate the screen name client-side.
 *
 * @return the JavaScript function
 */
@Override
public String getAUIValidatorJS() {
	StringBuilder javascript = new StringBuilder();

	try {
		Company company = _companyLocalService.getCompanyByWebId(
			PropsUtil.get(PropsKeys.COMPANY_DEFAULT_WEB_ID));

		long companyId = company.getCompanyId();

		String[] reservedWords = _getReservedWords(companyId);

		javascript.append("function(val) { return !(");

		for (int i = 0; i < reservedWords.length; i++) {
			javascript.append(
				"val.indexOf(\"" + reservedWords[i] + "\") !== -1");

			if ((reservedWords.length > 1) &&
				(i < (reservedWords.length - 1))) {

				javascript.append(" || ");
			}
		}

		javascript.append(")}");
	}
	catch (PortalException pe) {
		_log.error(pe);
	}

	return javascript.toString();
}
 
开发者ID:liferay,项目名称:liferay-blade-samples,代码行数:39,代码来源:CustomScreenNameValidator.java

示例14: 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

示例15: especificValidations

import com.liferay.portal.kernel.util.PropsUtil; //导入依赖的package包/类
@Override
public boolean especificValidations(UploadRequest uploadRequest,
		PortletResponse portletResponse) {
	if(!Validator.isNumber(PropsUtil.get("lms.course.default.evaluations"))) {
		return true;
	}

	PortletRequest portletRequest = (PortletRequest)uploadRequest.getAttribute(JavaConstants.JAVAX_PORTLET_REQUEST);
	String numOfEvaluations = uploadRequest.getParameter("numOfEvaluations");
	Long courseId = ParamUtil.getLong(uploadRequest, "courseId");
	
	if (Validator.isNotNull(courseId)) {
		return true;
	}
	
	if(Validator.isNumber(numOfEvaluations)){
		_numOfEvaluations.set(GetterUtil.getLong(numOfEvaluations));
		return true;
	}

	if(Validator.isNull(numOfEvaluations)) {
		SessionErrors.add(portletRequest, "num-of-evaluations-required");
	}
	else {
		SessionErrors.add(portletRequest, "num-of-evaluations-number");
	}

	return false;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:30,代码来源:EvaluationAvgCourseEval.java


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