public void add(DeletionRule rule) { if (findByCommonName(rule.getCommonName()) != null) throw new IllegalStateException( "DeletionRule with cn: '" + rule.getCommonName() + "' already exists"); if (findByStorageSystemGroupID(rule.getStorageSystemGroupID()) != null) throw new IllegalStateException( "DeletionRule with Storage System Group ID: '" + rule.getStorageSystemGroupID() + "' already exists"); list.add(rule); }
public DeletionRule findByStorageSystemGroupID(String storageSystemGroupID) { for (DeletionRule rule : list) if (storageSystemGroupID.equals(rule.getStorageSystemGroupID())) return rule; return null; }