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


Java DDMStructure类代码示例

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


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

示例1: getSortedRecords

import com.liferay.portlet.dynamicdatamapping.model.DDMStructure; //导入依赖的package包/类
private List<DDLRecord> getSortedRecords(final HttpServletRequest request, final DDLRecordSet recordSet,
        final String sortByStructureColumnName) throws Exception {

    DDMStructure structure = recordSet.getDDMStructure();
    String indexedSortColumn = DDMIndexerUtil.encodeName(structure.getStructureId(), sortByStructureColumnName, Locale.US);

    SearchContext searchContext = SearchContextFactory.getInstance(request);
    String fieldType = structure.getFieldType(sortByStructureColumnName);
    int sortType = getSortType(fieldType);

    Sort sort = SortFactoryUtil.create(indexedSortColumn, sortType, false);

    searchContext.setSorts(sort);
    Indexer indexer = IndexerRegistryUtil.getIndexer("com.liferay.portlet.dynamicdatalists.util.DDLIndexer");
    Hits results = indexer.search(searchContext);

    return adapt(results);
}
 
开发者ID:permeance,项目名称:liferay-sample-ddl-sort-example,代码行数:19,代码来源:SamplePortletController.java

示例2: DocumentAttribute

import com.liferay.portlet.dynamicdatamapping.model.DDMStructure; //导入依赖的package包/类
/**
 * Creates a new instance of SortAttribute from a {@link DDMStructure}.
 *
 * @param name
 *            the name of the field
 * @param structure
 *            the structure of the field
 */
public DocumentAttribute(final String name, final DDMStructure structure) {
	this.customField = true;
	this.name = name;
	try {
		final Integer newType = TYPE_MAPPING.get(structure.getFieldDataType(name));
		this.type = newType == null ? Sort.INT_TYPE : newType;
	} catch (final PortalException | SystemException e) {
		throw new IllegalArgumentException(e);
	}
}
 
开发者ID:liefke,项目名称:org.portletbeans,代码行数:19,代码来源:DocumentAttribute.java

示例3: load

import com.liferay.portlet.dynamicdatamapping.model.DDMStructure; //导入依赖的package包/类
@Override
public DDMStructure load(final PortletPreferences preferences, final String key, final String defaultValue) {
	final String uuid = preferences.getValue(key, "");
	if (StringUtils.isEmpty(uuid)) {
		return null;
	}
	final long groupId = ServiceContextThreadLocal.getServiceContext().getScopeGroupId();
	try {
		return DDMStructureLocalServiceUtil.fetchDDMStructureByUuidAndGroupId(uuid, groupId);
	} catch (final SystemException e) {
		log.error("Could not load structure {} from group {}", new Object[] { uuid, groupId, e });
		return null;
	}
}
 
开发者ID:liefke,项目名称:org.portletbeans,代码行数:15,代码来源:DdmStructurePreferenceHandler.java

示例4: addDDMStructures

import com.liferay.portlet.dynamicdatamapping.model.DDMStructure; //导入依赖的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

示例5: addDDMTemplates

import com.liferay.portlet.dynamicdatamapping.model.DDMStructure; //导入依赖的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

示例6: addDDLDisplayTemplates

import com.liferay.portlet.dynamicdatamapping.model.DDMStructure; //导入依赖的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);
	}
}
 
开发者ID:rivetlogic,项目名称:liferay-voice-command,代码行数:40,代码来源:ResourceImporter.java

示例7: addDDLFormTemplates

import com.liferay.portlet.dynamicdatamapping.model.DDMStructure; //导入依赖的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);
	}
}
 
开发者ID:rivetlogic,项目名称:liferay-voice-command,代码行数:40,代码来源:ResourceImporter.java

示例8: addDDLDisplayTemplates

import com.liferay.portlet.dynamicdatamapping.model.DDMStructure; //导入依赖的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);
	}
}
 
开发者ID:rivetlogic,项目名称:liferay-voice-command,代码行数:33,代码来源:FileSystemImporter.java

示例9: addDDLFormTemplates

import com.liferay.portlet.dynamicdatamapping.model.DDMStructure; //导入依赖的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);
	}
}
 
开发者ID:rivetlogic,项目名称:liferay-voice-command,代码行数:31,代码来源:FileSystemImporter.java

示例10: addDDMStructures

import com.liferay.portlet.dynamicdatamapping.model.DDMStructure; //导入依赖的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

示例11: addDDMTemplate

import com.liferay.portlet.dynamicdatamapping.model.DDMStructure; //导入依赖的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

示例12: store

import com.liferay.portlet.dynamicdatamapping.model.DDMStructure; //导入依赖的package包/类
@Override
public void store(final PortletPreferences preferences, final String key, final DDMStructure structure)
		throws ReadOnlyException {
	preferences.setValue(key, structure == null ? null : structure.getUuid());
}
 
