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


Java Group类代码示例

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

Group类属于nl.strohalm.cyclos.entities.groups包,在下文中一共展示了Group类的40个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createTransfers

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
private void createTransfers() {
    // Add the sms trade transfer
    smsTradeTT = new TransferType();
    smsTradeTT.setName(bundle.getString("transfer-type.sms-trade.name"));
    smsTradeTT.setDescription(bundle.getString("transfer-type.sms-trade.description"));
    smsTradeTT.setFrom(memberAccType);
    smsTradeTT.setTo(memberAccType);
    smsTradeTT.getContext().setPayment(true);
    smsTradeTT.setChannels(Collections.singleton(smsChannel));
    // smsTradeTT.setMaxAmountPerDay(new BigDecimal(500));
    smsTradeTT.setAllowSmsNotification(true);
    smsTradeTT.setGroups(new HashSet<Group>(enabledMemberGroups));

    entityManager.persist(smsTradeTT);

    // Add the sms charging transfer
    smsChargeTT = new TransferType();
    smsChargeTT.setName(bundle.getString("transfer-type.sms-charge.name"));
    smsChargeTT.setDescription(bundle.getString("transfer-type.sms-charge.description"));
    smsChargeTT.setFrom(memberAccType);
    smsChargeTT.setTo(organizationAccType);

    entityManager.persist(smsChargeTT);

}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:26,代码来源:CreateSmsData.java


