Oracle ADF openPopUp with PageFragments - popup

I have a popup that was opened when a query was performed. I had a bean that processed the query and then opened my popup.
The problem is that I now changed my page from .jsf to .jsff(Fragments), and it is no longer working.
Can anyone explain me how to solve this problem?
This is my Bean Class:
package view;
import javax.el.ELContext;
import javax.el.ExpressionFactory;
import javax.el.MethodExpression;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.event.ComponentSystemEvent;
import oracle.adf.view.rich.component.rich.RichPopup;
import oracle.adf.view.rich.event.QueryEvent;
import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;
import org.apache.myfaces.trinidad.util.Service;
public class newBean {
public newBean() {
super();
}
public void processSomeQuery(QueryEvent queryEvent) {
/** Manipulate ViewCriteria, if you want and
* then invoke query,optionally
*/
System.out.println("INNNNNNNNNNNNNNNNN");
invokeQueryEventMethodExpression("#{bindings.ImplicitViewCriteriaQuery.processQuery}",
queryEvent);
openPopup("p1");
}
/**
* Gets ViewCriteria used by the QueryModel
*/
private void invokeQueryEventMethodExpression(String expression,
QueryEvent queryEvent) {
FacesContext fctx = FacesContext.getCurrentInstance();
ELContext elctx = fctx.getELContext();
ExpressionFactory efactory =
fctx.getApplication().getExpressionFactory();
MethodExpression me =
efactory.createMethodExpression(elctx, expression, Object.class,
new Class[] { QueryEvent.class });
me.invoke(elctx, new Object[] { queryEvent });
}
public void openPopup (String popupId) {
ExtendedRenderKitService erkService =
Service.getService(FacesContext.getCurrentInstance().getRenderKit(),
ExtendedRenderKitService.class);
erkService.addScript(FacesContext.getCurrentInstance(),
"var hints = {autodismissNever:true}; " +
"AdfPage.PAGE.findComponent('" + popupId +
"').show(hints);");
System.out.println("POPUP INNNNN");
}
public void closePopup (String popupId) {
ExtendedRenderKitService erkService =
Service.getService(FacesContext.getCurrentInstance().getRenderKit(),
ExtendedRenderKitService.class);
erkService.addScript(FacesContext.getCurrentInstance(),
"var hints = {autodismissNever:true}; " +
"AdfPage.PAGE.findComponent('" + popupId +
"').hide(hints);");
}
}
This is my popup Code which has a table inside to show results from a query:
<af:panelGroupLayout layout="vertical" id="pgl2">
<af:popup childCreation="deferred" autoCancel="disabled" id="p1" contentDelivery="lazyUncached">
<af:panelWindow id="pw1">
<af:panelCollection id="pc1">
<f:facet name="menus"/>
<f:facet name="toolbar"/>
<f:facet name="statusbar"/>
<af:table value="#{bindings.NameView1_1.collectionModel}" var="row"
rows="#{bindings.NameView1_1.rangeSize}"
emptyText="#{bindings.NameView1_1.viewable ? 'No data to display.' : 'Access Denied.'}"
rowBandingInterval="0"
selectedRowKeys="#{bindings.NameView1_1.collectionModel.selectedRow}"
selectionListener="#{bindings.NameView1_1.collectionModel.makeCurrent}"
rowSelection="single" fetchSize="#{bindings.NameView1_1.rangeSize}"
id="resId1">
<af:column headerText="#{bindings.NameView1_1.hints.IdNo.label}" id="resId1c1">
<af:outputText value="#{row.IdNo}"
shortDesc="#{bindings.NameView1_1.hints.IdNo.tooltip}" id="ot1">
<af:convertNumber groupingUsed="false"
pattern="#{bindings.NameView1_1.hints.IdNo.format}"/>
</af:outputText>
</af:column>
<af:column headerText="#{bindings.NameView1_1.hints.Title.label}" id="resId1c2">
<af:outputText value="#{row.Title}"
shortDesc="#{bindings.NameView1_1.hints.Title.tooltip}"
id="ot2"/>
</af:column>
<af:column headerText="#{bindings.NameView1_1.hints.Name.label}" id="resId1c3">
<af:outputText value="#{row.Name}"
shortDesc="#{bindings.NameView1_1.hints.Name.tooltip}" id="ot3"/>
</af:column>
<af:column headerText="#{bindings.NameView1_1.hints.Rowid1.label}" id="resId1c28">
<af:outputText value="#{row.Rowid1}"
shortDesc="#{bindings.NameView1_1.hints.Rowid1.tooltip}"
id="ot28"/>
</af:column>
</af:table>
</af:panelCollection>
</af:panelWindow>
</af:popup>
PS: To not had very extensive code for the table I deleted to post here some of the table values, hope I did not made mistake.
Also on the query I defined the QueryListner to be: #{managedBean1.processSomeQuery}
Thanks you so much.
Best Regards