开发者ID:liefke,项目名称:org.portletbeans,代码行数:6,代码来源:DdmStructurePreferenceHandler.java

示例13: addDDMTemplates

import com.liferay.portlet.dynamicdatamapping.model.DDMStructure; //导入依赖的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);
}
 
开发者ID:rivetlogic,项目名称:liferay-voice-command,代码行数:46,代码来源:FileSystemImporter.java

示例14: getStructure

import com.liferay.portlet.dynamicdatamapping.model.DDMStructure; //导入依赖的package包/类
private DDMStructure getStructure(Long globalId, User user) throws SystemException, PortalException {

		List<DDMStructure> structures = DDMStructureLocalServiceUtil.getStructures(globalId);
		DDMStructure ddmStructure = null;

		for (DDMStructure structure : structures) {

			if (structure.getStructureKey().toLowerCase().equals(TYPE_MAIL_TEMPLATE.toLowerCase())) {
				ddmStructure = structure;
			}
		}

		long userId = user.getUserId();
		long groupId = globalId;

		Map<Locale, String> nameMap = new HashMap<Locale, String>();

		nameMap.put(LocaleUtil.getDefault(), TYPE_MAIL_TEMPLATE);

		Map<Locale, String> descriptionMap = new HashMap<Locale, String>();

		StringBuilder xsd = new StringBuilder();

		xsd.append("<root  available-locales=\"" + LocaleUtil.getDefault() + "\" default-locale=\"" + LocaleUtil.getDefault() + "\">");

		// Subject

		xsd.append("<dynamic-element dataType=\"string\" indexType=\"keyword\" name=\"TextContent\" readOnly=\"false\" repeatable=\"false\" required=\"false\" showLabel=\"true\" type=\"text\" width=\"small\">");
		xsd.append("<meta-data locale=\"" + LocaleUtil.getDefault() + "\">");
		xsd.append("<entry name=\"label\"><![CDATA[Subject]]></entry>");
		xsd.append("<entry name=\"predefinedValue\"><![CDATA[]]></entry>");
		xsd.append("<entry name=\"tip\"><![CDATA[]]></entry>");
		xsd.append("</meta-data>");
		xsd.append("</dynamic-element>");

		// Content

		xsd.append("<dynamic-element dataType=\"html\" fieldNamespace=\"ddm\" indexType=\"keyword\" name=\"HTMLContent\" readOnly=\"false\" repeatable=\"false\" required=\"false\" showLabel=\"true\" type=\"ddm-text-html\" width=\"small\">");
		xsd.append("<meta-data locale=\"" + LocaleUtil.getDefault() + "\">");
		xsd.append("<entry name=\"label\"><![CDATA[Content]]></entry>");
		xsd.append("<entry name=\"predefinedValue\"><![CDATA[]]></entry>");
		xsd.append("<entry name=\"tip\"><![CDATA[]]></entry>");
		xsd.append("</meta-data>");
		xsd.append("</dynamic-element>");

		xsd.append("</root>");

		ServiceContext serviceContext = new ServiceContext();
		serviceContext.setScopeGroupId(groupId);

		long parentStructureId = new Long(0);
		long classNameId = new Long(10109);
		String structureKey = TYPE_MAIL_TEMPLATE;
		String storageType = "xml";
		int type = 0;

		String content = xsd.toString();

		if (ddmStructure == null) {
			return DDMStructureLocalServiceUtil.addStructure(userId, groupId, parentStructureId, classNameId, structureKey, nameMap, descriptionMap, content, storageType, type, serviceContext);
		} else {
			return DDMStructureLocalServiceUtil.updateStructure(groupId, parentStructureId, classNameId, structureKey, nameMap, descriptionMap, content, serviceContext);
		}

	}
 
开发者ID:mahytom,项目名称:liferay-webforms,代码行数:66,代码来源:DefaultValuesBuilder.java

示例15: toSort

import com.liferay.portlet.dynamicdatamapping.model.DDMStructure; //导入依赖的package包/类
/**
 * Converts this model object to the one used by Liferay.
 *
 * @param ascending
 *            {@code true} to sort ascending
 * @param structure
 *            the current structure
 * @param locale
 *            the locale of the current user
 * @return the Liferay model object.
 */
public Sort toSort(final boolean ascending, final DDMStructure structure, final Locale locale) {
	String field = this.name;
	if (this.customField) {
		field = toField(structure, locale).concat("_sortable");
	}
	return new Sort(field, this.type, !ascending);
}
 
开发者ID:liefke,项目名称:org.portletbeans,代码行数:19,代码来源:DocumentAttribute.java


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