Java 类com.liferay.portal.kernel.util.PortalUtil 实例源码

项目:opencps-v2    文件:LoginPostAction.java   
@Override
public void processLifecycleEvent(LifecycleEvent lifecycleEvent) throws ActionException {
    User user;
    try {
        user = PortalUtil.getUser(lifecycleEvent.getRequest());

        PrincipalThreadLocal.setName(user.getUserId());

        PermissionChecker permissionChecker;

        permissionChecker = PermissionCheckerFactoryUtil.create(user);

        PermissionThreadLocal.setPermissionChecker(permissionChecker);

        String friendlyUrl = user.getSiteGroups().get(0).getFriendlyURL();

        lifecycleEvent.getResponse().sendRedirect("/group" + friendlyUrl);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}
项目:liferay-dummy-factory    文件:JournalUtils.java   
/**
 * Build content field
 *
 * @param groupId Company group ID
 * @param locales locales
 * @param baseArticle content data
 * @return DDMStructure applied content XML strings
 * @throws Exception
 */
public String buildFields(long groupId, String[] locales, String baseArticle) throws Exception {
    DDMStructure ddmStructure = 
        _DDMStructureLocalService.getStructure(
            groupId,
            PortalUtil.getClassNameId(JournalArticle.class), 
            LDFPortletKeys._DDM_STRUCTURE_KEY
        );

    Map<String, Serializable> fieldsMap = Maps.newConcurrentMap();
    fieldsMap.put(DDM_CONTENT, baseArticle);

    Fields fields = _ddmLocalUtil.toFields(
            ddmStructure.getStructureId(), 
            fieldsMap, 
            locales,
            LocaleUtil.getDefault());

    return _journalConverter.getContent(ddmStructure, fields);
}
项目:liferay-blade-samples    文件:RegionLocalServiceBaseImpl.java   
/**
 * Performs a SQL query.
 *
 * @param sql the sql query
 */
protected void runSQL(String sql) {
    try {
        DataSource dataSource = regionPersistence.getDataSource();

        DB db = DBManagerUtil.getDB();

        sql = db.buildSQL(sql);
        sql = PortalUtil.transformSQL(sql);

        SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
                sql);

        sqlUpdate.update();
    }
    catch (Exception e) {
        throw new SystemException(e);
    }
}
项目:liferay-blade-samples    文件:CountryLocalServiceBaseImpl.java   
/**
 * Performs a SQL query.
 *
 * @param sql the sql query
 */
protected void runSQL(String sql) {
    try {
        DataSource dataSource = countryPersistence.getDataSource();

        DB db = DBManagerUtil.getDB();

        sql = db.buildSQL(sql);
        sql = PortalUtil.transformSQL(sql);

        SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
                sql);

        sqlUpdate.update();
    }
    catch (Exception e) {
        throw new SystemException(e);
    }
}
项目:liferay-blade-samples    文件:FooServiceBaseImpl.java   
/**
 * Performs a SQL query.
 *
 * @param sql the sql query
 */
protected void runSQL(String sql) {
    try {
        DataSource dataSource = fooPersistence.getDataSource();

        DB db = DBManagerUtil.getDB();

        sql = db.buildSQL(sql);
        sql = PortalUtil.transformSQL(sql);

        SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
                sql);

        sqlUpdate.update();
    }
    catch (Exception e) {
        throw new SystemException(e);
    }
}
项目:liferay-blade-samples    文件:FooLocalServiceBaseImpl.java   
/**
 * Performs a SQL query.
 *
 * @param sql the sql query
 */
protected void runSQL(String sql) {
    try {
        DataSource dataSource = fooPersistence.getDataSource();

        DB db = DBManagerUtil.getDB();

        sql = db.buildSQL(sql);
        sql = PortalUtil.transformSQL(sql);

        SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
                sql);

        sqlUpdate.update();
    }
    catch (Exception e) {
        throw new SystemException(e);
    }
}
项目:liferay-blade-samples    文件:RegionLocalServiceBaseImpl.java   
/**
 * Performs a SQL query.
 *
 * @param sql the sql query
 */
protected void runSQL(String sql) {
    try {
        DataSource dataSource = regionPersistence.getDataSource();

        DB db = DBManagerUtil.getDB();

        sql = db.buildSQL(sql);
        sql = PortalUtil.transformSQL(sql);

        SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
                sql);

        sqlUpdate.update();
    }
    catch (Exception e) {
        throw new SystemException(e);
    }
}
项目:liferay-blade-samples    文件:CountryLocalServiceBaseImpl.java   
/**
 * Performs a SQL query.
 *
 * @param sql the sql query
 */
