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


Java ExpressionList.raw方法代码示例

本文整理汇总了Java中com.avaje.ebean.ExpressionList.raw方法的典型用法代码示例。如果您正苦于以下问题:Java ExpressionList.raw方法的具体用法?Java ExpressionList.raw怎么用?Java ExpressionList.raw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.avaje.ebean.ExpressionList的用法示例。


在下文中一共展示了ExpressionList.raw方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPortfolioEntriesViewAllowedAsQuery

import com.avaje.ebean.ExpressionList; //导入方法依赖的package包/类
/**
 * Get the ebean expression list for all authorized portfolio entries of the
 * sign-in user. It's possible to filter and sort the list.
 * 
 * @param expression
 *            the ebean filter expression
 * @param securityService
 *            the security service
 */
public static ExpressionList<PortfolioEntry> getPortfolioEntriesViewAllowedAsQuery(ISecurityService securityService) throws AccountManagementException {

    IUserAccount userAccount = securityService.getCurrentUser();

    String raw = "(";

    // user has permission PORTFOLIO_ENTRY_VIEW_DETAILS_ALL_PERMISSION
    // OR
    if (securityService.restrict(IMafConstants.PORTFOLIO_ENTRY_VIEW_DETAILS_ALL_PERMISSION, userAccount)) {
        raw += "1 = '1' OR ";
    }

    // user has permission PORTFOLIO_ENTRY_VIEW_PUBLIC_PERMISSION
    // AND portfolioEntry is public AND portfolioEntry is not a concept
    // OR
    if (securityService.restrict(IMafConstants.PORTFOLIO_ENTRY_VIEW_PUBLIC_PERMISSION, userAccount)) {
        raw += "(isPublic=true AND activeLifeCycleInstance.isConcept=false) OR ";
    }

    Actor actor = ActorDao.getActorByUid(userAccount.getIdentifier());
    if (actor != null) {

        // user has permission
        // PORTFOLIO_ENTRY_VIEW_DETAILS_AS_MANAGER_PERMISSION AND
        // user is manager of the portfolioEntry OR
        if (securityService.restrict(IMafConstants.PORTFOLIO_ENTRY_VIEW_DETAILS_AS_MANAGER_PERMISSION, userAccount)) {
            raw += "manager.id=" + actor.id + " OR ";
        }

        // user has permission
        // PORTFOLIO_ENTRY_VIEW_DETAILS_AS_STAKEHOLDER_PERMISSION AND
        // user is direct stakeholder of the portfolioEntry
        if (securityService.restrict(IMafConstants.PORTFOLIO_ENTRY_VIEW_DETAILS_AS_STAKEHOLDER_PERMISSION, userAccount)) {
            raw += "(stakeholders.deleted=false AND stakeholders.actor.id=" + actor.id + ") OR ";
        }

        // user has permission
        // PORTFOLIO_ENTRY_VIEW_DETAILS_AS_STAKEHOLDER_PERMISSION AND
        // user is stakeholder of a portfolio of the portfolioEntry
        if (securityService.restrict(IMafConstants.PORTFOLIO_ENTRY_VIEW_DETAILS_AS_STAKEHOLDER_PERMISSION, userAccount)) {
            raw += "(portfolios.deleted=false AND portfolios.stakeholders.deleted=false AND portfolios.stakeholders.actor.id=" + actor.id + ") OR ";
        }

        // user has permission
        // PORTFOLIO_ENTRY_VIEW_DETAILS_AS_PORTFOLIO_MANAGER_PERMISSION
        // AND
        // user
        // is portfolio manager of the portfolioEntry
        if (securityService.restrict(IMafConstants.PORTFOLIO_ENTRY_VIEW_DETAILS_AS_PORTFOLIO_MANAGER_PERMISSION, userAccount)) {
            raw += "(portfolios.deleted=false AND portfolios.manager.id=" + actor.id + ") OR ";
        }

    }

    raw += "1 = '0')";

    ExpressionList<PortfolioEntry> expressionList = PortfolioEntryDao.findPortfolioEntry.where();

    expressionList = expressionList.eq("deleted", false);

    return expressionList.raw(raw);
}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:72,代码来源:PortfolioEntryDynamicHelper.java

示例2: getBudgetBucketsViewAllowedAsQuery

import com.avaje.ebean.ExpressionList; //导入方法依赖的package包/类
/**
 * Get the ebean expression list for all authorized budget buckets of the
 * sign-in user. It's possible to filter and sort the list.
 * 
 * @param expression
 *            the ebean filter expression
 * @param orderBy
 *            the ebean order by
 * @param securityService
 *            the security service
 */
