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


Java PropsKeys类代码示例

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


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

示例1: send

import com.liferay.portal.kernel.util.PropsKeys; //导入依赖的package包/类
public static void send(String toStr, String subject,
		String body, boolean isHtml) throws SystemException, AddressException, PortalException {

	Company cmp = null;
	try {
	  cmp = CompanyServiceUtil.getCompanyByVirtualHost(AppConstants.COMPANY_VIRTUAL_HOST);
	} catch (Throwable t) {
		
	}
	if (cmp != null) {
		long cmpId = cmp.getCompanyId();
		String fromStr = PrefsPropsUtil.getString(cmpId,
				PropsKeys.ADMIN_EMAIL_FROM_ADDRESS);
		InternetAddress from = new InternetAddress(fromStr);
		InternetAddress to = new InternetAddress(toStr);
		if (from != null && to != null && subject != null && body != null) {
			MailMessage message = new MailMessage(from, to, subject, body, isHtml);
			MailServiceUtil.sendEmail(message);
		}
	}

}
 
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:23,代码来源:MailUtil.java

示例2: _notityMail

import com.liferay.portal.kernel.util.PropsKeys; //导入依赖的package包/类
private void _notityMail(String context, Throwable e) {

		try {
			String errorMailTo =
				PrefsPropsUtil.getString(
					PortletPropsKeys.MQTT_ERRORS_SEND_MAIL_TO,
					PortletPropsValues.MQTT_ERRORS_SEND_MAIL_TO);

			if (Validator.isNotNull(errorMailTo)) {
				MailMessage mailMessage = new MailMessage();

				long companyId = PortalUtil.getDefaultCompanyId();

				String fromAddress = PrefsPropsUtil.getString(
					companyId, PropsKeys.ADMIN_EMAIL_FROM_ADDRESS);

				mailMessage.setHTMLFormat(false);
				mailMessage.setTo(new InternetAddress(errorMailTo));
				mailMessage.setSubject(String.format(
					"%s Mqtt connector error", PortalUtil.getComputerName()));
				mailMessage.setFrom(new InternetAddress(fromAddress));

				StringWriter sw = new StringWriter();
				PrintWriter pw = new PrintWriter(sw);
				e.printStackTrace(pw);

				mailMessage.setBody(String.format(
					"context: %s\nerror: %s\n stacktrace:%s\n", context,
					e.getMessage(), sw.toString()));

				MailServiceUtil.sendEmail(mailMessage);
			}
		}
		catch (Exception e1) {
			_log.error(e1);
		}
	}
 
开发者ID:baxtheman,项目名称:mqtt-liferay-plugins,代码行数:38,代码来源:MqttLocalServiceImpl.java

示例3: register

import com.liferay.portal.kernel.util.PropsKeys; //导入依赖的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

示例4: getNameInNamespace

import com.liferay.portal.kernel.util.PropsKeys; //导入依赖的package包/类
public String getNameInNamespace(long companyId, Binding binding)
		throws Exception {

	String baseDN = PrefsPropsUtil.getString(companyId,
			PropsKeys.LDAP_BASE_DN);

	if (Validator.isNull(baseDN)) {
		return binding.getName();
	} else {
		StringBuilder sb = new StringBuilder();

		sb.append(binding.getName());
		sb.append(StringPool.COMMA);
		sb.append(baseDN);

		return sb.toString();
	}
}
 
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:19,代码来源:ManagerLdap.java

示例5: sendInternal

import com.liferay.portal.kernel.util.PropsKeys; //导入依赖的package包/类
public static void sendInternal(String subject, String body, boolean isHtml)
		throws SystemException, AddressException, PortalException {

	Company cmp = null;
	try {
	  cmp = CompanyServiceUtil.getCompanyByVirtualHost(AppConstants.COMPANY_VIRTUAL_HOST);
	} catch (Throwable t) {
		
	}
	if (cmp != null) {
		long cmpId = cmp.getCompanyId();
		String toStr = PrefsPropsUtil.getString(cmpId,
				PropsKeys.ADMIN_EMAIL_FROM_ADDRESS);
		send(toStr, subject, body, isHtml);
	}
}
 
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:17,代码来源:MailUtil.java

