subash-canapathy / maven-confluence-plugin

Automatically exported from code.google.com/p/maven-confluence-plugin
0 stars 0 forks source link

As a tech writer I want to be able to assign different labels to different pages so that I can find common content across my site #56

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Using the site.xml option, labels can only be applied at the site level.  As a 
tech writer I want to be able to assign different labels to different pages so 
that I can find common content across my site.

I'm assuming it is a case of updating the XSD schema and Site.Child class to 
allow page specific labels.

Original issue reported on code.google.com by mwba...@gmail.com on 1 Aug 2013 at 11:53

GoogleCodeExporter commented 9 years ago
Hi, Thanks for feedbacks

I'll start working on soon

Original comment by bartolom...@gmail.com on 1 Aug 2013 at 9:25

GoogleCodeExporter commented 9 years ago

Original comment by bartolom...@gmail.com on 6 Aug 2013 at 9:15

GoogleCodeExporter commented 9 years ago
i've deployed 3.4.0-SNAPSHOT release with requested fix 

please test it and let me know

Original comment by bartolom...@gmail.com on 6 Aug 2013 at 6:17

GoogleCodeExporter commented 9 years ago
The new schema is in branch master 

maven-confluence-plugin/schemas/site-schema-3.4.0-SNAPSHOT.xsd

Original comment by bartolom...@gmail.com on 6 Aug 2013 at 6:24

GoogleCodeExporter commented 9 years ago
Thanks for the quick update.

I have been able to add specific labels to pages, which is great.

A couple of minor requests.

1. For the getComputedLabels() method to work, there must be site level labels
eg:
<site ...>
<label>site-1</label>
...
It appears that the site object is never null and that the site object must 
have a label for the child labels to be 'computed'.

2. If you update a label, you end up with two labels.  In the case above, if 
the site-1 label was updated to site-2, the page would then list two labels 
after generation.

Ugly code, but functional:
            Long pageId = Long.parseLong(p.getId());
            List<String> currentLabels = new java.util.ArrayList<String>();
            for (Object lbl : confluence.getLabelsById(pageId)) {
                currentLabels.add(((Label)lbl).getName());
            }

            Label swizzleLabel = new Label();
            for( String label : child.getComputedLabels() ) {

                if (!currentLabels.contains(label)) {
                    confluence.addLabelByName(label, pageId );
                } else {
                    currentLabels.remove(label);
                }
            }

            for (String label : currentLabels) {
                confluence.removeLabelByName(label, pageId);
            }

NOTE: It appears that the org.codehaus.swizzle.confluence.Confluence class has 
include of java.awt.Label that breaks the code snippet above.  I deleted the 
import and it worked.

Thanks again.

Original comment by mwba...@gmail.com on 7 Aug 2013 at 12:40

GoogleCodeExporter commented 9 years ago
Hi thx for feedbacks

original idea was to implement label inheritance when use model ... 

1. site inherits configuration labels (which ones present in pom)
2. home inherits site labels
3. children inherits  site labels

I've seen that there is an issue on this and i'll trying to fix it

Original comment by bartolom...@gmail.com on 9 Aug 2013 at 9:23

GoogleCodeExporter commented 9 years ago
Hi

i've fixed problem (following the original strategy)  and fix is available in 
the latest 3.4.0-SNAPSHOT

Original comment by bartolom...@gmail.com on 9 Aug 2013 at 10:20

GoogleCodeExporter commented 9 years ago
The inheritance works now.  Thanks for the updates.

It would be good if you can incorporate the label sync as well to clean up 
redundant labels.  I noticed this as I was testing by changing labels in the 
site.xml then performing a mvn site:site.  As the pages were being updated, the 
labels were being added, resulting in the updated pages including labels that 
shouldn't have been there.

Not a show stopper, but it would be good to include so that labels are kept in 
sync.

Original comment by mwba...@gmail.com on 12 Aug 2013 at 11:18

GoogleCodeExporter commented 9 years ago
I've released version 3.4.0 that allows to have labels per page

Original comment by bartolom...@gmail.com on 17 Aug 2013 at 7:09

GoogleCodeExporter commented 9 years ago
new supported schema at

https://code.google.com/p/maven-confluence-plugin/source/browse/schemas/site-sch
ema-3.4.0.xsd

Original comment by bartolom...@gmail.com on 17 Aug 2013 at 8:46