/** * Returns all the structures matching the group, name, and description. * * @param groupId the primary key of the structure's group * @param name the structure's name * @param description the structure's description * @return the matching structures */ @Override public java.util.List<com.liferay.dynamic.data.mapping.model.DDMStructure> getStructure( long groupId, String name, String description) { return _ddmStructureLocalService.getStructure(groupId, name, description); }
/** * Returns the structure with the ID. * * @param structureId the primary key of the structure * @return the structure with the ID */ @Override public com.liferay.dynamic.data.mapping.model.DDMStructure getStructure( long structureId) throws com.liferay.portal.kernel.exception.PortalException { return _ddmStructureLocalService.getStructure(structureId); }
/** * Returns the structure matching the class name ID, structure key, and * group. * * @param groupId the primary key of the structure's group * @param classNameId the primary key of the class name for the structure's related model * @param structureKey the unique string identifying the structure * @return the matching structure */ @Override public com.liferay.dynamic.data.mapping.model.DDMStructure getStructure( long groupId, long classNameId, String structureKey) throws com.liferay.portal.kernel.exception.PortalException { return _ddmStructureLocalService.getStructure(groupId, classNameId, structureKey); }
/** * Returns all the structures matching the group, name, and description. * * @param groupId the primary key of the structure's group * @param name the structure's name * @param description the structure's description * @return the matching structures */ public static java.util.List<com.liferay.dynamic.data.mapping.model.DDMStructure> getStructure( long groupId, String name, String description) { return getService().getStructure(groupId, name, description); }
/** * Returns the structure with the ID. * * @param structureId the primary key of the structure * @return the structure with the ID */ public static com.liferay.dynamic.data.mapping.model.DDMStructure getStructure( long structureId) throws com.liferay.portal.kernel.exception.PortalException { return getService().getStructure(structureId); }
protected DDMForm getDDMForm(long structureId) throws Exception { DDMForm ddmForm = _ddmSructureDDMForms.get(structureId); if (ddmForm != null) { return ddmForm; } DDMStructure ddmStructure = _ddmStructureLocalService.getStructure( structureId); ddmForm = ddmStructure.getDDMForm(); _ddmSructureDDMForms.put(structureId, ddmForm); return ddmForm; }
/** * Returns the structure matching the class name ID, structure key, and * group. * * @param groupId the primary key of the structure's group * @param classNameId the primary key of the class name for the structure's related model * @param structureKey the unique string identifying the structure * @return the matching structure */ public static com.liferay.dynamic.data.mapping.model.DDMStructure getStructure( long groupId, long classNameId, String structureKey) throws com.liferay.portal.kernel.exception.PortalException { return getService().getStructure(groupId, classNameId, structureKey); }
@Override public void addAttributes( long structureId, Document document, DDMFormValues ddmFormValues) throws PortalException { com.liferay.dynamic.data.mapping.model.DDMStructure ddmStructure = _ddmStructureLocalService.getStructure(structureId); _ddmIndexer.addAttributes( document, ddmStructure, _ddmBeanTranslator.translate(ddmFormValues)); }
@Override public String extractAttributes( long structureId, DDMFormValues ddmFormValues, Locale locale) throws PortalException { com.liferay.dynamic.data.mapping.model.DDMStructure ddmStructure = _ddmStructureLocalService.getStructure(structureId); return _ddmIndexer.extractIndexableAttributes( ddmStructure, _ddmBeanTranslator.translate(ddmFormValues), locale); }
@Override public DDMStructure getStructure(long structureId) throws PortalException { try { com.liferay.dynamic.data.mapping.model.DDMStructure ddmStructure = _ddmStructureLocalService.getStructure(structureId); return new DDMStructureImpl(ddmStructure); } catch (PortalException pe) { throw translate(pe); } }
protected DDMStructureIndexer getDDMStructureIndexer(long structureId) throws PortalException { DDMStructure structure = _ddmStructureLocalService.getStructure( structureId); Indexer<?> indexer = _indexerRegistry.nullSafeGetIndexer( structure.getClassName()); return (DDMStructureIndexer)indexer; }
protected long getStructureVersionId(long ddmStructureId) throws PortalException { DDMStructure ddmStructure = ddmStructureLocalService.getStructure( ddmStructureId); DDMStructureVersion ddmStructureVersion = ddmStructure.getStructureVersion(); return ddmStructureVersion.getStructureVersionId(); }
@Override public DDMStructure getStructure( long groupId, long classNameId, String structureKey) throws PortalException { try { com.liferay.dynamic.data.mapping.model.DDMStructure structure = _ddmStructureLocalService.getStructure( groupId, classNameId, structureKey); return new DDMStructureImpl(structure); } catch (PortalException pe) { throw translate(pe); } }
protected long getBestDDMStructureIdMatch( long id, long ddmStructureId1, long ddmStructureId2) throws Exception { DDMStructure ddmStructure1 = _ddmStructureLocalService.getStructure( ddmStructureId1); Set<String> fieldNames1 = ddmStructure1.getFieldNames(); Set<String> articleFieldNames = getArticleFieldNames(id); fieldNames1.removeAll(articleFieldNames); DDMStructure ddmStructure2 = _ddmStructureLocalService.getStructure( ddmStructureId2); Set<String> fieldNames2 = ddmStructure2.getFieldNames(); fieldNames2.removeAll(articleFieldNames); if (fieldNames1.size() <= fieldNames2.size()) { return ddmStructure1.getStructureId(); } return ddmStructure2.getStructureId(); }
/** * Returns the structure matching the class name ID, structure key, and * group. * * @param groupId the primary key of the structure's group * @param classNameId the primary key of the class name for the structure's * related model * @param structureKey the unique string identifying the structure * @return the matching structure */ @Override public DDMStructure getStructure( long groupId, long classNameId, String structureKey) throws PortalException { DDMStructure structure = ddmStructureLocalService.getStructure( groupId, classNameId, structureKey); _ddmStructureModelResourcePermission.check( getPermissionChecker(), structure, ActionKeys.VIEW); return structure; }
@Override public QueryFilter createFieldValueQueryFilter( String ddmStructureFieldName, Serializable ddmStructureFieldValue, Locale locale) throws Exception { BooleanQuery booleanQuery = new BooleanQueryImpl(); String[] ddmStructureFieldNameParts = StringUtil.split( ddmStructureFieldName, DDMIndexer.DDM_FIELD_SEPARATOR); DDMStructure structure = _ddmStructureLocalService.getStructure( GetterUtil.getLong(ddmStructureFieldNameParts[2])); String fieldName = StringUtil.replaceLast( ddmStructureFieldNameParts[3], StringPool.UNDERLINE.concat(LocaleUtil.toLanguageId(locale)), StringPool.BLANK); if (structure.hasField(fieldName)) { ddmStructureFieldValue = _ddm.getIndexedFieldValue( ddmStructureFieldValue, structure.getFieldType(fieldName)); } booleanQuery.addRequiredTerm( ddmStructureFieldName, StringPool.QUOTE + ddmStructureFieldValue + StringPool.QUOTE); return new QueryFilter(booleanQuery); }
@Override @SystemEvent(type = SystemEventConstants.TYPE_DELETE) public void deleteFeed(JournalFeed feed) throws PortalException { // Feed journalFeedPersistence.remove(feed); // DDM Structure Link DDMStructure ddmStructure = ddmStructureLocalService.getStructure( feed.getGroupId(), classNameLocalService.getClassNameId(JournalArticle.class), feed.getDDMStructureKey(), true); ddmStructureLinkLocalService.deleteStructureLink( classNameLocalService.getClassNameId(JournalFeed.class), feed.getPrimaryKey(), ddmStructure.getStructureId()); // Resources resourceLocalService.deleteResource( feed.getCompanyId(), JournalFeed.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, feed.getId()); // Expando expandoValueLocalService.deleteValues( JournalFeed.class.getName(), feed.getId()); }
public void validateDDMStructureId( long groupId, long folderId, String ddmStructureKey) throws PortalException { int restrictionType = _journalHelper.getRestrictionType(folderId); DDMStructure ddmStructure = _ddmStructureLocalService.getStructure( _portal.getSiteGroupId(groupId), _classNameLocalService.getClassNameId(JournalArticle.class), ddmStructureKey, true); List<DDMStructure> folderDDMStructures = _journalFolderLocalService.getDDMStructures( _portal.getCurrentAndAncestorSiteGroupIds(groupId), folderId, restrictionType); for (DDMStructure folderDDMStructure : folderDDMStructures) { if (folderDDMStructure.getStructureId() == ddmStructure.getStructureId()) { return; } } throw new InvalidDDMStructureException( StringBundler.concat( "Invalid structure ", ddmStructure.getStructureId(), " for folder ", folderId)); }
protected void checkValidContainer(long classPK, long containerModelId) throws PortalException { JournalArticle article = _journalArticleLocalService.getLatestArticle( classPK); DDMStructure ddmStructure = _ddmStructureLocalService.getStructure( _portal.getSiteGroupId(article.getGroupId()), _portal.getClassNameId(JournalArticle.class), article.getDDMStructureKey(), true); if (containerModelId == TrashEntryConstants.DEFAULT_CONTAINER_ID) { containerModelId = article.getFolderId(); } int restrictionType = _journalHelper.getRestrictionType( containerModelId); List<DDMStructure> folderDDMStructures = _journalFolderLocalService.getDDMStructures( _portal.getCurrentAndAncestorSiteGroupIds(article.getGroupId()), containerModelId, restrictionType); for (DDMStructure folderDDMStructure : folderDDMStructures) { if (folderDDMStructure.getStructureId() == ddmStructure.getStructureId()) { return; } } throw new RestoreEntryException( RestoreEntryException.INVALID_CONTAINER); }
protected void checkValidContainer(long classPK, long containerModelId) throws PortalException { JournalArticle article = _journalArticleLocalService.getLatestArticle( classPK); DDMStructure ddmStructure = _ddmStructureLocalService.getStructure( _portal.getSiteGroupId(article.getGroupId()), _portal.getClassNameId(JournalArticle.class), article.getDDMStructureKey(), true); if (containerModelId == TrashEntryConstants.DEFAULT_CONTAINER_ID) { containerModelId = article.getFolderId(); } int restrictionType = JournalHelperUtil.getRestrictionType( containerModelId); List<DDMStructure> folderDDMStructures = _journalFolderLocalService.getDDMStructures( _portal.getCurrentAndAncestorSiteGroupIds(article.getGroupId()), containerModelId, restrictionType); for (DDMStructure folderDDMStructure : folderDDMStructures) { if (folderDDMStructure.getStructureId() == ddmStructure.getStructureId()) { return; } } throw new RestoreEntryException( RestoreEntryException.INVALID_CONTAINER); }