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


Java FenixFramework.atomic方法代码示例

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


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

示例1: delete

import pt.ist.fenixframework.FenixFramework; //导入方法依赖的package包/类
@RequestMapping(value = "{slugSite}/{slugPost}/delete", method = RequestMethod.POST)
public RedirectView delete(@PathVariable String slugSite, @PathVariable String slugPost) {

    FenixFramework.atomic(() -> {
        Site s = Site.fromSlug(slugSite);
        Post post = s.postForSlug(slugPost);
        ensureCanEditPost(post);
        ensureCanDoThis(s, Permission.DELETE_POSTS);
        if(post.isVisible()) {
            ensureCanDoThis(s, Permission.DELETE_POSTS_PUBLISHED);
        }
        if(!Authenticate.getUser().equals(post.getCreatedBy())) {
            ensureCanDoThis(s, Permission.DELETE_OTHERS_POSTS);
        }
        SiteActivity.deletedPost(post, Site.fromSlug(slugSite), Authenticate.getUser());
        post.archive();
    });
    return new RedirectView("/cms/posts/" + slugSite + "", true);
}
 
开发者ID:FenixEdu,项目名称:fenixedu-cms,代码行数:20,代码来源:AdminPosts.java

示例2: editPostFile

import pt.ist.fenixframework.FenixFramework; //导入方法依赖的package包/类
@RequestMapping(value = "{siteSlug}/{postFileId}/edit", method = RequestMethod.POST)
public RedirectView editPostFile(@PathVariable String siteSlug, @PathVariable String postFileId,
                                 @RequestParam String filename, @RequestParam String displayName,
                                 @RequestParam(required = false) String accessGroup) {
    Site site = Site.fromSlug(siteSlug);
    ensureCanDoThis(site, PermissionsArray.Permission.EDIT_POSTS);
    PostFile postFile = FenixFramework.getDomainObject(postFileId);
    FenixFramework.atomic(()->{
        if(site.equals(postFile.getSite())) {
            postFile.getFiles().setDisplayName(displayName);
            postFile.getFiles().setFilename(filename);
            if(!postFile.getIsEmbedded() && !Strings.isNullOrEmpty(accessGroup)) {
                postFile.getFiles().setAccessGroup(Group.parse(accessGroup));
            }
        }
    });
    return editMediaLibraryRedirect(postFile);
}
 
开发者ID:FenixEdu,项目名称:fenixedu-cms,代码行数:19,代码来源:AdminMediaLibrary.java

示例3: recover

import pt.ist.fenixframework.FenixFramework; //导入方法依赖的package包/类
@RequestMapping(value = "{slugSite}/{slugPost}/recover", method = RequestMethod.POST)
public RedirectView recover(@PathVariable String slugSite, @PathVariable String slugPost) {
    Site s = Site.fromSlug(slugSite);
    Post post = s.archivedPostForSlug(slugPost);

    FenixFramework.atomic(() -> {
        ensureCanEditPost(s, post);
        ensureCanDoThis(s, Permission.DELETE_POSTS);

        if(!Authenticate.getUser().equals(post.getCreatedBy())) {
            ensureCanDoThis(s, Permission.DELETE_OTHERS_POSTS);
        }

        SiteActivity.recoveredPost(post, Site.fromSlug(slugSite), Authenticate.getUser());

        post.recover();
    });

    return new RedirectView("/cms/posts/" + slugSite + "/" + post.getSlug() + "/edit", true);
}
 
开发者ID:FenixEdu,项目名称:fenixedu-cms,代码行数:21,代码来源:AdminPosts.java

示例4: moveMenuDown

