public static String getCompanyModelPath( long companyId, String className, Serializable classPK) { return getModelPath( PATH_PREFIX_COMPANY, companyId, className, classPK, null); }
/** * Returns a model path for the staged model. The group ID, class name, and * class PK are queried from the staged model to generate the path. * * <p> * For example, a model path would resemble the following: * </p> * * <p> * <pre> * <code> * /group/"queried groupId"/"queried className"/"queried classPK".xml * </code> * </pre></p> * * @param stagedModel the staged model the path is needed for * @return a model path for the staged model * @see StagedModel */ public static String getModelPath(StagedModel stagedModel) { return getModelPath(stagedModel, null); }
/** * Returns a model path based on the group ID, class name, and class PK. * * <p> * For example, a model path would resemble the following: * </p> * * <p> * <pre> * <code> * /group/"groupId"/"className"/"classPK".xml * </code> * </pre></p> * * @param groupId the group ID of the entity's group * @param className the entity's class name * @param classPK the primary key of the entity * @return a model path based on the parameters */ public static String getModelPath( long groupId, String className, Serializable classPK) { return getModelPath( PATH_PREFIX_GROUP, groupId, className, classPK, null); }
public static String getModelPath( long groupId, String className, long classPK) { return getModelPath(groupId, className, Long.valueOf(classPK)); }
/** * Returns a model path based on the group ID, class name, and class PK, * where the group ID is queried from the portlet data context. This method * uses the source group ID from the context. * * <p> * For example, a model path would resemble the following: * </p> * * <p> * <pre> * <code> * /group/"queried groupId"/"className"/"classPK".xml * </code> * </pre></p> * * @param portletDataContext the context of the current export/import * process * @param className the entity's class name * @param classPK the primary key of the entity * @return a model path based on the parameters * @see PortletDataContext#getSourceGroupId() */ public static String getModelPath( PortletDataContext portletDataContext, String className, long classPK) { return getModelPath(portletDataContext, className, classPK, null); }
/** * Returns a model path for the named file related to the entity, having the * class name and class PK. The dependent object's file name is appended to * the generated prefix. * * <p> * For example, a model path would resemble the following: * </p> * * <p> * <pre> * <code> * /group/"queried groupId"/"className"/"classPK"/"dependentFileName" * </code> * </pre></p> * * @param portletDataContext the context of the current export/import * process * @param className the related entity's class name * @param classPK the primary key of the related entity * @param dependentFileName the dependent object's file name * @return a model path for the entity's dependent object */ public static String getModelPath( PortletDataContext portletDataContext, String className, long classPK, String dependentFileName) { return getModelPath( PATH_PREFIX_GROUP, portletDataContext.getSourceGroupId(), className, classPK, dependentFileName); }
(StagedGroupedModel)stagedModel; return getModelPath( PATH_PREFIX_GROUP, stagedGroupedModel.getGroupId(), stagedModelType.getClassName(), stagedModel.getPrimaryKeyObj(), return getModelPath( PATH_PREFIX_COMPANY, stagedModel.getCompanyId(), stagedModelType.getClassName(), stagedModel.getPrimaryKeyObj(),
private static StagedModel _getReferenceStagedModel( PortletDataContext portletDataContext, Element element) { long groupId = GetterUtil.getLong(element.attributeValue("group-id")); String className = element.attributeValue("class-name"); Serializable classPK = GetterUtil.getString( element.attributeValue("class-pk")); String path = ExportImportPathUtil.getModelPath( groupId, className, classPK); StagedModel stagedModel = (StagedModel)portletDataContext.getZipEntryAsObject(element, path); if (stagedModel != null) { return stagedModel; } path = ExportImportPathUtil.getCompanyModelPath( portletDataContext.getSourceCompanyId(), className, classPK); return (StagedModel)portletDataContext.getZipEntryAsObject( element, path); }
document.getRootElement()); String path = ExportImportPathUtil.getModelPath( stagedModel);
@Override public ServiceContext createServiceContext( StagedModel stagedModel, Class<?> clazz) { return createServiceContext( getImportDataStagedModelElement(stagedModel), ExportImportPathUtil.getModelPath(stagedModel), stagedModel, clazz); }
@Override public Element getImportDataStagedModelElement(StagedModel stagedModel) { String path = ExportImportPathUtil.getModelPath(stagedModel); return getImportDataElement( ExportImportClassedModelUtil.getClassSimpleName(stagedModel), "path", path); }
String path = ExportImportPathUtil.getModelPath(stagedModel);
throws PortletDataException { String path = ExportImportPathUtil.getModelPath(stagedModel);
protected void exportFormInstanceSettings( PortletDataContext portletDataContext, DDMFormInstance formInstance, Element formInstanceElement) { String settingsDDMFormValuesPath = ExportImportPathUtil.getModelPath( formInstance, "settings-ddm-form-values.json"); formInstanceElement.addAttribute( "settings-ddm-form-values-path", settingsDDMFormValuesPath); portletDataContext.addZipEntry( settingsDDMFormValuesPath, formInstance.getSettings()); }
@Override protected void doExportStagedModel( PortletDataContext portletDataContext, DDMFormInstanceRecord record) throws Exception { StagedModelDataHandlerUtil.exportReferenceStagedModel( portletDataContext, record, record.getFormInstance(), PortletDataContext.REFERENCE_TYPE_STRONG); Element recordElement = portletDataContext.getExportDataElement(record); exportDDMFormValues(portletDataContext, record, recordElement); portletDataContext.addClassedModel( recordElement, ExportImportPathUtil.getModelPath(record), record); }
@Override protected void doExportStagedModel( PortletDataContext portletDataContext, JournalFolder folder) throws Exception { if (folder.getParentFolderId() != JournalFolderConstants.DEFAULT_PARENT_FOLDER_ID) { StagedModelDataHandlerUtil.exportReferenceStagedModel( portletDataContext, folder, folder.getParentFolder(), PortletDataContext.REFERENCE_TYPE_PARENT); } Element folderElement = portletDataContext.getExportDataElement(folder); exportFolderDDMStructures(portletDataContext, folder); portletDataContext.addClassedModel( folderElement, ExportImportPathUtil.getModelPath(folder), folder); }
protected void exportDDMFormValues( PortletDataContext portletDataContext, DDMFormInstanceRecord record, Element recordElement) throws Exception { String ddmFormValuesPath = ExportImportPathUtil.getModelPath( record, "ddm-form-values.json"); recordElement.addAttribute("ddm-form-values-path", ddmFormValuesPath); DDMFormValues ddmFormValues = _storageEngine.getDDMFormValues( record.getStorageId()); ddmFormValues = _ddmFormValuesExportImportContentProcessor. replaceExportContentReferences( portletDataContext, record, ddmFormValues, true, false); portletDataContext.addZipEntry( ddmFormValuesPath, _ddmFormValuesJSONSerializer.serialize(ddmFormValues)); }
@Override protected void doExportStagedModel( PortletDataContext portletDataContext, DDMFormInstance formInstance) throws Exception { DDMStructure ddmStructure = formInstance.getStructure(); StagedModelDataHandlerUtil.exportReferenceStagedModel( portletDataContext, formInstance, ddmStructure, PortletDataContext.REFERENCE_TYPE_STRONG); List<DDMTemplate> ddmTemplates = ddmStructure.getTemplates(); Element formInstanceElement = portletDataContext.getExportDataElement( formInstance); for (DDMTemplate ddmTemplate : ddmTemplates) { StagedModelDataHandlerUtil.exportReferenceStagedModel( portletDataContext, formInstance, ddmTemplate, PortletDataContext.REFERENCE_TYPE_STRONG); } exportFormInstanceSettings( portletDataContext, formInstance, formInstanceElement); portletDataContext.addClassedModel( formInstanceElement, ExportImportPathUtil.getModelPath(formInstance), formInstance); }
StagedModel stagedModel = (StagedModel)classedModel; String path = ExportImportPathUtil.getModelPath(stagedModel);
@Override public void exportAssetLinks(PortletDataContext portletDataContext) throws Exception { Document document = SAXReaderUtil.createDocument(); Element rootElement = document.addElement("links"); Element exportDataRootElement = portletDataContext.getExportDataRootElement(); try { portletDataContext.setExportDataRootElement(rootElement); List<AssetLink> assetLinks = _assetLinkLocalService.getLinks( portletDataContext.getGroupId(), portletDataContext.getStartDate(), portletDataContext.getEndDate(), QueryUtil.ALL_POS, QueryUtil.ALL_POS); for (AssetLink assetLink : assetLinks) { StagedAssetLink stagedAssetLink = ModelAdapterUtil.adapt( assetLink, AssetLink.class, StagedAssetLink.class); portletDataContext.addClassedModel( portletDataContext.getExportDataElement(stagedAssetLink), ExportImportPathUtil.getModelPath(stagedAssetLink), stagedAssetLink); } } finally { portletDataContext.setExportDataRootElement(exportDataRootElement); } portletDataContext.addZipEntry( ExportImportPathUtil.getRootPath(portletDataContext) + "/links.xml", document.formattedString()); }