/** * * <p> * generateEntityKey * </p> * * @param fragment * @return */ public String generateEntityKey( ContentFragment fragment) { return fragment.getId(); }
public FragmentNotInLayoutException(ContentFragment fragment) { super("The fragment "+fragment != null ?fragment.getId():"{null fragment}"+" could not be located in this layout."); }
public Decoration getDecoration( ContentFragment fragment ) { return (Decoration) fragmentDecorations.get( fragment.getId() ); }
public PortletWindowImpl(RequestContext requestContext, ContentFragment fragment, PortletDefinition pd) { this.requestContext = requestContext; this.id = fragment.getId(); this.portletEntityId = fragment.getFragmentId(); if (this.portletEntityId == null) { this.portletEntityId = this.id; } this.fragment = fragment; this.pd = pd; this.valid = pd != null; }
/** * Get layout fragment id. * * @param f fragment * @return fragment id */ private static String getId( Object f ) { return ( ( f instanceof ContentFragment ) ? ((ContentFragment) f).getId() : ((Fragment) f).getId() ); }
public PortletWindow getPortletWindow(ContentFragment fragment) { PortletWindow window = portletWindows.get(fragment.getId()); if (window == null) { window = createPortletWindow(fragment); } return window; }
protected void clearTargetCache(ContentFragment f, RequestContext context) { clearTargetCache(f.getId(), context); }
public String toString() { if (fragment != null) { return "event_target="+fragment.getId()+",event_type_code="+ eventType + ",orginial_coordinate="+ originalCoordinate+",new_coordinate="+ newCoordinate; } else if (page != null) { return "event_target="+page.getId()+",event_type_code="+ eventType + ",portlet_type="+ portletType+",portlet_name="+ portletName; } else { return "event_type_code="+ eventType; } } }
public Coordinate remove( ContentFragment fragment ) throws PortletPlacementException { if ( fragment == null ) throw new NullPointerException( "PortletPlacementContext remove() cannot accept a null Fragment argument" ); Coordinate currentCoordinate = (Coordinate)this.fragmentCoordinateMap.get( fragment.getId() ); if ( currentCoordinate == null ) throw new NullPointerException( "PortletPlacementContext remove() cannot locate target fragment (" + fragment.getId() + ")" ); int currentCol = getLatestColumn( currentCoordinate ); int currentRow = getLatestRow( currentCoordinate ); verifyFragmentAtExpectedCoordinate( currentCol, currentRow, fragment, "moveDirection()" ); ArrayList currentColumn = this.columnsList[currentCol]; currentColumn.remove( currentRow ); this.fragmentCoordinateMap.remove( fragment.getId() ); this.fragmentMap.remove( fragment.getId() ); syncFragments(false, currentCol, null, null); return currentCoordinate; }
public String dumpFragments( String debug ) { StringBuffer out = new StringBuffer(); out.append( "PortletPlacementContext - " ); if ( debug != null ) out.append( debug ).append( " - " ); out.append( "container: " ).append( this.layoutContainerFragment == null ? "<null>" : ( this.layoutContainerFragment.getId() + " / " + this.layoutContainerFragment.getType() ) ).append( " column-count=" ).append( this.numberOfColumns ).append( eol ); for (int ix = 0; ix < this.columnsList.length; ix++) { ArrayList column = this.columnsList[ix]; out.append( " column " ).append( ix ).append( eol ); Iterator frags = column.iterator(); while ( frags.hasNext() ) { ContentFragment f = (ContentFragment)frags.next(); out.append( " frag " ).append( f == null ? "<null>" : ( f.getId() + " / " + f.getType() ) ).append( eol ); } } return out.toString(); } public ContentFragment debugFragments( String debug )
/** * <p> * handleError * </p> * * @param e * @param msg */ @SuppressWarnings("unchecked") protected void handleError(Exception e, String msg, ContentFragment fragment) { log.error(msg, e); Set<Exception> exceptions = (Set<Exception>) renderRequest.getAttribute(FRAGMENT_PROCESSING_ERROR_PREFIX + fragment.getId()); if (exceptions == null) { exceptions = new HashSet<Exception>(); setAttribute(FRAGMENT_PROCESSING_ERROR_PREFIX + fragment.getId(), exceptions); } exceptions.add(e); }
public int getFragmentRow( ContentFragment fragment ) { if ( fragment == null ) return -1; Coordinate coordinate = (Coordinate)this.fragmentCoordinateMap.get( fragment.getId() ); if ( coordinate == null ) return -1; if ( coordinate.getNewRow() >= 0 ) return coordinate.getNewRow(); return coordinate.getOldRow(); }
public int getFragmentCol( ContentFragment fragment ) { if ( fragment == null ) return -1; Coordinate coordinate = (Coordinate)this.fragmentCoordinateMap.get( fragment.getId() ); if ( coordinate == null ) return -1; if ( coordinate.getNewCol() >= 0 ) return coordinate.getNewCol(); return coordinate.getOldCol(); }
protected boolean initFragment(RequestContext requestContext, Theme theme, ContentFragment fragment, PageActionAccess pageActionAccess, boolean isAjaxRequest) { boolean fragmentSupportsActions = false; try { Decoration decoration = theme.getDecoration(fragment); fragment.setDecoration(decoration); fragmentSupportsActions = initActionsForFragment(requestContext, fragment, pageActionAccess, decoration, isAjaxRequest); } catch (Exception e) { log.warn("Unable to initalize actions for fragment "+fragment.getId(), e); } return fragmentSupportsActions; }
protected void init( ContentFragment container, ContentFragment excludeFragment ) throws PortletPlacementException { if ( container == null ) { container = page.getRootFragment(); if ( container == null ) throw new PortletPlacementException( "PortletPlacementContext cannot acquire root layout fragment from page" ); } if ( ! "layout".equals( container.getType() ) ) { throw new PortletPlacementException( "PortletPlacementContext specified container fragment (" + container.getId() + ") is not a layout fragment, but is type: " + container.getType() ); } this.layoutContainerFragment = container; int columnCount = PortletPlacementMetadataAccess.getColumnCountAndSizes( container, registry, null ); if ( columnCount <= 0 ) { throw new PortletPlacementException( "PortletPlacementContext cannot detemine number of columns in layout fragment (" + container.getId() + ")" ); } this.numberOfColumns = columnCount; initProcessLayoutContainerFragment( excludeFragment ); //debugFragments( "init" ); }
public ContentFragmentBean(final ContentFragment contentFragment) { id = contentFragment.getId(); type = contentFragment.getType(); name = contentFragment.getName(); locked = contentFragment.isLocked(); decorator = contentFragment.getDecorator(); mode = contentFragment.getMode(); state = contentFragment.getState(); properties = contentFragment.getPropertiesMap(); Collection<ContentFragment> childContentFragments = contentFragment.getFragments(); if (childContentFragments != null && !childContentFragments.isEmpty()) { ArrayList<ContentFragmentBean> childContentFragmentBeanList = new ArrayList<ContentFragmentBean>(); for (ContentFragment childContentFragment : childContentFragments) { childContentFragmentBeanList.add(new ContentFragmentBean(childContentFragment)); } contentFragmentBeans = childContentFragmentBeanList; } }
protected void notifyFragments(ContentFragment f, RequestContext context, ContentPage page) { if (f.getFragments() != null && f.getFragments().size() > 0) { for (Object child : f.getFragments()) { if (!"hidden".equals(f.getState())) { notifyFragments((ContentFragment)child, context, page); } } } ContentCacheKey cacheKey = portletContentCache.createCacheKey(context, f.getId()); if (portletContentCache.isKeyInCache(cacheKey)) { portletContentCache.remove(cacheKey); portletContentCache.invalidate(context); } }
protected PortletContent createPortletContent(RequestContext request, PortletWindow portletWindow, int expirationCache) { ContentCacheKey cacheKey = portletContentCache.createCacheKey(request, portletWindow.getFragment().getId()); String title = portletWindow.getFragment().getTitle(); if (title == null) { title = request.getPreferedLanguage(portletWindow.getPortletDefinition()).getTitle(); } if (title == null) { title = portletWindow.getPortletDefinition().getPortletName(); } return new PortletContentImpl(cacheKey, expirationCache, title, portletWindow.getPortletMode(), portletWindow.getWindowState()); }
ContentCacheKey cacheKey = portletContentCache.createCacheKey(requestContext, fragment.getId()); CacheElement cachedElement = portletContentCache.get(cacheKey);