import pt.ist.fenixframework.FenixFramework; //导入方法依赖的package包/类
@RequestMapping(value = "{slugSite}/{slugMenu}/down", method = RequestMethod.POST)
public RedirectView moveMenuDown(Model model, @PathVariable String slugSite, @PathVariable String slugMenu) {
    FenixFramework.atomic(() -> {
        Site site = Site.fromSlug(slugSite);
        ensureCanDoThis(site, Permission.LIST_MENUS, Permission.EDIT_MENU);
        Menu menu = site.menuForSlug(slugMenu);
        if(menu.getPrivileged()) {
            ensureCanDoThis(site, EDIT_PRIVILEGED_MENU,
                    Permission.DELETE_PRIVILEGED_MENU);
        }
        Integer oldOrder = menu.getOrder();
        if(oldOrder<site.getMenusSet().size()) {
            site.getOrderedMenusSet().stream().filter(m -> m.getOrder() == oldOrder + 1).forEach(m -> m.setOrder(oldOrder));
            menu.setOrder(oldOrder + 1);
        }
    });
    return new RedirectView("/cms/menus/" + slugSite, true);
}
 
开发者ID:FenixEdu,项目名称:fenixedu-cms,代码行数:19,代码来源:AdminMenu.java

示例5: recover

import pt.ist.fenixframework.FenixFramework; //导入方法依赖的package包/类
@RequestMapping(value = "{slugSite}/{slugPage}/recover", method = RequestMethod.POST)
public RedirectView recover(@PathVariable String slugSite, @PathVariable String slugPage) {
    Site site = Site.fromSlug(slugSite);
    Page page = site.archivedPageForSlug(slugPage);
    FenixFramework.atomic(() -> {
        ensureCanDoThis(site, Permission.EDIT_PAGE, Permission.DELETE_PAGE);
        if(!page.isStaticPage()) {
            throw CmsDomainException.forbiden();
        }

        SiteActivity.recoveredPage(page, site, Authenticate.getUser());

        page.recover();
    });

    return pageRedirect(page);
}
 
开发者ID:FenixEdu,项目名称:fenixedu-cms,代码行数:18,代码来源:AdminPages.java

示例6: delete

import pt.ist.fenixframework.FenixFramework; //导入方法依赖的package包/类
@RequestMapping(value = "{slugSite}/{slugPage}/delete", method = RequestMethod.POST)
public RedirectView delete(@PathVariable String slugSite, @PathVariable String slugPage) {
    Site s = Site.fromSlug(slugSite);
    Page page = s.pageForSlug(slugPage);
    FenixFramework.atomic(() -> {
        ensureCanDoThis(page.getSite(), Permission.EDIT_PAGE, Permission.DELETE_PAGE);
        if(!page.isStaticPage()) {
            throw CmsDomainException.forbiden();
        }

        SiteActivity.deletedPage(page,s, Authenticate.getUser());

        page.archive();
    });
    return allPagesRedirect(s);
}
 
开发者ID:FenixEdu,项目名称:fenixedu-cms,代码行数:17,代码来源:AdminPages.java

示例7: editCategory

import pt.ist.fenixframework.FenixFramework; //导入方法依赖的package包/类
@RequestMapping(value = "{slugSite}/{slugCategory}", method = RequestMethod.POST)
public RedirectView editCategory(@PathVariable String slugSite, @PathVariable String slugCategory,
                                 @RequestParam LocalizedString name,
                                 @RequestParam(required = false, defaultValue = "false") boolean privileged) {
    Site s = Site.fromSlug(slugSite);
    Category c = s.categoryForSlug(slugCategory);
    FenixFramework.atomic(()->{
        ensureCanDoThis(s, Permission.LIST_CATEGORIES, Permission.EDIT_CATEGORY);
        if(c.getPrivileged()) {
            ensureCanDoThis(s, Permission.USE_PRIVILEGED_CATEGORY, Permission.EDIT_PRIVILEGED_CATEGORY);
        }
        c.setPrivileged(privileged);
        c.setName(name);
    });
    Signal.emit(Category.SIGNAL_EDITED, new DomainObjectEvent<>(c));
    return new RedirectView("/cms/categories/" + s.getSlug() + "/" + c.getSlug(), true);
}
 
