Hi!

I've began to work on adding custom label support on Gerrit Trigger plugin.
Currently, there are 2 default labels:Code-Review and Verified, which have
hardcoded votes on the 5 distinct build outcomes (successful, failed,
started, unstable and not built)

Those votes on each label are persisted with the help of a databound
setter, like so:

<tr><td></td><td><div style="font-weight: bold; border-bottom: 1px
solid black; margin-bottom: 0.2em; margin-top:
0.4em;">${%Verify}</div></td></tr>
<f:entry title="${%Started}"
         field="gerritBuildStartedVerifiedValue"
         
help="/plugin/gerrit-trigger/trigger/help-GerritBuildStartedVerified.html">
    <f:textbox name="gerritBuildStartedVerifiedValue"
               value="${it.gerritBuildStartedVerifiedValue}"
               default=""
               
checkUrl="'descriptorByName/com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger/emptyOrIntegerCheck?value='+escape(this.value)"/>
</f:entry>

@DataBoundSetter
public void setGerritBuildStartedVerifiedValue(Integer
gerritBuildStartedVerifiedValue) {
    this.gerritBuildStartedVerifiedValue = gerritBuildStartedVerifiedValue;
}

So it's a 1-to-1 relationship between the java field and the actual textbox
in the web UI section.
The persistance is done by reflection, so the
gerritBuildStartedVerifiedValue is matched by
setGerritBuildVerifiedStartedValue automatically.

Now my question:
How do I persist a custom list of labels? Since I don't know how many
labels there are at some point (and what their names will be) I can't work
with databound setters.

<j:forEach items="${instance.getVerdictCategoriesList()}" var="p">
        <tr>
            <td></td>
            <td>
                <div style="font-weight: bold; border-bottom: 1px
solid black; margin-bottom: 0.2em; margin-top: 0.4em;">
                    ${p.verdictValue}
                </div>
            </td>
        </tr>
        <f:entry title="${%Started}"
                 field="startedVote">
            <f:textbox name="startedVote"
                       value=""
                       default=""/>
        </f:entry>


        <f:entry title="${%Successful}"
                 field="successfulVote">
            <f:textbox name="successfulVote"
                       value=""
                       default=""/>
        </f:entry>


        <f:entry title="${%Failed}"
                 field="failedVote">
            <f:textbox name="failedVote"
                       value=""
                       default=""/>
        </f:entry>


        <f:entry title="${%Unstable}"
                 field="unstableVote">
            <f:textbox name="unstableVote"
                       value=""
                       default=""/>
        </f:entry>


        <f:entry title="${%Not Built}"
                 field="notBuiltVote">
            <f:textbox name="notBuiltVote"
                       value=""
                       default=""/>
        </f:entry>
    </j:if>
</j:forEach>

This is what I currently have in order to display custom labels and their
custom votes, but I don't see how I can persist the custom votes values. On
the UI, it looks like this (currently added only 1 custom label called
Validated) :
[image: image.png]

I already have a data structure containing all the custom labels and their
custom votes on each build outcome available through
*instance.getVerdictCategoriesList()
*but I don't know how I can set those values from the UI.
Any help is much appreciated!

P.S. Keep in mind that there can be an indefinite number of custom labels
that you can add.
-- 
George Cimpoies
R&D • Itiviti
Software Engineer

Mobile: +40 751 048 489
[email protected]

1 Victor Deleu Street | Cluj-Napoca, Cluj 400112

-- 



Visit: itiviti.com <https://www.itiviti.com/> / ullink.com 
<https://www.ullink.com/> »
Read the latest news from Itiviti » 
<http://www.itiviti.com/news/>




*The information contained in or 
attached to this email is strictly confidential. If you are not the 
intended recipient, please notify us immediately by telephone and return 
the message to us.*

*
*

*Email communications by definition contain 
personal information. The ITIVITI group of companies (of which ULLINK forms 
part) is subject to European data protection regulations. ULLINK’s Privacy 
Policy is available at www.ullink.com <http://www.ullink.com/>. ULLINK 
expects the recipient of this email to be compliant with ULLINK’s Privacy 
Policy and applicable regulations. Please advise us immediately at 
[email protected] <mailto:[email protected]> if you are not 
compliant with these.*

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CABE7CDe8%2BDT1fiATYep2_xCphqjUkX90Ya_wUJPR-MrMJ3KZ%2BQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to