Coverage Report - org.openpermis.editor.policy.command.ResourceDomainRemoveCommand
 
Classes in this File Line Coverage Branch Coverage Complexity
ResourceDomainRemoveCommand
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.DomainBean;
 15  
 import org.openpermis.policy.bean.PolicyBean;
 16  
 import org.openpermis.policy.bean.TargetBean;
 17  
 
 18  
 
 19  
 /**
 20  
  * Command that deletes a domain allover the model.
 21  
  * @since 0.1.0
 22  
  */
 23  
 public class ResourceDomainRemoveCommand extends PartRemoveCommand<DomainBean>
 24  
 {
 25  
         //---- Constructors
 26  
 
 27  
         /**
 28  
          * Creates a command.
 29  
          * @param domain the domain to modify, must not be {@code null}.
 30  
          * @since 0.1.0
 31  
          */
 32  
         public ResourceDomainRemoveCommand (DomainBean domain) {
 33  0
                 super(domain);
 34  0
         }
 35  
 
 36  
         //---- Methods
 37  
 
 38  
         /**
 39  
          * @since 0.1.0
 40  
          */
 41  
         public void removePart (PolicyBean policyBean, boolean doExec) {
 42  0
                 List<TargetBean> parents = policyBean.getParentTargets(this.getPart());
 43  0
                 for (final TargetBean currTarget : parents) {
 44  0
                         currTarget.setResourceDomain(null);
 45  
                 }
 46  0
         }
 47  
 
 48  
 }