001/*
002 * SonarQube
003 * Copyright (C) 2009-2016 SonarSource SA
004 * mailto:contact AT sonarsource DOT com
005 *
006 * This program is free software; you can redistribute it and/or
007 * modify it under the terms of the GNU Lesser General Public
008 * License as published by the Free Software Foundation; either
009 * version 3 of the License, or (at your option) any later version.
010 *
011 * This program is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014 * Lesser General Public License for more details.
015 *
016 * You should have received a copy of the GNU Lesser General Public License
017 * along with this program; if not, write to the Free Software Foundation,
018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
019 */
020package org.sonar.api.batch.postjob.internal;
021
022import org.sonar.api.batch.postjob.PostJobDescriptor;
023
024import java.util.Arrays;
025import java.util.Collection;
026
027public class DefaultPostJobDescriptor implements PostJobDescriptor {
028
029  private String name;
030  private String[] properties = new String[0];
031  private boolean disabledInIssues = false;
032
033  public String name() {
034    return name;
035  }
036
037  public Collection<String> properties() {
038    return Arrays.asList(properties);
039  }
040
041  public boolean isDisabledInIssues() {
042    return disabledInIssues;
043  }
044
045  @Override
046  public DefaultPostJobDescriptor name(String name) {
047    this.name = name;
048    return this;
049  }
050
051  @Override
052  public DefaultPostJobDescriptor requireProperty(String... propertyKey) {
053    return requireProperties(propertyKey);
054  }
055
056  @Override
057  public DefaultPostJobDescriptor requireProperties(String... propertyKeys) {
058    this.properties = propertyKeys;
059    return this;
060  }
061
062  @Override
063  public DefaultPostJobDescriptor disabledInIssues() {
064    this.disabledInIssues = true;
065    return this;
066  }
067
068}