001package com.identityworksllc.iiq.common; 002 003import sailpoint.tools.Util; 004 005import java.util.HashMap; 006import java.util.Map; 007 008/** 009 * Configuration for the {@link ProvisioningUtilities} class 010 */ 011public class ProvisioningArguments { 012 013 /** 014 * Case name template 015 */ 016 private String caseNameTemplate = "{Workflow} - {IdentityName} - {Timestamp}"; 017 018 /** 019 * Any extra parameters to pass to the provisioning workflow or Provisioner 020 */ 021 private Map<String, Object> defaultExtraParameters; 022 /** 023 * If true, the plan will be compiled and an error will be thrown before Provisioner / LCM submission if any account selections are present 024 */ 025 private boolean errorOnAccountSelection; 026 /** 027 * If true, the plan will be compiled and an error will be thrown before Provisioner / LCM submission if any unmanaged plans are present 028 */ 029 private boolean errorOnManualTask; 030 /** 031 * If true, the plan will be compiled and an error with be thrown before the Provisioner / LCM submission if expansion results in any new account creations 032 */ 033 private boolean errorOnNewAccount; 034 /** 035 * If true, the plan will be compiled and an error will be thrown before Provisioner / LCM submission if any unanswered questions 036 */ 037 private boolean errorOnProvisioningForms; 038 039 /** 040 * The name of the field to use to pass the Identity Name to the provisioning workflow 041 */ 042 private String identityFieldName; 043 044 /** 045 * The name of the field to use to pass the Provisioning Plan to provisioning workflow 046 */ 047 private String planFieldName; 048 049 /** 050 * If true, the provisioning workflow will be used; otherwise the Provisioner will be 051 * invoked directly 052 */ 053 private boolean useWorkflow; 054 055 /** 056 * The name of the workflow to use for provisioning, if useWorkflow is true 057 */ 058 private String workflowName; 059 060 /** 061 * Basic constructor that creates a no-approval, no-notification provisioning 062 */ 063 public ProvisioningArguments() { 064 defaultExtraParameters = new HashMap<>(); 065 defaultExtraParameters.put(ProvisioningUtilities.PLAN_PARAM_APPROVAL_SCHEME, ProvisioningUtilities.NO_APPROVAL_SCHEME); 066 defaultExtraParameters.put(ProvisioningUtilities.PLAN_PARAM_NOTIFICATION_SCHEME, ProvisioningUtilities.NO_APPROVAL_SCHEME); 067 068 workflowName = "LCM Provisioning"; 069 useWorkflow = true; 070 identityFieldName = "identityName"; 071 planFieldName = "plan"; 072 } 073 074 public String getCaseNameTemplate() { 075 return caseNameTemplate; 076 } 077 078 public Map<String, Object> getDefaultExtraParameters() { 079 return defaultExtraParameters; 080 } 081 082 public String getIdentityFieldName() { 083 return identityFieldName; 084 } 085 086 public String getPlanFieldName() { 087 return planFieldName; 088 } 089 090 public String getWorkflowName() { 091 return workflowName; 092 } 093 094 public boolean isErrorOnAccountSelection() { 095 return errorOnAccountSelection; 096 } 097 098 public boolean isErrorOnManualTask() { 099 return errorOnManualTask; 100 } 101 102 public boolean isErrorOnNewAccount() { 103 return errorOnNewAccount; 104 } 105 106 public boolean isErrorOnProvisioningForms() { 107 return errorOnProvisioningForms; 108 } 109 110 public boolean isUseWorkflow() { 111 return useWorkflow; 112 } 113 114 /** 115 * Merges in another workflow config 116 * @param other The other workflow config 117 */ 118 public void merge(ProvisioningArguments other) { 119 setWorkflowName(other.workflowName); 120 setUseWorkflow(other.useWorkflow); 121 setPlanFieldName(other.planFieldName); 122 setIdentityFieldName(other.identityFieldName); 123 setCaseNameTemplate(other.caseNameTemplate); 124 setErrorOnProvisioningForms(other.errorOnManualTask); 125 setErrorOnAccountSelection(other.errorOnAccountSelection); 126 setErrorOnNewAccount(other.errorOnNewAccount); 127 setErrorOnManualTask(other.errorOnManualTask); 128 129 if (other.defaultExtraParameters != null) { 130 this.defaultExtraParameters.putAll(other.defaultExtraParameters); 131 } 132 } 133 134 public void setCaseNameTemplate(String caseNameTemplate) { 135 if (Util.isNotNullOrEmpty(caseNameTemplate)) { 136 this.caseNameTemplate = caseNameTemplate; 137 } 138 } 139 140 public void setDefaultExtraParameters(Map<String, Object> defaultExtraParameters) { 141 if (defaultExtraParameters != null) { 142 this.defaultExtraParameters = defaultExtraParameters; 143 } else { 144 this.defaultExtraParameters = new HashMap<>(); 145 } 146 } 147 148 public void setErrorOnAccountSelection(boolean errorOnAccountSelection) { 149 this.errorOnAccountSelection = errorOnAccountSelection; 150 } 151 152 public void setErrorOnManualTask(boolean errorOnManualTask) { 153 this.errorOnManualTask = errorOnManualTask; 154 } 155 156 public void setErrorOnNewAccount(boolean errorOnNewAccount) { 157 this.errorOnNewAccount = errorOnNewAccount; 158 } 159 160 public void setErrorOnProvisioningForms(boolean errorOnProvisioningForms) { 161 this.errorOnProvisioningForms = errorOnProvisioningForms; 162 } 163 164 public void setIdentityFieldName(String identityFieldName) { 165 if (Util.isNotNullOrEmpty(identityFieldName)) { 166 this.identityFieldName = identityFieldName; 167 } 168 } 169 170 public void setPlanFieldName(String planFieldName) { 171 if (Util.isNotNullOrEmpty(planFieldName)) { 172 this.planFieldName = planFieldName; 173 } 174 } 175 176 public void setUseWorkflow(boolean useWorkflow) { 177 this.useWorkflow = useWorkflow; 178 } 179 180 public void setWorkflowName(String workflowName) { 181 if (Util.isNotNullOrEmpty(workflowName)) { 182 this.workflowName = workflowName; 183 } 184 } 185}