public static ExpressionList<BudgetBucket> getBudgetBucketsViewAllowedAsQuery(Expression expression, OrderBy<BudgetBucket> orderBy,
        ISecurityService securityService) throws AccountManagementException {

    IUserAccount userAccount = securityService.getCurrentUser();

    String raw = "(";

    // user has permission BUDGET_BUCKET_VIEW_ALL_PERMISSION
    // OR
    if (securityService.restrict(IMafConstants.BUDGET_BUCKET_VIEW_ALL_PERMISSION, userAccount)) {
        raw += "1 = '1' OR ";
    }

    // user has permission BUDGET_BUCKET_VIEW_AS_OWNER_PERMISSION AND
    // user or his subordinates is owner of the budgetBucket OR
    Actor actor = ActorDao.getActorByUid(userAccount.getIdentifier());
    if (actor != null && securityService.restrict(IMafConstants.BUDGET_BUCKET_VIEW_AS_OWNER_PERMISSION, userAccount)) {

        raw += "owner.id = " + actor.id + " OR ";

        String subordinatesString = ActorHierarchy.getSubordinatesAsString(actor.id, ",");
        if (subordinatesString != null && !subordinatesString.trim().isEmpty()) {
            raw += "owner.id IN (" + subordinatesString + ") OR ";
        }

    }

    raw += "1 = '0')";

    ExpressionList<BudgetBucket> expressionList;

    if (orderBy != null) {
        expressionList = BudgetBucketDAO.findBudgetBucket.where();
        Utilities.updateExpressionListWithOrderBy(orderBy, expressionList);
    } else {
        expressionList = BudgetBucketDAO.findBudgetBucket.where();
    }

    expressionList = expressionList.eq("deleted", false);

    if (expression != null) {
        return expressionList.add(expression).raw(raw);
    } else {
        return expressionList.raw(raw);
    }

}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:59,代码来源:BudgetBucketDynamicHelper.java

示例3: getPortfoliosViewAllowedAsQuery

import com.avaje.ebean.ExpressionList; //导入方法依赖的package包/类
/**
 * Get the ebean expression list for all authorized portfolios of the
 * sign-in user. It's possible to filter and sort the list.
 * 
 * @param expression
 *            the ebean filter expression
 * @param orderBy
 *            the ebean order by
 * @param securityService
 *            the security service
 */
public static ExpressionList<Portfolio> getPortfoliosViewAllowedAsQuery(Expression expression, OrderBy<Portfolio> orderBy, ISecurityService securityService)
        throws AccountManagementException {

    IUserAccount userAccount = securityService.getCurrentUser();

    String raw = "(";

    // user has permission PORTFOLIO_VIEW_DETAILS_ALL_PERMISSION
    // OR
    if (securityService.restrict(IMafConstants.PORTFOLIO_VIEW_DETAILS_ALL_PERMISSION, userAccount)) {
        raw += "1 = '1' OR ";
    }

    Actor actor = ActorDao.getActorByUid(userAccount.getIdentifier());
    if (actor != null) {

        // user has permission
        // PORTFOLIO_VIEW_DETAILS_AS_MANAGER_PERMISSION AND
        // user is manager of the portfolio OR
        if (securityService.restrict(IMafConstants.PORTFOLIO_VIEW_DETAILS_AS_MANAGER_PERMISSION, userAccount)) {
            raw += "manager.id=" + actor.id + " OR ";
        }

        // user has permission
        // PORTFOLIO_VIEW_DETAILS_AS_STAKEHOLDER_PERMISSION AND
        // user is direct stakeholder of the portfolio
        if (securityService.restrict(IMafConstants.PORTFOLIO_VIEW_DETAILS_AS_STAKEHOLDER_PERMISSION, userAccount)) {
            raw += "(stakeholders.deleted=false AND stakeholders.actor.id=" + actor.id + ") OR ";
        }

    }

    raw += "1 = '0')";

    ExpressionList<Portfolio> expressionList;

    if (orderBy != null) {
        expressionList = PortfolioDao.findPortfolio.where();
        Utilities.updateExpressionListWithOrderBy(orderBy, expressionList);
    } else {
        expressionList = PortfolioDao.findPortfolio.where();
    }

    expressionList = expressionList.eq("deleted", false);

    if (expression != null) {
        return expressionList.add(expression).raw(raw);
    } else {
        return expressionList.raw(raw);
    }

}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:64,代码来源:PortfolioDynamicHelper.java

