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 findByCommonName(String commonName) { for (DeletionRule rule : list) if (commonName.equals(rule.getCommonName())) return rule; return null; }