protected void runSQL(String sql) {
    try {
        DataSource dataSource = countryPersistence.getDataSource();

        DB db = DBManagerUtil.getDB();

        sql = db.buildSQL(sql);
        sql = PortalUtil.transformSQL(sql);

        SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
                sql);

        sqlUpdate.update();
    }
    catch (Exception e) {
        throw new SystemException(e);
    }
}
项目:liferay-blade-samples    文件:FooServiceBaseImpl.java   
/**
 * Performs a SQL query.
 *
 * @param sql the sql query
 */
protected void runSQL(String sql) {
    try {
        DataSource dataSource = fooPersistence.getDataSource();

        DB db = DBManagerUtil.getDB();

        sql = db.buildSQL(sql);
        sql = PortalUtil.transformSQL(sql);

        SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
                sql);

        sqlUpdate.update();
    }
    catch (Exception e) {
        throw new SystemException(e);
    }
}
项目:liferay-blade-samples    文件:FooLocalServiceBaseImpl.java   
/**
 * Performs a SQL query.
 *
 * @param sql the sql query
 */
protected void runSQL(String sql) {
    try {
        DataSource dataSource = fooPersistence.getDataSource();

        DB db = DBManagerUtil.getDB();

        sql = db.buildSQL(sql);
        sql = PortalUtil.transformSQL(sql);

        SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
                sql);

        sqlUpdate.update();
    }
    catch (Exception e) {
        throw new SystemException(e);
    }
}
项目:liferay-blade-samples    文件:RegionLocalServiceBaseImpl.java   
/**
 * Performs a SQL query.
 *
 * @param sql the sql query
 */
protected void runSQL(String sql) {
    try {
        DataSource dataSource = regionPersistence.getDataSource();

        DB db = DBManagerUtil.getDB();

        sql = db.buildSQL(sql);
        sql = PortalUtil.transformSQL(sql);

        SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
                sql);

        sqlUpdate.update();
    }
    catch (Exception e) {
        throw new SystemException(e);
    }
}
项目:liferay-blade-samples    文件:CountryLocalServiceBaseImpl.java   
/**
 * Performs a SQL query.
 *
 * @param sql the sql query
 */
protected void runSQL(String sql) {
    try {
        DataSource dataSource = countryPersistence.getDataSource();

        DB db = DBManagerUtil.getDB();

        sql = db.buildSQL(sql);
        sql = PortalUtil.transformSQL(sql);

        SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
                sql);

        sqlUpdate.update();
    }
    catch (Exception e) {
        throw new SystemException(e);
    }
}
项目:liferay-blade-samples    文件:FooServiceBaseImpl.java   
/**
 * Performs a SQL query.
 *
 * @param sql the sql query
 */
protected void runSQL(String sql) {
    try {
        DataSource dataSource = fooPersistence.getDataSource();

        DB db = DBManagerUtil.getDB();

        sql = db.buildSQL(sql);
        sql = PortalUtil.transformSQL(sql);

        SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
                sql);

        sqlUpdate.update();
    }
    catch (Exception e) {
        throw new SystemException(e);
    }
}
项目:liferay-blade-samples    文件:FooLocalServiceBaseImpl.java   
/**
 * Performs a SQL query.
 *
 * @param sql the sql query
 */
protected void runSQL(String sql) {
    try {
        DataSource dataSource = fooPersistence.getDataSource();

        DB db = DBManagerUtil.getDB();

        sql = db.buildSQL(sql);
        sql = PortalUtil.transformSQL(sql);

        SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
                sql);

        sqlUpdate.update();
    }
    catch (Exception e) {
        throw new SystemException(e);
    }
}
项目:index-checker    文件:DLFileEntryPermissionsHelper.java   
@Override
protected boolean isRelatedEntry(Data data) {

    long groupId = data.getGroupId();
    long repositoryId = data.get("repositoryId", -1L);

    boolean hiddenFolder = isHiddenFolder(groupId, repositoryId);

    if (!hiddenFolder) {
        return false;
    }

    long classNameId = data.get("classNameId", 0L);

    if (classNameId == 0) {
        return false;
    }

    String permissionsClassName = PortalUtil.getClassName(classNameId);

    return ArrayUtil.contains(
        validPermissionClassNames, permissionsClassName);
}
项目:index-checker    文件:MBMessagePermissionsHelper.java   
@Override
protected boolean isRelatedEntry(Data data) {

    long categoryId = data.get("categoryId", 0L);

    if (categoryId != MBCategoryConstants.DISCUSSION_CATEGORY_ID) {
        return false;
    }

    long classNameId = data.get("classNameId", 0L);

    if (classNameId == 0) {
        return false;
    }

    String permissionsClassName = PortalUtil.getClassName(classNameId);

    return ArrayUtil.contains(
        validPermissionClassNames, permissionsClassName);
}
项目:liferay-gsearch    文件:GSearchUtil.java   
/**
 * Get current layout friendly URL
 * 
 * @return String friendly URL for the current layout
 * @throws PortalException
 */
