Coverage report

  %line %branch
org.apache.jetspeed.layout.impl.MovePortletAction
0% 
0% 

 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  * 
 9  
  *      http://www.apache.org/licenses/LICENSE-2.0
 10  
  * 
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 package org.apache.jetspeed.layout.impl;
 18  
 
 19  
 import java.security.Principal;
 20  
 import java.util.Map;
 21  
 import java.util.Iterator;
 22  
 
 23  
 import javax.security.auth.Subject;
 24  
 
 25  
 import org.apache.commons.logging.Log;
 26  
 import org.apache.commons.logging.LogFactory;
 27  
 import org.apache.jetspeed.JetspeedActions;
 28  
 import org.apache.jetspeed.administration.PortalConfiguration;
 29  
 import org.apache.jetspeed.ajax.AJAXException;
 30  
 import org.apache.jetspeed.ajax.AjaxAction;
 31  
 import org.apache.jetspeed.ajax.AjaxBuilder;
 32  
 import org.apache.jetspeed.components.portletregistry.PortletRegistry;
 33  
 import org.apache.jetspeed.layout.Coordinate;
 34  
 import org.apache.jetspeed.layout.PortletActionSecurityBehavior;
 35  
 import org.apache.jetspeed.layout.PortletPlacementException;
 36  
 import org.apache.jetspeed.layout.PortletPlacementContext;
 37  
 import org.apache.jetspeed.om.page.Fragment;
 38  
 import org.apache.jetspeed.om.page.Page;
 39  
 import org.apache.jetspeed.page.PageManager;
 40  
 import org.apache.jetspeed.page.document.NodeException;
 41  
 import org.apache.jetspeed.portalsite.PortalSiteRequestContext;
 42  
 import org.apache.jetspeed.profiler.impl.ProfilerValveImpl;
 43  
 import org.apache.jetspeed.request.RequestContext;
 44  
 import org.apache.jetspeed.security.RolePrincipal;
 45  
 import org.apache.jetspeed.security.impl.RolePrincipalImpl;
 46  
 import org.apache.jetspeed.Jetspeed;
 47  
 
 48  
 /**
 49  
  * Move Portlet portlet placement action
 50  
  *
 51  
  * AJAX Parameters: 
 52  
  *    id = the fragment id of the portlet to move
 53  
  *    page = (implied in the URL)
 54  
  * Additional Absolute Parameters:  
 55  
  *    row = the new row to move to
 56  
  *    col = the new column to move to
 57  
  * Additional Relative Parameters: (move left, right, up, down)
 58  
  *    none
 59  
  *    
 60  
  * @author <a>David Gurney</a>
 61  
  * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
 62  
  * @version $Id: $
 63  
  */
 64  
 public class MovePortletAction 
 65  
     extends BasePortletAction 
 66  
     implements AjaxAction, AjaxBuilder, Constants
 67  
 {
 68  0
     protected static final Log log = LogFactory.getLog(MovePortletAction.class);
 69  0
     protected static final String eol = System.getProperty( "line.separator" );
 70  
     
 71  
     private PortletRegistry registry;
 72  0
     private int iMoveType = -1;
 73  0
     private String sMoveType = null;
 74  
 
 75  
     public MovePortletAction( String template, 
 76  
             				  String errorTemplate,
 77  
                               PortletRegistry registry,
 78  
                               String sMoveType )
 79  
         throws AJAXException
 80  
     {
 81  0
         this( template, errorTemplate, registry, sMoveType, null, class="keyword">null );
 82  0
     }
 83  
     
 84  
     public MovePortletAction( String template, 
 85  
                               String errorTemplate,
 86  
                               PortletRegistry registry,
 87  
                               PageManager pageManager,
 88  
                               PortletActionSecurityBehavior securityBehavior )
 89  
         throws AJAXException
 90  
     {
 91  0
         this( template, errorTemplate, registry, "moveabs", pageManager, securityBehavior );
 92  0
     }
 93  
 
 94  
     public MovePortletAction( String template,
 95  
                               String errorTemplate,
 96  
                               PortletRegistry registry,
 97  
                               String sMoveType,
 98  
                               PageManager pageManager,
 99  
                               PortletActionSecurityBehavior securityBehavior )
 100  
         throws AJAXException
 101  
     {
 102  0
         super( template, errorTemplate, pageManager, securityBehavior );
 103  0
         setMoveType( sMoveType );
 104  0
         this.registry = registry;
 105  0
     }
 106  
 
 107  
     // Convert the move type into an integer
 108  
     public void setMoveType(String p_sMoveType) throws AJAXException
 109  
     {
 110  0
         sMoveType = p_sMoveType;
 111  
 
 112  0
         if (p_sMoveType.equalsIgnoreCase("moveabs"))
 113  
         {
 114  0
             iMoveType = ABS;
 115  
         } 
 116  0
         else if (p_sMoveType.equalsIgnoreCase("moveup"))
 117  
         {
 118  0
             iMoveType = UP;
 119  
         } 
 120  0
         else if (p_sMoveType.equalsIgnoreCase("movedown"))
 121  
         {
 122  0
             iMoveType = DOWN;
 123  
         } 
 124  0
         else if (p_sMoveType.equalsIgnoreCase("moveleft"))
 125  
         {
 126  0
             iMoveType = LEFT;
 127  
         } 
 128  0
         else if (p_sMoveType.equalsIgnoreCase("moveright"))
 129  
         {
 130  0
             iMoveType = RIGHT;
 131  
         }
 132  0
         else if (p_sMoveType.equalsIgnoreCase("move"))
 133  
         {
 134  0
             iMoveType = CARTESIAN;
 135  
         }
 136  
         else
 137  
         {
 138  0
             throw new AJAXException("invalid move type of:" + p_sMoveType);
 139  
         }
 140  0
     }
 141  
 
 142  
     public boolean runBatch(RequestContext requestContext, Map resultMap) throws AJAXException
 143  
     {
 144  0
         return runAction(requestContext, resultMap, true);
 145  
     }    
 146  
     
 147  
     public boolean run(RequestContext requestContext, Map resultMap)
 148  
             throws AJAXException
 149  
     {
 150  0
         return runAction(requestContext, resultMap, false);
 151  
     }
 152  
         
 153  
     protected boolean runAction( RequestContext requestContext, Map resultMap, class="keyword">boolean batch )  throws AJAXException
 154  
     {
 155  0
         boolean success = true;
 156  0
         String status = "success";
 157  
         try
 158  
         {
 159  0
             resultMap.put(ACTION, sMoveType);
 160  
             // Get the necessary parameters off of the request
 161  0
             String moveFragmentId = getActionParameter(requestContext, FRAGMENTID);
 162  0
             String layoutId = getActionParameter(requestContext, LAYOUTID);
 163  0
             if ( moveFragmentId == null ) 
 164  
             {
 165  0
                 throw new Exception( FRAGMENTID + " not provided; must specify portlet or layout id" ); 
 166  
             }
 167  0
             resultMap.put(FRAGMENTID, moveFragmentId);
 168  
                         
 169  0
             Fragment currentLayoutFragment = null;
 170  0
             Fragment moveToLayoutFragment = null;
 171  
             // when layoutId is null we use old behavior, ignoring everything to do with multiple layout fragments
 172  0
             if ( layoutId != null && layoutId.length() > 0 && iMoveType != CARTESIAN )
 173  
             {
 174  0
                 Page page = requestContext.getPage();
 175  0
                 currentLayoutFragment = page.getFragmentById( layoutId );
 176  0
                 if ( currentLayoutFragment == null )
 177  
                 {
 178  0
                     throw new Exception("layout id not found: " + layoutId );
 179  
                 }
 180  
                 else
 181  
                 {
 182  
                     // determine if layoutId parameter refers to the current layout fragment or to some other layout fragment
 183  0
                     moveToLayoutFragment = currentLayoutFragment;
 184  0
                     Iterator layoutChildIter = moveToLayoutFragment.getFragments().iterator();
 185  0
                     while ( layoutChildIter.hasNext() )
 186  
                     {
 187  0
                         Fragment childFrag = (Fragment)layoutChildIter.next();
 188  0
                         if ( childFrag != null )
 189  
                         {
 190  0
                             if ( moveFragmentId.equals( childFrag.getId() ) )
 191  
                             {
 192  0
                                 moveToLayoutFragment = null;
 193  0
                                 break;
 194  
                             }
 195  
                         }
 196  0
                     }
 197  0
                     if ( moveToLayoutFragment != null )
 198  
                     {
 199  
                         // figure out the current layout fragment - must know to be able to find the portlet
 200  
                         //    fragment by row/col when a new page is created
 201  0
                         Fragment root = requestContext.getPage().getRootFragment();
 202  0
                         currentLayoutFragment = getParentFragmentById( moveFragmentId, root );
 203  
                     }
 204  
                 }
 205  0
                 if ( currentLayoutFragment == null )
 206  
                 {
 207  
                     // report error
 208  0
                     throw new Exception("parent layout id not found for portlet id:" + moveFragmentId );
 209  
                 }
 210  
             }
 211  
             
 212  0
             if ( false == checkAccess( requestContext, JetspeedActions.EDIT ) )
 213  
             {
 214  0
             	if ( ! isPageQualclass="keyword">ifiedForCreateNewPageOnEdit( requestContext ) )
 215  
             	{
 216  0
             		success = false;
 217  0
                     resultMap.put(REASON, "Page is not qualified for create-new-page-on-edit");
 218  0
                     return success;
 219  
             	}
 220  
             	
 221  0
                 Page page = requestContext.getPage();
 222  0
                 Fragment fragment = page.getFragmentById( moveFragmentId );
 223  0
                 if ( fragment == null )
 224  
                 {
 225  0
                     success = false;
 226  0
                     resultMap.put(REASON, "Fragment not found");
 227  0
                     return success;
 228  
                 }
 229  0
                 NestedFragmentContext moveFragmentContext = null;
 230  0
                 NestedFragmentContext moveToFragmentContext = null;
 231  
                 try
 232  
                 {
 233  0
                 	moveFragmentContext = new NestedFragmentContext( fragment, page, registry );
 234  
                 	//log.info( "moveFragmentContext original : " + eol + moveFragmentContext.toString() );
 235  0
                 	if ( moveToLayoutFragment != null )
 236  
                 	{
 237  0
                 		moveToFragmentContext = new NestedFragmentContext( moveToLayoutFragment, page, registry );
 238  
                 		//log.info( "moveToFragmentContext original : " + eol + moveToFragmentContext.toString() );
 239  
                 	}
 240  
                 }
 241  0
                 catch ( Exception ex )
 242  
                 {
 243  0
                 	log.error( "Failure to construct nested context for fragment " + moveFragmentId, ex );
 244  0
                 	success = false;
 245  0
                     resultMap.put( REASON, "Cannot construct nested context for fragment" );
 246  0
                     return success;
 247  0
                 }
 248  
                                 
 249  
                 //log.info("before createNewPageOnEdit page-name=" + page.getName() + " page-path=" + page.getPath() + " page-url=" + page.getUrl() );
 250  0
                 if ( ! createNewPageOnEdit( requestContext ) )
 251  
                 {
 252  0
                     success = false;
 253  0
                     resultMap.put(REASON, "Insufficient access to edit page");
 254  0
                     return success;
 255  
                 }
 256  0
                 status = "refresh";
 257  
                 
 258  0
                 Page newPage = requestContext.getPage();                
 259  
                 //log.info("after createNewPageOnEdit page-name=" + newPage.getName() + " page-path=" + newPage.getPath() + " page-url=" + newPage.getUrl() );
 260  0
                 Fragment newPageRootFragment = newPage.getRootFragment();
 261  
                 
 262  
                 // using NestedFragmentContext, find portlet id for copy of target portlet in the new page 
 263  0
                 Fragment newFragment = null;
 264  
                 try
 265  
                 {
 266  0
                 	newFragment = moveFragmentContext.getFragmentOnNewPage( newPage, registry );
 267  
                 	//log.info( "npe newFragment: " + newFragment.getType() + " " + newFragment.getId() );
 268  
                 }
 269  0
                 catch ( Exception ex )
 270  
                 {
 271  0
                 	log.error( "Failure to locate copy of fragment " + moveFragmentId, ex );
 272  0
                 	success = false;
 273  0
                     resultMap.put( REASON, "Failed to find new fragment for portlet id: " + moveFragmentId );
 274  0
                     return success;
 275  0
                 }
 276  
                 
 277  0
                 moveFragmentId = newFragment.getId();
 278  0
                 currentLayoutFragment = getParentFragmentById( moveFragmentId, newPageRootFragment );
 279  0
                 if ( currentLayoutFragment == null )
 280  
                 {
 281  0
                 	success = false;
 282  0
                     resultMap.put( REASON, "Failed to find parent layout for copied fragment " + moveFragmentId );
 283  0
                     return success;
 284  
                 }
 285  
                 //log.info( "npe newParentFragment: " + currentLayoutFragment.getType() + " " + currentLayoutFragment.getId() );
 286  0
                 if ( moveToLayoutFragment != null )
 287  
                 {
 288  0
                 	Fragment newMoveToFragment = null;
 289  
                     try
 290  
                     {
 291  0
                     	newMoveToFragment = moveToFragmentContext.getFragmentOnNewPage( newPage, registry );
 292  
                     	//log.info( "npe newMoveToFragment: " + newMoveToFragment.getType() + " " + newMoveToFragment.getId() );
 293  
                     }
 294  0
                     catch ( Exception ex )
 295  
                     {
 296  0
                     	log.error( "Failure to locate copy of destination fragment " + moveToLayoutFragment.getId(), ex );
 297  0
                     	success = false;
 298  0
                         resultMap.put( REASON, "Failed to find copy of destination fragment" );
 299  0
                         return success;
 300  0
                     }
 301  0
                     moveToLayoutFragment = newMoveToFragment;
 302  
                 }
 303  
             }
 304  
             
 305  0
             if ( moveToLayoutFragment != null )
 306  
             {
 307  0
                 success = moveToOtherLayoutFragment( requestContext,
 308  
                                         			 batch,
 309  
                                         			 resultMap,
 310  
                                         			 moveFragmentId,
 311  
                                         			 moveToLayoutFragment,
 312  
                                         			 currentLayoutFragment ) ;
 313  
             }
 314  
             else
 315  
             {
 316  0
             	PortletPlacementContext placement = null;
 317  0
             	Page page = requestContext.getPage();
 318  
             	
 319  0
             	if ( currentLayoutFragment == null )
 320  0
             		currentLayoutFragment = getParentFragmentById( moveFragmentId, page.getRootFragment() );
 321  
             	
 322  0
                 if ( currentLayoutFragment != null )
 323  0
                     placement = new PortletPlacementContextImpl( page, registry, currentLayoutFragment );
 324  
                 else
 325  0
                     placement = new PortletPlacementContextImpl( page, registry );
 326  
                 
 327  0
                 Fragment fragment = placement.getFragmentById(moveFragmentId);
 328  0
                 if ( fragment == null )
 329  
                 {
 330  0
                     success = false;
 331  0
                     resultMap.put( REASON, "Failed to find fragment for portlet id: " + moveFragmentId );
 332  0
                     return success;
 333  
                 }
 334  
                 
 335  0
                 success = moveInFragment( requestContext, placement, fragment, null, resultMap, batch );
 336  
             }
 337  0
             if ( success )
 338  
             {
 339  0
             	resultMap.put( STATUS, status );
 340  
             }
 341  
         }
 342  0
         catch ( Exception e )
 343  
         {
 344  
             // Log the exception
 345  0
             log.error( "exception while moving a portlet", e );
 346  0
             resultMap.put( REASON, e.toString() );
 347  
             // Return a failure indicator
 348  0
             success = false;
 349  0
         }
 350  
 
 351  0
         return success;
 352  
     }
 353  
     
 354  
     protected boolean moveInFragment( RequestContext requestContext, PortletPlacementContext placement, Fragment fragment, Fragment placeInLayoutFragment, Map resultMap, class="keyword">boolean batch )
 355  
         throws PortletPlacementException, NodeException, AJAXException
 356  
     {
 357  0
     	boolean success = true;
 358  
 
 359  0
     	String moveFragmentId = fragment.getId();
 360  0
     	boolean addFragment = (placeInLayoutFragment != null);
 361  0
         Coordinate returnCoordinate = null;
 362  0
         float oldX = 0f, oldY = 0f, oldZ = 0f, oldWidth = 0f, oldHeight = 0f;
 363  0
         float x = -1f, y = -1f, z = -1f, width = -1f, height = -1f;
 364  0
         boolean absHeightChanged = false;
 365  
 
 366  
         // desktop extended
 367  0
         String posExtended = getActionParameter( requestContext, DESKTOP_EXTENDED );
 368  0
         if ( posExtended != null )
 369  
         {
 370  0
             Map fragmentProperties = fragment.getProperties();
 371  0
             if ( fragmentProperties == null )
 372  
             {
 373  0
                 success = false;
 374  0
                 resultMap.put(REASON, "Failed to acquire fragment properties map for portlet id: " + moveFragmentId );
 375  0
                 return success;
 376  
             }
 377  0
             String oldDeskExt = (String)fragmentProperties.get( DESKTOP_EXTENDED );
 378  0
             resultMap.put( OLD_DESKTOP_EXTENDED, ( (oldDeskExt != null) ? oldDeskExt : "" ) );
 379  0
             fragmentProperties.put( DESKTOP_EXTENDED, posExtended );
 380  
         }
 381  
                 
 382  
         // only required for moveabs
 383  0
         if ( iMoveType == ABS )
 384  
         {
 385  0
             Coordinate newCoordinate = getCoordinateFromParams( requestContext );
 386  0
             returnCoordinate = placement.moveAbsolute( fragment, newCoordinate, addFragment );
 387  0
             String sHeight = getActionParameter( requestContext, HEIGHT );
 388  0
             if ( sHeight != null && sHeight.length() > 0 )
 389  
             {
 390  0
                 oldHeight = fragment.getLayoutHeight();
 391  0
                 height = Float.parseFloat( sHeight );
 392  0
                 fragment.setLayoutHeight( height );
 393  0
                 absHeightChanged = true;
 394  
             }
 395  0
         } 
 396  0
         else if ( iMoveType == LEFT )
 397  
         {
 398  0
             returnCoordinate = placement.moveLeft( fragment );
 399  
         } 
 400  0
         else if ( iMoveType == RIGHT )
 401  
         {
 402  0
             returnCoordinate = placement.moveRight( fragment );
 403  
         } 
 404  0
         else if ( iMoveType == UP )
 405  
         {
 406  0
             returnCoordinate = placement.moveUp( fragment );
 407  
         } 
 408  0
         else if ( iMoveType == DOWN )
 409  
         {
 410  0
             returnCoordinate = placement.moveDown( fragment );
 411  
         }
 412  0
         else if ( iMoveType == CARTESIAN )
 413  
         {
 414  0
             String sx = getActionParameter( requestContext, X );
 415  0
             String sy = getActionParameter( requestContext, Y );
 416  0
             String sz = getActionParameter( requestContext, Z );
 417  0
             String sWidth = getActionParameter( requestContext, WIDTH );
 418  0
             String sHeight = getActionParameter( requestContext, HEIGHT );
 419  0
             if ( sx != null )
 420  
             {
 421  0
                 oldX = fragment.getLayoutX();
 422  0
                 x = Float.parseFloat( sx ); 
 423  0
                 fragment.setLayoutX( x );
 424  
             }
 425  0
             if ( sy != null )
 426  
             {
 427  0
                 oldY = fragment.getLayoutY();                    
 428  0
                 y = Float.parseFloat( sy ); 
 429  0
                 fragment.setLayoutY( y );
 430  
             }                
 431  0
             if ( sz != null )
 432  
             {
 433  0
                 oldZ = fragment.getLayoutZ();                    
 434  0
                 z = Float.parseFloat( sz ); 
 435  0
                 fragment.setLayoutZ( z );
 436  
             }                
 437  0
             if ( sWidth != null )
 438  
             {
 439  0
                 oldWidth = fragment.getLayoutWidth();                    
 440  0
                 width = Float.parseFloat( sWidth ); 
 441  0
                 fragment.setLayoutWidth( width );
 442  
             }
 443  0
             if ( sHeight != null )
 444  
             {
 445  0
                 oldHeight = fragment.getLayoutHeight();                    
 446  0
                 height = Float.parseFloat( sHeight ); 
 447  0
                 fragment.setLayoutHeight( height );
 448  
             }
 449  
         }
 450  
         
 451  
         // synchronize back to the page layout root fragment
 452  0
         Page page = placement.syncPageFragments();
 453  
     
 454  0
         if ( placeInLayoutFragment != null )
 455  
         {
 456  0
             placeInLayoutFragment.getFragments().add( fragment );
 457  
         }
 458  
         
 459  0
         if ( pageManager != null && ! batch )
 460  
         {
 461  0
             pageManager.updatePage( page );
 462  
         }
 463  
         
 464  0
         if ( iMoveType == CARTESIAN )
 465  
         {
 466  0
             putCartesianResult( resultMap, x, oldX, X, OLD_X );
 467  0
             putCartesianResult( resultMap, y, oldY, Y, OLD_Y );                
 468  0
             putCartesianResult( resultMap, z, oldZ, Z, OLD_Z );
 469  0
             putCartesianResult( resultMap, width, oldWidth, WIDTH, OLD_WIDTH );
 470  0
             putCartesianResult( resultMap, height, oldHeight, HEIGHT, OLD_HEIGHT );
 471  
         }
 472  
         else
 473  
         {
 474  
             // Need to determine what the old col and row were
 475  0
             resultMap.put( OLDCOL, String.valueOf( returnCoordinate.getOldCol() ) );
 476  0
             resultMap.put( OLDROW, String.valueOf( returnCoordinate.getOldRow() ) );
 477  
             // Need to determine what the new col and row were
 478  0
             resultMap.put( NEWCOL, String.valueOf( returnCoordinate.getNewCol() ) );
 479  0
             resultMap.put( NEWROW, String.valueOf( returnCoordinate.getNewRow() ) );
 480  0
             if ( absHeightChanged )
 481  
             {
 482  0
                 putCartesianResult( resultMap, height, oldHeight, HEIGHT, OLD_HEIGHT );
 483  
             }
 484  
         }
 485  
         
 486  0
         resultMap.put( FRAGMENTID, moveFragmentId );
 487  
         
 488  0
         return success;
 489  
     }
 490  
 
 491  
     protected boolean moveToOtherLayoutFragment( RequestContext requestContext,
 492  
                                                  boolean batch,
 493  
                                                  Map resultMap,
 494  
                                                  String moveFragmentId,
 495  
                                                  Fragment moveToLayoutFragment,
 496  
                                                  Fragment removeFromLayoutFragment )
 497  
         throws PortletPlacementException, NodeException, AJAXException
 498  
     {
 499  0
         boolean success = true;
 500  0
         Fragment placeFragment = null;
 501  0
         if ( removeFromLayoutFragment != null )
 502  
         {
 503  0
         	Page page = requestContext.getPage();
 504  0
             PortletPlacementContext placement = new PortletPlacementContextImpl( page, registry, removeFromLayoutFragment );
 505  
         
 506  0
             placeFragment = placement.getFragmentById( moveFragmentId );
 507  0
             if ( placeFragment == null )
 508  
             {
 509  0
                 success = false;
 510  0
                 resultMap.put( REASON, "Failed to find fragment to move to another layout for fragment id: " + moveFragmentId );
 511  0
                 return success;
 512  
             }
 513  0
             placement.remove( placeFragment );
 514  0
             page = placement.syncPageFragments();
 515  0
             page.removeFragmentById( moveFragmentId );
 516  
         }
 517  0
         if ( placeFragment != null )
 518  
         {
 519  0
             return placeFragment( requestContext,
 520  
                                   batch,
 521  
                                   resultMap,
 522  
                                   placeFragment,
 523  
                                   moveToLayoutFragment );
 524  
         }
 525  0
         return success;
 526  
     }
 527  
 
 528  
     protected boolean placeFragment( RequestContext requestContext,
 529  
                                      boolean batch,
 530  
                                      Map resultMap,
 531  
                                      Fragment placeFragment,
 532  
                                      Fragment placeInLayoutFragment )
 533  
         throws PortletPlacementException, NodeException, AJAXException
 534  
     {
 535  0
         boolean success = true;
 536  0
         if ( placeFragment == null )
 537  
         {
 538  0
             success = false;
 539  0
             return success;
 540  
         }
 541  
         
 542  
         // add fragment
 543  0
         Page page = requestContext.getPage();
 544  0
         PortletPlacementContext placement = new PortletPlacementContextImpl( page, registry, placeInLayoutFragment );
 545  
         //placement.add( placeFragment, getCoordinateFromParams( requestContext ) );
 546  
         
 547  0
         success = moveInFragment( requestContext, placement, placeFragment, placeInLayoutFragment, resultMap, batch );
 548  
 
 549  0
         return success;
 550  
     }
 551  
     
 552  
     protected Coordinate getCoordinateFromParams(RequestContext requestContext)
 553  
     {
 554  0
         String a_sCol = getActionParameter( requestContext, COL );
 555  0
         String a_sRow = getActionParameter( requestContext, ROW );
 556  
 
 557  0
         int a_iCol = 0;
 558  0
         int a_iRow = 0;
 559  
 
 560  
         // Convert the col and row into integers
 561  0
         if ( a_sCol != null )
 562  
         {
 563  0
             a_iCol = Integer.parseInt( a_sCol );
 564  
         }
 565  0
         if ( a_sRow != null )
 566  
         {
 567  0
             a_iRow = Integer.parseInt( a_sRow );
 568  
         }
 569  
 
 570  0
         Coordinate a_oCoordinate = new CoordinateImpl( 0, 0, a_iCol, a_iRow );
 571  0
         return a_oCoordinate;
 572  
     }
 573  
 
 574  
     protected void putCartesianResult(Map resultMap, float value, class="keyword">float oldValue, String name, String oldName)
 575  
     {    
 576  0
         if (value != -1F)
 577  
         {
 578  0
             resultMap.put(oldName, new Float(oldValue));
 579  0
             resultMap.put(name, new Float(value));
 580  
         }
 581  0
     }
 582  
     
 583  
     protected PortletRegistry getPortletRegistry()
 584  
     {
 585  0
     	return this.registry;
 586  
     }
 587  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.