/** * Gets the label that exists on this system by the name. * * @return null if name is null. * @see Label#parseExpression(String) (String) */ public Label getLabel(String expr) { if(expr==null) return null; expr = hudson.util.QuotedStringTokenizer.unquote(expr); while(true) { Label l = labels.get(expr); if(l!=null) return l; // non-existent try { labels.putIfAbsent(expr,Label.parseExpression(expr)); } catch (ANTLRException e) { // laxly accept it as a single label atom for backward compatibility return getLabelAtom(expr); } } }
return FormValidation.ok(); // nothing typed yet try { Label.parseExpression(value); } catch (ANTLRException e) { return FormValidation.error(e,
public boolean match(Node node) { if (node == null) return false; try { return Label.parseExpression(labelExpr).matches(node); } catch (ANTLRException e) { } return false; }
/** * Gets the label that exists on this system by the name. * * @return null if name is null. * @see Label#parseExpression(String) (String) */ public Label getLabel(String expr) { if (expr == null) { return null; } while (true) { Label l = labels.get(expr); if (l != null) { return l; } // non-existent try { labels.putIfAbsent(expr, Label.parseExpression(expr)); } catch (RecognitionException e) { // laxly accept it as a single label atom for backward compatibility return getLabelAtom(expr); } } }
/** * Gets the label that exists on this system by the name. * * @return null if name is null. * @see Label#parseExpression(String) (String) */ public Label getLabel(String expr) { if (expr == null) { return null; } while (true) { Label l = labels.get(expr); if (l != null) { return l; } // non-existent try { labels.putIfAbsent(expr, Label.parseExpression(expr)); } catch (ANTLRException e) { // laxly accept it as a single label atom for backward compatibility return getLabelAtom(expr); } } }
/** * Gets the label that exists on this system by the name. * * @return null if name is null. * @see Label#parseExpression(String) (String) */ public Label getLabel(String expr) { if (expr == null) { return null; } while (true) { Label l = labels.get(expr); if (l != null) { return l; } // non-existent try { labels.putIfAbsent(expr, Label.parseExpression(expr)); } catch (ANTLRException e) { // laxly accept it as a single label atom for backward compatibility return getLabelAtom(expr); } } }
/** * Gets the label that exists on this system by the name. * * @return null if name is null. * @see Label#parseExpression(String) (String) */ public Label getLabel(String expr) { if (expr == null) { return null; } while (true) { Label l = labels.get(expr); if (l != null) { return l; } // non-existent try { labels.putIfAbsent(expr, Label.parseExpression(expr)); } catch (ANTLRException e) { // laxly accept it as a single label atom for backward compatibility return getLabelAtom(expr); } } }
/** * Gets the label that exists on this system by the name. * * @return null if name is null. * @see Label#parseExpression(String) (String) */ public Label getLabel(String expr) { if(expr==null) return null; expr = hudson.util.QuotedStringTokenizer.unquote(expr); while(true) { Label l = labels.get(expr); if(l!=null) return l; // non-existent try { labels.putIfAbsent(expr,Label.parseExpression(expr)); } catch (ANTLRException e) { // laxly accept it as a single label atom for backward compatibility return getLabelAtom(expr); } } }
public Boolean call() throws ANTLRException { Node n = Jenkins.getInstance().getNode(nodeName); if (n == null) return false; return Label.parseExpression(labelExpr).matches(n); }
public FormValidation doCheckAssignedLabelString(@QueryParameter String value) { if (Util.fixEmpty(value)==null) return FormValidation.ok(); // nothing typed yet try { Label.parseExpression(value); } catch (ANTLRException e) { return FormValidation.error(e, Messages.AbstractProject_AssignedLabelString_InvalidBooleanExpression(e.getMessage())); } // TODO: if there's an atom in the expression that is empty, report it if (Hudson.getInstance().getLabel(value).isEmpty()) return FormValidation.warning(Messages.AbstractProject_AssignedLabelString_NoMatch()); return FormValidation.ok(); }
public FormValidation doCheckLabelString(@QueryParameter String value) { if (Util.fixEmpty(value)==null) return FormValidation.ok(); // nothing typed yet try { Label.parseExpression(value); } catch (ANTLRException e) { return FormValidation.error(e, Messages.JobPropertyImpl_LabelString_InvalidBooleanExpression(e.getMessage())); } // TODO: if there's an atom in the expression that is empty, report it if (JenkinsHelper.getInstance().getLabel(value).isEmpty()) return FormValidation.warning(Messages.JobPropertyImpl_LabelString_NoMatch()); return FormValidation.ok(); }
public FormValidation doCheckAssignedLabelString(@QueryParameter String value) { if (Util.fixEmpty(value) == null) { return FormValidation.ok(); // nothing typed yet } try { Label.parseExpression(value); } catch (ANTLRException e) { return FormValidation.error(e, Messages.AbstractProject_AssignedLabelString_InvalidBooleanExpression(e.getMessage())); } // TODO: if there's an atom in the expression that is empty, report it if (Hudson.getInstance().getLabel(value).isEmpty()) { return FormValidation.warning(Messages.AbstractProject_AssignedLabelString_NoMatch()); } return FormValidation.ok(); }
public FormValidation doCheckAssignedLabelString(@QueryParameter String value) { if (Util.fixEmpty(value)==null) return FormValidation.ok(); // nothing typed yet try { Label.parseExpression(value); } catch (ANTLRException e) { return FormValidation.error(e, Messages.AbstractProject_AssignedLabelString_InvalidBooleanExpression(e.getMessage())); } // TODO: if there's an atom in the expression that is empty, report it if (Hudson.getInstance().getLabel(value).isEmpty()) return FormValidation.warning(Messages.AbstractProject_AssignedLabelString_NoMatch()); return FormValidation.ok(); }
public FormValidation doCheckAssignedLabelString(@QueryParameter String value) { if (Util.fixEmpty(value) == null) { return FormValidation.ok(); // nothing typed yet } try { Label.parseExpression(value); } catch (RecognitionException e) { return FormValidation.error(e, Messages.AbstractProject_AssignedLabelString_InvalidBooleanExpression(e.getMessage())); } // TODO: if there's an atom in the expression that is empty, report it if (Hudson.getInstance().getLabel(value).isEmpty()) { return FormValidation.warning(Messages.AbstractProject_AssignedLabelString_NoMatch()); } return FormValidation.ok(); }
/** * Returns a list of auto completion candidates. * * @return candidates */ public AutoCompletionCandidates doAutoCompleteLabel() { AutoCompletionCandidates candidates = new AutoCompletionCandidates(); List<Node> masterNodeList = Jenkins.getInstance().getNodes(); for (Node node : masterNodeList) { try { for (LabelAtom atom : Label.parseExpression(node.getLabelString()).listAtoms()) { candidates.add(atom.getName()); } } catch (ANTLRException e) { // invalid expression, skipped } } return candidates; }
return FormValidation.ok(); // nothing typed yet try { Label.parseExpression(value); } catch (ANTLRException e) { return FormValidation.error(e,