Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   *  The MIT License
   *
   *  Copyright 2010 Sony Ericsson Mobile Communications.
   *
   *  Permission is hereby granted, free of charge, to any person obtaining a copy
   *  of this software and associated documentation files (the "Software"), to deal
   *  in the Software without restriction, including without limitation the rights
   *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  *  copies of the Software, and to permit persons to whom the Software is
  *  furnished to do so, subject to the following conditions:
  *
  *  The above copyright notice and this permission notice shall be included in
  *  all copies or substantial portions of the Software.
  *
  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  *  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  *  THE SOFTWARE.
  */
 package com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data;
 
 import java.util.List;
Base settings for one matcher rule of a Gerrit project.

Author(s):
Robert Sandell <robert.sandell@sonyericsson.com>
 
 public class GerritProject implements Describable<GerritProject> {
 
     private CompareType compareType;
     private String pattern;
     private List<Branchbranches;
     private List<FilePathfilePaths;


    
Default empty constructor.
 
     public GerritProject() {
 
     }

    
DataBound Constructor.

Parameters:
compareType the compareType
pattern the project-name pattern
branches the branch-rules
filePaths the file-path rules.
 
     public GerritProject(CompareType compareTypeString patternList<BranchbranchesList<FilePathfilePaths) {
 
         this. = compareType;
         this. = pattern;
         this. = branches;
         this. = filePaths;
     }

    
Which algorithm-type to use with the pattern.

Returns:
the compareType
 
     public CompareType getCompareType() {
         return ;
     }

    
Which algorithm-type to use with the pattern.

Parameters:
compareType the compareType
 
     public void setCompareType(CompareType compareType) {
         this. = compareType;
     }

    
The pattern for the project-name to match on.

Returns:
the pattern
 
     public String getPattern() {
         return ;
     }

    
The pattern for the project-name to match on.

Parameters:
pattern the pattern
 
     public void setPattern(String pattern) {
         this. = pattern;
    }

    
The list of FilePath-rules.

Returns:
the branch-rules
    public List<BranchgetBranches() {
        return ;
    }

    
The list of FilePath-rules.

Parameters:
branches the branch-rules
    public void setBranches(List<Branchbranches) {
        this. = branches;
    }

    
The list of filepath-rules.

Returns:
the filepath-rules
    public List<FilePathgetFilePaths() {
        return ;
    }

    
The list of filepath-rules.

Parameters:
filePaths the filepath-rules
    public void setFilePaths(List<FilePathfilePaths) {
        this. = filePaths;
    }

    
Compares the project, branch and files to see if the rules specified is a match.

Parameters:
project the gerrit project
branch the branch.
files the files.
Returns:
true is the rules match.
    public boolean isInteresting(String projectString branchList<Stringfiles) {
        if (.matches(project)) {
            for (Branch b : ) {
                if (b.isInteresting(branch)) {
                    for (FilePath f : ) {
                        if (f.isInteresting(files)) {
                            return true;
                        }
                    }
                }
            }
            return false;
        } else {
            return false;
        }
    }

    
Compares the project and branch to see if the rules specified is a match.

Parameters:
project the gerrit project
branch the branch.
Returns:
true is the rules match.
    public boolean isInteresting(String projectString branch) {
        if (.matches(project)) {
            for (Branch b : ) {
                if (b.isInteresting(branch)) {
                    return true;
                }
            }
            return false;
        } else {
            return false;
        }
    }
    @Override
        return Hudson.getInstance().getDescriptor(getClass());
    }

    
Descriptor allowing for communication within the Repeatable. Necessary for editable combobox.
    @Extension
    public static final class DescriptorImpl extends Descriptor<GerritProject> {
        
Used to fill the project pattern combobox with AJAX.

Returns:
ComboBoxModels containing a list of all Gerrit Projects
        public ComboBoxModel doFillPatternItems() {
    		return new ComboBoxModel(PluginImpl.getInstance().getGerritProjects());
        }
        @Override
        public String getDisplayName() {
            return null;
        }
    }
New to GrepCode? Check out our FAQ X