示例6: refreshCfg

import com.liferay.portal.kernel.util.PropsKeys; //导入依赖的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: sendNewsUpdateMail

import com.liferay.portal.kernel.util.PropsKeys; //导入依赖的package包/类
/**
 * Send news update mail.
 *
 * @param sub the sub
 * @param offers the offers
 */
public void sendNewsUpdateMail(final AHSubscription sub,
        final List<AHOffer> offers) {
	try {
		final String addr = PrefsPropsUtil.getString(
		        PortalUtil.getDefaultCompanyId(),
		        PropsKeys.ADMIN_EMAIL_FROM_ADDRESS);
		final InternetAddress from = new InternetAddress(addr);
		final InternetAddress to = new InternetAddress(sub.getEmail());
		final String subj = CustomPortalServiceHandler
		        .getConfigValue(E_ConfigKey.NEWS_UPDATE_SUBJ);
		final String body = CustomPortalServiceHandler
		        .getConfigValue(E_ConfigKey.NEWS_UPDATE_BODY);
		this.sendNewsMail(from, to, subj, body, sub, offers);
	} catch (final Throwable t) {
		m_objLog.error(t);
	}
}
 
开发者ID:fraunhoferfokus,项目名称:particity,代码行数:24,代码来源:MailListener.java

示例8: addDDMStructures

import com.liferay.portal.kernel.util.PropsKeys; //导入依赖的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: addDDMStructures

import com.liferay.portal.kernel.util.PropsKeys; //导入依赖的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

示例10: getAUIValidatorJS

import com.liferay.portal.kernel.util.PropsKeys; //导入依赖的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

示例11: getUser

import com.liferay.portal.kernel.util.PropsKeys; //导入依赖的package包/类
public Binding getUser(long companyId, String screenName) throws Exception {

		LdapContext ctx = getContext(companyId);

		if (ctx == null) {
			return null;
		}

		String baseDN = PrefsPropsUtil.getString(companyId,
				PropsKeys.LDAP_BASE_DN);

		Properties userMappings = getUserMappings(companyId);

		StringBuilder filter = new StringBuilder();

		filter.append(StringPool.OPEN_PARENTHESIS);
		filter.append(userMappings.getProperty("screenName"));
		filter.append(StringPool.EQUAL);
		filter.append(screenName);
		filter.append(StringPool.CLOSE_PARENTHESIS);

		SearchControls cons = new SearchControls(SearchControls.SUBTREE_SCOPE,
				1, 0, null, false, false);

		NamingEnumeration<SearchResult> enu = ctx.search(baseDN,
				filter.toString(), cons);
		//System.out.println("TTTTTTTTT " + baseDN + " --------- "  + filter.toString() + "  ==== " + cons + "");
		ctx.close();

		if (enu.hasMoreElements()) {
			Binding binding = enu.nextElement();
		//	System.out.println("TTTTTTTTT " + binding);
			return binding;
		} else {
			return null;
		}
	}
 
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:38,代码来源:ManagerLdap.java

示例12: getContext

import com.liferay.portal.kernel.util.PropsKeys; //导入依赖的package包/类
public LdapContext getContext(long companyId) throws Exception {
	String baseProviderURL = PrefsPropsUtil.getString(companyId,
			PropsKeys.LDAP_BASE_PROVIDER_URL);
	String pricipal = PrefsPropsUtil.getString(companyId,
			PropsKeys.LDAP_SECURITY_PRINCIPAL);
	String credentials = PrefsPropsUtil.getString(companyId,
			PropsKeys.LDAP_SECURITY_CREDENTIALS);
	return getContext(companyId, baseProviderURL, pricipal, credentials);
}
 
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:10,代码来源:ManagerLdap.java

示例13: getUser