示例4: getTimesheetReportsApprovalAllowedAsQuery

import com.avaje.ebean.ExpressionList; //导入方法依赖的package包/类
/**
 * Get the ebean expression list for all authorized timesheet report of the
 * sign-in user (meaning the reports he can display and provide approval).
 * It's possible to filter and sort the list.
 * 
 * @param expression
 *            the ebean filter expression
 * @param orderBy
 *            the ebean order by
 * @param securityService
 *            the security service
 */
public static ExpressionList<TimesheetReport> getTimesheetReportsApprovalAllowedAsQuery(Expression expression, OrderBy<TimesheetReport> orderBy,
        ISecurityService securityService) throws AccountManagementException {

    IUserAccount userAccount = securityService.getCurrentUser();

    String raw = "(";

    // user has permission TIMESHEET_APPROVAL_ALL_PERMISSION
    // OR
    if (securityService.restrict(IMafConstants.TIMESHEET_APPROVAL_ALL_PERMISSION, userAccount)) {
        raw += "1 = '1' OR ";
    }

    // user has permission
    // TIMESHEET_APPROVAL_AS_MANAGER_PERMISSION AND
    // user or his subordinates is manager of the actor of the report OR
    Actor actor = ActorDao.getActorByUid(userAccount.getIdentifier());
    if (actor != null && securityService.restrict(IMafConstants.TIMESHEET_APPROVAL_AS_MANAGER_PERMISSION, userAccount)) {

        raw += "actor.manager.id=" + actor.id + " OR ";

        String subordinatesString = ActorHierarchy.getSubordinatesAsString(actor.id, ",");
        if (subordinatesString != null && !subordinatesString.trim().isEmpty()) {
            raw += "actor.manager.id IN (" + subordinatesString + ") OR ";
        }

    }

    raw += "1 = '0')";

    ExpressionList<TimesheetReport> expressionList;

    if (orderBy != null) {
        expressionList = TimesheetDao.findTimesheetReport.where();
        Utilities.updateExpressionListWithOrderBy(orderBy, expressionList);
    } else {
        expressionList = TimesheetDao.findTimesheetReport.where();
    }

    expressionList = expressionList.eq("deleted", false);

    if (expression != null) {
        return expressionList.add(expression).raw(raw);
    } else {
        return expressionList.raw(raw);
    }

}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:61,代码来源:TimesheetReportDynamicHelper.java

示例5: getOrgUnitsViewAllowedAsQuery

import com.avaje.ebean.ExpressionList; //导入方法依赖的package包/类
/**
 * Get the ebean expression list for all authorized org units of the sign-in
 * user. It's possible to filter and sort the list.
 * 
 * @param expression
 *            the ebean filter expression
 * @param orderBy
 *            the ebean order by
 * @param securityService
 *            the security service
 */
public static ExpressionList<OrgUnit> getOrgUnitsViewAllowedAsQuery(Expression expression, OrderBy<OrgUnit> orderBy, ISecurityService securityService)
        throws AccountManagementException {

    IUserAccount userAccount = securityService.getCurrentUser();
    String raw = "(";

    // user has permission ORG_UNIT_VIEW_ALL_PERMISSION
    // OR
    if (securityService.restrict(IMafConstants.ORG_UNIT_VIEW_ALL_PERMISSION, userAccount)) {
        raw += "1 = '1' OR ";
    }

    // user has permission ORG_UNIT_VIEW_AS_RESPONSIBLE_PERMISSION AND
    // user or his subordinates is manager of the orgUnit OR
    Actor actor = ActorDao.getActorByUid(userAccount.getIdentifier());
    if (actor != null && securityService.restrict(IMafConstants.ORG_UNIT_VIEW_AS_RESPONSIBLE_PERMISSION, userAccount)) {

        raw += "manager.id = " + actor.id + " OR ";

        String subordinatesString = ActorHierarchy.getSubordinatesAsString(actor.id, ",");
        if (subordinatesString != null && !subordinatesString.trim().isEmpty()) {
            raw += "manager.id IN (" + subordinatesString + ") OR ";
        }

    }

    raw += "1 = '0')";

    ExpressionList<OrgUnit> expressionList;

    if (orderBy != null) {
        expressionList = OrgUnitDao.findOrgUnit.where();
        Utilities.updateExpressionListWithOrderBy(orderBy, expressionList);
    } else {
        expressionList = OrgUnitDao.findOrgUnit.where();
    }

    expressionList = expressionList.eq("deleted", false);

    if (expression != null) {
        return expressionList.add(expression).raw(raw);
    } else {
        return expressionList.raw(raw);
    }

}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:58,代码来源:OrgUnitDynamicHelper.java

