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


Java FileUtil.stripExtension方法代码示例

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


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

示例1: addDDMStructures

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

示例2: addDDMTemplate

import com.liferay.portal.kernel.util.FileUtil; //导入方法依赖的package包/类
protected void addDDMTemplate(
		long templateGroupId, long ddmStructureId, String fileName,
		String language, String script, String type, String mode)
	throws Exception {

	fileName = FileUtil.getShortFileName(fileName);

	fileName = FileUtil.stripExtension(fileName);

	String name = getName(fileName);

	DDMTemplate ddmTemplate = DDMTemplateLocalServiceUtil.fetchTemplate(
		groupId, PortalUtil.getClassNameId(DDMStructure.class),
		getKey(fileName));

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

			return;
		}

		DDMTemplateLocalServiceUtil.deleteTemplate(ddmTemplate);
	}

	DDMTemplateLocalServiceUtil.addTemplate(
		userId, templateGroupId,
		PortalUtil.getClassNameId(DDMStructure.class), ddmStructureId,
		getKey(fileName), getMap(name), null, type, mode, language, script,
		false, false, StringPool.BLANK, null, serviceContext);
}
 
开发者ID:rivetlogic,项目名称:liferay-voice-command,代码行数:36,代码来源:FileSystemImporter.java

示例3: addDDMTemplates

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

	String ddmTemplateKey = getJournalId(fileName);

	String name = FileUtil.stripExtension(fileName);

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

	String language = getDDMTemplateLanguage(fileName);

	String xsl = StringUtil.read(inputStream);

	xsl = replaceFileEntryURL(xsl);

	setServiceContext(fileName);

	DDMStructure ddmStructure = DDMStructureLocalServiceUtil.getStructure(
		groupId, PortalUtil.getClassNameId(JournalArticle.class),
		ddmStructureKey);

	DDMTemplate ddmTemplate = DDMTemplateLocalServiceUtil.addTemplate(
		userId, groupId, PortalUtil.getClassNameId(DDMStructure.class),
		ddmStructure.getStructureId(), ddmTemplateKey, nameMap, null,
		DDMTemplateConstants.TEMPLATE_TYPE_DISPLAY, null, language, xsl,
		false, false, null, null, serviceContext);

	addJournalArticles(
		ddmStructureKey, ddmTemplate.getTemplateKey(),
		_JOURNAL_ARTICLES_DIR_NAME + name);
}
 
开发者ID:rivetlogic,项目名称:liferay-elasticsearch-integration,代码行数:33,代码来源:FileSystemImporter.java

示例4: addDDMStructures

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

示例5: addDDLStructures

import com.liferay.portal.kernel.util.FileUtil; //导入方法依赖的package包/类
protected void addDDLStructures(String dirName) throws Exception {
	File dir = new File(_resourcesDir, dirName);

	if (!dir.isDirectory() || !dir.canRead()) {
		return;
	}

	File[] files = listFiles(dir);

	for (File file : files) {
		String fileName = FileUtil.stripExtension(file.getName());

		addDDMStructures(fileName, getInputStream(file));
	}
}
 
开发者ID:rivetlogic,项目名称:liferay-voice-command,代码行数:16,代码来源:FileSystemImporter.java

示例6: addJournalArticles