import com.liferay.portal.kernel.util.PropsKeys; //导入依赖的package包/类
public Binding getUser(LdapContext ctx, long companyId, String screenName) throws Exception {


		if (ctx == null) {
			return null;
		}

		String baseDN = PrefsPropsUtil.getString(companyId,
				PropsKeys.LDAP_BASE_DN);

		Properties userMappings = getUserMappings(companyId);

		StringBuilder filter = new StringBuilder();

		filter.append(StringPool.OPEN_PARENTHESIS);
		filter.append(userMappings.getProperty("screenName"));
		filter.append(StringPool.EQUAL);
		filter.append(screenName);
		filter.append(StringPool.CLOSE_PARENTHESIS);

		SearchControls cons = new SearchControls(SearchControls.SUBTREE_SCOPE,
				1, 0, null, false, false);

		NamingEnumeration<SearchResult> enu = ctx.search(baseDN,
				filter.toString(), cons);
		///System.out.println("TTTTTTTTT " + baseDN + " --------- "  + filter.toString() + "  ==== " + cons + "");
		ctx.close();

		if (enu.hasMoreElements()) {
			Binding binding = enu.nextElement();
		//	System.out.println("TTTTTTTTT " + binding);
			return binding;
		} else {
			return null;
		}
	}
 
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:37,代码来源:EmployeeExportToLdap.java

示例14: sendMail

import com.liferay.portal.kernel.util.PropsKeys; //导入依赖的package包/类
public static void sendMail(String emailTo, String nameTo, String content[], long companyId, Locale userLocale) {
	
	try{
		InternetAddress to = new InternetAddress(emailTo, nameTo);
		
		String portal = LanguageUtil.get(userLocale, "p2ptaskactivity.mail.portal");
		String subject= LanguageUtil.get(userLocale, "p2ptaskactivity.mail.subject");
		
		String bodyTitle   = LanguageUtil.format(userLocale, "p2ptaskactivity.mail.body.title", nameTo);
		String bodyMessage = LanguageUtil.format(userLocale, "p2ptaskactivity.mail.body.message", content);
		String bodyEnd     = LanguageUtil.get(userLocale, "p2ptaskactivity.mail.body.end");
		
		String body = bodyTitle +"\n\n"+ bodyMessage +"\n\n"+ bodyEnd +"\n\n"+ portal+"\n";
		log.debug("MESSAGE: "+bodyMessage);
		String fromName=PrefsPropsUtil.getString(companyId,PropsKeys.ADMIN_EMAIL_FROM_NAME,"");
		String fromAddress=PrefsPropsUtil.getString(companyId,PropsKeys.ADMIN_EMAIL_FROM_ADDRESS,"");
					
		InternetAddress from = new InternetAddress(fromAddress, fromName);
		
		MailMessage mailm = new MailMessage(from, to, subject, body, true);
		MailServiceUtil.sendEmail(mailm);
	}
	catch(Exception ex)
	{
	}	

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

示例15: initGlobals

import com.liferay.portal.kernel.util.PropsKeys; //导入依赖的package包/类
public static void initGlobals() {
	try {
		// get default company
		Company company = CompanyLocalServiceUtil.getCompanyByWebId(PropsUtil.get(PropsKeys.COMPANY_DEFAULT_WEB_ID));
		// fallback
		if (company == null)
			company = CompanyLocalServiceUtil.getCompany(PortalUtil.getDefaultCompanyId());	
		
		globalCompanyId = company.getCompanyId();
		globalGroupId = company.getGroup().getGroupId();
		globalAdminId = company.getDefaultUser().getUserId(); 
		m_objLog.debug("Initial company is "+globalCompanyId+", group "+globalGroupId+", user "+globalAdminId);

		// get welcome page
		Layout layout = getLayout(globalGroupId, E_ContextPath.HOME.getPath());
		if (layout != null) {
			// correct values
			globalCompanyId = layout.getCompanyId();
			globalGroupId = layout.getGroupId();
			homeLayoutId = layout.getLayoutId();
			User admin = getDefaultAdmin(globalCompanyId);
			if (admin != null) {
				globalAdminId = admin.getUserId();
			} 
			m_objLog.debug("Corrected company is "+globalCompanyId+", group "+globalGroupId+", user "+globalAdminId);
		}
		
	} catch (Throwable t) {
		m_objLog.error(t);
	}
}
 
开发者ID:fraunhoferfokus,项目名称:particity,代码行数:32,代码来源:ParticityInitializer.java


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