本文整理了Java中hudson.model.Job.setAllowSave()
方法的一些代码示例,展示了Job.setAllowSave()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Job.setAllowSave()
方法的具体详情如下:
包路径:hudson.model.Job
类名称:Job
方法名:setAllowSave
[英]Set true if save operation for config is permitted, false - otherwise .
[中]如果允许对配置执行保存操作,则设置为true,否则设置为false。
代码示例来源:origin: hudson/hudson-2.x
/**
* Converts collection of propertyClass descriptors to {@link DescribableList}
*
* @param descriptors .
* @param owner new owner for properties.
* @param propertyClass projectProperty
* @return {@link DescribableList}
*/
@SuppressWarnings("unchecked")
public static <T extends Describable<T>, D extends Descriptor<T>, P extends IProjectProperty> DescribableList<T, D>
convertToDescribableList(List<D> descriptors, Job owner, Class<P> propertyClass) {
List<T> describableList = new CopyOnWriteArrayList<T>();
DescribableList<T, D> result = new DescribableList<T, D>(owner);
for (Descriptor<T> descriptor : descriptors) {
IProjectProperty<T> property =
CascadingUtil.getProjectProperty(owner, descriptor.getJsonSafeClassName(), propertyClass);
if (null != property.getValue()) {
describableList.add(property.getValue());
}
}
try {
owner.setAllowSave(false);
result.addAll(describableList);
owner.setAllowSave(true);
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Failed to add list of describable elements", e);
}
return result;
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* Converts collection of propertyClass descriptors to {@link DescribableList}
*
* @param descriptors .
* @param owner new owner for properties.
* @param propertyClass projectProperty
* @return {@link DescribableList}
*/
@SuppressWarnings("unchecked")
public static <T extends Describable<T>, D extends Descriptor<T>, P extends IProjectProperty> DescribableList<T, D>
convertToDescribableList(List<D> descriptors, Job owner, Class<P> propertyClass) {
List<T> describableList = new CopyOnWriteArrayList<T>();
DescribableList<T, D> result = new DescribableList<T, D>(owner);
for (Descriptor<T> descriptor : descriptors) {
IProjectProperty<T> property =
CascadingUtil.getProjectProperty(owner, descriptor.getJsonSafeClassName(), propertyClass);
if (null != property.getValue()) {
describableList.add(property.getValue());
}
}
try {
owner.setAllowSave(false);
result.addAll(describableList);
owner.setAllowSave(true);
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Failed to add list of describable elements", e);
}
return result;
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* Converts collection of propertyClass descriptors to
* {@link DescribableList}
*
* @param descriptors .
* @param owner new owner for properties.
* @param propertyClass projectProperty
* @return {@link DescribableList}
*/
@SuppressWarnings("unchecked")
public static <T extends Describable<T>, D extends Descriptor<T>, P extends IProjectProperty> DescribableList<T, D> convertToDescribableList(List<D> descriptors, Job owner, Class<P> propertyClass) {
List<T> describableList = new CopyOnWriteArrayList<T>();
DescribableList<T, D> result = new DescribableList<T, D>(owner);
for (Descriptor<T> descriptor : descriptors) {
IProjectProperty<T> property =
CascadingUtil.getProjectProperty(owner, descriptor.getJsonSafeClassName(), propertyClass);
if (null != property.getValue()) {
describableList.add(property.getValue());
}
}
try {
owner.setAllowSave(false);
result.addAll(describableList);
owner.setAllowSave(true);
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Failed to add list of describable elements", e);
}
return result;
}
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
* Converts collection of propertyClass descriptors to {@link DescribableList}
*
* @param descriptors .
* @param owner new owner for properties.
* @param propertyClass projectProperty
* @return {@link DescribableList}
*/
@SuppressWarnings("unchecked")
public static <T extends Describable<T>, D extends Descriptor<T>, P extends IProjectProperty> DescribableList<T, D>
convertToDescribableList(List<D> descriptors, Job owner, Class<P> propertyClass) {
List<T> describableList = new CopyOnWriteArrayList<T>();
DescribableList<T, D> result = new DescribableList<T, D>(owner);
for (Descriptor<T> descriptor : descriptors) {
IProjectProperty<T> property =
CascadingUtil.getProjectProperty(owner, descriptor.getJsonSafeClassName(), propertyClass);
if (null != property.getValue()) {
describableList.add(property.getValue());
}
}
try {
owner.setAllowSave(false);
result.addAll(describableList);
owner.setAllowSave(true);
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Failed to add list of describable elements", e);
}
return result;
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* Accepts submission from the configuration page.
*/
public synchronized void doConfigSubmit(StaplerRequest req,
StaplerResponse rsp) throws IOException, ServletException, FormException {
checkPermission(CONFIGURE);
try {
setAllowSave(false);
submit(req, rsp);
setAllowSave(true);
save();
String newName = req.getParameter("name");
if (newName != null && !newName.equals(name)) {
// check this error early to avoid HTTP response splitting.
Hudson.checkGoodName(newName);
rsp.sendRedirect("rename?newName=" + URLEncoder.encode(newName, "UTF-8"));
} else {
rsp.sendRedirect(".");
}
} catch (JSONException e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
pw.println("Failed to parse form data. Please report this problem as a bug");
pw.println("JSON=" + req.getSubmittedForm());
pw.println();
e.printStackTrace(pw);
rsp.setStatus(SC_BAD_REQUEST);
sendError(sw.toString(), req, rsp, true);
}
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
* Accepts submission from the configuration page.
*/
public synchronized void doConfigSubmit(StaplerRequest req,
StaplerResponse rsp) throws IOException, ServletException, FormException {
checkPermission(CONFIGURE);
try {
setAllowSave(false);
submit(req, rsp);
setAllowSave(true);
save();
String newName = req.getParameter("name");
if (newName != null && !newName.equals(name)) {
// check this error early to avoid HTTP response splitting.
Hudson.checkGoodName(newName);
rsp.sendRedirect("rename?newName=" + URLEncoder.encode(newName, "UTF-8"));
} else {
rsp.sendRedirect(".");
}
} catch (JSONException e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
pw.println("Failed to parse form data. Please report this problem as a bug");
pw.println("JSON=" + req.getSubmittedForm());
pw.println();
e.printStackTrace(pw);
rsp.setStatus(SC_BAD_REQUEST);
sendError(sw.toString(), req, rsp, true);
}
}
代码示例来源:origin: hudson/hudson-2.x
/**
* Accepts submission from the configuration page.
*/
public synchronized void doConfigSubmit(StaplerRequest req,
StaplerResponse rsp) throws IOException, ServletException, FormException {
checkPermission(CONFIGURE);
try {
setAllowSave(false);
submit(req, rsp);
setAllowSave(true);
save();
String newName = req.getParameter("name");
if (newName != null && !newName.equals(name)) {
// check this error early to avoid HTTP response splitting.
Hudson.checkGoodName(newName);
rsp.sendRedirect("rename?newName=" + URLEncoder.encode(newName, "UTF-8"));
} else {
rsp.sendRedirect(".");
}
} catch (JSONException e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
pw.println("Failed to parse form data. Please report this problem as a bug");
pw.println("JSON=" + req.getSubmittedForm());
pw.println();
e.printStackTrace(pw);
rsp.setStatus(SC_BAD_REQUEST);
sendError(sw.toString(), req, rsp, true);
}
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
checkPermission(CONFIGURE);
try {
setAllowSave(false);
submit(req, rsp);
setAllowSave(true);
内容来源于网络,如有侵权,请联系作者删除!