/**
* Deletes securities from the specified sec master.
*/
@Override
protected void doRun() {
SecuritySearchRequest securitySearchRequest = new SecuritySearchRequest();
if (getCommandLine().hasOption(SECURITY_NAMES_OPT)) {
securitySearchRequest.setName(
getCommandLine().getOptionValue(SECURITY_NAMES_OPT));
}
if (getCommandLine().hasOption(SECURITY_IDS_OPT)) {
List<ObjectId> ids = new ArrayList<ObjectId>();
for (String s : getCommandLine().getOptionValues(SECURITY_IDS_OPT)) {
ids.add(ObjectId.parse(s));
}
securitySearchRequest.setObjectIds(ids);
}
if (getCommandLine().hasOption(EXTERNAL_ID_SCHEMES_OPT)) {
securitySearchRequest.setExternalIdScheme(
getCommandLine().getOptionValue(EXTERNAL_ID_SCHEMES_OPT));
}
if (getCommandLine().hasOption(EXTERNAL_ID_VALUES_OPT)) {
securitySearchRequest.setExternalIdValue(
getCommandLine().getOptionValue(EXTERNAL_ID_VALUES_OPT));
}
SecurityMaster securityMaster = getToolContext().getSecurityMaster();
for (SecurityDocument securityDocument : SecuritySearchIterator.iterable(securityMaster, securitySearchRequest)) {