示例2: getAllowedValues

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
public static Collection<? extends Entity> getAllowedValues(final Group group, final Permission permission) {
    Collection<? extends Entity> current;

    final Class<?> clazz = permission.getClass();
    if (clazz == BrokerPermission.class) {
        current = getCurrentValues((BrokerGroup) group, (BrokerPermission) permission);
    } else if (clazz == MemberPermission.class) {
        current = getCurrentValues((MemberGroup) group, (MemberPermission) permission);
    } else if (clazz == OperatorPermission.class) {
        current = getCurrentValues((OperatorGroup) group, (OperatorPermission) permission);
    } else if (clazz == AdminAdminPermission.class) {
        current = getCurrentValues((AdminGroup) group, (AdminAdminPermission) permission);
    } else if (clazz == AdminMemberPermission.class) {
        current = getCurrentValues((AdminGroup) group, (AdminMemberPermission) permission);
    } else if (clazz == AdminSystemPermission.class) {
        current = getCurrentValues((AdminGroup) group, (AdminSystemPermission) permission);
    } else {
        throw new IllegalArgumentException("Unsupported permission class: " + clazz);
    }
    return current;
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:22,代码来源:PermissionHelper.java


示例3: initDataBinderForRead

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
protected DataBinder<E> initDataBinderForRead(final ActionContext context) {
    final LocalSettings settings = settingsService.getLocalSettings();
    final BeanBinder<? extends User> userBinder = BeanBinder.instance(getUserClass(), "user");
    userBinder.registerBinder("username", PropertyBinder.instance(String.class, "username"));
    userBinder.registerBinder("lastLogin", PropertyBinder.instance(Calendar.class, "lastLogin", settings.getDateConverter()));

    final BeanBinder<? extends Group> groupBinder = BeanBinder.instance(getGroupClass(), "group");
    groupBinder.registerBinder("name", PropertyBinder.instance(String.class, "name"));

    final BeanBinder<E> elementBinder = BeanBinder.instance(getElementClass());
    elementBinder.registerBinder("id", PropertyBinder.instance(Long.class, "id", IdConverter.instance()));
    elementBinder.registerBinder("name", PropertyBinder.instance(String.class, "name"));
    elementBinder.registerBinder("user", userBinder);
    elementBinder.registerBinder("email", PropertyBinder.instance(String.class, "email"));
    elementBinder.registerBinder("creationDate", PropertyBinder.instance(Calendar.class, "creationDate", settings.getDateConverter()));
    elementBinder.registerBinder("group", groupBinder);
    return elementBinder;
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:19,代码来源:ProfileAction.java


示例4: validate

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
@Override
public void validate(final Group group) {
    if (group.isTransient()) {
        getInsertValidator().validate(group);
    } else if (Group.Status.REMOVED.equals(group.getStatus())) {
        getRemovedValidator().validate(group);
    } else if (group instanceof AdminGroup) {
        getAdminValidator().validate(group);
    } else if (group instanceof BrokerGroup) {
        getBrokerValidator().validate(group);
    } else if (group instanceof MemberGroup) {
        getMemberValidator().validate(group);
    } else if (group instanceof OperatorGroup) {
        getOperatorValidator().validate(group);
    }
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:17,代码来源:GroupServiceImpl.java


示例5: handleAccounts

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
/**
 * This method creates the accounts related to the member group, and marks those not related as inactive
 */
@SuppressWarnings("unchecked")
private void handleAccounts(Member member) {
    member = fetchService.fetch(member, RelationshipHelper.nested(Element.Relationships.GROUP, MemberGroup.Relationships.ACCOUNT_SETTINGS));
    final MemberGroup group = member.getMemberGroup();
    final Collection<MemberGroupAccountSettings> accountSettings = group.getAccountSettings();
    final List<MemberAccount> accounts = (List<MemberAccount>) accountService.getAccounts(member, Account.Relationships.TYPE);
    // Mark as inactive the accounts no longer used
    for (final MemberAccount account : accounts) {
        if (!hasAccount(account, accountSettings)) {
            memberAccountHandler.deactivate(account, group.getStatus() == Group.Status.REMOVED);
        }
    }
    // Create the accounts the member does not yet has
    if (!CollectionUtils.isEmpty(accountSettings)) {
        for (final MemberGroupAccountSettings settings : accountSettings) {
            memberAccountHandler.activate(member, settings.getAccountType());
        }
    }
    // Activate members without accounts but in active groups
    if (member.getActivationDate() == null && group.isActive()) {
        member.setActivationDate(Calendar.getInstance());
    }
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:27,代码来源:ElementServiceImpl.java


示例6: search

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
public List<CustomizedFile> search(final CustomizedFileQuery query) {
    final StringBuilder hql = JpaQueryHelper.getInitialQuery(getEntityType(), "f", query.getFetch());
    final Map<String, Object> namedParameters = new HashMap<String, Object>();
    if (!query.isAll()) {
        JpaQueryHelper.addParameterToQuery(hql, namedParameters, "f.type", query.getType());
        final Group group = query.getGroup();
        if (group == null) {
            hql.append(" and f.group is null");
        } else {
            JpaQueryHelper.addParameterToQuery(hql, namedParameters, "f.group", group);
        }
        final GroupFilter groupFilter = query.getGroupFilter();
        if (groupFilter == null) {
            hql.append(" and f.groupFilter is null");
        } else {
            JpaQueryHelper.addParameterToQuery(hql, namedParameters, "f.groupFilter", groupFilter);
        }
    }
    JpaQueryHelper.appendOrder(hql, "f.type", "f.name");
    return list(query, hql.toString(), namedParameters);
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:22,代码来源:CustomizedFileDAOImpl.java


示例7: elementQueryDataBinder

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
public static <Q extends FullTextElementQuery> DataBinder<Q> elementQueryDataBinder(final LocalSettings settings, final Class<Q> queryClass, final Class<? extends CustomFieldValue> customFieldValueClass) {
    final BeanBinder<? extends CustomFieldValue> customValueBinder = BeanBinder.instance(customFieldValueClass);
    customValueBinder.registerBinder("field", PropertyBinder.instance(MemberCustomField.class, "field", ReferenceConverter.instance(MemberCustomField.class)));
    customValueBinder.registerBinder("value", PropertyBinder.instance(String.class, "value"));

    final BeanBinder<Q> binder = BeanBinder.instance(queryClass);
    if (FullTextMemberQuery.class.isAssignableFrom(queryClass)) {
        binder.registerBinder("activationPeriod", DataBinderHelper.periodBinder(settings, "activationPeriod"));
        binder.registerBinder("groupFilters", SimpleCollectionBinder.instance(GroupFilter.class, "groupFilters"));
        binder.registerBinder("broker", PropertyBinder.instance(Member.class, "broker"));
    }
    binder.registerBinder("customValues", BeanCollectionBinder.instance(customValueBinder, "customValues"));
    binder.registerBinder("groups", SimpleCollectionBinder.instance(Group.class, "groups"));
    binder.registerBinder("keywords", PropertyBinder.instance(String.class, "keywords"));
    binder.registerBinder("pageParameters", DataBinderHelper.pageBinder());

    return binder;
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:19,代码来源:SearchElementsAction.java


示例8: granted

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
/**
 * Return whether this access matches the specified group, given that the member is the broker
 */
public boolean granted(final Group group, final boolean byOwner, final boolean byBroker, final boolean atRegistration, final boolean byWebService) {
    if (byWebService) {
        return this != NONE;
    }
    boolean isGranted = granted(group);
    if (isGranted && group instanceof MemberGroup) {
        switch (this) {
            case MEMBER:
                isGranted = byOwner || byBroker;
                break;
            case MEMBER_NOT_REGISTRATION:
                isGranted = !atRegistration && (byOwner || byBroker);
                break;
            case REGISTRATION:
                isGranted = atRegistration || byBroker;
                break;
            case BROKER:
                isGranted = byBroker;
                break;
        }
    }
    return isGranted;
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:27,代码来源:MemberCustomField.java


示例9: grant

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
@Override
public Loan grant(final GrantLoanDTO params) throws CreditsException {
    if (params.isAutomatic()) {
        // This is a manually granted loan
        throw new PermissionDeniedException();
    }
    permissionService.permission(params.getMember()).admin(AdminMemberPermission.LOANS_GRANT).check();
    Calendar date = params.getDate();
    // Check for a specific permission for admins to set a date
    if (date != null) {
        // Currently, there's no specific permission for discard with date. We use repay with date
        permissionService.permission().admin(AdminMemberPermission.LOANS_GRANT_WITH_DATE).check();
    }
    TransferType transferType = params.getTransferType();
    // Null transfer type will fail validation, so, we don't need to check for it here
    if (transferType != null) {
        // Check the permission to the loan transfer type
        AdminGroup group = LoggedUser.group();
        Collection<TransferType> transferTypes = fetchService.fetch(group, Group.Relationships.TRANSFER_TYPES).getTransferTypes();
        if (!transferTypes.contains(transferType)) {
            throw new PermissionDeniedException();
        }
    }
    return loanService.grant(params);
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:26,代码来源:LoanServiceSecurity.java


示例10: checkRequiredValues

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
/**
 * Checks if every required entity is an allowed one. If permission is a MemberPermission then it ensure the required entities for the memberGroup
 */
private boolean checkRequiredValues(Group group, final MemberGroup memberGroup, final Permission permission, final Map<Permission, AbstractPermissionCheck.RequiredValuesBean> requiredValues) {
    if (requiredValues == null) {
        return true;
    } else {
        AbstractPermissionCheck.RequiredValuesBean required = requiredValues.get(permission);
        if (required == null) {
            return true;
        } else {
            if (group.getNature() == Group.Nature.OPERATOR && required.getPermission().getModule().getType() == ModuleType.MEMBER) {
                group = memberGroup;
            }
            return checkRequiredValues(group, required.getPermission(), required.getEntities());
        }
    }
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:19,代码来源:PermissionServiceImpl.java


示例11: getDataBinder

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
public DataBinder<CardQuery> getDataBinder() {
    try {
        lock.readLock().lock();
        if (dataBinder == null) {
            final LocalSettings localSettings = settingsService.getLocalSettings();
            final BeanBinder<CardQuery> binder = BeanBinder.instance(CardQuery.class);
            binder.registerBinder("groups", SimpleCollectionBinder.instance(Group.class, "groups"));
            binder.registerBinder("status", SimpleCollectionBinder.instance(Card.Status.class, "status"));
            binder.registerBinder("expiration", DataBinderHelper.rawPeriodBinder(localSettings, "expiration"));
            binder.registerBinder("member", PropertyBinder.instance(Member.class, "member"));
            binder.registerBinder("number", PropertyBinder.instance(BigInteger.class, "number"));
            binder.registerBinder("cardType", PropertyBinder.instance(CardType.class, "cardType"));
            binder.registerBinder("pageParameters", DataBinderHelper.pageBinder());

            dataBinder = binder;
        }
        return dataBinder;
    } finally {
        lock.readLock().unlock();
    }
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:22,代码来源:SearchCardsAction.java


示例12: createGroupRemark

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
/**
 * Create a remark for a group change
 */
private void createGroupRemark(final Element member, final Group oldGroup, final Group newGroup, final String comments) {
    final Calendar now = Calendar.getInstance();
    final GroupRemark remark = new GroupRemark();
    if (LoggedUser.hasUser()) {
        remark.setWriter(LoggedUser.element());
    }
    remark.setSubject(member);
    remark.setDate(now);
    remark.setOldGroup(oldGroup);
    remark.setNewGroup(newGroup);
    remark.setComments(comments);
    remarkService.save(remark);

    updateGroupHistoryLogs(member, newGroup, now);
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:19,代码来源:ElementServiceImpl.java


示例13: prepareForm

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
@Override
protected void prepareForm(final ActionContext context) throws Exception {
    super.prepareForm(context);
    final HttpServletRequest request = context.getRequest();
    final MemberRecordType type = (MemberRecordType) request.getAttribute("type");
    final Element element = (Element) request.getAttribute("element");
    final MemberRecordQuery query = new MemberRecordQuery();
    query.setType(type);
    query.setElement(element);
    final List<MemberRecord> memberRecords = getMemberRecordService().search(query);
    request.setAttribute("memberRecords", memberRecords);
    request.setAttribute("removed", element.getGroup().getStatus() == Group.Status.REMOVED);
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:14,代码来源:FlatMemberRecordsAction.java


示例14: createGroup

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
private <G extends Group> G createGroup(final Class<G> groupClass, final Group.Status status, final String keyPart, final ModuleType... moduleTypes) {
    G group = null;
    try {
        group = groupClass.newInstance();
    } catch (final Exception e) {
        e.printStackTrace();
        System.exit(1);
    }
    group.setStatus(status);
    group.setName(bundle.getString("group." + keyPart + ".name"));
    group.setDescription(bundle.getString("group." + keyPart + ".description"));
    group.getBasicSettings().setPasswordPolicy(PasswordPolicy.NONE);

    entityManager.persist(group);
    if (moduleTypes != null && moduleTypes.length > 0) {
        if (group.getPermissions() == null) {
            group.setPermissions(new HashSet<Permission>());
        }
        for (final ModuleType moduleType : moduleTypes) {
            for (Module module : moduleType.getModules()) {
                group.getPermissions().addAll(module.getPermissions());
            }
        }

        entityManager.flush();
    }
    return group;
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:29,代码来源:CreateBasicData.java


示例15: getSinglePeriodNumberOfMembers

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
public StatisticalResultDTO getSinglePeriodNumberOfMembers(final StatisticalKeyDevelopmentsQuery queryParameters) {
    final Period periodMain = queryParameters.getPeriodMain();
    final Collection<Group> groups = queryParameters.getGroups();

    // Number of members
    final int periodMainMembersCount = getElementDao().getNumberOfMembersInGroupsInPeriod(groups, periodMain);

    // Number of new members
    final int periodMainNewMembersCount = getNewMembersCount(periodMain, groups);

    // Number of disappeared members
    final int periodMainDisappearedMembersCount = getDisappearedMembersCount(periodMain, groups);

    // Data structure to build the table
    final Number[][] tableCells = new Number[3][1];

    // First row
    tableCells[0][0] = new StatisticalNumber(periodMainMembersCount);

    // Second row
    tableCells[1][0] = new StatisticalNumber(periodMainNewMembersCount);

    // Third row
    tableCells[2][0] = new StatisticalNumber(periodMainDisappearedMembersCount);

    final StatisticalResultDTO result = new StatisticalResultDTO(tableCells);
    result.setBaseKey("reports.stats.keydevelopments.numberOfMembers");
    final String[] rowKeys = { "reports.stats.keydevelopments.numberOfMembers.numberOfMembers", "reports.stats.keydevelopments.numberOfMembers.numberOfNewMembers", "reports.stats.keydevelopments.numberOfMembers.numberOfDisappearedMembers" };
    try {
        result.setRowKeys(rowKeys);
        applySinglePeriodColumnHeadersAndKeys(result, queryParameters);
        passGroupFilter(result, queryParameters);
    } catch (final Exception e) {
        System.out.println("Error in NumberOfMembers!");
        e.printStackTrace();
    }

    return result;
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:40,代码来源:StatisticalKeyDevelopmentsServiceImpl.java


示例16: removedFromBrokerGroupNotification

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
@Override
public void removedFromBrokerGroupNotification(final Member member) {
    Group group = member.getGroup();

    // Get message settings
    final MessageSettings messageSettings = settingsService.getMessageSettings();
    final String subject = messageSettings.getRemovedFromBrokerGroupSubject();
    final String body = messageSettings.getRemovedFromBrokerGroupMessage();
    final String sms = messageSettings.getRemovedFromBrokerGroupSms();

    // Process message content
    final LocalSettings localSettings = settingsService.getLocalSettings();
    final String processedSubject = MessageProcessingHelper.processVariables(subject, group, localSettings);
    final String processedBody = MessageProcessingHelper.processVariables(body, group, localSettings);
    final String processedSms = MessageProcessingHelper.processVariables(sms, group, localSettings);

    // Create the DTO
    final SendMessageFromSystemDTO message = new SendMessageFromSystemDTO();
    message.setType(Message.Type.BROKERING);
    message.setToMember(member);
    message.setSubject(processedSubject);
    message.setBody(processedBody);
    message.setSms(processedSms);

    // Send the message
    messageService.sendFromSystem(message);
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:28,代码来源:MemberNotificationHandlerImpl.java


示例17: hasGroupsWhichRequiresSpecialOnPassword

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
@Override
public boolean hasGroupsWhichRequiresSpecialOnPassword() {
    final GroupQuery query = new GroupQuery();
    query.setStatus(Group.Status.NORMAL);
    for (final Group group : search(query)) {
        if (group.getBasicSettings().getPasswordPolicy() == PasswordPolicy.AVOID_OBVIOUS_LETTERS_NUMBERS_SPECIAL) {
            return true;
        }
    }
    return false;
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:12,代码来源:GroupServiceImpl.java


示例18: getMultivaluedPermissions

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
/**
 * @param groupNature the group's nature
 * @return a collection of permissions having a relationship to its possible values according to the specified group's nature
 */
public static Collection<Permission> getMultivaluedPermissions(final Group.Nature groupNature) {
    final Collection<Permission> list = new ArrayList<Permission>();

    for (final ModuleType moduleType : ModuleType.getModuleTypes(groupNature)) {
        for (final Module module : moduleType.getModules()) {
            for (final Permission permission : module.getPermissions()) {
                addListPermission(list, permission);
            }
        }
    }

    return Collections.unmodifiableCollection(list);
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:18,代码来源:PermissionHelper.java


示例19: setLoginCookies

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
/**
 * Sets the cookies for the guest pages, based on the given group / group filter
 */
public void setLoginCookies(final HttpServletRequest request, final HttpServletResponse response, final Entity entity) {
    Long groupId = null;
    Long groupFilterId = null;
    if (entity instanceof Group) {
        groupId = entity.getId();
    } else if (entity instanceof GroupFilter) {
        groupFilterId = entity.getId();
    }
    addRootCookie(request, response, "groupId", groupId);
    addRootCookie(request, response, "groupFilterId", groupFilterId);
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:15,代码来源:ResponseHelper.java


示例20: loadGroup

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
private Group loadGroup(final Long id) {
    return LoggedUser.runAsSystem(new Callable<Group>() {
        @Override
        public Group call() throws Exception {
            return groupService.load(id, Group.Relationships.GROUP_FILTERS);
        }
    });
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:9,代码来源:LinkGeneratorImpl.java


示例21: load

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
void load(final Group group) {
    this.group = fetchService.fetch(group, FETCH);
    possibleValuesMap = new HashMap<Permission, Set<EntityVO>>();

    CommonDataBean commonData = null;
    if (group.getNature() != Group.Nature.OPERATOR) { // for operator it's not necessary to load the acc types
        commonData = new CommonDataBean(getSystemAccountTypes(), getMemberAccountTypes());
    }

    Map<SharedValue, Set<EntityVO>> loaded = new HashMap<SharedValue, Set<EntityVO>>();
    for (Permission permission : PermissionHelper.getMultivaluedPermissions(group.getNature())) {
        SharedValue shared = permissionSharedValueMap.get(permission);
        Set<EntityVO> values = loaded.get(shared);
        if (values == null) {
            Collection<? extends Entity> possibleValues;
            Class<?> clazz = permission.getClass();
            if (clazz == BrokerPermission.class) {
                possibleValues = load(commonData, (BrokerPermission) permission);
            } else if (clazz == MemberPermission.class) {
                possibleValues = load(commonData, (MemberPermission) permission);
            } else if (clazz == OperatorPermission.class) {
                possibleValues = load((OperatorPermission) permission);
            } else if (clazz == AdminAdminPermission.class) {
                possibleValues = load(commonData, (AdminAdminPermission) permission);
            } else if (clazz == AdminMemberPermission.class) {
                possibleValues = load(commonData, (AdminMemberPermission) permission);
            } else if (clazz == AdminSystemPermission.class) {
                possibleValues = load(commonData, (AdminSystemPermission) permission);
            } else {
                throw new IllegalArgumentException("Unknown permission class: " + clazz);
            }
            values = EntityHelper.toEntityVO(possibleValues);
            if (shared != null) { // only add to loaded if it's a sharing values permission
                loaded.put(shared, values);
            }
        }
        possibleValuesMap.put(permission, values);
    }
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:40,代码来源:PermissionCatalogHandlerImpl.java


示例22: customizedPathFor

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
/**
 * Returns the root path for the customized file type
 */
public String customizedPathFor(final CustomizedFile.Type type, final Group group, final boolean forceSameGroup) {
    // Style sheets use the same path as the original file
    if (group != null && type != CustomizedFile.Type.STYLE) {
        final String pathPart = pathPart(group, forceSameGroup);
        return customizedPathFor(type) + pathPart + "/";
    }
    return customizedPathFor(type);
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:12,代码来源:CustomizationHelper.java


示例23: getGroupQueryDataBinder

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
public DataBinder<GroupQuery> getGroupQueryDataBinder() {
    if (groupQueryDataBinder == null) {
        final BeanBinder<GroupQuery> binder = BeanBinder.instance(GroupQuery.class);
        binder.registerBinder("memberAccountType", PropertyBinder.instance(MemberAccountType.class, "accountTypeId"));
        binder.registerBinder("paymentFilter", PropertyBinder.instance(PaymentFilter.class, "paymentFilterId"));
        binder.registerBinder("groupFilters", SimpleCollectionBinder.instance(GroupFilter.class, "groupFilterIds"));
        binder.registerBinder("naturesCollection", SimpleCollectionBinder.instance(Group.Nature.class, "natures"));
        binder.registerBinder("statusCollection", SimpleCollectionBinder.instance(Group.Status.class, "status"));
        groupQueryDataBinder = binder;
    }
    return groupQueryDataBinder;
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:13,代码来源:SearchGroupsAjaxAction.java


示例24: applyQueryRestrictions

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
private boolean applyQueryRestrictions(final ReferenceQuery query) {

        if (!CollectionUtils.isEmpty(query.getGroups())) {
            query.setGroups(PermissionHelper.checkSelection(permissionService.getAllVisibleGroups(), query.getGroups()));
            if (query.getGroups().isEmpty()) {
                return false;
            }
        } else {
            Collection<Group> groups = new ArrayList<Group>();
            groups.addAll(permissionService.getAllVisibleGroups());
            query.setGroups(groups);
        }
        return hasViewPermission(query.getNature());
    }
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:15,代码来源:ReferenceServiceSecurity.java


示例25: prepareForm

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
@Override
protected QueryParameters prepareForm(final ActionContext context) {
    final HttpServletRequest request = context.getRequest();
    final Member loggedMember = context.getElement();

    final GroupQuery possibleGroupQuery = new GroupQuery();
    possibleGroupQuery.setNatures(Group.Nature.OPERATOR);
    possibleGroupQuery.setStatus(Group.Status.NORMAL);
    possibleGroupQuery.setMember(loggedMember);
    final List<? extends Group> possibleNewGroups = groupService.search(possibleGroupQuery);
    if (possibleNewGroups.isEmpty()) {
        throw new ValidationException(new ValidationError("operator.noGroup"));
    }

    final FullTextOperatorQuery query = (FullTextOperatorQuery) super.prepareForm(context);
    query.setMember(loggedMember);
    query.setEnabled(null);

    // Store the groups
    final GroupQuery groupQuery = new GroupQuery();
    groupQuery.setNatures(Group.Nature.OPERATOR);
    groupQuery.setMember(loggedMember);
    request.setAttribute("groups", groupService.search(groupQuery));

    // Store the possible groups for new operator
    request.setAttribute("possibleNewGroups", possibleNewGroups);

    return query;
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:30,代码来源:SearchOperatorsAction.java


示例26: pathPart

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
/**
 * Returns the additional path part for the given customized group
 */
private String pathPart(final Group group, final boolean forceSameGroup) {
    if (group == null) {
        return null;
    }
    Long groupId;
    if (!forceSameGroup && (group instanceof OperatorGroup)) {
        final OperatorGroup og = (OperatorGroup) loadGroup(group.getId(), RelationshipHelper.nested(OperatorGroup.Relationships.MEMBER, Element.Relationships.GROUP));
        groupId = og.getMember().getGroup().getId();
    } else {
        groupId = group.getId();
    }
    return "group_" + groupId.toString();
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:17,代码来源:CustomizationHelper.java


示例27: updateGroupHistoryLogs

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
/**
 * Updates end date of last group history log and create new group history log
 */
private void updateGroupHistoryLogs(final Element element, final Group newGroup, final Calendar date) {
    // Update end date of last group history log
    final GroupHistoryLog lastGhl = groupHistoryLogDao.getLastGroupHistoryLog(element);
    if (lastGhl != null) {
        lastGhl.getPeriod().setEnd(date);
        groupHistoryLogDao.update(lastGhl);
    }

    // Create new group history log
    createGroupHistoryLog(element, newGroup, date);
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:15,代码来源:ElementServiceImpl.java


示例28: prepareForm

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
@Override
protected void prepareForm(final ActionContext context) throws Exception {
    final HttpServletRequest request = context.getRequest();

    // Get the possible groups
    final GroupQuery groupQuery = new GroupQuery();
    groupQuery.setNatures(Group.Nature.MEMBER, Group.Nature.BROKER);
    groupQuery.setManagedBy(context.<AdminGroup> getGroup());
    groupQuery.setStatus(Group.Status.NORMAL);
    final List<? extends Group> groups = groupService.search(groupQuery);
    request.setAttribute("groups", groups);
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:13,代码来源:ImportMembersAction.java


示例29: onlyForAdsSearch

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
/**
 * Filters the ad custom field list, returning only those for ad search
 */
public List<AdCustomField> onlyForAdsSearch(final List<AdCustomField> fields) {
    final Group.Nature nature = LoggedUser.hasUser() ? LoggedUser.group().getNature() : Group.Nature.MEMBER;
    final List<AdCustomField> adFields = new ArrayList<AdCustomField>();
    for (final AdCustomField field : fields) {
        final AdCustomField.Visibility visibility = field.getVisibility();
        if (visibility.granted(nature) || LoggedUser.isWebService() && visibility == AdCustomField.Visibility.WEB_SERVICE) {
            adFields.add(field);
        }
    }
    return adFields;
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:15,代码来源:CustomFieldHelper.java


示例30: hasPermissionOrIsEmpty

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
/**
 * Like {@link #hasPermission(Permission...)}, but returns true if permissions is not null and empty. It stills returns false if permissions is
 * null, as the semantics is that there is no possible permissions, while if empty is like no permission check is needed
 */
private boolean hasPermissionOrIsEmpty(final Group group, final List<Permission> permissions, final Map<Permission, AbstractPermissionCheck.RequiredValuesBean> requiredValues) {
    if (permissions == null) {
        return false;
    } else if (permissions.isEmpty()) {
        debug("Passing with empty permissions on group id=" + group.getId() + " (" + group.getName() + ")");
        return true;
    } else {
        boolean result = hasPermission(group, permissions, requiredValues);
        debug(group, permissions, result);
        return result;
    }
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:17,代码来源:PermissionServiceImpl.java


示例31: executeAction

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
@Override
protected ActionForward executeAction(final ActionContext context) throws Exception {

    final HttpServletRequest request = context.getRequest();

    // Check whether should allow the transaction password generation
    if (context.isTransactionPasswordEnabled()) {
        final User user = context.getUser();
        Group loggedGroup = context.getGroup();
        if (loggedGroup instanceof OperatorGroup) {
            loggedGroup = groupService.load(loggedGroup.getId(), RelationshipHelper.nested(OperatorGroup.Relationships.MEMBER, Element.Relationships.GROUP));
        }
        final TransactionPassword transactionPassword = loggedGroup.getBasicSettings().getTransactionPassword();
        final TransactionPasswordStatus transactionPasswordStatus = user.getTransactionPasswordStatus();
        request.setAttribute("generateTransactionPassword", transactionPasswordStatus.isGenerationAllowed() && !(transactionPassword == TransactionPassword.MANUAL && transactionPasswordStatus == TransactionPasswordStatus.NEVER_CREATED));
    }

    if (context.isAdmin()) {
        request.setAttribute("applicationStatus", applicationService.getApplicationStatus());
    } else {
        // Member / operator data
        request.setAttribute("status", memberService.getStatus());
        request.setAttribute("quickAccess", memberService.getQuickAccess());
    }

    return context.getInputForward();
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:28,代码来源:HomeAction.java


示例32: getNewMembersCount

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
private int getNewMembersCount(final Period period, final Collection<Group> groups) {
    final MemberQuery memberQuery = new MemberQuery();
    memberQuery.setCreationPeriod(period);
    memberQuery.setGroups(groups);
    memberQuery.setPageForCount();
    return PageHelper.getTotalCount(getElementDao().searchHistoryNew(memberQuery));
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:8,代码来源:StatisticalKeyDevelopmentsServiceImpl.java


示例33: load

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
@Override
public <T extends User> T load(final String username, final Relationship... fetch) throws EntityNotFoundException, DaoException {
    final Map<String, Object> namedParameters = new HashMap<String, Object>();
    namedParameters.put("username", username);
    namedParameters.put("admin", Element.Nature.ADMIN.getElementClass());
    namedParameters.put("member", Element.Nature.MEMBER.getElementClass());
    namedParameters.put("removed", Group.Status.REMOVED);
    final T user = this.<T> uniqueResult("select u from User u left join fetch u.element e where u.username = :username and TYPE(e) in (:admin, :member) and e.group.status <> :removed", namedParameters);
    if (user == null) {
        throw new EntityNotFoundException(getEntityType());
    }
    return getFetchDao().fetch(user, fetch);
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:14,代码来源:UserDAOImpl.java


示例34: getDataBinder

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
public DataBinder<? extends Group> getDataBinder(final Group.Nature nature) {
    if (dataBinders == null) {
        dataBinders = new EnumMap<Group.Nature, DataBinder<? extends Group>>(Group.Nature.class);

        final BeanBinder<BasicGroupSettings> basicSettingsBinder = BeanBinder.instance(BasicGroupSettings.class, "basicSettings");
        final BeanBinder<MemberGroupSettings> memberSettingsBinder = BeanBinder.instance(MemberGroupSettings.class, "memberSettings");

        final BeanBinder<AdminGroup> adminGroupBinder = BeanBinder.instance(AdminGroup.class);
        initBasic(adminGroupBinder, basicSettingsBinder);
        initSystem(adminGroupBinder);
        dataBinders.put(Group.Nature.ADMIN, adminGroupBinder);

        final BeanBinder<MemberGroup> memberGroupBinder = BeanBinder.instance(MemberGroup.class);
        initBasic(memberGroupBinder, basicSettingsBinder);
        initSystem(memberGroupBinder);
        initMember(memberGroupBinder, memberSettingsBinder);
        dataBinders.put(Group.Nature.MEMBER, memberGroupBinder);

        final BeanBinder<OperatorGroup> operatorGroupBinder = BeanBinder.instance(OperatorGroup.class);
        initBasic(operatorGroupBinder, basicSettingsBinder);
        initOperator(operatorGroupBinder);
        dataBinders.put(Group.Nature.OPERATOR, operatorGroupBinder);

        final BeanBinder<BrokerGroup> brokerGroupBinder = BeanBinder.instance(BrokerGroup.class);
        initBasic(brokerGroupBinder, basicSettingsBinder);
        initSystem(brokerGroupBinder);
        initMember(brokerGroupBinder, memberSettingsBinder);
        initBroker(brokerGroupBinder);
        dataBinders.put(Group.Nature.BROKER, brokerGroupBinder);
    }
    return dataBinders.get(nature);
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:33,代码来源:EditGroupAction.java


示例35: getNumberOfCreatedAds

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
@Override
public Integer getNumberOfCreatedAds(final Period period, final Collection<? extends Group> groups) {
    final Map<String, Object> namedParameters = new HashMap<String, Object>();
    final StringBuilder hql = new StringBuilder("select count(ad.id) from Ad ad where 1=1");
    JpaQueryHelper.addPeriodParameterToQuery(hql, namedParameters, "ad.creationDate", period);
    if (!CollectionUtils.isEmpty(groups)) {
        hql.append(" and ad.owner.group in :groups ");
        namedParameters.put("groups", groups);
    }
    return uniqueResult(hql.toString(), namedParameters);
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:12,代码来源:AdDAOImpl.java


示例36: executeQuery

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
@Override
protected void executeQuery(final ActionContext context, final QueryParameters queryParameters) {
    final HttpServletRequest request = context.getRequest();
    final GroupQuery groupQuery = (GroupQuery) queryParameters;
    final List<? extends Group> groups = groupService.search(groupQuery);
    request.setAttribute("groups", groups);
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:8,代码来源:ListGroupsAction.java


示例37: countByType

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
@Override
public Map<MemberRecordType, Integer> countByType(final Element element) {
    // Find the types related to the given element and that the logged user has access
    final MemberRecordTypeQuery typeQuery = new MemberRecordTypeQuery();
    Collection<Group> groups = new ArrayList<Group>();
    groups.add(element.getGroup());
    typeQuery.setGroups(groups);
    if (LoggedUser.hasUser()) {
        final Group loggedGroup = LoggedUser.group();
        if (loggedGroup instanceof AdminGroup) {
            typeQuery.setViewableByAdminGroup((AdminGroup) loggedGroup);
        } else if (loggedGroup instanceof BrokerGroup) {
            typeQuery.setViewableByBrokerGroup((BrokerGroup) loggedGroup);
        } else {
            throw new PermissionDeniedException();
        }
    }
    // For each type, count the records for the given element
    final List<MemberRecordType> types = memberRecordTypeService.search(typeQuery);
    final Map<MemberRecordType, Integer> map = new LinkedHashMap<MemberRecordType, Integer>();
    for (final MemberRecordType type : types) {
        final MemberRecordQuery query = new MemberRecordQuery();
        query.setElement(element);
        query.setType(type);
        query.setPageForCount();
        final int count = PageHelper.getTotalCount(search(query));
        map.put(type, count);
    }
    return map;
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:31,代码来源:MemberRecordServiceImpl.java


示例38: fullTextSearch

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public List<? extends Element> fullTextSearch(final FullTextElementQuery query) {
    // Since the full text does not index group filters, only groups, disassemble the group filters into groups
    if (query instanceof FullTextMemberQuery) {
        final FullTextMemberQuery memberQuery = (FullTextMemberQuery) query;
        // groupFilters
        final Collection<GroupFilter> groupFilters = fetchService.fetch(memberQuery.getGroupFilters(), GroupFilter.Relationships.GROUPS);
        if (CollectionUtils.isNotEmpty(groupFilters)) {
            final boolean hasGroupFilters = CollectionUtils.isNotEmpty(memberQuery.getGroupFilters());
            final boolean hasGroups = CollectionUtils.isNotEmpty(memberQuery.getGroups());
            final Set<Group> groupsFromFilters = new HashSet<Group>();
            if (hasGroupFilters) {
                // Get all groups from selected group filters
                for (final GroupFilter groupFilter : groupFilters) {
                    groupsFromFilters.addAll(groupFilter.getGroups());
                }
                if (hasGroups) {
                    // When there's both groups and group filters, use an intersection between them
                    memberQuery.setGroups(CollectionUtils.intersection(groupsFromFilters, memberQuery.getGroups()));
                } else {
                    // Else, use only the groups from group filters
                    memberQuery.setGroups(groupsFromFilters);
                }
            }
            memberQuery.setGroupFilters(null);
        }
    }
    if (query.getNameDisplay() == null) {
        query.setNameDisplay(settingsService.getLocalSettings().getMemberResultDisplay());
    }
    query.setAnalyzer(settingsService.getLocalSettings().getLanguage().getAnalyzer());
    return elementDao.fullTextSearch(query);
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:35,代码来源:ElementServiceImpl.java


示例39: remove

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
@Override
public void remove(final Long id) throws EntityNotFoundException {
    final Group group = load(id, FETCH_TO_REMOVE);
    if (!(group instanceof OperatorGroup)) {
        removeFromInverseCollections(group);
    }
    // Ensure the permissions cache for this group is evicted
    permissionService.evictCache(group);
    groupDao.delete(id);
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:11,代码来源:GroupServiceImpl.java


示例40: search

import nl.strohalm.cyclos.entities.groups.Group; //导入依赖的package包/类
public List<Brokering> search(final BrokeringQuery query) {
    final Map<String, Object> namedParameters = new HashMap<String, Object>();
    final Set<Relationship> fetch = query.getFetch();
    final StringBuilder hql = JpaQueryHelper.getInitialQuery(getEntityType(), "b", fetch);
    JpaQueryHelper.addParameterToQuery(hql, namedParameters, "b.broker", query.getBroker());
    JpaQueryHelper.addParameterToQuery(hql, namedParameters, "b.brokered", query.getBrokered());
    JpaQueryHelper.addLikeParameterToQuery(hql, namedParameters, "b.brokered.name", query.getName());
    JpaQueryHelper.addLikeParameterToQuery(hql, namedParameters, "b.brokered.user.username", query.getUsername());
    JpaQueryHelper.addParameterToQueryOperator(hql, namedParameters, "b.startDate", "<", DateHelper.truncate(query.getStartExpirationDate()));
    if (CollectionUtils.isNotEmpty(query.getGroups())) {
        hql.append(" and b.brokered.group in :groups ");
        namedParameters.put("groups", query.getGroups());
    }
    if (query.getStatus() != null) {
        hql.append(" and b.endDate is null ");
        if (query.getStatus() == BrokeringQuery.Status.ACTIVE) {
            hql.append(" and b.brokered.activationDate is not null and b.brokered.group.status = :normalGroup");
            namedParameters.put("normalGroup", Group.Status.NORMAL);
        } else if (query.getStatus() == BrokeringQuery.Status.COMMISSION_COMPLETE) {
            hql.append(" and not exists (select bcs.id from BrokeringCommissionStatus bcs where bcs.brokering = b and bcs.period.end is null) ");
            hql.append(" and not exists (select bcc.id from BrokerCommissionContract bcc where bcc.brokering = b and (bcc.status = :activeContract or bcc.status = :pendingContract)) ");
            namedParameters.put("activeContract", BrokerCommissionContract.Status.ACTIVE);
            namedParameters.put("pendingContract", BrokerCommissionContract.Status.PENDING);
        } else if (query.getStatus() == BrokeringQuery.Status.PENDING) {
            hql.append(" and b.brokered.activationDate is null ");
        }
    }
    if (!query.isReturnFinished()) {
        hql.append(" and b.endDate is null");
    }
    JpaQueryHelper.appendOrder(hql, "b.brokered.user.username");
    return list(query, hql.toString(), namedParameters);
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:34,代码来源:BrokeringDAOImpl.java



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