// Path: src/main/java/com/synopsys/arc/jenkinsci/plugins/jobrestrictions/restrictions/JobRestriction.java
// public abstract class JobRestriction implements ExtensionPoint, Describable<JobRestriction>, Serializable {
//     
//     public static final JobRestriction DEFAULT = new AnyJobRestriction();
//     
//     /**
//      * Check if the {@link Queue} item can be taken.
//      * This method is being used to check if the {@link Node} can take the
//      * specified job. If the job cannot be taken, Jenkins will try to launch 
//      * the job on other nodes.
//      * @param item An item to be checked
//      * @return true if the node can take the item
//      */
//     public abstract boolean canTake(@Nonnull Queue.BuildableItem item);
//         
//     /**
//      * Check if the {@link Job} can be executed according to the specified {@link Run}.
//      * If the job cannot be executed, it will be aborted by the plugin.
//      * @param run A {@link Run} to be checked 
//      * @return true if the build can be executed
//      */
//     public abstract boolean canTake(@Nonnull Run run);
// 
//     @Override
//     public JobRestrictionDescriptor getDescriptor() {
//         return (JobRestrictionDescriptor) JenkinsHelper.getInstanceOrDie().getDescriptorOrDie(getClass());
//     }
// 
//     /**
//      * Get list of all registered {@link JobRestriction}s.
//      * @return List of {@link JobRestriction}s.
//      */    
//     public static DescriptorExtensionList<JobRestriction,JobRestrictionDescriptor> all() {
//         return JenkinsHelper.getInstanceOrDie().<JobRestriction,JobRestrictionDescriptor>getDescriptorList
//             (JobRestriction.class);
//     }
//     
//     /**
//      * Returns list of {@link JobRestrictionDescriptor}s.
//      * @return List of available descriptors.
//      * @since 0.2
//      */
//     public static List<JobRestrictionDescriptor> allDescriptors() {
//         return all().reverseView();
//     }
//     
// }
// 
// Path: src/main/java/com/synopsys/arc/jenkinsci/plugins/jobrestrictions/restrictions/JobRestrictionDescriptor.java
// public abstract class JobRestrictionDescriptor extends Descriptor<JobRestriction> {
//     public JobRestrictionDescriptor getDefaultSettingsProvider() {
//         return (JobRestrictionDescriptor)JobRestriction.all().find(AnyJobRestriction.class);
//     } 
// }


import org.kohsuke.stapler.DataBoundConstructor;
import com.synopsys.arc.jenkinsci.plugins.jobrestrictions.Messages;
import com.synopsys.arc.jenkinsci.plugins.jobrestrictions.restrictions.JobRestriction;
import com.synopsys.arc.jenkinsci.plugins.jobrestrictions.restrictions.JobRestrictionDescriptor;
import hudson.Extension;
import hudson.model.Queue;
import hudson.model.Run;
import java.util.ArrayList;
/*
 * The MIT License
 *
 * Copyright 2013-2016 Oleg Nenashev, Synopsys Inc.
 *
 * 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.synopsys.arc.jenkinsci.plugins.jobrestrictions.restrictions.logic;


/**
 * Implements "And" condition with multiple entries.
 * @author Oleg Nenashev
 * @since 0.2
 */
public class MultipleAndJobRestriction extends JobRestriction {
    private final ArrayList<JobRestriction> restrictions;

    @DataBoundConstructor
    public MultipleAndJobRestriction(ArrayList<JobRestriction> restrictions) {
        this.restrictions = restrictions != null ? restrictions : new ArrayList<JobRestriction>();
    }

// Path: src/main/java/com/synopsys/arc/jenkinsci/plugins/jobrestrictions/restrictions/JobRestriction.java
// public abstract class JobRestriction implements ExtensionPoint, Describable<JobRestriction>, Serializable {
//     
//     public static final JobRestriction DEFAULT = new AnyJobRestriction();
//     
//     /**
//      * Check if the {@link Queue} item can be taken.
//      * This method is being used to check if the {@link Node} can take the
//      * specified job. If the job cannot be taken, Jenkins will try to launch 
//      * the job on other nodes.
//      * @param item An item to be checked
//      * @return true if the node can take the item
//      */
//     public abstract boolean canTake(@Nonnull Queue.BuildableItem item);
//         
//     /**
//      * Check if the {@link Job} can be executed according to the specified {@link Run}.
//      * If the job cannot be executed, it will be aborted by the plugin.
//      * @param run A {@link Run} to be checked 
//      * @return true if the build can be executed
//      */
//     public abstract boolean canTake(@Nonnull Run run);
// 
//     @Override
//     public JobRestrictionDescriptor getDescriptor() {
//         return (JobRestrictionDescriptor) JenkinsHelper.getInstanceOrDie().getDescriptorOrDie(getClass());
//     }
// 
//     /**
//      * Get list of all registered {@link JobRestriction}s.
//      * @return List of {@link JobRestriction}s.
//      */    
//     public static DescriptorExtensionList<JobRestriction,JobRestrictionDescriptor> all() {
//         return JenkinsHelper.getInstanceOrDie().<JobRestriction,JobRestrictionDescriptor>getDescriptorList
//             (JobRestriction.class);
//     }
//     
//     /**
//      * Returns list of {@link JobRestrictionDescriptor}s.
//      * @return List of available descriptors.
//      * @since 0.2
//      */
//     public static List<JobRestrictionDescriptor> allDescriptors() {
//         return all().reverseView();
//     }
//     
// }
// 
// Path: src/main/java/com/synopsys/arc/jenkinsci/plugins/jobrestrictions/restrictions/JobRestrictionDescriptor.java
// public abstract class JobRestrictionDescriptor extends Descriptor<JobRestriction> {
//     public JobRestrictionDescriptor getDefaultSettingsProvider() {
//         return (JobRestrictionDescriptor)JobRestriction.all().find(AnyJobRestriction.class);
//     } 
// }


// Path: src/main/java/com/synopsys/arc/jenkinsci/plugins/jobrestrictions/restrictions/logic/MultipleAndJobRestriction.java
import org.kohsuke.stapler.DataBoundConstructor;
import com.synopsys.arc.jenkinsci.plugins.jobrestrictions.Messages;
import com.synopsys.arc.jenkinsci.plugins.jobrestrictions.restrictions.JobRestriction;
import com.synopsys.arc.jenkinsci.plugins.jobrestrictions.restrictions.JobRestrictionDescriptor;
import hudson.Extension;
import hudson.model.Queue;
import hudson.model.Run;
import java.util.ArrayList;

/*
 * The MIT License
 *
 * Copyright 2013-2016 Oleg Nenashev, Synopsys Inc.
 *
 * 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.synopsys.arc.jenkinsci.plugins.jobrestrictions.restrictions.logic;


/**
 * Implements "And" condition with multiple entries.
 * @author Oleg Nenashev
 * @since 0.2
 */
public class MultipleAndJobRestriction extends JobRestriction {
    private final ArrayList<JobRestriction> restrictions;

    @DataBoundConstructor
    public MultipleAndJobRestriction(ArrayList<JobRestriction> restrictions) {
        this.restrictions = restrictions != null ? restrictions : new ArrayList<JobRestriction>();
    }

    public ArrayList<JobRestriction> getRestrictions() {