You should not use PopupId directly, create binding for your popup in your newBean Class and use this binding and method getClientId();
for instance, change the newBean and add the following inside of the top of the class
private RichPopup myPopup=new RichPopup();
public RichPopup getMyPopup(){ return this.myPopup; }
public void setMyPopup(RichPopup myPopup) { this.myPopup = myPopup; }
Then change the code inside openPopup function so that:
erkService.addScript(FacesContext.getCurrentInstance(),
"var hints = {autodismissNever:true}; " +
"AdfPage.PAGE.findComponent('" + popupId +
"').show(hints);");
System.out.println("POPUP INNNNN");
get replaced by
myPopup.show(hints);
System.out.println("POPUP INNNNN");
Don't forget to bind your popup inside the jsff like the following:
<af:popup childCreation="deferred" autoCancel="disabled" id="p1" contentDelivery="lazyUncached" bindings="#{pageFlowScope.newBean.myPopup}">

Related

Value is not valid using entryset

This issue arrived when I tried to use a LinkedHashMap to save entries from a database. I don't know to what extent the xhtml code is working, but superficially looks well.
The issue is in this part of the xhtml:
<tbody>
<tr>
<td>Movie:</td>
<!--td>
<h:selectOneMenu id="foundmovieid" value="#{webRental.idmovie}">
<f:selectItems id="movieid" value="#{webMovie.get_all_movies()}"></f:selectItems>
</h:selectOneMenu>
</td-->
<td>
<h:selectOneMenu value="#{webRental.idmovie}">
<f:selectItems value="#{webMovie.availableMovies.entrySet()}" var="entry"
itemValue="#{entry.key}" itemLabel="#{entry.value}" />
</h:selectOneMenu>
</td>
</tr>
</tbody>
</table>
<h:commandButton value="Submit" action="#{webRental.save()}"></h:commandButton>
Here is the WebRental.java:
public class WebRental {
#EJB
private RentalsFacade rf;
private String iduser;
private String idmovie;
//getters and setters
public List<Rentals> get_all_rents() {
return rf.findAll();
}
public void save() {
try {
rf.Save(iduser, idmovie);
} catch (Exception e) {
}
}
}
and the WebMovie.java, whose MoviesFacade has an EntityManager and a way to persist new pbject Movies (id, title, director's name and length):
#Named
#RequestScoped
public class WebMovie {
#EJB
private MoviesFacade mf;
private String id;
private String title;
private String director;
private int length;
private Map<String, String> availableMovies;
//geters and setters
public List<Movies> get_all_movies() {
availableMovies = new LinkedHashMap<>();
List<Movies> found = mf.findAll();
found.forEach((m) -> {
String first = m.getId();
String second = m.getTitle() + ", " + m.getDirector() + ", " + m.getLength() + " minutes.";
availableMovies.put(first,second);
});
return mf.findAll();
}
public void save() {
try {
mf.Save(id, title, director, length);
} catch (Exception e) {
}
}
}
In the xhtml, theres a muted section, which is just what I have to do (get id's and submit them) but in a way that you only see the id's. The unmuted section is the part im having trouble with, since it says that the value is invalid.
To solve this do I have to use "converters"? If so, how do I implement it? If not, what is my error?
Also, in the muted section there is a call to "get_all_movies()", but since it's muted, it shouldnt be called. How do I call that function outside of that muted section so I can delete the whole section after I get the SelectOneMenu with the map working?
Turns out using Maps is very strange...
How I solved this was by removing most of the SelectItems so that it just is:
<f:selectItems value="#{webMovie.availableMovies}" />
And then changing the way I insert everything to the Map like so:
#PostConstruct
public void init() {
availableMovies = new HashMap<>();
mf.findAll().forEach((m) -> {
availableMovies.put((String) m.getTitle() + ", " + m.getDirector() + ", " + m.getLength() + " minutes.",(String) m.getId());
});
//Turns out that, for the selectItems to read properly the map, you have to insert the text you want to be displayed as the key, and then the value as value. I was doing it backwards.
}
That way I dont have to depend on the !--'d section that calls get_all_movies() and I could delete it!

how to pass data to onTestSuccess method in Listener class of TESTNG for each iteration from #Test method used dataprovider

, i have a #Test method with dataprovider , i have a Listener.class , my target is that when my #Test method is success, the status of case in testrail is setted as "Passed" automatically in onTestSuccess Method of Listener class , this process is ok, but when i use dataprovider for #Test Method, this causes the problem
i want that same method must be worked (let say) three times because of dataprovider and different case id data must be sent to onTestSuccess method for each iteration from #Test method
My Listener.class
package com.myproject.test.listeners;
import java.lang.reflect.Method;
import org.testng.IClass;
import org.testng.IInvokedMethod;
import org.testng.IInvokedMethodListener;
import org.testng.ISuite;
import org.testng.ISuiteListener;
import org.testng.ITestContext;
import org.testng.ITestListener;
import org.testng.ITestResult;
public class Listener implements ITestListener, ISuiteListener, IInvokedMethodListener {
...
public void onTestStart(ITestResult result) {
}
public void onTestSuccess(ITestResult result) {
try {
Program pr = new Program();
System.out.println("onTestSuccess Method for :" + result.getName());
String TestID = null;
String TestRunID = null;
for (Method testMethod : result.getTestClass().getRealClass().getMethods()) {
if (testMethod.getName().equals(result.getName()) && testMethod.isAnnotationPresent(UseAsTestRailId.class)) {
UseAsTestRailId useAsTestName = testMethod.getAnnotation(UseAsTestRailId.class);
TestID = Integer.toString(useAsTestName.testRailCaseId());
TestRunID = Integer.toString(useAsTestName.testRailRunId());
System.out.println("Case ID---> " + TestID + " Run ID--> " + TestRunID);
// 1 = Passed
pr.enterTestResult(TestRunID, TestID, 1);
}
}
} catch (Exception ex) {
System.out.println(ex.toString());
}
}
...
}
My test class (SettingsTests.java) including my #Test method (checkCurrentPasswordFormatIsValidatedTest)
#Listeners(com.test.listeners.Listener.class)
//listener annotation row is written in BaseTest class
public class SettingsTests extends BaseTest {
...
/**
* Test Case - C5001275 - Check that "Please enter at least 8 characters."
* message is displayed when entered value into "Current Password" field in
* wrong format This case will run two times!
*
* #param currentPasswordValue
*/
#Test(dataProvider = "currentPasswordTestWithWrongValue")
#UseAsTestRailId(testRailCaseId = 5001275,testRailRunId = 56662)
// aim is that to send different case id for each iteration,now even if method works twice , only one testRailCaseId is sent
public void checkCurrentPasswordFormatIsValidatedTest(String currentPasswordValue) {
logger.trace("STARTING TEST: checkCurrentPasswordFormatisValidatedTest");
logger.trace("Test Step : Enter current password in wrong format");
settingsPageObject.enterCurrentPassword(currentPasswordValue);
logger.trace("Test Step : Click on the button 'UPDATE' ");
settingsPageObject.clickOnUpdateButton();
logger.trace("Expected Result: The message 'Please enter at least 8 characters.' is displayed on screen.");
Assert.assertEquals(settingsPageObject.getCurrentPasswordWrongText(), "Please enter at least 8 characters.");
}
#DataProvider(name = "currentPasswordTestWithWrongValue")
public static Object[][] validateTestWithCurrentPasswordInWrongFormat() {
return new Object[][] { { RandomStringUtils.randomAlphabetic(7) }, { RandomStringUtils.randomAlphabetic(1) } };
}
...
}
My annotation class (UseAsTestRailId.java)
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
#Retention(RetentionPolicy.RUNTIME)
#Target(ElementType.METHOD)
public #interface UseAsTestRailId
{
int testRailCaseId() default 0;
int testRailRunId() default 0;
String[] tags() default "";
}
Some #Test methods to set two case status, some #Test methods to set three case status in testRail,so the more dataprovider data set needed the more case id needed , it must be dynamical
You can use the setattribute value in the testresult object to set custom value. Get the currentresult from Reporter : Reporter.getCurrentTestresult and then setAttribute ("TC_id",sasdf) and use that in your ontestsuccess using the getAttribute ("TC_id") on result object.

Error setting database config property for IDatabaseConnection (HSQLDB)

I've included fully testable code below, which generates the following error when supplied with a dataset xml containing empty fields. A sample dataset.xml is also below.
java.lang.IllegalArgumentException: table.column=places.CITY value is
empty but must contain a value (to disable this feature check, set
DatabaseConfig.FEATURE_ALLOW_EMPTY_FIELDS to true)
The thread here is similar but is different since it uses multiple dbTester.getConnection() whereas my code only uses one, yet has the same error. The main problem relates to this line databaseConfig.setProperty(DatabaseConfig.FEATURE_ALLOW_EMPTY_FIELDS, Boolean.TRUE); .
It seems to be ignored entirely. I've tried putting the init code inside the #Test method but the error remains.
dataset.xml
<?xml version='1.0' encoding='UTF-8'?>
<dataset>
<places address="123 Up Street" city="Chicago" id="001"/>
<places address="456 Down Street" city="" id="002"/>
<places address="789 Right Street" city="Boston" id="003"/>
</dataset>
Code:
import org.dbunit.IDatabaseTester;
import org.dbunit.JdbcDatabaseTester;
import org.dbunit.database.DatabaseConfig;
import org.dbunit.database.IDatabaseConnection;
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.xml.FlatXmlDataSetBuilder;
import org.dbunit.operation.DatabaseOperation;
import org.junit.Before;
import org.junit.Test;
import java.io.File;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
public class DBConnectionIT {
IDatabaseTester databaseTester = null;
IDatabaseConnection iConn = null;
Connection connection = null;
#Before
public void init() throws Exception {
databaseTester = new JdbcDatabaseTester(org.hsqldb.jdbcDriver.class.getName(), "jdbc:hsqldb:mem:testdb;sql.syntax_pgs=true", "sa", "");
iConn = databaseTester.getConnection();
DatabaseConfig databaseConfig = iConn.getConfig();
databaseConfig.setProperty(DatabaseConfig.FEATURE_ALLOW_EMPTY_FIELDS, Boolean.TRUE);
connection = iConn.getConnection();
createTable(connection);
IDataSet dataSet = new FlatXmlDataSetBuilder().build(new File("dataset.xml"));
databaseTester.setDataSet(dataSet);
databaseTester.setSetUpOperation(DatabaseOperation.CLEAN_INSERT);
databaseTester.setTearDownOperation(DatabaseOperation.DELETE_ALL);
databaseTester.onSetup();
}
#Test
public void testDBUnit() {
try {
PreparedStatement pst = connection.prepareStatement("select * from places");
ResultSet rs = pst.executeQuery();
while (rs.next()) {
System.out.println(rs.getString(1));
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
private void createTable(Connection conn) throws Exception {
PreparedStatement pp = conn.prepareStatement(
"CREATE TABLE PLACES" +
"(address VARCHAR(255), " +
"city TEXT, " +
"id VARCHAR(255) NOT NULL primary key)");
pp.executeUpdate();
pp.close();
}
}
EDIT (based on César Rodríguez's answer):
I've now refactored out this method in the parent class:
protected void setUpDatabaseConfig(DatabaseConfig databaseConfig) {
databaseConfig.setProperty(DatabaseConfig.FEATURE_ALLOW_EMPTY_FIELDS, Boolean.TRUE);
}
and created a sub-class which #Overrides this method, but it's saying this sub-class is not being used. How do I address this class (DBConnectionOverride) in the parent class, to solve my problem?
class DBConnectionOverride extends DBConnectionIT {
#Override
protected void setUpDatabaseConfig(DatabaseConfig databaseConfig) {
databaseConfig.setProperty(DatabaseConfig.FEATURE_ALLOW_EMPTY_FIELDS, true);
}
}
I've stumbled upon the correct answer, at least the one which solves my problem. It related to this line all along databaseTester.onSetup() which could simply be replaced with DatabaseOperation.CLEAN_INSERT.execute(iConn, dataSet);. Feel free comment on why this seemed to have fixed the error.
You must override method setUpDatabaseConfig(DatabaseConfig config) as follows:
#Override
protected void setUpDatabaseConfig(DatabaseConfig config) {
config.setProperty(DatabaseConfig.FEATURE_ALLOW_EMPTY_FIELDS, true);
}
Hope it helps
for me it's work:
IDatabaseConnection dbConn = new DatabaseDataSourceConnection(getDataSource());
dbConn.getConfig().setProperty(DatabaseConfig.FEATURE_ALLOW_EMPTY_FIELDS, true);
DatabaseOperation.CLEAN_INSERT.execute(dbConn, getiDataSet(loadDBData.source()));

Wicket 7 with wicketstuff tinymce4 Can't load language

I'm running Wicket 7.5.0 and wicketstuff-tinymcr with the same version.
Im trying to initialize a tinyMce editor but I get this error:
Failed to load:
http://localhost:8080/mywebapp/wicket/resource/wicket.contrib.tinymce4.TinyMceBehavior/tinymce/langs/sv.js
The tiny script is loaded though:
http://localhost:8080/mywebapp/wicket/resource/wicket.contrib.tinymce4.TinyMceBehavior/tinymce/tinymce-ver-1481290207000.js
This seems to be loaded:
plugins/...
themes/...
./tinymce-ver-1481290207000.js
EDIT
This took care of it:
addCustomSetting("language: \"sv_SE\"");
This are the classes that loads it all:
import wicket.contrib.tinymce4.settings.TinyMCESettings;
public class MyTinyMCESettings extends TinyMCESettings {
public MyTinyMCESettings(TinyMCESettings.Theme theme) {
super(theme);
addCustomSetting("plugins: 'autoresize'");
addCustomSetting("language: \"sv_SE\""); // this works
}
}
The other one:
import org.apache.wicket.Component;
import wicket.contrib.tinymce4.TinyMceBehavior;
import wicket.contrib.tinymce4.settings.TinyMCESettings;
public class MyTinyMceBehavior extends TinyMceBehavior {
public static final String KEY_EVENT = "keyup";
private Component component;
private TinyMCESettings settings;
public MyTinyMceBehavior(TinyMCESettings settings) {
super(settings);
this.settings = settings;
}
#Override
protected String getScript(TinyMCESettings.Mode mode, Collection<Component> components) {
StringBuilder script = new StringBuilder();
script.append(" tinyMCE.init({")
.append(settings.toJavaScript(mode, components))
.append(",onchange_callback : function (ed) {\n" +
" var text = ed.getContent();" +
" $('#" + component.getMarkupId() + "').html(text).trigger('" + KEY_EVENT + "');" +
"}")
.append("});\n");
return script.toString();
}
}
It seems TinyMCESettings detects 'SV' locale and tries to set the language: https://github.com/wicketstuff/core/blob/7db920363a8e0254b33b8deccee95688dd922aa5/tinymce4-parent/tinymce4/src/main/java/wicket/contrib/tinymce4/settings/TinyMCESettings.java#L262
Set it explicitly to null in the settings and it won't try to load it.
Made an edit with code that works.

Jenkins Plugin. RootAction. index.jelly in seperate window

i am writing a simple plugin and am forced to create a RootAction which displays a page (the index.jelly) and needs some additional values to confirm and then execute the methode.
My problem is, that the index.jelly file gets always displayed on a blank window.
But i do need it to be included inside of the Jenkinstemplate in the main table, as usual.
Can't seem to figure out why this is happening.
Any ideas?
RestartJksLink.java
package org.jenkinsci.plugins.tomcat_app_restart;
import hudson.Extension;
import hudson.model.ManagementLink;
/**
*
*
* #author [...]
*/
#Extension
public class RestartJksLink extends ManagementLink {
#Override
public String getIconFileName() {
return "/plugin/tomcat-app-restart/images/restart.png";
}
#Override
public String getUrlName() {
return "jksrestart";
}
#Override
public String getDescription() {
return "Restart your Jenkins-Application on Tomcat";
}
public String getDisplayName() {
return "Restart Jenkins-App on Tomcat";
}
}
RestartJksRootAction.java
package org.jenkinsci.plugins.tomcat_app_restart;
import java.io.IOException;
import java.net.Authenticator;
import java.net.HttpURLConnection;
import java.net.PasswordAuthentication;
import java.net.URL;
import jenkins.model.Jenkins;
import hudson.Extension;
import hudson.model.RootAction;
import hudson.util.FormValidation;
#Extension
public class RestartJksRootAction implements RootAction {
public String getDisplayName() {
return "Restart Jenkins on Tomcat";
}
public String getIconFileName() {
if (!Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER)) {
return null;
}
if (!Jenkins.getInstance().getLifecycle().canRestart()) {
return null;
}
return "/plugin/tomcat-app-restart/images/restart.png";
}
public String getUrlName() {
return "jksrestart";
}
public FormValidation doJksRestart() {
Authenticator.setDefault (new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication ("admin", "admin".toCharArray());
}
});
URL url;
try {
url = new URL("http://localhost:8888/manager/text/start?path=/jenkins");
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
System.out.println("" + connection.getResponseMessage());
return FormValidation.ok("Success");
} catch (IOException e) {
return FormValidation.error("Client error: " + e.getMessage());
}
}
}
index.jelly inside: resources.org.jenkinsci.plugins.tomcat_app_restart.RestartJksRootAction
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt" xmlns:p="/lib/hudson/project">
<f:validateButton
title="${%Restart Jenkins}" progress="${%Restarting...}"
method="JksRestart" with="" />
</j:jelly>
Thank you guys!
I am new to jenkins plugin development, this would help me a lot to understand.
Kind regards.
this demo (rootaction-example-plugin) helped a lot.You can read it.
https://github.com/gustavohenrique/jenkins-plugins/tree/master/rootaction-example-plugin
Add the <l:main-panel> tag and the the <l:layout norefresh="true">tag to the index.jelly file.
And include the side panel:
Pass the the build to Action (through a parameter of the constructor)
The build can be retrieved out of the parameters of the perform method which is inherited from the BuildStepCompatibilityLayer class (by Extending Publisher).
Create a getBuild() method in the Action class
Add the <st:include it="${it.build}" page="sidepanel.jelly" /> tag with the build
Jelly Example (index.jelly):
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt" xmlns:p="/lib/hudson/project">
<l:layout norefresh="true">
<st:include it="${it.build}" page="sidepanel.jelly" />
<l:main-panel>
<f:validateButton title="${%Restart Jenkins}" progress="${%Restarting...}" method="JksRestart" with="" />
</l:main-panel>
</l:layout>
</j:jelly>
Java Action class example:
package tryPublisher.tryPublisher;
import hudson.model.Action;
import hudson.model.AbstractBuild;
public class ExampleAction implements Action {
AbstractBuild<?,?> build;
public ExampleAction(AbstractBuild<?,?> build) {
this.build = build;
}
#Override
public String getIconFileName() {
return "/plugin/action.png";
}
#Override
public String getDisplayName() {
return "ExampleAction";
}
#Override
public String getUrlName() {
return "ExampleActionUrl";
}
public AbstractBuild<?,?> getBuild() {
return this.build;
}
}
Java Publisher class example:
package tryPublisher.tryPublisher;
import java.io.IOException;
import hudson.Launcher;
import hudson.model.AbstractBuild;
import hudson.model.BuildListener;
import hudson.tasks.BuildStepMonitor;
import hudson.tasks.Publisher;
public class ExamplePublisher extends Publisher {
#Override
public BuildStepMonitor getRequiredMonitorService() {
return BuildStepMonitor.NONE;
}
#Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
BuildListener listener) throws InterruptedException, IOException {
build.getActions().add(new ExampleAction(build));
return true;
}
}
The .jelly file has to be in the right resources map of the plugin project. In a map with the same name as the name of the Java class implementing Action. The name of the .jelly is important also.