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


Java Group.getStatus方法代码示例

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


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

示例1: getPossibleNewGroups

import nl.strohalm.cyclos.entities.groups.Group; //导入方法依赖的package包/类
@Override
public List<? extends Group> getPossibleNewGroups(final Element element) {
    Group group = fetchService.fetch(element, Element.Relationships.GROUP).getGroup();
    if (group.getStatus() == Group.Status.REMOVED) {
        return Collections.singletonList(group);
    }
    final GroupQuery query = new GroupQuery();
    if (group instanceof OperatorGroup) {
        query.setNatures(Group.Nature.OPERATOR);
        query.setMember(((OperatorGroup) group).getMember());
    } else {
        if (group.getNature() == Group.Nature.ADMIN) {
            query.setNatures(Group.Nature.ADMIN);
        } else {
            query.setNatures(Group.Nature.MEMBER, Group.Nature.BROKER);
        }
    }
    final List<? extends Group> groups = groupService.search(query);
    groups.remove(group);
    return groups;
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:22,代码来源:ElementServiceImpl.java

示例2: handleValidation

import nl.strohalm.cyclos.entities.groups.Group; //导入方法依赖的package包/类
@Override
protected ActionForward handleValidation(final ActionContext context) {
    try {
        validateForm(context);
        final ChangeOperatorGroupForm form = context.getForm();
        final Group newGroup = groupService.load(form.getNewGroupId());
        if (newGroup.getStatus() == Group.Status.REMOVED) {
            final Map<String, Object> fields = new HashMap<String, Object>();
            fields.put("confirmationMessage", context.message("changeGroup.confirmRemove", newGroup.getName()));
            responseHelper.writeStatus(context.getResponse(), ResponseHelper.Status.SUCCESS, fields);
        } else {
            responseHelper.writeValidationSuccess(context.getResponse());
        }
    } catch (final ValidationException e) {
        responseHelper.writeValidationErrors(context.getResponse(), e);
    }
    return null;
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:19,代码来源:ChangeOperatorGroupAction.java

示例3: handleValidation

import nl.strohalm.cyclos.entities.groups.Group; //导入方法依赖的package包/类
@Override
protected ActionForward handleValidation(final ActionContext context) {
    try {
        validateForm(context);
        final ChangeMemberGroupForm form = context.getForm();
        final Group newGroup = groupService.load(form.getNewGroupId());
        if (newGroup.getStatus() == Group.Status.REMOVED) {
            final Map<String, Object> fields = new HashMap<String, Object>();
            fields.put("confirmationMessage", context.message("changeGroup.confirmRemove", newGroup.getName()));
            responseHelper.writeStatus(context.getResponse(), ResponseHelper.Status.SUCCESS, fields);
        } else {
            responseHelper.writeValidationSuccess(context.getResponse());
        }
    } catch (final ValidationException e) {
        responseHelper.writeValidationErrors(context.getResponse(), e);
    }
    return null;
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:19,代码来源:ChangeMemberGroupAction.java

示例4: filterMemberGroups

import nl.strohalm.cyclos.entities.groups.Group; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private Collection<? extends MemberGroup> filterMemberGroups(final Predicate predicate, Collection<? extends Group> groups) {
    Predicate predicateToApply = predicate;

    if (groups == null) { // search for not removed member and broker groups
        final GroupQuery query = new GroupQuery();
        query.setStatus(Group.Status.NORMAL);
        query.setNatures(Group.Nature.MEMBER, Group.Nature.BROKER);

        groups = groupService.search(query);
    } else if (groups.isEmpty()) { // if the group list is empty then return the same (empty) list
        return (Collection<? extends MemberGroup>) groups;
    } else { // it creates a predicate to filter not removed member and broker groups
        final Predicate memberGroupPredicate = new Predicate() {
            @Override
            public boolean evaluate(final Object object) {
                final Group grp = (Group) object;
                return Group.Status.NORMAL == grp.getStatus() && (Group.Nature.MEMBER == grp.getNature() || Group.Nature.BROKER == grp.getNature());
            }
        };

        predicateToApply = predicate == null ? memberGroupPredicate : new AndPredicate(memberGroupPredicate, predicate);
    }

    CollectionUtils.filter(groups, predicateToApply);
    return (Collection<? extends MemberGroup>) groups;
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:28,代码来源:GuaranteeServiceImpl.java

示例5: getAccounts

import nl.strohalm.cyclos.entities.groups.Group; //导入方法依赖的package包/类
private List<? extends Account> getAccounts(final AccountOwner owner, final boolean forceAllAccounts, final Relationship... fetch) {
    final AccountQuery query = new AccountQuery();
    query.setOwner(owner);
    query.fetch(fetch);
    List<? extends Account> accounts = accountDao.search(query);
    if (forceAllAccounts) {
        return accounts;
    } else if (owner instanceof Member) {
        accounts = new ArrayList<Account>(accounts);
        final Member member = fetchService.fetch((Member) owner);
        for (final Iterator<? extends Account> iterator = accounts.iterator(); iterator.hasNext();) {
            final Account account = iterator.next();
            MemberGroupAccountSettings accountSettings;
            boolean remove = false;
            final Group group = member.getGroup();
            if (group.getStatus() == Group.Status.NORMAL) {
                try {
                    accountSettings = groupService.loadAccountSettings(group.getId(), account.getType().getId());
                } catch (final EntityNotFoundException e) {
                    accountSettings = null;
                    remove = true;
                }
            } else {
                // Removed group
                accountSettings = null;
            }
            // Check whether the account is hidden
            if (accountSettings != null && accountSettings.isHideWhenNoCreditLimit()) {
                // Hide the account: it should be visible only when has credit limit, and credit limit is zero or there are at least one transfer
                final boolean hasCreditLimit = Math.abs(account.getCreditLimit().floatValue()) > PRECISION_DELTA;
                if (!hasCreditLimit && !transferDao.hasTransfers(account)) {
                    remove = true;
                }
            }
            if (remove) {
                iterator.remove();
            }
        }
    }
    return accounts;
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:42,代码来源:AccountServiceImpl.java


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