public Page(org.apache.rave.model.Page source) { this.id = source.getId(); this.name = source.getName(); this.ownerId = source.getOwnerId(); this.pageType = source.getPageType().toString(); this.pageLayoutCode = source.getPageLayout().getCode(); this.properties = source.getProperties(); this.subPages = createSubPages(source); this.regions = createRegions(source); this.members = createPageUsers(source); }
@Transactional public Boolean clonePageForUser(String pageId, String userId, String pageName) { Page page = getPage(pageId); if(pageName == null || pageName.equals("null")){ // try to use the original page name if none supplied pageName = page.getName(); } Page clonedPage = addNewUserPage(userService.getUserById(userId), pageName, page.getPageLayout().getCode()); // populate all the widgets in cloned page from original for(int i=0; i<page.getRegions().size(); i++){ for(int j=0; j<page.getRegions().get(i).getRegionWidgets().size(); j++){ String widgetId = page.getRegions().get(i).getRegionWidgets().get(j).getWidgetId(); addWidgetToPageRegion(clonedPage.getId(), widgetId, clonedPage.getRegions().get(i).getId()); } } clonedPage = getFromRepository(clonedPage.getId(), pageRepository); // newly created page - so only one pageUser PageUser pageUser = clonedPage.getMembers().get(0); // update status to pending pageUser.setPageStatus(PageInvitationStatus.PENDING); if(pageRepository.save(clonedPage) != null){ return Boolean.TRUE; }else{ return Boolean.FALSE; } }
public void buildModel(Page page, String omdlUrl, String wookieUrl) { this.wookieUrl = wookieUrl; OmdlWidget omdlWidget = null; this.status = new Status(OmdlModelUtils.getDate(), DEFAULT_STATUS); this.page = page; this.identifier = omdlUrl; this.title = page.getName(); this.description = DEFAULT_DESCRIPTION; this.creator = getCreator(page); this.date = OmdlModelUtils.getDate(); this.layout = OmdlModelUtils.getOmdlLayoutForExport(page.getPageLayout().getCode()); widgetsList = new ArrayList<OmdlWidget>(); for(int i=0;i<page.getRegions().size(); i++){ for(int j=0;j<page.getRegions().get(i).getRegionWidgets().size();j++){ Widget widget = widgetService.getWidget(page.getRegions().get(i).getRegionWidgets().get(j).getWidgetId()); omdlWidget = new OmdlWidget(); omdlWidget.setUrl(widget.getUrl()); omdlWidget.setLink(createLinkElement(widget.getType(), widget.getUrl())); // figure out what positioning to use for this widget String position = OmdlModelUtils.getPositionString(i+1, page.getRegions().size(), j+1, page.getRegions().get(i).getRegionWidgets().size()); if(position != null && position !=""){ omdlWidget.setPosition(position); } omdlWidget.setWidgetType(UNKNOWN_VALUE); widgetsList.add(omdlWidget); } } }
if (page.getParentPage() != null) { pageId = "'" + page.getId() + "'"; pageName = page.getName();
private void updateProperties(Page source, JpaPage converted) { replacePageReferences(source, converted); converted.setId(source.getId()); converted.setMembers(source.getMembers()); converted.setName(source.getName()); converted.setOwnerId(source.getOwnerId()); converted.setContextId(source.getContextId()); converted.setPageLayout(source.getPageLayout()); converted.setPageType(source.getPageType()); converted.setParentPage(source.getParentPage()); converted.setRegions(source.getRegions()); converted.setSubPages(source.getSubPages()); converted.setProperties(source.getProperties()); }