public static String getCurrentLayoutFriendlyURL(PortletRequest portletRequest)
    throws PortalException {

    ThemeDisplay themeDisplay =
        (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);

    Layout selectedLayout =
        LayoutLocalServiceUtil.getLayout(themeDisplay.getPlid());
    return PortalUtil.getLayoutFriendlyURL(selectedLayout, themeDisplay);
}
项目:liferay-gsearch    文件:JournalArticleItemBuilder.java   
/**
 * Get a view url for an article which is not bound to a layout or has a
 * default view page.
 * 
 * @return url string
 * @throws PortalException
 */
protected String getNotLayoutBoundJournalArticleUrl()
    throws PortalException {

    ThemeDisplay themeDisplay =
        (ThemeDisplay) _portletRequest.getAttribute(WebKeys.THEME_DISPLAY);

    Layout layout = GSearchUtil.getLayoutByFriendlyURL(
        _portletRequest, _assetPublisherPageFriendlyURL);

    String assetPublisherInstanceId =
        GSearchUtil.findDefaultAssetPublisherInstanceId(layout);

    JournalArticle journalArticle = getJournalArticle();

    StringBundler sb = new StringBundler();
    sb.append(PortalUtil.getLayoutFriendlyURL(layout, themeDisplay));
    sb.append("/-/asset_publisher/");
    sb.append(assetPublisherInstanceId);
    sb.append("/content/");
    sb.append(journalArticle.getUrlTitle());
    sb.append("?_");
    sb.append(AssetPublisherPortletKeys.ASSET_PUBLISHER);
    sb.append("_INSTANCE_");
    sb.append(assetPublisherInstanceId);
    sb.append("_groupId=");
    sb.append(journalArticle.getGroupId());

    return sb.toString();
}
项目:liferay-gsearch    文件:DLFileEntryItemBuilder.java   
/**
 * {@inheritDoc}
 */