示例6: getActorsViewAllowedAsQuery

import com.avaje.ebean.ExpressionList; //导入方法依赖的package包/类
/**
 * Get the ebean expression list for all authorized actors of the sign-in
 * user. It's possible to filter and sort the list.
 * 
 * @param expression
 *            the ebean filter expression
 * @param orderBy
 *            the ebean order by
 * @param securityService
 *            the security service
 */
public static ExpressionList<Actor> getActorsViewAllowedAsQuery(Expression expression, OrderBy<Actor> orderBy, ISecurityService securityService)
        throws AccountManagementException {
    IUserAccount currentUserAccount = securityService.getCurrentUser();
    String raw = "(";

    // user has permission ACTOR_VIEW_ALL_PERMISSION
    // OR
    if (securityService.restrict(IMafConstants.ACTOR_VIEW_ALL_PERMISSION, currentUserAccount)) {
        raw += "1 = '1' OR ";
    }

    Actor actor = ActorDao.getActorByUid(currentUserAccount.getIdentifier());
    if (actor != null) {

        // the actor "is" the user
        raw += "id = " + actor.id + " OR ";

        // user has permission
        // ACTOR_VIEW_AS_SUPERIOR_PERMISSION AND
        // user or his subordinates is manager of the actor OR
        if (securityService.restrict(IMafConstants.ACTOR_VIEW_AS_SUPERIOR_PERMISSION, currentUserAccount)) {
            raw += "manager.id = " + actor.id + " OR ";

            String subordinatesString = ActorHierarchy.getSubordinatesAsString(actor.id, ",");
            if (subordinatesString != null && !subordinatesString.trim().isEmpty()) {
                raw += "manager.id IN (" + subordinatesString + ") OR ";
            }
        }

    }

    raw += "1 = '0')";

    ExpressionList<Actor> expressionList;

    if (orderBy != null) {
        expressionList = ActorDao.findActor.where();
        Utilities.updateExpressionListWithOrderBy(orderBy, expressionList);

    } else {
        expressionList = ActorDao.findActor.where();
    }

    expressionList = expressionList.eq("deleted", false);

    if (expression != null) {
        return expressionList.add(expression).raw(raw);
    } else {
        return expressionList.raw(raw);
    }

}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:64,代码来源:ActorDynamicHelper.java

示例7: getReportsViewAllowedAsQuery

import com.avaje.ebean.ExpressionList; //导入方法依赖的package包/类
/**
 * get the ebean expression list for all authorized reports of the sign-in
 * user. It's possible to filter and sort the list.
 * 
 * @param expression
 *            the ebean filter expression
 * @param orderBy
 *            the ebean order by
 * @param securityService
 *            the security service
 */
public static ExpressionList<Reporting> getReportsViewAllowedAsQuery(Expression expression, OrderBy<Reporting> orderBy, ISecurityService securityService)
        throws AccountManagementException {

    IUserAccount userAccount = securityService.getCurrentUser();

    String raw = "(";

    // user has permission REPORTING_VIEW_ALL_PERMISSION
    // OR
    if (securityService.restrict(IMafConstants.REPORTING_VIEW_ALL_PERMISSION, userAccount)) {
        raw += "1 = '1' OR ";
    }

    // user has permission
    // REPORTING_VIEW_AS_VIEWER_PERMISSION AND
    // (the report is public OR the user has access to it)
    if (securityService.restrict(IMafConstants.REPORTING_VIEW_AS_VIEWER_PERMISSION, userAccount)) {
        raw += "(isPublic = 1 OR reportingAuthorization.principals.uid='" + userAccount.getIdentifier() + "') OR ";
    }

    raw += "1 = '0')";

    ExpressionList<Reporting> expressionList;

    if (orderBy != null) {
        expressionList = ReportingDao.findReporting.fetch("reportingAuthorization.principals", new FetchConfig().lazy()).where();
        Utilities.updateExpressionListWithOrderBy(orderBy, expressionList);
    } else {
        expressionList = ReportingDao.findReporting.fetch("reportingAuthorization.principals", new FetchConfig().lazy()).where();
    }

    expressionList = expressionList.eq("deleted", false);

    if (expression != null) {
        return expressionList.add(expression).raw(raw);
    } else {
        return expressionList.raw(raw);
    }

}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:52,代码来源:ReportingDynamicHelper.java


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