import com.urbancode.air.*
import com.urbancode.air.plugin.clearcasebasesnapshot.*

//standard preamble stuff
def apTool = new AirPluginTool(args[0], args[1]);
def props = apTool.getStepProperties();
ClearCaseHelper clearCaseHelper = new ClearCaseHelper(apTool, props);

if (clearCaseHelper.label == null) {
    throw new IllegalStateException("Please Specify a label!");
}

List<String> vobNameList = clearCaseHelper.getVobNameList();

//create the label
vobNameList.each { vobName ->
    clearCaseHelper.makeLabelTypeCommand(vobName);
}

//now apply the label
clearCaseHelper.applyLabels(vobNameList);