开发者ID:FenixEdu,项目名称:fenixedu-cms,代码行数:18,代码来源:AdminCategory.java

示例8: editMetadata

import pt.ist.fenixframework.FenixFramework; //导入方法依赖的package包/类
@RequestMapping(value = "{slugSite}/{slugPage}/metadata", method = RequestMethod.POST)
public RedirectView editMetadata(@PathVariable String slugSite,
                                     @PathVariable String slugPage,
                                     @RequestParam String metadata) {
    Site s = Site.fromSlug(slugSite);
    Page page = s.pageForSlug(slugPage);
    if(!page.isStaticPage()) {
        throw CmsDomainException.forbiden();
    }
    FenixFramework.atomic(()-> {
        ensureCanDoThis(s, Permission.EDIT_PAGE, Permission.SEE_METADATA, Permission.EDIT_METADATA);
        page.getStaticPost().ifPresent(
            post -> post.setMetadata(PostMetadata.internalize(metadata)));
    });
    return new RedirectView("/cms/pages/" + s.getSlug() + "/" + page.getSlug() + "/metadata", true);
}
 
开发者ID:FenixEdu,项目名称:fenixedu-cms,代码行数:17,代码来源:AdminPages.java

示例9: deleteFile

import pt.ist.fenixframework.FenixFramework; //导入方法依赖的package包/类
public ActionForward deleteFile(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws IOException {
    final GenericApplication application = getDomainObject(request, "applicationExternalId");
    final String confirmationCode = (String) getFromRequest(request, "confirmationCode");
    final GenericApplicationFile file = getDomainObject(request, "fileExternalId");
    if (application != null && confirmationCode != null && application.getConfirmationCode() != null
            && application.getConfirmationCode().equals(confirmationCode) && file != null
            && file.getGenericApplication() == application) {
        FenixFramework.atomic(() -> file.delete());
    } else {
        response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
        response.getWriter().write(HttpStatus.getStatusText(HttpStatus.SC_BAD_REQUEST));
        response.getWriter().close();
    }
    return confirmEmail(mapping, form, request, response);
}
 
开发者ID:FenixEdu,项目名称:fenixedu-academic,代码行数:17,代码来源:GenericCandidaciesDA.java

示例10: delete

import pt.ist.fenixframework.FenixFramework; //导入方法依赖的package包/类
@RequestMapping(value = "{slugSite}/{slugPage}/delete", method = RequestMethod.POST)
public RedirectView delete(@PathVariable String slugSite, @PathVariable String slugPage) {
    FenixFramework.atomic(() -> {
        Site site = Site.fromSlug(slugSite);
        ensureCanDoThis(site, Permission.SEE_PAGES, Permission.EDIT_PAGE, Permission.DELETE_PAGE, Permission.EDIT_ADVANCED_PAGES);
        site.pageForSlug(slugPage).archive();
    });
    return new RedirectView("/cms/pages/advanced/" + slugSite, true);
}
 
开发者ID:FenixEdu,项目名称:fenixedu-cms,代码行数:10,代码来源:AdminPagesAdvanced.java

示例11: delete

import pt.ist.fenixframework.FenixFramework; //导入方法依赖的package包/类
@RequestMapping(value = "{siteSlug}/{postFileId}/delete", method = RequestMethod.POST)
public RedirectView delete(@PathVariable String siteSlug, @PathVariable String postFileId) {
    Site site = Site.fromSlug(siteSlug);
    ensureCanDoThis(site, PermissionsArray.Permission.EDIT_POSTS);
    PostFile postFile = FenixFramework.getDomainObject(postFileId);
    Post post = postFile.getPost();
    if(site.equals(postFile.getSite())) {
        FenixFramework.atomic(()-> {
            postFile.delete();
            post.fixOrder(post.getFilesSorted());
        });
    }
    return mediaLibraryRedirect(site);
}
 
开发者ID:FenixEdu,项目名称:fenixedu-cms,代码行数:15,代码来源:AdminMediaLibrary.java

示例12: view

import pt.ist.fenixframework.FenixFramework; //导入方法依赖的package包/类
@RequestMapping(method = RequestMethod.POST)
public RedirectView view(@RequestParam String themesManagers, @RequestParam String rolesManagers,
                   @RequestParam String foldersManagers, @RequestParam String settingsManagers) {
  CmsSettings.getInstance().ensureCanManageGlobalPermissions();

  FenixFramework.atomic(()->{
    CmsSettings settings = CmsSettings.getInstance().getInstance();
    settings.setThemesManagers(group(themesManagers));
    settings.setRolesManagers(group(rolesManagers));
    settings.setFoldersManagers(group(foldersManagers));
    settings.setSettingsManagers(group(settingsManagers));
  });
  return new RedirectView("/cms/settings", true);
}
 
开发者ID:FenixEdu,项目名称:fenixedu-cms,代码行数:15,代码来源:AdminSettings.java

示例13: createRole

import pt.ist.fenixframework.FenixFramework; //导入方法依赖的package包/类
@RequestMapping(value = "/{roleTemplateId}/addSite", method = RequestMethod.POST)
public RedirectView createRole(@PathVariable String roleTemplateId, @RequestParam String siteSlug) {
    FenixFramework.atomic(()->{
        CmsSettings.getInstance().ensureCanManageRoles();
        RoleTemplate template = FenixFramework.getDomainObject(roleTemplateId);
        Site site = Site.fromSlug(siteSlug);
        if(!template.getRolesSet().stream().map(Role::getSite).filter(roleSite->roleSite.equals(site)).findAny().isPresent()) {
            new Role(template, site);
        }
    });
    return new RedirectView("/cms/permissions/site/" + siteSlug, true);
}
 
开发者ID:FenixEdu,项目名称:fenixedu-cms,代码行数:13,代码来源:AdminPermissions.java

示例14: edit

import pt.ist.fenixframework.FenixFramework; //导入方法依赖的package包/类
@RequestMapping(value = "/{roleTemplateId}/edit", method = RequestMethod.POST)
public RedirectView edit(@PathVariable String roleTemplateId, @RequestParam LocalizedString description, @RequestParam String permissions) {
    FenixFramework.atomic(() -> {
        CmsSettings.getInstance().ensureCanManageRoles();
        RoleTemplate template = FenixFramework.getDomainObject(roleTemplateId);
        template.setName(description);
        template.setPermissions(PermissionsArray.fromJson(toJsonArray(permissions)));
    });
    return new RedirectView("/cms/permissions/" + roleTemplateId + "/edit", true);
}
 
开发者ID:FenixEdu,项目名称:fenixedu-cms,代码行数:11,代码来源:AdminPermissions.java

示例15: delete

import pt.ist.fenixframework.FenixFramework; //导入方法依赖的package包/类
@RequestMapping(value = "{slugSite}/{slugCategory}/delete", method = RequestMethod.POST)
public RedirectView delete(@PathVariable String slugSite, @PathVariable String slugCategory) {
    FenixFramework.atomic(() -> {
        Site s = Site.fromSlug(slugSite);
        ensureCanDoThis(s, Permission.LIST_CATEGORIES, Permission.EDIT_CATEGORY, Permission.DELETE_CATEGORY);

        Category category = s.categoryForSlug(slugCategory);
        if(category.getPrivileged()) {
            ensureCanDoThis(s, Permission.EDIT_PRIVILEGED_CATEGORY);
        }

        category.delete();
    });
    return new RedirectView("/cms/categories/" + slugSite, true);
}
 
开发者ID:FenixEdu,项目名称:fenixedu-cms,代码行数:16,代码来源:AdminCategory.java


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