Coverage Report - org.openpermis.editor.policy.command.SubjectDomainRemoveCommand
 
Classes in this File Line Coverage Branch Coverage Complexity
SubjectDomainRemoveCommand
0%
0/7
0%
0/4
2
 
 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  
 
 13  
 import org.openpermis.policy.bean.DomainBean;
 14  
 import org.openpermis.policy.bean.PolicyBean;
 15  
 import org.openpermis.policy.bean.RoleAssignmentRuleBean;
 16  
 import org.openpermis.policy.bean.RoleAssignmentRuleBeanCollection;
 17  
 
 18  
 
 19  
 /**
 20  
  * Command that deletes a subject domain allover the model.
 21  
  * @since 0.3.0
 22  
  */
 23  
 public class SubjectDomainRemoveCommand 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.3.0
 31  
          */
 32  
         public SubjectDomainRemoveCommand (DomainBean domain) {
 33  0
                 super(domain);
 34  0
         }
 35  
 
 36  
         //---- Methods
 37  
 
 38  
         /**
 39  
          * @since 0.3.0
 40  
          */
 41  
         public void removePart (PolicyBean policyBean, boolean doExec) {
 42  0
                 final RoleAssignmentRuleBeanCollection roleAssignmentRules = 
 43  
                         policyBean.getRoleAssignmentRules();
 44  0
                 for (final RoleAssignmentRuleBean currRule : roleAssignmentRules) {
 45  0
                         if (currRule.getSubjectDomain().equals(getPart())) {
 46  0
                                 currRule.setSubjectDomain(null);
 47  
                         }
 48  
                 }
 49  0
         }
 50  
 
 51  
 
 52  
 }