Coverage Report - org.openpermis.editor.policy.command.ObligationRemoveCommand
 
Classes in this File Line Coverage Branch Coverage Complexity
ObligationRemoveCommand
0%
0/6
0%
0/2
1.5
 
 1  
 /*
 2  
  * Copyright (c) 2009, Swiss Federal Department of Defence Civil Protection and Sport
 3  
  *                     (http://www.vbs.admin.ch)
 4  
  * Copyright (c) 2009, Ergon Informatik AG (http://www.ergon.ch)
 5  
  * All rights reserved.
 6  
  *
 7  
  * Licensed under the Open Permis License which accompanies this distribution,
 8  
  * and is available at http://www.openpermis.org/BSDlicenceKent.txt
 9  
  */
 10  
 package org.openpermis.editor.policy.command;
 11  
 
 12  
 import java.util.List;
 13  
 
 14  
 import org.openpermis.policy.bean.ObligationBean;
 15  
 import org.openpermis.policy.bean.PolicyBean;
 16  
 import org.openpermis.policy.bean.TargetAccessRuleBean;
 17  
 
 18  
 
 19  
 /**
 20  
  * Command that deletes an obligation allover the model.
 21  
  * @since 0.3.0
 22  
  */
 23  
 public class ObligationRemoveCommand extends PartRemoveCommand<ObligationBean>
 24  
 {
 25  
         //---- Constructors
 26  
 
 27  
         /**
 28  
          * Creates a command.
 29  
          * @param obligation the obligation to modify, must not be {@code null}.
 30  
          * @since 0.3.0
 31  
          */
 32  
         public ObligationRemoveCommand (ObligationBean obligation) {
 33  0
                 super(obligation);
 34  0
         }
 35  
 
 36  
         //---- Methods
 37  
 
 38  
         /**
 39  
          * @since 0.3.0
 40  
          */
 41  
         public void removePart (PolicyBean policyBean, boolean doExec) {
 42  0
                 List<TargetAccessRuleBean> parents = policyBean.getParentTargetAccessRules(this.getPart());
 43  0
                 for (final TargetAccessRuleBean currRule : parents) {
 44  0
                         currRule.removeObligation(this.getPart());
 45  
                 }
 46  0
         }
 47  
 
 48  
 
 49  
 }