@Override
public String getLink() {

    StringBundler sb = new StringBundler();
    sb.append(PortalUtil.getPortalURL(_portletRequest));
    sb.append("/documents/");
    sb.append(_document.get(Field.SCOPE_GROUP_ID));
    sb.append("/");
    sb.append(_document.get(Field.FOLDER_ID));
    sb.append("/");
    sb.append(_document.get("path"));

    return sb.toString();
}
项目:servicebuilder-reflection    文件:ModelUtil.java   
public static Criterion generateSQLCriterion(String sql) {
    if (Validator.isNull(sql)) {
        return null;
    }

    sql = PortalUtil.transformSQL(sql);

    return RestrictionsFactoryUtil.sqlRestriction(sql);
}
项目:liferay-db-setup-core    文件:SetupArticles.java   
private static void addDDLRecordSet(final DdlRecordset recordSet, final long groupId)
        throws SystemException, PortalException {
    LOG.info("Adding DDLRecordSet " + recordSet.getName());
    Map<Locale, String> nameMap = new HashMap<>();
    Locale siteDefaultLocale = PortalUtil.getSiteDefaultLocale(groupId);
    nameMap.put(siteDefaultLocale, recordSet.getName());
    Map<Locale, String> descMap = new HashMap<>();
    descMap.put(siteDefaultLocale, recordSet.getDescription());
    DDLRecordSet ddlRecordSet = null;
    try {
        ddlRecordSet = DDLRecordSetLocalServiceUtil.fetchRecordSet(groupId, recordSet.getKey());
    } catch (SystemException e) {
        LOG.error("Error while trying to find DDLRecordSet with key: " + recordSet.getKey(), e);
    }

    if (ddlRecordSet != null) {
        LOG.info("DDLRecordSet already exists and will be overwritten.");
        ddlRecordSet.setNameMap(nameMap);
        ddlRecordSet.setDescriptionMap(descMap);
        ddlRecordSet.setDDMStructureId(ResolverUtil
                .getStructureId(recordSet.getDdlStructureKey(), groupId, DDLRecordSet.class, false));
        DDLRecordSetLocalServiceUtil.updateDDLRecordSet(ddlRecordSet);
        LOG.info("DDLRecordSet successfully updated: " + recordSet.getName());
        return;
    }

    DDLRecordSet newDDLRecordSet = DDLRecordSetLocalServiceUtil.addRecordSet(
            LiferaySetup.getRunAsUserId(), groupId,
            ResolverUtil.getStructureId(recordSet.getDdlStructureKey(), groupId,
                    DDLRecordSet.class, false),
            recordSet.getDdlStructureKey(), nameMap, descMap, MIN_DISPLAY_ROWS, 0,
            new ServiceContext());
    LOG.info("Added DDLRecordSet: " + newDDLRecordSet.getName());
}
项目:liferay-db-setup-core    文件:TitleMapUtil.java   
public static Locale getDefaultLocale(final long groupId, final String locationHint) {
    Locale siteDefaultLocale = null;
    try {
        siteDefaultLocale = PortalUtil.getSiteDefaultLocale(groupId);
    } catch (PortalException | SystemException e) {
        LOG.error("Error Reading Locale while for " + locationHint);
    }
    return siteDefaultLocale;
}
项目:liferay-db-setup-core    文件:SetupCategorization.java   
public static void setupVocabularies(final Site site, final long groupId)
        throws SystemException, PortalException {
    List<Vocabulary> vocabularies = site.getVocabulary();

    Locale siteDefaultLocale = PortalUtil.getSiteDefaultLocale(groupId);

    LOG.info("Setting up vocabularies");

    for (Vocabulary vocabulary : vocabularies) {
        setupVocabulary(vocabulary, site, groupId, siteDefaultLocale);
    }
}
项目:liferay-oidc-plugin    文件:Liferay70Adapter.java   
@Override
public boolean isUserLoggedIn(HttpServletRequest request) {
    try {
        return PortalUtil.getUser(request) != null;
    } catch (PortalException | SystemException e) {
        return false;
    }
}
项目:ch-inofix-timetracker    文件:ExportTaskRecordsMVCResourceCommand.java   
protected List<TaskRecord> getTaskRecords(PortletRequest request) throws Exception {

        ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

        PortletURL iteratorURL = PortletURLFactoryUtil.create(request, PortletKeys.TIMETRACKER,
                themeDisplay.getLayout(), PortletRequest.RENDER_PHASE);

        String description = ParamUtil.getString(request, "description");
        boolean advancedSearch = ParamUtil.getBoolean(request, "advancedSearch", false);
        boolean andOperator = ParamUtil.getBoolean(request, "andOperator", true);
        int end = ParamUtil.getInteger(request, "end");

        boolean ignoreFromDate = ParamUtil.getBoolean(request, "ignoreFromDate");

        Date fromDate = null;

        if (!ignoreFromDate) {

            int fromDateDay = ParamUtil.getInteger(request, "fromDateDay");
            int fromDateMonth = ParamUtil.getInteger(request, "fromDateMonth");
            int fromDateYear = ParamUtil.getInteger(request, "fromDateYear");
            fromDate = PortalUtil.getDate(fromDateMonth, fromDateDay, fromDateYear);
        }

        String keywords = ParamUtil.getString(request, "keywords");
        String orderByCol = ParamUtil.getString(request, "orderByCol", "modifiedDate");
        String orderByType = ParamUtil.getString(request, "orderByType", "desc");
        long ownerUserId = ParamUtil.getLong(request, "ownerUserId");
        int start = ParamUtil.getInteger(request, "start");
        int status = ParamUtil.getInteger(request, Field.STATUS);

        TaskRecordSearch taskRecordSearch = new TaskRecordSearch(request, iteratorURL);

        orderByCol = taskRecordSearch.getOrderByCol();

        boolean ignoreUntilDate = ParamUtil.getBoolean(request, "ignoreUntilDate");

        Date untilDate = null;

        if (!ignoreUntilDate) {

            int untilDateDay = ParamUtil.getInteger(request, "untilDateDay");
            int untilDateMonth = ParamUtil.getInteger(request, "untilDateMonth");
            int untilDateYear = ParamUtil.getInteger(request, "untilDateYear");
            untilDate = PortalUtil.getDate(untilDateMonth, untilDateDay, untilDateYear);
        }

        String workPackage = ParamUtil.getString(request, "workPackage");

        boolean reverse = "desc".equals(orderByType);

        Sort sort = new Sort(orderByCol, reverse);

        Hits hits = null;

        if (advancedSearch) {
            hits = TaskRecordServiceUtil.search(themeDisplay.getUserId(), themeDisplay.getScopeGroupId(), ownerUserId,
                    workPackage, description, status, fromDate, untilDate, null, andOperator, advancedSearch, start,
                    end, sort);
        } else {
            hits = TaskRecordServiceUtil.search(themeDisplay.getUserId(), themeDisplay.getScopeGroupId(), 0, keywords,
                    start, end, sort);
        }

        List<TaskRecord> taskRecords = TimetrackerUtil.getTaskRecords(hits);

        return taskRecords;

    }
