/** * Returns a source root path, or fragment, of the model path. This method * is called by the {@link #getRootPath(PortletDataContext)} method. The * fragment is generated with the source group ID from the portlet data * context. This helper method is useful during the import process. * * <p> * For example, a source root path would resemble the following: * </p> * * <p> * <pre> * <code> * /group/"queried groupId" * </code> * </pre></p> * * @param portletDataContext the context of the current export/import * process * @return a path fragment * @see PortletDataContext#getSourceGroupId() */ public static String getSourceRootPath( PortletDataContext portletDataContext) { return getRootPath( PATH_PREFIX_GROUP, portletDataContext.getSourceGroupId()); }
/** * 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); }
long sourceGroupId = portletDataContext.getSourceGroupId();
@Override public String replaceImportContentReferences( PortletDataContext portletDataContext, StagedModel stagedModel, String content) throws Exception { JournalFeed feed = (JournalFeed)stagedModel; Group group = _groupLocalService.getGroup( portletDataContext.getScopeGroupId()); String newGroupFriendlyURL = group.getFriendlyURL(); newGroupFriendlyURL = newGroupFriendlyURL.substring(1); String newTargetLayoutFriendlyURL = StringUtil.replace( feed.getTargetLayoutFriendlyUrl(), _DATA_HANDLER_GROUP_FRIENDLY_URL, newGroupFriendlyURL); long plid = _portal.getPlidFromFriendlyURL( portletDataContext.getCompanyId(), newTargetLayoutFriendlyURL); if (plid <= 0) { Group oldGroup = _groupLocalService.fetchGroup( portletDataContext.getSourceGroupId()); if (oldGroup == null) { return content; } String oldGroupFriendlyURL = oldGroup.getFriendlyURL(); oldGroupFriendlyURL = oldGroupFriendlyURL.substring(1); newTargetLayoutFriendlyURL = StringUtil.replace( feed.getTargetLayoutFriendlyUrl(), _DATA_HANDLER_GROUP_FRIENDLY_URL, oldGroupFriendlyURL); } feed.setTargetLayoutFriendlyUrl(newTargetLayoutFriendlyURL); return content; }
portletDataContext.getSourceGroupId(), portletDataContext.getGroupId());
portletDataContext.getSourceGroupId(), portletDataContext.getGroupId());
portletDataContext.getSourceCompanyGroupId()); clonePortletDataContext.setSourceGroupId( portletDataContext.getSourceGroupId()); clonePortletDataContext.setSourceUserPersonalSiteGroupId( portletDataContext.getSourceUserPersonalSiteGroupId());
_layoutLocalService.getLayoutByUuidAndGroupId( scopeLayoutUuid, portletDataContext.getSourceGroupId(), privateLayout);