import com.liferay.portal.kernel.util.FileUtil; //导入方法依赖的package包/类
protected void addJournalArticles(
		String ddmStructureKey, String ddmTemplateKey, String fileName,
		InputStream inputStream)
	throws Exception {

	String journalArticleId = getJournalId(fileName);

	String title = FileUtil.stripExtension(fileName);

	JSONObject assetJSONObject = _assetJSONObjectMap.get(fileName);

	Map<Locale, String> descriptionMap = null;

	if (assetJSONObject != null) {
		String abstractSummary = assetJSONObject.getString(
			"abstractSummary");

		descriptionMap = getMap(abstractSummary);
	}

	String content = StringUtil.read(inputStream);

	content = processJournalArticleContent(content);

	Locale articleDefaultLocale = LocaleUtil.fromLanguageId(
		LocalizationUtil.getDefaultLocale(content));

	Map<Locale, String> titleMap = getMap(articleDefaultLocale, title);

	boolean smallImage = false;
	String smallImageURL = StringPool.BLANK;

	if (assetJSONObject != null) {
		String smallImageFileName = assetJSONObject.getString("smallImage");

		if (Validator.isNotNull(smallImageFileName)) {
			smallImage = true;

			FileEntry fileEntry = _fileEntries.get(smallImageFileName);

			if (fileEntry != null) {
				smallImageURL = DLUtil.getPreviewURL(
					fileEntry, fileEntry.getFileVersion(), null,
					StringPool.BLANK);
			}
		}
	}

	setServiceContext(fileName);

	JournalArticle journalArticle =
		JournalArticleLocalServiceUtil.addArticle(
			userId, groupId, 0, 0, 0, journalArticleId, false,
			JournalArticleConstants.VERSION_DEFAULT, titleMap,
			descriptionMap, content, "general", ddmStructureKey,
			ddmTemplateKey, StringPool.BLANK, 1, 1, 2010, 0, 0, 0, 0, 0, 0,
			0, true, 0, 0, 0, 0, 0, true, true, smallImage, smallImageURL,
			null, new HashMap<String, byte[]>(), StringPool.BLANK,
			serviceContext);

	JournalArticleLocalServiceUtil.updateStatus(
		userId, groupId, journalArticle.getArticleId(),
		journalArticle.getVersion(), WorkflowConstants.STATUS_APPROVED,
		StringPool.BLANK, new HashMap<String, Serializable>(),
		serviceContext);
}
 
开发者ID:rivetlogic,项目名称:liferay-evernote,代码行数:67,代码来源:FileSystemImporter.java

示例7: addJournalArticles

import com.liferay.portal.kernel.util.FileUtil; //导入方法依赖的package包/类
protected void addJournalArticles(
		String ddmStructureKey, String ddmTemplateKey, String fileName,
		InputStream inputStream)
	throws Exception {

	String title = FileUtil.stripExtension(fileName);

	JSONObject assetJSONObject = _assetJSONObjectMap.get(fileName);

	Map<Locale, String> descriptionMap = null;

	if (assetJSONObject != null) {
		String abstractSummary = assetJSONObject.getString(
			"abstractSummary");

		descriptionMap = getMap(abstractSummary);
	}

	String content = StringUtil.read(inputStream);

	content = processJournalArticleContent(content);

	Locale articleDefaultLocale = LocaleUtil.fromLanguageId(
		LocalizationUtil.getDefaultLanguageId(content));

	boolean smallImage = false;
	String smallImageURL = StringPool.BLANK;

	if (assetJSONObject != null) {
		String smallImageFileName = assetJSONObject.getString("smallImage");

		if (Validator.isNotNull(smallImageFileName)) {
			smallImage = true;

			FileEntry fileEntry = _fileEntries.get(smallImageFileName);

			if (fileEntry != null) {
				smallImageURL = DLUtil.getPreviewURL(
					fileEntry, fileEntry.getFileVersion(), null,
					StringPool.BLANK);
			}
		}
	}

	setServiceContext(fileName);

	JournalArticle journalArticle =
		JournalArticleLocalServiceUtil.addArticle(
			userId, groupId, 0, 0, 0, getJournalId(fileName), false,
			JournalArticleConstants.VERSION_DEFAULT,
			getMap(articleDefaultLocale, title), descriptionMap, content,
			"general", ddmStructureKey, ddmTemplateKey, StringPool.BLANK, 1,
			1, 2010, 0, 0, 0, 0, 0, 0, 0, true, 0, 0, 0, 0, 0, true, true,
			smallImage, smallImageURL, null, new HashMap<String, byte[]>(),
			StringPool.BLANK, serviceContext);

	JournalArticleLocalServiceUtil.updateStatus(
		userId, groupId, journalArticle.getArticleId(),
		journalArticle.getVersion(), WorkflowConstants.STATUS_APPROVED,
		StringPool.BLANK, new HashMap<String, Serializable>(),
		serviceContext);
}
 
开发者ID:rivetlogic,项目名称:liferay-voice-command,代码行数:63,代码来源:FileSystemImporter.java

示例8: getJournalId

import com.liferay.portal.kernel.util.FileUtil; //导入方法依赖的package包/类
protected String getJournalId(String fileName) {
	String id = FileUtil.stripExtension(fileName);

	id = StringUtil.toUpperCase(id);

	return StringUtil.replace(id, StringPool.SPACE, StringPool.DASH);
}
 
开发者ID:rivetlogic,项目名称:liferay-evernote,代码行数:8,代码来源:FileSystemImporter.java


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