The type for the transientActionFactory should be the type you want to provide Actions for. for example Job, View or Run etc.
TransientActionFactory<Job> If you specify that then I don't think you need to implement the type method. /B On Tue, Nov 10, 2015 at 11:54 AM, Manu Kaamelott <[email protected]> wrote: > Hi thank you Daniel, > I don't understand very well what is an action. I read this I think I > didn't understand enough : > > https://wiki.jenkins-ci.org/display/JENKINS/Action+and+its+family+of+subtypes > > I am sure I have to write in type and creatFor but I don't understand > what. Thank you for the future answers. > Hope I explain very well :) ! > Manu > > I have this file: > FPJTransientActionFactory.java > @Extension > public class FPJTransientActionFactory extends TransientActionFactory<Flag > >{ > > > private Job job; > public List warningGet = new LinkedList(); > public List errorGet = new LinkedList(); > > public String getJobsFlag() throws IOException, RedmineException{ > Flag jobFlag = new Flag(); > String flag = jobFlag.getFlag(job); > > //List of warnings and errors > warningGet = jobFlag.getWarning(); > errorGet = jobFlag.getError(); > return flag; > } > @Override > public Class<Flag> type() { > throw new UnsupportedOperationException("Not supported yet."); //To > change body of generated methods, choose Tools | Templates. > } > @Override > public Collection<? extends Action> createFor(Flag t) { > throw new UnsupportedOperationException("Not supported yet."); //To > change body of generated methods, choose Tools | Templates. > } > } > > jobMain.jelly > <j:jelly xmlns:j="jelly:core"> > <!-- TODO --> > <link rel="stylesheet" href = > "${rootURL}/plugin/redmine/css/styleFlag.css" type="text/css"/> > > <table class="tableau"> > <tr> > <th>Drapeau</th> > <th>Erreur</th> > <th>Warning</th> > </tr> > <tr> > <td>${it.jobsFlag}</td> > <td> > <j:forEach var="error" items="${it.errorGet}"> > ${error}<br /> > </j:forEach> > </td> > <td> > <j:forEach var="warning" items="${it.warningGet}"> > ${warning} > </j:forEach> > </td> > </tr> > </table> > </j:jelly> > > Le jeudi 5 novembre 2015 13:11:24 UTC+1, Daniel Beck a écrit : >> >> >> On 05.11.2015, at 11:55, Manu Kaamelott <[email protected]> wrote: >> >> > But I didn't understand how write something in the main job page. I >> found mainJob.jelly but that didn't work. >> > I'd like to know how can I write in it. Can I use juste a ".java and >> .jelly" ? >> >> Hi Manu, >> >> First, you need to define an Action that gets associated with the Job you >> have. >> >> One way to do this is TransientActionFactory, assuming you have no data >> to store with the job. And if you do, you need something that explicitly >> adds the Action to the job, and then saves the job. >> >> Afterwards it's just a matter of adding a jobMain.jelly view to the >> Action, so in the regular Maven layout: >> >> If this is your Action class: >> src/main/java/com/acme/my_plugin/MyAction.java >> This is the Jelly view fragment shown on the job page: >> src/main/resources/com/acme/my_plugin/MyAction/jobMain.jelly >> >> So it's not a Jelly file corresponding to the Java file, but rather one >> stored in a folder with the same name as the class and with a name >> determined by convention (e.g. config.jelly for parts of the job config). >> >> Daniel >> >> -- > 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/4634b067-4456-4ca4-866d-b77da0027c66%40googlegroups.com > <https://groups.google.com/d/msgid/jenkinsci-dev/4634b067-4456-4ca4-866d-b77da0027c66%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- Robert Sandell *Software Engineer* *CloudBees Inc.* -- 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/CALzHZS2SAW1FsLg8ZxCsf7nO7y-8754N0QsjMO8OaYHoE87urw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