项目:ch-inofix-timetracker    文件:TaskRecordAssetRenderer.java   
@Override
public String getURLView(LiferayPortletResponse liferayPortletResponse, WindowState windowState) {

    try {

        long portletPlid = PortalUtil.getPlidFromPortletId(_taskRecord.getGroupId(), false,
                PortletKeys.TIMETRACKER);

        PortletURL portletURL = liferayPortletResponse.createLiferayPortletURL(portletPlid, PortletKeys.TIMETRACKER,
                PortletRequest.RENDER_PHASE);

        portletURL.setParameter("mvcPath", "/edit_task_record.jsp");

        portletURL.setParameter("taskRecordId", String.valueOf(_taskRecord.getTaskRecordId()));

        return portletURL.toString();

    } catch (Exception e) {
        _log.error(e.getMessage());
    }

    return null;
}
项目:ch-inofix-contact-manager    文件:ContactAssetRenderer.java   
@Override
public String getURLView(LiferayPortletResponse liferayPortletResponse, WindowState windowState) {

    try {

        long portletPlid = PortalUtil.getPlidFromPortletId(_contact.getGroupId(), false,
                PortletKeys.CONTACT_MANAGER);

        PortletURL portletURL = liferayPortletResponse.createLiferayPortletURL(portletPlid,
                PortletKeys.CONTACT_MANAGER, PortletRequest.RENDER_PHASE);

        portletURL.setParameter("mvcPath", "/edit_contact.jsp");

        portletURL.setParameter("contactId", String.valueOf(_contact.getContactId()));

        return portletURL.toString();

    } catch (Exception e) {
        _log.error(e.getMessage());
    }

    return null;
}
项目:opencps-v2    文件:LoginMVCActionCommand.java   
@Override
protected void doProcessAction(
    ActionRequest actionRequest, ActionResponse actionResponse)
    throws Exception {

    ThemeDisplay themeDisplay =
        (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    HttpServletRequest request = PortalUtil.getOriginalServletRequest(
        PortalUtil.getHttpServletRequest(actionRequest));

    HttpServletResponse response =
        PortalUtil.getHttpServletResponse(actionResponse);

    String login = ParamUtil.getString(actionRequest, "login");
    String password = ParamUtil.getString(actionRequest, "password");
    String action = ParamUtil.getString(actionRequest, "action");
    boolean rememberMe = ParamUtil.getBoolean(actionRequest, "rememberMe");
    String authType = CompanyConstants.AUTH_TYPE_EA;

    if (!Validator.isEmailAddress(login)) {

        Applicant app = ApplicantLocalServiceUtil.fetchByAppId(login);

        if (Validator.isNotNull(app)) {
            login = app.getContactEmail();
        }
    }

    Applicant applicant = UserMgtUtils.getApplicant(login);

    login = applicant != null ? applicant.getContactEmail() : login;

    User user = UserLocalServiceUtil.getUserByEmailAddress(
        themeDisplay.getCompanyId(), login);

    hideDefaultSuccessMessage(actionRequest);

    if (user != null &&
        user.getStatus() == WorkflowConstants.STATUS_PENDING) {

        actionResponse.sendRedirect(
            "/confirm-account?active_user_id=" + user.getUserId() +
                "&redirectURL=" + themeDisplay.getURLCurrent());
    }
    else {
        AuthenticatedSessionManagerUtil.login(
            request, response, login, password, rememberMe, authType);

        if (action != null && action.equals("confirm_account")) {
            actionResponse.sendRedirect(
                themeDisplay.getPortalURL() + "/profile");
        }
        else {
            actionResponse.sendRedirect(themeDisplay.getPathMain());
        }
    }

}
项目:ch-inofix-data-manager    文件:MeasurementAssetRenderer.java   
@Override
public String getURLView(LiferayPortletResponse liferayPortletResponse, WindowState windowState) {

    try {

        long portletPlid = PortalUtil.getPlidFromPortletId(_measurement.getGroupId(), false,
                PortletKeys.DATA_MANAGER);

        PortletURL portletURL = liferayPortletResponse.createLiferayPortletURL(portletPlid, PortletKeys.DATA_MANAGER,
                PortletRequest.RENDER_PHASE);

        portletURL.setParameter("mvcPath", "/edit_measurement.jsp");

        portletURL.setParameter("measurementId", String.valueOf(_measurement.getMeasurementId()));

        return portletURL.toString();

    } catch (Exception e) {
        _log.error(e.getMessage());
    }

    return null;
}
项目:liferay-blade-samples    文件:FooModelImpl.java   
@Override
public StagedModelType getStagedModelType() {
    return new StagedModelType(PortalUtil.getClassNameId(
            Foo.class.getName()));
}
项目:liferay-blade-samples    文件:FooLocalServiceBaseImpl.java   
@Override
public ExportActionableDynamicQuery getExportActionableDynamicQuery(
    final PortletDataContext portletDataContext) {
    final ExportActionableDynamicQuery exportActionableDynamicQuery = new ExportActionableDynamicQuery() {
            @Override
            public long performCount() throws PortalException {
                ManifestSummary manifestSummary = portletDataContext.getManifestSummary();

                StagedModelType stagedModelType = getStagedModelType();

                long modelAdditionCount = super.performCount();

                manifestSummary.addModelAdditionCount(stagedModelType,
                    modelAdditionCount);

                long modelDeletionCount = ExportImportHelperUtil.getModelDeletionCount(portletDataContext,
                        stagedModelType);

                manifestSummary.addModelDeletionCount(stagedModelType,
                    modelDeletionCount);

                return modelAdditionCount;
            }
        };

    initActionableDynamicQuery(exportActionableDynamicQuery);

    exportActionableDynamicQuery.setAddCriteriaMethod(new ActionableDynamicQuery.AddCriteriaMethod() {
            @Override
            public void addCriteria(DynamicQuery dynamicQuery) {
                portletDataContext.addDateRangeCriteria(dynamicQuery,
                    "modifiedDate");
            }
        });

    exportActionableDynamicQuery.setCompanyId(portletDataContext.getCompanyId());

    exportActionableDynamicQuery.setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod<Foo>() {
            @Override
            public void performAction(Foo foo) throws PortalException {
                StagedModelDataHandlerUtil.exportStagedModel(portletDataContext,
                    foo);
            }
        });
    exportActionableDynamicQuery.setStagedModelType(new StagedModelType(
            PortalUtil.getClassNameId(Foo.class.getName())));

    return exportActionableDynamicQuery;
}
项目:liferay-blade-samples    文件:FooModelImpl.java   
@Override
public StagedModelType getStagedModelType() {
    return new StagedModelType(PortalUtil.getClassNameId(
            Foo.class.getName()));
}
项目:liferay-blade-samples    文件:FooLocalServiceBaseImpl.java   
@Override
public ExportActionableDynamicQuery getExportActionableDynamicQuery(
    final PortletDataContext portletDataContext) {
    final ExportActionableDynamicQuery exportActionableDynamicQuery = new ExportActionableDynamicQuery() {
            @Override
            public long performCount() throws PortalException {
                ManifestSummary manifestSummary = portletDataContext.getManifestSummary();

                StagedModelType stagedModelType = getStagedModelType();

                long modelAdditionCount = super.performCount();

                manifestSummary.addModelAdditionCount(stagedModelType,
                    modelAdditionCount);

                long modelDeletionCount = ExportImportHelperUtil.getModelDeletionCount(portletDataContext,
                        stagedModelType);

                manifestSummary.addModelDeletionCount(stagedModelType,
                    modelDeletionCount);

                return modelAdditionCount;
            }
        };

    initActionableDynamicQuery(exportActionableDynamicQuery);

    exportActionableDynamicQuery.setAddCriteriaMethod(new ActionableDynamicQuery.AddCriteriaMethod() {
            @Override
            public void addCriteria(DynamicQuery dynamicQuery) {
                portletDataContext.addDateRangeCriteria(dynamicQuery,
                    "modifiedDate");
            }
        });

    exportActionableDynamicQuery.setCompanyId(portletDataContext.getCompanyId());

    exportActionableDynamicQuery.setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod<Foo>() {
            @Override
            public void performAction(Foo foo) throws PortalException {
                StagedModelDataHandlerUtil.exportStagedModel(portletDataContext,
                    foo);
            }
        });
    exportActionableDynamicQuery.setStagedModelType(new StagedModelType(
            PortalUtil.getClassNameId(Foo.class.getName())));

    return exportActionableDynamicQuery;
}
项目:liferay-blade-samples    文件:FooModelImpl.java   
@Override
public StagedModelType getStagedModelType() {
    return new StagedModelType(PortalUtil.getClassNameId(
            Foo.class.getName()));
}
项目:liferay-blade-samples    文件:FooLocalServiceBaseImpl.java   
@Override
public ExportActionableDynamicQuery getExportActionableDynamicQuery(
    final PortletDataContext portletDataContext) {
    final ExportActionableDynamicQuery exportActionableDynamicQuery = new ExportActionableDynamicQuery() {
            @Override
            public long performCount() throws PortalException {
                ManifestSummary manifestSummary = portletDataContext.getManifestSummary();

                StagedModelType stagedModelType = getStagedModelType();

                long modelAdditionCount = super.performCount();

                manifestSummary.addModelAdditionCount(stagedModelType,
                    modelAdditionCount);

                long modelDeletionCount = ExportImportHelperUtil.getModelDeletionCount(portletDataContext,
                        stagedModelType);

                manifestSummary.addModelDeletionCount(stagedModelType,
                    modelDeletionCount);

                return modelAdditionCount;
            }
        };

    initActionableDynamicQuery(exportActionableDynamicQuery);

    exportActionableDynamicQuery.setAddCriteriaMethod(new ActionableDynamicQuery.AddCriteriaMethod() {
            @Override
            public void addCriteria(DynamicQuery dynamicQuery) {
                portletDataContext.addDateRangeCriteria(dynamicQuery,
                    "modifiedDate");
            }
        });

    exportActionableDynamicQuery.setCompanyId(portletDataContext.getCompanyId());

    exportActionableDynamicQuery.setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod<Foo>() {
            @Override
            public void performAction(Foo foo) throws PortalException {
                StagedModelDataHandlerUtil.exportStagedModel(portletDataContext,
                    foo);
            }
        });
    exportActionableDynamicQuery.setStagedModelType(new StagedModelType(
            PortalUtil.getClassNameId(Foo.class.getName())));

    return exportActionableDynamicQuery;
}
项目:data-manipulator    文件:DataManipulatorAdmin.java   
public void create(
        ActionRequest actionRequest, ActionResponse actionResponse)
    throws Exception { 

    UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(
        actionRequest);

    RequestContext requestContext = new RequestContext(uploadRequest);

    ThemeDisplay themeDisplay = (ThemeDisplay)uploadRequest.getAttribute(
        WebKeys.THEME_DISPLAY);

    String handlerName = ParamUtil.getString(uploadRequest, "handlerName");

    BaseHandler handler = HandlerUtil.getHandler(handlerName);

    boolean handlerIsPortalType = HandlerUtil.isPortalType(handlerName);

    long[] groupIds = requestContext.getGroupIds();

    if ((groupIds.length <= 0) || handlerIsPortalType) {
        groupIds = new long[] {themeDisplay.getScopeGroupId()};
    }

    long[] userIds = requestContext.getUserIds();

    if ((userIds.length <= 0) || handlerIsPortalType) {
        userIds = new long[] {themeDisplay.getUserId()};
    }

    for (long groupId : groupIds) {
        for (long userId : userIds) {
            requestContext = new RequestContext(uploadRequest);

            requestContext.setGroupId(groupId);
            requestContext.setUserId(userId);

            HandlerThread handlerThread = new HandlerThread(
                handler, requestContext);

            handlerThread.start();
        }
    }
}