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


Java Group.getCustomizedFiles方法代码示例

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


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

示例1: handleSubmit

import nl.strohalm.cyclos.entities.groups.Group; //导入方法依赖的package包/类
@Override
protected ActionForward handleSubmit(final ActionContext context) throws Exception {
    final EditGroupForm form = context.getForm();
    Group group = readGroup(context);
    final Group baseGroup = readBaseGroup(context);
    final boolean isInsert = group.getId() == null;

    // Persist the group
    if (isInsert) {
        group = groupService.insert(group, baseGroup);
    } else {
        group = groupService.update(group, form.isForceAccept());
    }

    // Ensure the customized files collection is reloaded (for example, a group could be copied from other, and we need the collection to be
    // up-to-date)
    group = groupService.reload(group.getId(), Group.Relationships.CUSTOMIZED_FILES);

    // Physically update the files
    for (final CustomizedFile file : group.getCustomizedFiles()) {
        final File physicalFile = customizationHelper.customizedFileOf(file);
        customizationHelper.updateFile(physicalFile, file);
    }

    context.sendMessage(isInsert ? "group.inserted" : "group.modified");
    return ActionHelper.redirectWithParam(context.getRequest(), context.getSuccessForward(), "groupId", group.getId());
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:28,代码来源:EditGroupAction.java

示例2: executeAction

import nl.strohalm.cyclos.entities.groups.Group; //导入方法依赖的package包/类
@Override
protected ActionForward executeAction(final ActionContext context) throws Exception {
    final RemoveGroupForm form = context.getForm();
    final long id = form.getGroupId();
    if (id <= 0) {
        throw new ValidationException();
    }
    final Collection<File> toRemove = new ArrayList<File>();
    try {
        final Group group = groupService.load(id, Group.Relationships.CUSTOMIZED_FILES);
        final Collection<CustomizedFile> customizedFiles = group.getCustomizedFiles();
        // Before removing the group, get the customized files
        for (final CustomizedFile customizedFile : customizedFiles) {
            final File physicalFile = customizationHelper.customizedFileOf(customizedFile);
            toRemove.add(physicalFile);
        }
        groupService.remove(id);
        // Physically remove the customized files
        for (final File file : toRemove) {
            customizationHelper.deleteFile(file);
        }
        context.sendMessage("group.removed");
    } catch (final Exception e) {
        context.sendMessage("group.error.removing");
    }
    return context.getSuccessForward();
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:28,代码来源:RemoveGroupAction.java


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