1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package com.xpn.xwiki.internal.render

File LinkedResourceHelper.java

 

Code metrics

0
0
0
1
79
19
0
-
-
0
-

Classes

Class Line # Actions
LinkedResourceHelper 41 0 - 0 0
-1.0 -
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package com.xpn.xwiki.internal.render;
21   
22    import java.util.List;
23   
24    import org.xwiki.component.annotation.Role;
25    import org.xwiki.rendering.block.Block;
26    import org.xwiki.rendering.block.LinkBlock;
27    import org.xwiki.rendering.block.MacroBlock;
28    import org.xwiki.rendering.block.XDOM;
29    import org.xwiki.rendering.listener.reference.ResourceReference;
30    import org.xwiki.rendering.listener.reference.ResourceType;
31   
32    /**
33    * Helper component to extract blocks ({@link LinkBlock}, {@link MacroBlock}) that link to documents or spaces from a
34    * given XDOM and to generically read and write the resources from and to these blocks.
35    *
36    * @version $Id: 15548ad47e362d4fa59a85f0745ab2c521538606 $
37    * @since 7.4.1
38    * @since 8.0M1
39    */
40    @Role
 
41    public interface LinkedResourceHelper
42    {
43    /**
44    * @param xdom the XDOM to extract from
45    * @return the list of blocks that link to documents or spaces.
46    */
47    List<Block> getBlocks(XDOM xdom);
48   
49    /**
50    * @param block the block to extract from
51    * @return the resource reference string pointing to a document or space
52    */
53    String getResourceReferenceString(Block block);
54   
55    /**
56    * @param block the block to write to
57    * @param newReferenceString the new resource reference string that the block should point to
58    */
59    void setResourceReferenceString(Block block, String newReferenceString);
60   
61    /**
62    * @param block the block to extract from
63    * @return the type of the resource pointing to a document or space
64    */
65    ResourceType getResourceType(Block block);
66   
67    /**
68    * @param block the block to write to
69    * @param newResourceType the new type of resource that the block should point to
70    */
71    void setResourceType(Block block, ResourceType newResourceType);
72   
73    /**
74    * @param block the block to extract from
75    * @return the resource reference corresponding to the given block or {@code null} if none was found or if the block
76    * type is unsupported
77    */
78    ResourceReference getResourceReference(Block block);
79    }