本文整理汇总了Java中com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants类的典型用法代码示例。如果您正苦于以下问题:Java DDMTemplateConstants类的具体用法?Java DDMTemplateConstants怎么用?Java DDMTemplateConstants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DDMTemplateConstants类属于com.liferay.portlet.dynamicdatamapping.model包,在下文中一共展示了DDMTemplateConstants类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addDDMTemplates
import com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants; //导入依赖的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);
}
示例2: addDDLDisplayTemplates
import com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants; //导入依赖的package包/类
protected void addDDLDisplayTemplates(
String ddmStructureKey, String dirName, String fileName)
throws Exception {
DDMStructure ddmStructure = DDMStructureLocalServiceUtil.getStructure(
groupId, PortalUtil.getClassNameId(DDLRecordSet.class),
ddmStructureKey);
StringBundler sb = new StringBundler(4);
sb.append(resourcesDir);
sb.append(dirName);
sb.append(StringPool.SLASH);
sb.append(fileName);
Set<String> resourcePaths = servletContext.getResourcePaths(
sb.toString());
if (resourcePaths == null) {
return;
}
for (String resourcePath : resourcePaths) {
URL url = servletContext.getResource(resourcePath);
URLConnection urlConnection = url.openConnection();
String script = StringUtil.read(urlConnection.getInputStream());
if (Validator.isNull(script)) {
return;
}
addDDMTemplate(
groupId, ddmStructure.getStructureId(), resourcePath,
getDDMTemplateLanguage(resourcePath), script,
DDMTemplateConstants.TEMPLATE_TYPE_DISPLAY, StringPool.BLANK);
}
}
示例3: addDDLFormTemplates
import com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants; //导入依赖的package包/类
protected void addDDLFormTemplates(
String ddmStructureKey, String dirName, String fileName)
throws Exception {
DDMStructure ddmStructure = DDMStructureLocalServiceUtil.getStructure(
groupId, PortalUtil.getClassNameId(DDLRecordSet.class),
ddmStructureKey);
StringBundler sb = new StringBundler(4);
sb.append(resourcesDir);
sb.append(dirName);
sb.append(StringPool.SLASH);
sb.append(fileName);
Set<String> resourcePaths = servletContext.getResourcePaths(
sb.toString());
if (resourcePaths == null) {
return;
}
for (String resourcePath : resourcePaths) {
URL url = servletContext.getResource(resourcePath);
URLConnection urlConnection = url.openConnection();
String script = StringUtil.read(urlConnection.getInputStream());
if (Validator.isNull(script)) {
return;
}
addDDMTemplate(
groupId, ddmStructure.getStructureId(), resourcePath, "xsd",
script, DDMTemplateConstants.TEMPLATE_TYPE_FORM,
DDMTemplateConstants.TEMPLATE_MODE_CREATE);
}
}
示例4: addDDLDisplayTemplates
import com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants; //导入依赖的package包/类
protected void addDDLDisplayTemplates(
String ddmStructureKey, String dirName, String fileName)
throws Exception {
DDMStructure ddmStructure = DDMStructureLocalServiceUtil.getStructure(
groupId, PortalUtil.getClassNameId(DDLRecordSet.class),
ddmStructureKey);
File dir = new File(
_resourcesDir, dirName + StringPool.SLASH + fileName);
if (!dir.isDirectory() || !dir.canRead()) {
return;
}
File[] files = listFiles(dir);
for (File file : files) {
String language = getDDMTemplateLanguage(file.getName());
String script = StringUtil.read(getInputStream(file));
if (Validator.isNull(script)) {
return;
}
addDDMTemplate(
groupId, ddmStructure.getStructureId(), file.getName(),
language, script, DDMTemplateConstants.TEMPLATE_TYPE_DISPLAY,
null);
}
}
示例5: addDDLFormTemplates
import com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants; //导入依赖的package包/类
protected void addDDLFormTemplates(
String ddmStructureKey, String dirName, String fileName)
throws Exception {
DDMStructure ddmStructure = DDMStructureLocalServiceUtil.getStructure(
groupId, PortalUtil.getClassNameId(DDLRecordSet.class),
ddmStructureKey);
File dir = new File(
_resourcesDir, dirName + StringPool.SLASH + fileName);
if (!dir.isDirectory() || !dir.canRead()) {
return;
}
File[] files = listFiles(dir);
for (File file : files) {
String script = StringUtil.read(getInputStream(file));
if (Validator.isNull(script)) {
return;
}
addDDMTemplate(
groupId, ddmStructure.getStructureId(), file.getName(), "xsd",
script, DDMTemplateConstants.TEMPLATE_TYPE_FORM,
DDMTemplateConstants.TEMPLATE_MODE_CREATE);
}
}
示例6: addApplicationDisplayTemplate
import com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants; //导入依赖的package包/类
protected void addApplicationDisplayTemplate(
String script, File file, long classNameId)
throws PortalException, SystemException {
String fileName = FileUtil.stripExtension(file.getName());
String name = getName(fileName);
DDMTemplate ddmTemplate = DDMTemplateLocalServiceUtil.fetchTemplate(
groupId, classNameId, 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, groupId, classNameId, 0, getKey(fileName), getMap(name),
null, DDMTemplateConstants.TEMPLATE_TYPE_DISPLAY, StringPool.BLANK,
getDDMTemplateLanguage(name), script, false, false,
StringPool.BLANK, null, serviceContext);
}
示例7: addDDMTemplates
import com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants; //导入依赖的package包/类
protected void addDDMTemplates(
String ddmStructureKey, String fileName, InputStream inputStream)
throws Exception {
fileName = FileUtil.stripExtension(fileName);
String name = getName(fileName);
String xsl = StringUtil.read(inputStream);
setServiceContext(fileName);
DDMStructure ddmStructure = DDMStructureLocalServiceUtil.getStructure(
groupId, PortalUtil.getClassNameId(JournalArticle.class),
ddmStructureKey);
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);
}
ddmTemplate = DDMTemplateLocalServiceUtil.addTemplate(
userId, groupId, PortalUtil.getClassNameId(DDMStructure.class),
ddmStructure.getStructureId(), getKey(fileName), getMap(name), null,
DDMTemplateConstants.TEMPLATE_TYPE_DISPLAY, null,
getDDMTemplateLanguage(fileName), replaceFileEntryURL(xsl), false,
false, null, null, serviceContext);
addJournalArticles(
ddmStructureKey, ddmTemplate.getTemplateKey(),
_JOURNAL_ARTICLES_DIR_NAME + fileName);
}