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


Java FenixFramework类代码示例

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


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

示例1: create

import pt.ist.fenixframework.FenixFramework; //导入依赖的package包/类
@Override
public Site create(JsonElement json, JsonBuilder ctx) {
    JsonObject jObj = json.getAsJsonObject();

    JsonElement name = getRequiredValue(jObj, "name");
    JsonElement description = getRequiredValue(jObj, "description");

    Site site = new Site(LocalizedString.fromJson(name), LocalizedString.fromJson(description));

    if (jObj.has("theme") && !jObj.get("theme").isJsonNull()) {
        site.setTheme(FenixFramework.getDomainObject(jObj.get("theme").getAsString()));
    }

    if (jObj.has("embedded") && !jObj.get("embedded").isJsonNull()) {
        site.setEmbedded(jObj.get("embedded").getAsBoolean());
    }
    
    site.updateMenuFunctionality();

    return site;
}
 
开发者ID:FenixEdu,项目名称:fenixedu-cms,代码行数:22,代码来源:SiteAdapter.java

示例2: revertTo

import pt.ist.fenixframework.FenixFramework; //导入依赖的package包/类
@RequestMapping(value = "{slugSite}/{slugPost}/revertTo", method = RequestMethod.POST)
public RedirectView revertTo(@PathVariable String slugSite,
                             @PathVariable String slugPost,
                             @RequestParam PostContentRevision revision) {
  Site site = Site.fromSlug(slugSite);
  Post post = site.postForSlug(slugPost);
  ensureCanDoThis(site, Permission.EDIT_POSTS);

  if (revision.getPost() != post) {
    throw new RuntimeException("Invalid Revision");
  }

  if (revision.getPost().getLatestRevision().equals(revision)){
    throw new RuntimeException("Can't revert to last revision");
  }

  FenixFramework.atomic(() -> post.setBodyAndExcerpt(revision.getBody(),revision.getExcerpt()));

  if(post.isStaticPost() && post.getStaticPage().isPresent()) {
    String pageSlug = post.getStaticPage().get().getSlug();
    return new RedirectView("/cms/pages/" + site.getSlug() + "/" + pageSlug + "/edit", true);
  } else {
    return new RedirectView("/cms/posts/" + site.getSlug() + "/" + post.getSlug() + "/edit",
                            true);
  }
}
 
开发者ID:FenixEdu,项目名称:fenixedu-cms,代码行数:27,代码来源:AdminVersions.java

示例3: 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

示例4: createSite

import pt.ist.fenixframework.FenixFramework; //导入依赖的package包/类
@Atomic
private void createSite(LocalizedString name, LocalizedString description, SiteBuilder builder, boolean published, String folder,
        boolean embedded, String themeType, Set<String> roles) {
    CmsSettings.getInstance().ensureCanManageSettings();
    if (builder !=null){
        builder.create(name, description);
    } else {
        Site site = new Site(name, description);
    
        ofNullable(folder).filter(t -> !Strings.isNullOrEmpty(t)).map(FenixFramework::getDomainObject).map(CMSFolder.class::cast)
                .ifPresent(site::setFolder);

        site.setEmbedded(ofNullable(embedded).orElse(false));
        site.updateMenuFunctionality();
        site.setPublished(published);

        ofNullable(roles).ifPresent(rolesSet->
                rolesSet.forEach(role -> new Role(FenixFramework.getDomainObject(role), site)));

        ofNullable(themeType).filter(t -> !Strings.isNullOrEmpty(t)).map(CMSTheme::forType).ifPresent(site::setTheme);

        SiteActivity.createdSite(site, Authenticate.getUser());
    }
}
 
开发者ID:FenixEdu,项目名称:fenixedu-cms,代码行数:25,代码来源:CreateSite.java

示例5: moveMenuUp

import pt.ist.fenixframework.FenixFramework; //导入依赖的package包/类
@RequestMapping(value = "{slugSite}/{slugMenu}/up", method = RequestMethod.POST)
public RedirectView moveMenuUp(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>1) {
            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

示例6: 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

示例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: processFileChanges

import pt.ist.fenixframework.FenixFramework; //导入依赖的package包/类
private void processFileChanges(Site site, Post post, JsonObject postJson) {
	if(postJson.get("files")!=null && postJson.get("files").isJsonArray()) {
		for (JsonElement fileJsonEl : postJson.get("files").getAsJsonArray()) {
			JsonObject fileJson = fileJsonEl.getAsJsonObject();
			PostFile postFile = FenixFramework.getDomainObject(fileJson.get("id").getAsString());
			if(postFile.getPost() == post) {
				int index = fileJson.get("index").getAsInt();
				boolean isEmbedded = fileJson.get("isEmbedded").getAsBoolean();
				if(postFile.getIndex()!= index) {
					postFile.setIndex(index);
				}
				if(postFile.getIsEmbedded()!=isEmbedded) {
					postFile.setIsEmbedded(isEmbedded);
				}
				Signal.emit(PostFile.SIGNAL_EDITED, new DomainObjectEvent<>(postFile));
			}
		}
	}

}
 
开发者ID:FenixEdu,项目名称:fenixedu-cms,代码行数:21,代码来源:AdminPostsService.java

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: showPhoto

import pt.ist.fenixframework.FenixFramework; //导入依赖的package包/类
public ActionForward showPhoto(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

    Party party = FenixFramework.getDomainObject(request.getParameter("personID"));
    if (party.isPerson()) {
        Person person = (Person) party;
        Photograph personalPhoto = person.getPersonalPhoto();
        if (personalPhoto != null) {
            try {
                byte[] avatar = personalPhoto.getDefaultAvatar();
                response.setContentType(ContentType.PNG.getMimeType());
                DataOutputStream dos = new DataOutputStream(response.getOutputStream());
                dos.write(avatar);
                dos.close();
            } catch (java.io.IOException e) {
                throw new FenixActionException(e);
            }
        }
    }
    return null;
}
 
开发者ID:ist-dsi-archive,项目名称:fenix-parking,代码行数:22,代码来源:ParkingManagerDispatchAction.java

示例15: showHistory

import pt.ist.fenixframework.FenixFramework; //导入依赖的package包/类
public ActionForward showHistory(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    final String codeString = request.getParameter("externalId");
    String code = null;
    if (codeString == null) {
        code = (String) request.getAttribute("externalId");
    } else {
        code = codeString;
    }
    final ParkingRequest parkingRequest = FenixFramework.getDomainObject(code);
    List<ParkingPartyHistory> parkingPartyHistories =
            new ArrayList<ParkingPartyHistory>(parkingRequest.getParkingParty().getParty().getParkingPartyHistoriesSet());

    Collections.sort(parkingPartyHistories, new BeanComparator("historyDate"));
    request.setAttribute("parkingPartyHistories", parkingPartyHistories);
    request.setAttribute("parkingParty", parkingRequest.getParkingParty());
    return mapping.findForward("showParkingHistories");
}
 
开发者ID:ist-dsi-archive,项目名称:fenix-parking,代码行数:19,代码来源:ParkingManagerDispatchAction.java


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