| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
package org.kuali.rice.kew.doctype.bo; |
| 18 | |
|
| 19 | |
import org.apache.commons.lang.StringUtils; |
| 20 | |
import org.hibernate.annotations.Fetch; |
| 21 | |
import org.hibernate.annotations.FetchMode; |
| 22 | |
import org.hibernate.annotations.GenericGenerator; |
| 23 | |
import org.hibernate.annotations.Parameter; |
| 24 | |
import org.kuali.rice.core.api.config.property.ConfigContext; |
| 25 | |
import org.kuali.rice.core.api.exception.RiceRemoteServiceConnectionException; |
| 26 | |
import org.kuali.rice.core.api.reflect.ObjectDefinition; |
| 27 | |
import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader; |
| 28 | |
import org.kuali.rice.core.api.reflect.ObjectDefinition; |
| 29 | |
import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader; |
| 30 | |
import org.kuali.rice.core.web.format.FormatException; |
| 31 | |
import org.kuali.rice.kew.actionlist.CustomActionListAttribute; |
| 32 | |
import org.kuali.rice.kew.docsearch.DocumentSearchCriteriaProcessor; |
| 33 | |
import org.kuali.rice.kew.docsearch.DocumentSearchGenerator; |
| 34 | |
import org.kuali.rice.kew.docsearch.DocumentSearchResultProcessor; |
| 35 | |
import org.kuali.rice.kew.docsearch.SearchableAttribute; |
| 36 | |
import org.kuali.rice.kew.docsearch.StandardDocumentSearchCriteriaProcessor; |
| 37 | |
import org.kuali.rice.kew.docsearch.xml.DocumentSearchXMLResultProcessor; |
| 38 | |
import org.kuali.rice.kew.docsearch.xml.GenericXMLSearchableAttribute; |
| 39 | |
import org.kuali.rice.kew.doctype.ApplicationDocumentStatus; |
| 40 | |
import org.kuali.rice.kew.doctype.DocumentTypeAttribute; |
| 41 | |
import org.kuali.rice.kew.doctype.DocumentTypePolicy; |
| 42 | |
import org.kuali.rice.kew.doctype.DocumentTypePolicyEnum; |
| 43 | |
import org.kuali.rice.kew.doctype.DocumentTypeSecurity; |
| 44 | |
import org.kuali.rice.kew.doctype.service.DocumentTypeService; |
| 45 | |
import org.kuali.rice.kew.engine.node.Process; |
| 46 | |
import org.kuali.rice.kew.exception.ResourceUnavailableException; |
| 47 | |
import org.kuali.rice.kew.exception.WorkflowRuntimeException; |
| 48 | |
import org.kuali.rice.kew.mail.CustomEmailAttribute; |
| 49 | |
import org.kuali.rice.kew.notes.CustomNoteAttribute; |
| 50 | |
import org.kuali.rice.kew.postprocessor.DefaultPostProcessor; |
| 51 | |
import org.kuali.rice.kew.postprocessor.PostProcessor; |
| 52 | |
import org.kuali.rice.kew.postprocessor.PostProcessorRemote; |
| 53 | |
import org.kuali.rice.kew.postprocessor.PostProcessorRemoteAdapter; |
| 54 | |
import org.kuali.rice.kew.rule.bo.RuleAttribute; |
| 55 | |
import org.kuali.rice.kew.service.KEWServiceLocator; |
| 56 | |
import org.kuali.rice.kew.util.CodeTranslator; |
| 57 | |
import org.kuali.rice.kew.util.KEWConstants; |
| 58 | |
import org.kuali.rice.kew.util.KEWPropertyConstants; |
| 59 | |
import org.kuali.rice.kew.util.Utilities; |
| 60 | |
import org.kuali.rice.kim.bo.Group; |
| 61 | |
import org.kuali.rice.kim.service.IdentityManagementService; |
| 62 | |
import org.kuali.rice.kim.service.KIMServiceLocator; |
| 63 | |
import org.kuali.rice.kns.bo.Inactivateable; |
| 64 | |
import org.kuali.rice.kns.bo.PersistableBusinessObjectBase; |
| 65 | |
import org.kuali.rice.kns.util.ObjectUtils; |
| 66 | |
|
| 67 | |
import javax.persistence.Basic; |
| 68 | |
import javax.persistence.CascadeType; |
| 69 | |
import javax.persistence.Column; |
| 70 | |
import javax.persistence.Entity; |
| 71 | |
import javax.persistence.FetchType; |
| 72 | |
import javax.persistence.GeneratedValue; |
| 73 | |
import javax.persistence.Id; |
| 74 | |
import javax.persistence.Lob; |
| 75 | |
import javax.persistence.NamedQueries; |
| 76 | |
import javax.persistence.NamedQuery; |
| 77 | |
import javax.persistence.OneToMany; |
| 78 | |
import javax.persistence.OrderBy; |
| 79 | |
import javax.persistence.Table; |
| 80 | |
import javax.persistence.Transient; |
| 81 | |
import java.lang.reflect.InvocationTargetException; |
| 82 | |
import java.util.ArrayList; |
| 83 | |
import java.util.Collection; |
| 84 | |
import java.util.Collections; |
| 85 | |
import java.util.Iterator; |
| 86 | |
import java.util.List; |
| 87 | |
import java.util.Set; |
| 88 | |
|
| 89 | |
|
| 90 | |
|
| 91 | |
|
| 92 | |
|
| 93 | |
|
| 94 | |
|
| 95 | |
|
| 96 | |
@Entity |
| 97 | |
|
| 98 | |
@Table(name = "KREW_DOC_TYP_T") |
| 99 | |
@NamedQueries({ |
| 100 | |
@NamedQuery(name = "DocumentType.QuickLinks.FindLabelByTypeName", query = "SELECT label FROM DocumentType WHERE name = :docTypeName AND currentInd = 1"), |
| 101 | |
@NamedQuery(name = "DocumentType.QuickLinks.FindInitiatedDocumentTypesListByInitiatorWorkflowId", query = "SELECT DISTINCT dt.name, dt.label FROM DocumentType dt, DocumentRouteHeaderValue drhv " + |
| 102 | |
"WHERE drhv.initiatorWorkflowId = :initiatorWorkflowId AND drhv.documentTypeId = dt.documentTypeId AND dt.active = 1 AND dt.currentInd = 1 " + |
| 103 | |
"ORDER BY UPPER(dt.label)") |
| 104 | |
}) |
| 105 | |
public class DocumentType extends PersistableBusinessObjectBase implements Inactivateable, DocumentTypeEBO { |
| 106 | 0 | private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(DocumentType.class); |
| 107 | |
|
| 108 | |
private static final long serialVersionUID = 1312830153583125069L; |
| 109 | |
|
| 110 | |
@Id |
| 111 | |
@GeneratedValue(generator = "KREW_DOC_HDR_S") |
| 112 | |
@GenericGenerator(name = "KREW_DOC_HDR_S", strategy = "org.hibernate.id.enhanced.SequenceStyleGenerator", parameters = { |
| 113 | |
@Parameter(name = "sequence_name", value = "KREW_DOC_HDR_S"), |
| 114 | |
@Parameter(name = "value_column", value = "id") |
| 115 | |
}) |
| 116 | |
@Column(name = "DOC_TYP_ID") |
| 117 | |
private Long documentTypeId; |
| 118 | |
@Column(name = "PARNT_ID") |
| 119 | |
private Long docTypeParentId; |
| 120 | |
@Column(name = "DOC_TYP_NM") |
| 121 | |
private String name; |
| 122 | 0 | @Column(name = "DOC_TYP_VER_NBR") |
| 123 | |
private Integer version = new Integer(0); |
| 124 | |
@Column(name = "ACTV_IND") |
| 125 | |
private Boolean active; |
| 126 | |
@Column(name = "CUR_IND") |
| 127 | |
private Boolean currentInd; |
| 128 | |
@Column(name = "DOC_TYP_DESC") |
| 129 | |
private String description; |
| 130 | |
@Column(name = "LBL") |
| 131 | |
private String label; |
| 132 | |
@Column(name = "PREV_DOC_TYP_VER_NBR") |
| 133 | |
private Long previousVersionId; |
| 134 | |
@Column(name = "DOC_HDR_ID") |
| 135 | |
private Long routeHeaderId; |
| 136 | |
|
| 137 | |
@Column(name = "HELP_DEF_URL") |
| 138 | |
private String unresolvedHelpDefinitionUrl; |
| 139 | |
|
| 140 | |
@Column(name = "DOC_SEARCH_HELP_URL") |
| 141 | |
private String unresolvedDocSearchHelpUrl; |
| 142 | |
|
| 143 | |
@Column(name = "DOC_HDLR_URL") |
| 144 | |
private String unresolvedDocHandlerUrl; |
| 145 | |
@Column(name = "POST_PRCSR") |
| 146 | |
private String postProcessorName; |
| 147 | |
@Column(name = "GRP_ID") |
| 148 | |
|
| 149 | |
private String workgroupId; |
| 150 | |
@Column(name = "BLNKT_APPR_GRP_ID") |
| 151 | |
private String blanketApproveWorkgroupId; |
| 152 | |
@Column(name = "BLNKT_APPR_PLCY") |
| 153 | |
private String blanketApprovePolicy; |
| 154 | |
@Column(name = "RPT_GRP_ID") |
| 155 | |
private String reportingWorkgroupId; |
| 156 | |
@Column(name = "SVC_NMSPC") |
| 157 | |
private String actualServiceNamespace; |
| 158 | |
|
| 159 | |
|
| 160 | |
|
| 161 | |
|
| 162 | |
|
| 163 | |
@Transient |
| 164 | |
private String returnUrl; |
| 165 | |
@Transient |
| 166 | |
private String actionsUrl; |
| 167 | 0 | @Transient |
| 168 | |
private Boolean applyRetroactively = Boolean.FALSE; |
| 169 | |
|
| 170 | |
|
| 171 | |
|
| 172 | |
|
| 173 | |
@Transient |
| 174 | |
private Group defaultExceptionWorkgroup; |
| 175 | |
|
| 176 | |
@OneToMany(fetch = FetchType.EAGER, cascade = {CascadeType.REMOVE, CascadeType.MERGE, CascadeType.PERSIST}, mappedBy = "documentType") |
| 177 | |
@Fetch(value = FetchMode.SELECT) |
| 178 | |
private Collection<DocumentTypePolicy> policies; |
| 179 | |
|
| 180 | |
|
| 181 | |
|
| 182 | |
|
| 183 | |
|
| 184 | |
|
| 185 | |
@OneToMany(fetch = FetchType.EAGER, cascade = {CascadeType.REMOVE, CascadeType.MERGE, CascadeType.PERSIST}, mappedBy = "documentType") |
| 186 | |
@Fetch(value = FetchMode.SELECT) |
| 187 | |
private List<ApplicationDocumentStatus> validApplicationStatuses; |
| 188 | |
|
| 189 | |
@Transient |
| 190 | |
private List routeLevels; |
| 191 | |
@Transient |
| 192 | |
private Collection childrenDocTypes; |
| 193 | |
@Fetch(value = FetchMode.SELECT) |
| 194 | |
@OneToMany(fetch = FetchType.EAGER, cascade = {CascadeType.REMOVE, CascadeType.MERGE, CascadeType.PERSIST}, mappedBy = "documentType") |
| 195 | |
@OrderBy("orderIndex ASC") |
| 196 | |
private List<DocumentTypeAttribute> documentTypeAttributes; |
| 197 | |
|
| 198 | |
|
| 199 | 0 | @Fetch(value = FetchMode.SELECT) |
| 200 | |
@OneToMany(fetch = FetchType.EAGER, cascade = {CascadeType.MERGE, CascadeType.PERSIST}, mappedBy = "documentType") |
| 201 | |
private List<Process> processes = new ArrayList(); |
| 202 | 0 | @Column(name = "RTE_VER_NBR") |
| 203 | |
private String routingVersion = KEWConstants.CURRENT_ROUTING_VERSION; |
| 204 | |
|
| 205 | |
|
| 206 | |
@Column(name = "NOTIFY_ADDR") |
| 207 | |
private String actualNotificationFromAddress; |
| 208 | |
@Lob |
| 209 | |
@Basic(fetch = FetchType.LAZY) |
| 210 | |
@Column(name = "SEC_XML") |
| 211 | |
private String documentTypeSecurityXml; |
| 212 | |
@Transient |
| 213 | |
private DocumentTypeSecurity documentTypeSecurity; |
| 214 | |
|
| 215 | |
|
| 216 | |
@Column(name = "EMAIL_XSL") |
| 217 | |
private String customEmailStylesheet; |
| 218 | |
|
| 219 | 0 | public DocumentType() { |
| 220 | 0 | routeLevels = new ArrayList(); |
| 221 | 0 | documentTypeAttributes = new ArrayList<DocumentTypeAttribute>(); |
| 222 | 0 | policies = new ArrayList<DocumentTypePolicy>(); |
| 223 | 0 | version = new Integer(0); |
| 224 | 0 | label = null; |
| 225 | 0 | } |
| 226 | |
|
| 227 | |
public void populateDataDictionaryEditableFields(Set<String> propertyNamesEditableViaUI, DocumentType dataDictionaryEditedType) { |
| 228 | 0 | String currentPropertyName = ""; |
| 229 | |
try { |
| 230 | 0 | for (String propertyName : propertyNamesEditableViaUI) { |
| 231 | 0 | currentPropertyName = propertyName; |
| 232 | 0 | if (KEWPropertyConstants.PARENT_DOC_TYPE_NAME.equals(propertyName)) { |
| 233 | |
|
| 234 | 0 | String parentDocumentTypeName = (String) ObjectUtils.getPropertyValue(dataDictionaryEditedType, propertyName); |
| 235 | 0 | if (StringUtils.isNotBlank(parentDocumentTypeName)) { |
| 236 | 0 | DocumentType parentDocType = KEWServiceLocator.getDocumentTypeService().findByName(parentDocumentTypeName); |
| 237 | 0 | if (ObjectUtils.isNull(parentDocType)) { |
| 238 | 0 | throw new WorkflowRuntimeException("Could not find valid document type for document type name '" + parentDocumentTypeName + "' to set as Parent Document Type"); |
| 239 | |
} |
| 240 | 0 | setDocTypeParentId(parentDocType.getDocumentTypeId()); |
| 241 | |
} |
| 242 | 0 | } |
| 243 | |
|
| 244 | |
else { |
| 245 | 0 | LOG.info("*** COPYING PROPERTY NAME FROM OLD BO TO NEW BO: " + propertyName); |
| 246 | 0 | ObjectUtils.setObjectProperty(this, propertyName, ObjectUtils.getPropertyValue(dataDictionaryEditedType, propertyName)); |
| 247 | |
} |
| 248 | |
} |
| 249 | 0 | } catch (FormatException e) { |
| 250 | 0 | throw new WorkflowRuntimeException("Error setting property '" + currentPropertyName + "' in Document Type", e); |
| 251 | 0 | } catch (IllegalAccessException e) { |
| 252 | 0 | throw new WorkflowRuntimeException("Error setting property '" + currentPropertyName + "' in Document Type", e); |
| 253 | 0 | } catch (InvocationTargetException e) { |
| 254 | 0 | throw new WorkflowRuntimeException("Error setting property '" + currentPropertyName + "' in Document Type", e); |
| 255 | 0 | } catch (NoSuchMethodException e) { |
| 256 | 0 | throw new WorkflowRuntimeException("Error setting property '" + currentPropertyName + "' in Document Type", e); |
| 257 | 0 | } catch (Exception e) { |
| 258 | 0 | throw new WorkflowRuntimeException("Error setting property '" + currentPropertyName + "' in Document Type", e); |
| 259 | 0 | } |
| 260 | 0 | } |
| 261 | |
|
| 262 | |
public DocumentTypePolicy getAllowUnrequestedActionPolicy() { |
| 263 | 0 | return getPolicyByName(DocumentTypePolicyEnum.ALLOW_UNREQUESTED_ACTION.getName(), Boolean.TRUE); |
| 264 | |
} |
| 265 | |
|
| 266 | |
public DocumentTypePolicy getDefaultApprovePolicy() { |
| 267 | 0 | return getPolicyByName(DocumentTypePolicyEnum.DEFAULT_APPROVE.getName(), Boolean.TRUE); |
| 268 | |
} |
| 269 | |
|
| 270 | |
public DocumentTypePolicy getUseWorkflowSuperUserDocHandlerUrl() { |
| 271 | 0 | return getPolicyByName(DocumentTypePolicyEnum.USE_KEW_SUPERUSER_DOCHANDLER.getName(), Boolean.TRUE); |
| 272 | |
} |
| 273 | |
|
| 274 | |
public DocumentTypePolicy getInitiatorMustRoutePolicy() { |
| 275 | 0 | return getPolicyByName(DocumentTypePolicyEnum.INITIATOR_MUST_ROUTE.getName(), Boolean.TRUE); |
| 276 | |
} |
| 277 | |
|
| 278 | |
public DocumentTypePolicy getInitiatorMustSavePolicy() { |
| 279 | 0 | return getPolicyByName(DocumentTypePolicyEnum.INITIATOR_MUST_SAVE.getName(), Boolean.TRUE); |
| 280 | |
} |
| 281 | |
|
| 282 | |
public DocumentTypePolicy getInitiatorMustCancelPolicy() { |
| 283 | 0 | return getPolicyByName(DocumentTypePolicyEnum.INITIATOR_MUST_CANCEL.getName(), Boolean.TRUE); |
| 284 | |
} |
| 285 | |
|
| 286 | |
public DocumentTypePolicy getInitiatorMustBlanketApprovePolicy() { |
| 287 | 0 | return getPolicyByName(DocumentTypePolicyEnum.INITIATOR_MUST_BLANKET_APPROVE.getName(), Boolean.TRUE); |
| 288 | |
} |
| 289 | |
|
| 290 | |
public DocumentTypePolicy getLookIntoFuturePolicy() { |
| 291 | 0 | return getPolicyByName(DocumentTypePolicyEnum.LOOK_FUTURE.getName(), Boolean.FALSE); |
| 292 | |
} |
| 293 | |
|
| 294 | |
public DocumentTypePolicy getSuperUserApproveNotificationPolicy() { |
| 295 | 0 | return getPolicyByName(DocumentTypePolicyEnum.SEND_NOTIFICATION_ON_SU_APPROVE.getName(), Boolean.FALSE); |
| 296 | |
} |
| 297 | |
|
| 298 | |
public DocumentTypePolicy getSupportsQuickInitiatePolicy() { |
| 299 | 0 | return getPolicyByName(DocumentTypePolicyEnum.SUPPORTS_QUICK_INITIATE.getName(), Boolean.TRUE); |
| 300 | |
} |
| 301 | |
|
| 302 | |
public DocumentTypePolicy getNotifyOnSavePolicy() { |
| 303 | 0 | return getPolicyByName(DocumentTypePolicyEnum.NOTIFY_ON_SAVE.getName(), Boolean.FALSE); |
| 304 | |
} |
| 305 | |
|
| 306 | |
|
| 307 | |
|
| 308 | |
|
| 309 | |
public DocumentTypePolicy getDocumentStatusPolicy() { |
| 310 | 0 | return getPolicyByName(DocumentTypePolicyEnum.DOCUMENT_STATUS_POLICY.getName(), KEWConstants.DOCUMENT_STATUS_POLICY_KEW_STATUS); |
| 311 | |
} |
| 312 | |
|
| 313 | |
|
| 314 | |
|
| 315 | |
|
| 316 | |
public DocumentTypePolicy getSuPostprocessorOverridePolicy() { |
| 317 | 0 | return getPolicyByName(DocumentTypePolicyEnum.ALLOW_SU_POSTPROCESSOR_OVERRIDE_POLICY.getName(), Boolean.TRUE); |
| 318 | |
} |
| 319 | |
|
| 320 | |
|
| 321 | |
|
| 322 | |
|
| 323 | |
|
| 324 | |
|
| 325 | |
|
| 326 | |
|
| 327 | |
public Boolean isKEWStatusInUse() { |
| 328 | 0 | if (isPolicyDefined(DocumentTypePolicyEnum.DOCUMENT_STATUS_POLICY)) { |
| 329 | 0 | String policyValue = getPolicyByName(DocumentTypePolicyEnum.DOCUMENT_STATUS_POLICY.getName(), KEWConstants.DOCUMENT_STATUS_POLICY_KEW_STATUS).getPolicyStringValue(); |
| 330 | 0 | return (policyValue == null || "".equals(policyValue) |
| 331 | |
|| KEWConstants.DOCUMENT_STATUS_POLICY_KEW_STATUS.equalsIgnoreCase(policyValue) |
| 332 | |
|| KEWConstants.DOCUMENT_STATUS_POLICY_BOTH.equalsIgnoreCase(policyValue)) ? Boolean.TRUE : Boolean.FALSE; |
| 333 | |
} else { |
| 334 | 0 | return Boolean.TRUE; |
| 335 | |
} |
| 336 | |
} |
| 337 | |
|
| 338 | |
|
| 339 | |
|
| 340 | |
|
| 341 | |
|
| 342 | |
|
| 343 | |
|
| 344 | |
public Boolean isAppDocStatusInUse() { |
| 345 | 0 | if (isPolicyDefined(DocumentTypePolicyEnum.DOCUMENT_STATUS_POLICY)) { |
| 346 | 0 | String policyValue = getPolicyByName(DocumentTypePolicyEnum.DOCUMENT_STATUS_POLICY.getName(), KEWConstants.DOCUMENT_STATUS_POLICY_KEW_STATUS).getPolicyStringValue(); |
| 347 | 0 | return (KEWConstants.DOCUMENT_STATUS_POLICY_APP_DOC_STATUS.equalsIgnoreCase(policyValue) |
| 348 | |
|| KEWConstants.DOCUMENT_STATUS_POLICY_BOTH.equalsIgnoreCase(policyValue)) ? Boolean.TRUE : Boolean.FALSE; |
| 349 | |
} else { |
| 350 | 0 | return Boolean.FALSE; |
| 351 | |
} |
| 352 | |
} |
| 353 | |
|
| 354 | |
|
| 355 | |
|
| 356 | |
|
| 357 | |
|
| 358 | |
|
| 359 | |
|
| 360 | |
|
| 361 | |
public Boolean areBothStatusesInUse() { |
| 362 | 0 | if (isPolicyDefined(DocumentTypePolicyEnum.DOCUMENT_STATUS_POLICY)) { |
| 363 | 0 | String policyValue = getPolicyByName(DocumentTypePolicyEnum.DOCUMENT_STATUS_POLICY.getName(), KEWConstants.DOCUMENT_STATUS_POLICY_KEW_STATUS).getPolicyStringValue(); |
| 364 | 0 | return (KEWConstants.DOCUMENT_STATUS_POLICY_BOTH.equalsIgnoreCase(policyValue)) ? Boolean.TRUE : Boolean.FALSE; |
| 365 | |
} else { |
| 366 | 0 | return Boolean.FALSE; |
| 367 | |
} |
| 368 | |
} |
| 369 | |
|
| 370 | |
public String getUseWorkflowSuperUserDocHandlerUrlValue() { |
| 371 | 0 | if (getUseWorkflowSuperUserDocHandlerUrl() != null) { |
| 372 | 0 | return getUseWorkflowSuperUserDocHandlerUrl().getPolicyDisplayValue(); |
| 373 | |
} |
| 374 | 0 | return null; |
| 375 | |
} |
| 376 | |
|
| 377 | |
public String getAllowUnrequestedActionPolicyDisplayValue() { |
| 378 | 0 | if (getAllowUnrequestedActionPolicy() != null) { |
| 379 | 0 | return getAllowUnrequestedActionPolicy().getPolicyDisplayValue(); |
| 380 | |
} |
| 381 | 0 | return null; |
| 382 | |
} |
| 383 | |
|
| 384 | |
public String getDefaultApprovePolicyDisplayValue() { |
| 385 | 0 | if (getDefaultApprovePolicy() != null) { |
| 386 | 0 | return getDefaultApprovePolicy().getPolicyDisplayValue(); |
| 387 | |
} |
| 388 | 0 | return null; |
| 389 | |
} |
| 390 | |
|
| 391 | |
public String getInitiatorMustRouteDisplayValue() { |
| 392 | 0 | if (getInitiatorMustRoutePolicy() != null) { |
| 393 | 0 | return getInitiatorMustRoutePolicy().getPolicyDisplayValue(); |
| 394 | |
} |
| 395 | 0 | return null; |
| 396 | |
} |
| 397 | |
|
| 398 | |
public String getInitiatorMustSaveDisplayValue() { |
| 399 | 0 | if (getInitiatorMustSavePolicy() != null) { |
| 400 | 0 | return getInitiatorMustSavePolicy().getPolicyDisplayValue(); |
| 401 | |
} |
| 402 | 0 | return null; |
| 403 | |
} |
| 404 | |
|
| 405 | |
public boolean isPolicyDefined(DocumentTypePolicyEnum policyToCheck) { |
| 406 | 0 | Iterator<DocumentTypePolicy> policyIter = getPolicies().iterator(); |
| 407 | 0 | while (policyIter.hasNext()) { |
| 408 | 0 | DocumentTypePolicy policy = policyIter.next(); |
| 409 | 0 | if (policyToCheck.getName().equals(policy.getPolicyName())) { |
| 410 | 0 | return true; |
| 411 | |
} |
| 412 | 0 | } |
| 413 | 0 | return getParentDocType() != null && getParentDocType().isPolicyDefined(policyToCheck); |
| 414 | |
} |
| 415 | |
|
| 416 | |
public void addSearchableAttribute(DocumentTypeAttribute searchableAttribute) { |
| 417 | 0 | documentTypeAttributes.add(searchableAttribute); |
| 418 | 0 | } |
| 419 | |
|
| 420 | |
public boolean hasSearchableAttributes() { |
| 421 | 0 | return !getSearchableAttributes().isEmpty(); |
| 422 | |
} |
| 423 | |
|
| 424 | |
public List<SearchableAttribute> getSearchableAttributes() { |
| 425 | 0 | List<SearchableAttribute> searchAtts = new ArrayList<SearchableAttribute>(); |
| 426 | 0 | if ((documentTypeAttributes == null || documentTypeAttributes.isEmpty())) { |
| 427 | 0 | if (getParentDocType() != null) { |
| 428 | 0 | return getParentDocType().getSearchableAttributes(); |
| 429 | |
} else { |
| 430 | 0 | return searchAtts; |
| 431 | |
} |
| 432 | |
} |
| 433 | |
|
| 434 | 0 | for (Iterator iterator = documentTypeAttributes.iterator(); iterator.hasNext();) { |
| 435 | 0 | DocumentTypeAttribute attribute = (DocumentTypeAttribute) iterator.next(); |
| 436 | |
|
| 437 | 0 | RuleAttribute ruleAttribute = attribute.getRuleAttribute(); |
| 438 | 0 | SearchableAttribute searchableAttribute = null; |
| 439 | 0 | if (KEWConstants.SEARCHABLE_ATTRIBUTE_TYPE.equals(ruleAttribute.getType())) { |
| 440 | 0 | ObjectDefinition objDef = getAttributeObjectDefinition(ruleAttribute); |
| 441 | |
try { |
| 442 | 0 | searchableAttribute = (SearchableAttribute) GlobalResourceLoader.getObject(objDef); |
| 443 | 0 | } catch (RiceRemoteServiceConnectionException e) { |
| 444 | 0 | LOG.warn("Unable to connect to load searchable attributes for " + this.getName()); |
| 445 | 0 | LOG.warn(e.getMessage()); |
| 446 | 0 | searchableAttribute = null; |
| 447 | 0 | } |
| 448 | 0 | } else if (KEWConstants.SEARCHABLE_XML_ATTRIBUTE_TYPE.equals(ruleAttribute.getType())) { |
| 449 | 0 | ObjectDefinition objDef = getAttributeObjectDefinition(ruleAttribute); |
| 450 | 0 | searchableAttribute = (SearchableAttribute) GlobalResourceLoader.getObject(objDef); |
| 451 | |
|
| 452 | 0 | ((GenericXMLSearchableAttribute) searchableAttribute).setRuleAttribute(ruleAttribute); |
| 453 | |
} |
| 454 | 0 | if (searchableAttribute != null) { |
| 455 | 0 | searchAtts.add(searchableAttribute); |
| 456 | |
} |
| 457 | 0 | } |
| 458 | 0 | return searchAtts; |
| 459 | |
} |
| 460 | |
|
| 461 | |
public DocumentTypeAttribute getDocumentTypeAttribute(int index) { |
| 462 | 0 | while (getDocumentTypeAttributes().size() <= index) { |
| 463 | 0 | DocumentTypeAttribute attribute = new DocumentTypeAttribute(); |
| 464 | |
|
| 465 | 0 | getDocumentTypeAttributes().add(attribute); |
| 466 | 0 | } |
| 467 | 0 | return (DocumentTypeAttribute) getDocumentTypeAttributes().get(index); |
| 468 | |
} |
| 469 | |
|
| 470 | |
public void setDocumentTypeAttribute(int index, DocumentTypeAttribute documentTypeAttribute) { |
| 471 | 0 | documentTypeAttributes.set(index, documentTypeAttribute); |
| 472 | 0 | } |
| 473 | |
|
| 474 | |
public String getDocTypeActiveIndicatorDisplayValue() { |
| 475 | 0 | if (getActive() == null) { |
| 476 | 0 | return KEWConstants.INACTIVE_LABEL_LOWER; |
| 477 | |
} |
| 478 | 0 | return CodeTranslator.getActiveIndicatorLabel(getActive()); |
| 479 | |
} |
| 480 | |
|
| 481 | |
public Collection getChildrenDocTypes() { |
| 482 | 0 | if (this.childrenDocTypes == null) { |
| 483 | 0 | this.childrenDocTypes = KEWServiceLocator.getDocumentTypeService().getChildDocumentTypes(getDocumentTypeId()); |
| 484 | |
} |
| 485 | 0 | return childrenDocTypes; |
| 486 | |
} |
| 487 | |
|
| 488 | |
public java.lang.Long getDocTypeParentId() { |
| 489 | 0 | return docTypeParentId; |
| 490 | |
} |
| 491 | |
|
| 492 | |
public void setDocTypeParentId(java.lang.Long docTypeParentId) { |
| 493 | 0 | this.docTypeParentId = docTypeParentId; |
| 494 | 0 | } |
| 495 | |
|
| 496 | |
public DocumentType getParentDocType() { |
| 497 | 0 | return KEWServiceLocator.getDocumentTypeService().findById(this.docTypeParentId); |
| 498 | |
} |
| 499 | |
|
| 500 | |
public Collection<DocumentTypePolicy> getPolicies() { |
| 501 | 0 | return policies; |
| 502 | |
} |
| 503 | |
|
| 504 | |
public void setPolicies(Collection<DocumentTypePolicy> policies) { |
| 505 | 0 | this.policies = policies; |
| 506 | 0 | } |
| 507 | |
|
| 508 | |
public List<ApplicationDocumentStatus> getValidApplicationStatuses() { |
| 509 | 0 | return this.validApplicationStatuses; |
| 510 | |
} |
| 511 | |
|
| 512 | |
public void setValidApplicationStatuses( |
| 513 | |
List<ApplicationDocumentStatus> validApplicationStatuses) { |
| 514 | 0 | this.validApplicationStatuses = validApplicationStatuses; |
| 515 | 0 | } |
| 516 | |
|
| 517 | |
public String getDocumentTypeSecurityXml() { |
| 518 | 0 | return documentTypeSecurityXml; |
| 519 | |
} |
| 520 | |
|
| 521 | |
public void setDocumentTypeSecurityXml(String documentTypeSecurityXml) { |
| 522 | 0 | this.documentTypeSecurityXml = documentTypeSecurityXml; |
| 523 | 0 | if (!org.apache.commons.lang.StringUtils.isEmpty(documentTypeSecurityXml.trim())) { |
| 524 | 0 | this.documentTypeSecurity = new DocumentTypeSecurity(this.getServiceNamespace(), documentTypeSecurityXml); |
| 525 | |
} else { |
| 526 | 0 | this.documentTypeSecurity = null; |
| 527 | |
} |
| 528 | 0 | } |
| 529 | |
|
| 530 | |
public DocumentTypeSecurity getDocumentTypeSecurity() { |
| 531 | 0 | if (this.documentTypeSecurity == null && |
| 532 | |
this.documentTypeSecurityXml != null && |
| 533 | |
!org.apache.commons.lang.StringUtils.isEmpty(documentTypeSecurityXml.trim())) { |
| 534 | 0 | this.documentTypeSecurity = new DocumentTypeSecurity(this.getServiceNamespace(), documentTypeSecurityXml); |
| 535 | |
} |
| 536 | 0 | if ((this.documentTypeSecurity == null) && (getParentDocType() != null)) { |
| 537 | 0 | return getParentDocType().getDocumentTypeSecurity(); |
| 538 | |
} |
| 539 | 0 | return this.documentTypeSecurity; |
| 540 | |
} |
| 541 | |
|
| 542 | |
|
| 543 | |
public List getRouteLevels() { |
| 544 | 0 | if (routeLevels.isEmpty() && getParentDocType() != null) { |
| 545 | 0 | return getParentRouteLevels(getParentDocType()); |
| 546 | |
} |
| 547 | 0 | return routeLevels; |
| 548 | |
} |
| 549 | |
|
| 550 | |
private List getParentRouteLevels(DocumentType parent) { |
| 551 | 0 | if (parent.getRouteLevels() == null) { |
| 552 | 0 | return getParentRouteLevels(parent.getParentDocType()); |
| 553 | |
} else { |
| 554 | 0 | return parent.getRouteLevels(); |
| 555 | |
} |
| 556 | |
} |
| 557 | |
|
| 558 | |
public void setRouteLevels(List routeLevels) { |
| 559 | 0 | this.routeLevels = routeLevels; |
| 560 | 0 | } |
| 561 | |
|
| 562 | |
public String getActionsUrl() { |
| 563 | 0 | return actionsUrl; |
| 564 | |
} |
| 565 | |
|
| 566 | |
public void setActionsUrl(String actions) { |
| 567 | 0 | this.actionsUrl = actions; |
| 568 | 0 | } |
| 569 | |
|
| 570 | |
public Boolean getActive() { |
| 571 | 0 | return active; |
| 572 | |
} |
| 573 | |
|
| 574 | |
public void setActive(java.lang.Boolean activeInd) { |
| 575 | 0 | this.active = activeInd; |
| 576 | 0 | } |
| 577 | |
|
| 578 | |
public java.lang.Boolean getCurrentInd() { |
| 579 | 0 | return currentInd; |
| 580 | |
} |
| 581 | |
|
| 582 | |
public void setCurrentInd(java.lang.Boolean currentInd) { |
| 583 | 0 | this.currentInd = currentInd; |
| 584 | 0 | } |
| 585 | |
|
| 586 | |
public java.lang.String getDescription() { |
| 587 | 0 | return description; |
| 588 | |
} |
| 589 | |
|
| 590 | |
public void setDescription(java.lang.String description) { |
| 591 | 0 | this.description = description; |
| 592 | 0 | } |
| 593 | |
|
| 594 | |
|
| 595 | |
|
| 596 | |
|
| 597 | |
|
| 598 | |
public String getDocHandlerUrl() { |
| 599 | 0 | return resolveDocHandlerUrl(getUnresolvedInheritedDocHandlerUrl(false)); |
| 600 | |
} |
| 601 | |
|
| 602 | |
|
| 603 | |
|
| 604 | |
|
| 605 | |
|
| 606 | |
|
| 607 | |
|
| 608 | |
|
| 609 | |
|
| 610 | |
|
| 611 | |
|
| 612 | |
|
| 613 | |
protected String getUnresolvedInheritedDocHandlerUrl(boolean forDisplayPurposes) { |
| 614 | 0 | if (StringUtils.isNotBlank(getUnresolvedDocHandlerUrl())) { |
| 615 | |
|
| 616 | 0 | return getUnresolvedDocHandlerUrl(); |
| 617 | |
} |
| 618 | |
|
| 619 | 0 | DocumentType docType = getParentDocType(); |
| 620 | 0 | if (ObjectUtils.isNotNull(docType)) { |
| 621 | 0 | String parentValue = docType.getUnresolvedDocHandlerUrl(); |
| 622 | 0 | if (StringUtils.isNotBlank(parentValue)) { |
| 623 | |
|
| 624 | 0 | if (forDisplayPurposes) { |
| 625 | 0 | parentValue += " " + KEWConstants.DOCUMENT_TYPE_INHERITED_VALUE_INDICATOR; |
| 626 | |
} |
| 627 | 0 | return parentValue; |
| 628 | |
} |
| 629 | |
|
| 630 | 0 | return docType.getUnresolvedInheritedDocHandlerUrl(forDisplayPurposes); |
| 631 | |
} |
| 632 | 0 | return null; |
| 633 | |
} |
| 634 | |
|
| 635 | |
|
| 636 | |
|
| 637 | |
|
| 638 | |
|
| 639 | |
public String getDisplayableUnresolvedDocHandlerUrl() { |
| 640 | 0 | return getUnresolvedInheritedDocHandlerUrl(true); |
| 641 | |
} |
| 642 | |
|
| 643 | |
|
| 644 | |
|
| 645 | |
|
| 646 | |
|
| 647 | |
|
| 648 | |
public void setDisplayableUnresolvedDocHandlerUrl(String displayableUnresolvedDocHandlerUrl) { |
| 649 | |
|
| 650 | 0 | } |
| 651 | |
|
| 652 | |
|
| 653 | |
|
| 654 | |
|
| 655 | |
public String getUnresolvedDocHandlerUrl() { |
| 656 | 0 | return this.unresolvedDocHandlerUrl; |
| 657 | |
} |
| 658 | |
|
| 659 | |
|
| 660 | |
|
| 661 | |
|
| 662 | |
public void setUnresolvedDocHandlerUrl(String unresolvedDocHandlerUrl) { |
| 663 | 0 | this.unresolvedDocHandlerUrl = unresolvedDocHandlerUrl; |
| 664 | 0 | } |
| 665 | |
|
| 666 | |
|
| 667 | |
|
| 668 | |
|
| 669 | |
|
| 670 | |
protected String resolveDocHandlerUrl(String docHandlerUrl) { |
| 671 | 0 | if (StringUtils.isBlank(docHandlerUrl)) { |
| 672 | 0 | return ""; |
| 673 | |
} |
| 674 | 0 | return Utilities.substituteConfigParameters(getServiceNamespace(), docHandlerUrl); |
| 675 | |
} |
| 676 | |
|
| 677 | |
|
| 678 | |
|
| 679 | |
|
| 680 | |
|
| 681 | |
|
| 682 | |
public void setDocHandlerUrl(java.lang.String docHandlerUrl) { |
| 683 | 0 | setUnresolvedDocHandlerUrl(docHandlerUrl); |
| 684 | 0 | } |
| 685 | |
|
| 686 | |
|
| 687 | |
|
| 688 | |
|
| 689 | |
public String getUnresolvedHelpDefinitionUrl() { |
| 690 | 0 | return this.unresolvedHelpDefinitionUrl; |
| 691 | |
} |
| 692 | |
|
| 693 | |
|
| 694 | |
|
| 695 | |
|
| 696 | |
public void setUnresolvedHelpDefinitionUrl(String unresolvedHelpDefinitionUrl) { |
| 697 | 0 | this.unresolvedHelpDefinitionUrl = unresolvedHelpDefinitionUrl; |
| 698 | 0 | } |
| 699 | |
|
| 700 | |
|
| 701 | |
|
| 702 | |
|
| 703 | |
|
| 704 | |
public String getHelpDefinitionUrl() { |
| 705 | 0 | return resolveHelpUrl(getUnresolvedHelpDefinitionUrl()); |
| 706 | |
} |
| 707 | |
|
| 708 | |
|
| 709 | |
|
| 710 | |
|
| 711 | |
|
| 712 | |
protected String resolveHelpUrl(String helpDefinitionUrl) { |
| 713 | 0 | if (StringUtils.isBlank(helpDefinitionUrl)) { |
| 714 | 0 | return ""; |
| 715 | |
} |
| 716 | 0 | return Utilities.substituteConfigParameters(helpDefinitionUrl); |
| 717 | |
} |
| 718 | |
|
| 719 | |
|
| 720 | |
|
| 721 | |
|
| 722 | |
public String getUnresolvedDocSearchHelpUrl() { |
| 723 | 0 | return this.unresolvedDocSearchHelpUrl; |
| 724 | |
} |
| 725 | |
|
| 726 | |
|
| 727 | |
|
| 728 | |
|
| 729 | |
public void setUnresolvedDocSearchHelpUrl(String unresolvedDocSearchHelpUrl) { |
| 730 | 0 | this.unresolvedDocSearchHelpUrl = unresolvedDocSearchHelpUrl; |
| 731 | 0 | } |
| 732 | |
|
| 733 | |
|
| 734 | |
|
| 735 | |
|
| 736 | |
|
| 737 | |
public String getDocSearchHelpUrl() { |
| 738 | 0 | return resolveHelpUrl(getUnresolvedDocSearchHelpUrl()); |
| 739 | |
} |
| 740 | |
|
| 741 | |
public java.lang.String getLabel() { |
| 742 | 0 | return label; |
| 743 | |
} |
| 744 | |
|
| 745 | |
public void setLabel(java.lang.String label) { |
| 746 | 0 | this.label = label; |
| 747 | 0 | } |
| 748 | |
|
| 749 | |
public java.lang.String getName() { |
| 750 | 0 | return name; |
| 751 | |
} |
| 752 | |
|
| 753 | |
public void setName(java.lang.String name) { |
| 754 | 0 | this.name = name; |
| 755 | 0 | } |
| 756 | |
|
| 757 | |
public PostProcessor getPostProcessor() { |
| 758 | 0 | String pname = getPostProcessorName(); |
| 759 | |
|
| 760 | 0 | if (StringUtils.equals(pname, KEWConstants.POST_PROCESSOR_NON_DEFINED_VALUE)) { |
| 761 | 0 | return new DefaultPostProcessor(); |
| 762 | |
} |
| 763 | 0 | if (StringUtils.isBlank(pname)) { |
| 764 | 0 | if (getParentDocType() != null) { |
| 765 | 0 | return getParentDocType().getPostProcessor(); |
| 766 | |
} else { |
| 767 | 0 | return new DefaultPostProcessor(); |
| 768 | |
} |
| 769 | |
} |
| 770 | |
|
| 771 | 0 | ObjectDefinition objDef = getObjectDefinition(pname); |
| 772 | 0 | Object postProcessor = GlobalResourceLoader.getObject(objDef); |
| 773 | |
|
| 774 | 0 | if (postProcessor == null) { |
| 775 | 0 | throw new WorkflowRuntimeException("Could not locate PostProcessor in this JVM or at service namespace " + getServiceNamespace() + ": " + pname); |
| 776 | |
} |
| 777 | 0 | if (postProcessor instanceof PostProcessorRemote) { |
| 778 | 0 | postProcessor = new PostProcessorRemoteAdapter((PostProcessorRemote) postProcessor); |
| 779 | |
} |
| 780 | |
|
| 781 | 0 | return (PostProcessor) postProcessor; |
| 782 | |
} |
| 783 | |
|
| 784 | |
|
| 785 | |
|
| 786 | |
|
| 787 | |
|
| 788 | |
|
| 789 | |
|
| 790 | |
|
| 791 | |
|
| 792 | |
|
| 793 | |
|
| 794 | |
|
| 795 | |
|
| 796 | |
|
| 797 | |
protected String getInheritedPostProcessorName(boolean forDisplayPurposes) { |
| 798 | 0 | if (StringUtils.isNotBlank(getPostProcessorName())) { |
| 799 | |
|
| 800 | 0 | return getPostProcessorName(); |
| 801 | |
} |
| 802 | 0 | if (ObjectUtils.isNotNull(getParentDocType())) { |
| 803 | |
|
| 804 | 0 | String parentValue = getParentDocType().getPostProcessorName(); |
| 805 | 0 | if (StringUtils.isNotBlank(parentValue)) { |
| 806 | |
|
| 807 | 0 | if (forDisplayPurposes) { |
| 808 | 0 | parentValue += " " + KEWConstants.DOCUMENT_TYPE_INHERITED_VALUE_INDICATOR; |
| 809 | |
} |
| 810 | 0 | return parentValue; |
| 811 | |
} |
| 812 | |
|
| 813 | 0 | return getParentDocType().getInheritedPostProcessorName(forDisplayPurposes); |
| 814 | |
} |
| 815 | 0 | return null; |
| 816 | |
} |
| 817 | |
|
| 818 | |
public java.lang.String getPostProcessorName() { |
| 819 | 0 | return postProcessorName; |
| 820 | |
} |
| 821 | |
|
| 822 | |
public void setPostProcessorName(java.lang.String postProcessorName) { |
| 823 | 0 | this.postProcessorName = postProcessorName; |
| 824 | 0 | } |
| 825 | |
|
| 826 | |
public String getDisplayablePostProcessorName() { |
| 827 | 0 | return getInheritedPostProcessorName(true); |
| 828 | |
} |
| 829 | |
|
| 830 | |
|
| 831 | |
|
| 832 | |
|
| 833 | |
|
| 834 | |
|
| 835 | |
public void setDisplayablePostProcessorName(String displayablePostProcessorName) { |
| 836 | |
|
| 837 | 0 | } |
| 838 | |
|
| 839 | |
public java.lang.Long getPreviousVersionId() { |
| 840 | 0 | return previousVersionId; |
| 841 | |
} |
| 842 | |
|
| 843 | |
public void setPreviousVersionId(java.lang.Long previousVersionId) { |
| 844 | 0 | this.previousVersionId = previousVersionId; |
| 845 | 0 | } |
| 846 | |
|
| 847 | |
public java.lang.Long getRouteHeaderId() { |
| 848 | 0 | return routeHeaderId; |
| 849 | |
} |
| 850 | |
|
| 851 | |
public void setRouteHeaderId(java.lang.Long routeHeaderId) { |
| 852 | 0 | this.routeHeaderId = routeHeaderId; |
| 853 | 0 | } |
| 854 | |
|
| 855 | |
public java.lang.Integer getVersion() { |
| 856 | 0 | return version; |
| 857 | |
} |
| 858 | |
|
| 859 | |
public void setVersion(java.lang.Integer version) { |
| 860 | 0 | this.version = version; |
| 861 | 0 | } |
| 862 | |
|
| 863 | |
public java.lang.Long getDocumentTypeId() { |
| 864 | 0 | return documentTypeId; |
| 865 | |
} |
| 866 | |
|
| 867 | |
public void setDocumentTypeId(java.lang.Long docTypeGrpId) { |
| 868 | 0 | this.documentTypeId = docTypeGrpId; |
| 869 | 0 | } |
| 870 | |
|
| 871 | |
public Object copy(boolean preserveKeys) { |
| 872 | 0 | throw new UnsupportedOperationException("The copy method is deprecated and unimplemented!"); |
| 873 | |
} |
| 874 | |
|
| 875 | |
public java.lang.String getReturnUrl() { |
| 876 | 0 | return returnUrl; |
| 877 | |
} |
| 878 | |
|
| 879 | |
public void setReturnUrl(java.lang.String returnUrl) { |
| 880 | 0 | this.returnUrl = returnUrl; |
| 881 | 0 | } |
| 882 | |
|
| 883 | |
private DocumentTypePolicy getPolicyByName(String policyName, Boolean defaultValue) { |
| 884 | |
|
| 885 | 0 | Iterator policyIter = getPolicies().iterator(); |
| 886 | 0 | while (policyIter.hasNext()) { |
| 887 | 0 | DocumentTypePolicy policy = (DocumentTypePolicy) policyIter.next(); |
| 888 | 0 | if (policyName.equals(policy.getPolicyName())) { |
| 889 | 0 | policy.setInheritedFlag(Boolean.FALSE); |
| 890 | 0 | return policy; |
| 891 | |
} |
| 892 | 0 | } |
| 893 | |
|
| 894 | 0 | if (getParentDocType() != null) { |
| 895 | 0 | DocumentTypePolicy policy = getParentDocType().getPolicyByName(policyName, defaultValue); |
| 896 | 0 | policy.setInheritedFlag(Boolean.TRUE); |
| 897 | 0 | if (policy.getPolicyValue() == null) { |
| 898 | 0 | policy.setPolicyValue(Boolean.TRUE); |
| 899 | |
} |
| 900 | 0 | return policy; |
| 901 | |
} |
| 902 | 0 | DocumentTypePolicy policy = new DocumentTypePolicy(); |
| 903 | 0 | policy.setPolicyName(policyName); |
| 904 | 0 | policy.setInheritedFlag(Boolean.FALSE); |
| 905 | 0 | policy.setPolicyValue(defaultValue); |
| 906 | 0 | return policy; |
| 907 | |
} |
| 908 | |
|
| 909 | |
private DocumentTypePolicy getPolicyByName(String policyName, String defaultValue) { |
| 910 | |
|
| 911 | 0 | Iterator policyIter = getPolicies().iterator(); |
| 912 | 0 | while (policyIter.hasNext()) { |
| 913 | 0 | DocumentTypePolicy policy = (DocumentTypePolicy) policyIter.next(); |
| 914 | 0 | if (policyName.equals(policy.getPolicyName())) { |
| 915 | 0 | policy.setInheritedFlag(Boolean.FALSE); |
| 916 | 0 | return policy; |
| 917 | |
} |
| 918 | 0 | } |
| 919 | |
|
| 920 | 0 | if (getParentDocType() != null) { |
| 921 | 0 | DocumentTypePolicy policy = getParentDocType().getPolicyByName(policyName, defaultValue); |
| 922 | 0 | policy.setInheritedFlag(Boolean.TRUE); |
| 923 | 0 | if (policy.getPolicyValue() == null) { |
| 924 | 0 | policy.setPolicyValue(Boolean.TRUE); |
| 925 | |
} |
| 926 | 0 | return policy; |
| 927 | |
} |
| 928 | 0 | DocumentTypePolicy policy = new DocumentTypePolicy(); |
| 929 | 0 | policy.setPolicyName(policyName); |
| 930 | 0 | policy.setInheritedFlag(Boolean.FALSE); |
| 931 | 0 | policy.setPolicyValue(Boolean.TRUE); |
| 932 | 0 | policy.setPolicyStringValue(defaultValue); |
| 933 | 0 | return policy; |
| 934 | |
} |
| 935 | |
|
| 936 | |
private DocumentTypeService getDocumentTypeService() { |
| 937 | 0 | return (DocumentTypeService) KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_TYPE_SERVICE); |
| 938 | |
} |
| 939 | |
|
| 940 | |
public Group getSuperUserWorkgroup() { |
| 941 | 0 | Group superUserWorkgroup = getSuperUserWorkgroupNoInheritence(); |
| 942 | 0 | if (superUserWorkgroup == null && getParentDocType() != null) { |
| 943 | 0 | return getParentDocType().getSuperUserWorkgroup(); |
| 944 | |
} |
| 945 | 0 | return superUserWorkgroup; |
| 946 | |
} |
| 947 | |
|
| 948 | |
public Group getSuperUserWorkgroupNoInheritence() { |
| 949 | 0 | if (workgroupId == null) { |
| 950 | 0 | return null; |
| 951 | |
} |
| 952 | 0 | return getIdentityManagementService().getGroup(this.workgroupId); |
| 953 | |
} |
| 954 | |
|
| 955 | |
public void setSuperUserWorkgroupNoInheritence(Group suWorkgroup) { |
| 956 | 0 | this.workgroupId = null; |
| 957 | 0 | if (ObjectUtils.isNotNull(suWorkgroup)) { |
| 958 | 0 | this.workgroupId = suWorkgroup.getGroupId(); |
| 959 | |
} |
| 960 | 0 | } |
| 961 | |
|
| 962 | |
|
| 963 | |
|
| 964 | |
|
| 965 | |
public boolean isSuperUserGroupDefined() { |
| 966 | 0 | if (this.workgroupId == null) { |
| 967 | 0 | return getParentDocType() != null && getParentDocType().isSuperUserGroupDefined(); |
| 968 | |
} |
| 969 | 0 | return true; |
| 970 | |
} |
| 971 | |
|
| 972 | |
public DocumentType getPreviousVersion() { |
| 973 | 0 | return getDocumentTypeService().findById(previousVersionId); |
| 974 | |
} |
| 975 | |
|
| 976 | |
public Group getBlanketApproveWorkgroup() { |
| 977 | 0 | return getIdentityManagementService().getGroup(blanketApproveWorkgroupId); |
| 978 | |
} |
| 979 | |
|
| 980 | |
public void setBlanketApproveWorkgroup(Group blanketApproveWorkgroup) { |
| 981 | 0 | this.blanketApproveWorkgroupId = null; |
| 982 | 0 | if (ObjectUtils.isNotNull(blanketApproveWorkgroup)) { |
| 983 | 0 | this.blanketApproveWorkgroupId = blanketApproveWorkgroup.getGroupId(); |
| 984 | |
} |
| 985 | 0 | } |
| 986 | |
|
| 987 | |
public String getBlanketApprovePolicy() { |
| 988 | 0 | return this.blanketApprovePolicy; |
| 989 | |
} |
| 990 | |
|
| 991 | |
public void setBlanketApprovePolicy(String blanketApprovePolicy) { |
| 992 | 0 | this.blanketApprovePolicy = blanketApprovePolicy; |
| 993 | 0 | } |
| 994 | |
|
| 995 | |
public Group getBlanketApproveWorkgroupWithInheritance() { |
| 996 | 0 | if (getParentDocType() != null && this.blanketApproveWorkgroupId == null) { |
| 997 | 0 | return getParentDocType().getBlanketApproveWorkgroupWithInheritance(); |
| 998 | |
} |
| 999 | 0 | return getIdentityManagementService().getGroup(blanketApproveWorkgroupId); |
| 1000 | |
} |
| 1001 | |
|
| 1002 | |
public boolean isBlanketApprover(String principalId) { |
| 1003 | 0 | if (KEWConstants.DOCUMENT_TYPE_BLANKET_APPROVE_POLICY_NONE.equalsIgnoreCase(getBlanketApprovePolicy())) { |
| 1004 | |
|
| 1005 | 0 | return false; |
| 1006 | 0 | } else if (KEWConstants.DOCUMENT_TYPE_BLANKET_APPROVE_POLICY_ANY.equalsIgnoreCase(getBlanketApprovePolicy())) { |
| 1007 | |
|
| 1008 | 0 | return true; |
| 1009 | |
} |
| 1010 | 0 | if (blanketApproveWorkgroupId != null) { |
| 1011 | 0 | return getIdentityManagementService().isMemberOfGroup(principalId, blanketApproveWorkgroupId); |
| 1012 | |
} |
| 1013 | 0 | DocumentType parentDoc = getParentDocType(); |
| 1014 | 0 | if (parentDoc != null) { |
| 1015 | |
|
| 1016 | 0 | return parentDoc.isBlanketApprover(principalId); |
| 1017 | |
} |
| 1018 | 0 | return false; |
| 1019 | |
} |
| 1020 | |
|
| 1021 | |
|
| 1022 | |
|
| 1023 | |
|
| 1024 | |
|
| 1025 | |
public boolean isBlanketApproveGroupDefined() { |
| 1026 | 0 | if (StringUtils.isBlank(getBlanketApprovePolicy()) && this.blanketApproveWorkgroupId == null) { |
| 1027 | 0 | return getParentDocType() != null && getParentDocType().isBlanketApproveGroupDefined(); |
| 1028 | |
} |
| 1029 | 0 | return true; |
| 1030 | |
} |
| 1031 | |
|
| 1032 | |
|
| 1033 | |
|
| 1034 | |
|
| 1035 | |
public String getReportingWorkgroupId() { |
| 1036 | 0 | return this.reportingWorkgroupId; |
| 1037 | |
} |
| 1038 | |
|
| 1039 | |
|
| 1040 | |
|
| 1041 | |
|
| 1042 | |
public void setReportingWorkgroupId(String reportingWorkgroupId) { |
| 1043 | 0 | this.reportingWorkgroupId = reportingWorkgroupId; |
| 1044 | 0 | } |
| 1045 | |
|
| 1046 | |
public Group getReportingWorkgroup() { |
| 1047 | 0 | return getIdentityManagementService().getGroup(this.reportingWorkgroupId); |
| 1048 | |
} |
| 1049 | |
|
| 1050 | |
public void setReportingWorkgroup(Group reportingWorkgroup) { |
| 1051 | 0 | this.reportingWorkgroupId = null; |
| 1052 | 0 | if (ObjectUtils.isNotNull(reportingWorkgroup)) { |
| 1053 | 0 | this.reportingWorkgroupId = reportingWorkgroup.getGroupId(); |
| 1054 | |
} |
| 1055 | 0 | } |
| 1056 | |
|
| 1057 | |
public Group getDefaultExceptionWorkgroup() { |
| 1058 | 0 | return defaultExceptionWorkgroup; |
| 1059 | |
} |
| 1060 | |
|
| 1061 | |
public void setDefaultExceptionWorkgroup(Group defaultExceptionWorkgroup) { |
| 1062 | 0 | this.defaultExceptionWorkgroup = defaultExceptionWorkgroup; |
| 1063 | 0 | } |
| 1064 | |
|
| 1065 | |
|
| 1066 | |
public DocumentSearchGenerator getDocumentSearchGenerator() { |
| 1067 | 0 | ObjectDefinition objDef = getAttributeObjectDefinition(KEWConstants.SEARCH_GENERATOR_ATTRIBUTE_TYPE); |
| 1068 | 0 | if (objDef == null) { |
| 1069 | 0 | if (getParentDocType() != null) { |
| 1070 | 0 | return getParentDocType().getDocumentSearchGenerator(); |
| 1071 | |
} else { |
| 1072 | 0 | return KEWServiceLocator.getDocumentSearchService().getStandardDocumentSearchGenerator(); |
| 1073 | |
} |
| 1074 | |
} |
| 1075 | |
|
| 1076 | |
Object searchGenerator; |
| 1077 | |
try { |
| 1078 | 0 | searchGenerator = GlobalResourceLoader.getObject(objDef); |
| 1079 | 0 | } catch (RiceRemoteServiceConnectionException e) { |
| 1080 | 0 | LOG.warn("Unable to connect to load searchGenerator for " + this.getName() + ". Using StandardDocumentSearchGenerator as default."); |
| 1081 | 0 | LOG.warn(e.getMessage()); |
| 1082 | 0 | return KEWServiceLocator.getDocumentSearchService().getStandardDocumentSearchGenerator(); |
| 1083 | 0 | } |
| 1084 | |
|
| 1085 | 0 | if (searchGenerator == null) { |
| 1086 | 0 | throw new WorkflowRuntimeException("Could not locate DocumentSearchGenerator in this JVM or at service namespace " + getServiceNamespace() + ": " + objDef.getClassName()); |
| 1087 | |
} |
| 1088 | |
|
| 1089 | 0 | return (DocumentSearchGenerator) searchGenerator; |
| 1090 | |
} |
| 1091 | |
|
| 1092 | |
public DocumentSearchCriteriaProcessor getDocumentSearchCriteriaProcessor() { |
| 1093 | 0 | ObjectDefinition objDef = getAttributeObjectDefinition(KEWConstants.SEARCH_CRITERIA_PROCESSOR_ATTRIBUTE_TYPE); |
| 1094 | 0 | if (objDef == null) { |
| 1095 | 0 | if (getParentDocType() != null) { |
| 1096 | 0 | return getParentDocType().getDocumentSearchCriteriaProcessor(); |
| 1097 | |
} else { |
| 1098 | 0 | return new StandardDocumentSearchCriteriaProcessor(); |
| 1099 | |
} |
| 1100 | |
} |
| 1101 | 0 | Object criteriaProcessor = GlobalResourceLoader.getObject(objDef); |
| 1102 | 0 | if (criteriaProcessor == null) { |
| 1103 | 0 | throw new WorkflowRuntimeException("Could not locate DocumentSearchCriteriaProcessor in this JVM or at service namespace " + getServiceNamespace() + ": " + objDef.getClassName()); |
| 1104 | |
} |
| 1105 | 0 | return (DocumentSearchCriteriaProcessor) criteriaProcessor; |
| 1106 | |
} |
| 1107 | |
|
| 1108 | |
public DocumentSearchResultProcessor getDocumentSearchResultProcessor() { |
| 1109 | 0 | if ((documentTypeAttributes == null || documentTypeAttributes.isEmpty())) { |
| 1110 | 0 | if (getParentDocType() != null) { |
| 1111 | 0 | return getParentDocType().getDocumentSearchResultProcessor(); |
| 1112 | |
} else { |
| 1113 | 0 | return KEWServiceLocator.getDocumentSearchService().getStandardDocumentSearchResultProcessor(); |
| 1114 | |
|
| 1115 | |
} |
| 1116 | |
} |
| 1117 | 0 | for (Iterator iterator = documentTypeAttributes.iterator(); iterator.hasNext();) { |
| 1118 | 0 | DocumentTypeAttribute attribute = (DocumentTypeAttribute) iterator.next(); |
| 1119 | 0 | RuleAttribute ruleAttribute = attribute.getRuleAttribute(); |
| 1120 | 0 | if (KEWConstants.SEARCH_RESULT_PROCESSOR_ATTRIBUTE_TYPE.equals(ruleAttribute.getType())) { |
| 1121 | 0 | ObjectDefinition objDef = getAttributeObjectDefinition(ruleAttribute); |
| 1122 | 0 | return (DocumentSearchResultProcessor) GlobalResourceLoader.getObject(objDef); |
| 1123 | 0 | } else if (KEWConstants.SEARCH_RESULT_XML_PROCESSOR_ATTRIBUTE_TYPE.equals(ruleAttribute.getType())) { |
| 1124 | 0 | ObjectDefinition objDef = getAttributeObjectDefinition(ruleAttribute); |
| 1125 | 0 | DocumentSearchResultProcessor resultProcessor = (DocumentSearchResultProcessor) GlobalResourceLoader.getObject(objDef); |
| 1126 | |
|
| 1127 | 0 | ((DocumentSearchXMLResultProcessor) resultProcessor).setRuleAttribute(ruleAttribute); |
| 1128 | 0 | return resultProcessor; |
| 1129 | |
} |
| 1130 | 0 | } |
| 1131 | 0 | return KEWServiceLocator.getDocumentSearchService().getStandardDocumentSearchResultProcessor(); |
| 1132 | |
|
| 1133 | |
} |
| 1134 | |
|
| 1135 | |
public CustomActionListAttribute getCustomActionListAttribute() throws ResourceUnavailableException { |
| 1136 | |
|
| 1137 | 0 | ObjectDefinition objDef = getAttributeObjectDefinition(KEWConstants.ACTION_LIST_ATTRIBUTE_TYPE); |
| 1138 | 0 | if (objDef == null) { |
| 1139 | 0 | return null; |
| 1140 | |
} |
| 1141 | |
try { |
| 1142 | 0 | return (CustomActionListAttribute) GlobalResourceLoader.getObject(objDef); |
| 1143 | 0 | } catch (RuntimeException e) { |
| 1144 | 0 | LOG.error("Error obtaining custom action list attribute: " + objDef, e); |
| 1145 | 0 | throw e; |
| 1146 | |
} |
| 1147 | |
|
| 1148 | |
} |
| 1149 | |
|
| 1150 | |
public CustomEmailAttribute getCustomEmailAttribute() throws ResourceUnavailableException { |
| 1151 | 0 | ObjectDefinition objDef = getAttributeObjectDefinition(KEWConstants.EMAIL_ATTRIBUTE_TYPE); |
| 1152 | 0 | if (objDef == null) { |
| 1153 | 0 | return null; |
| 1154 | |
} |
| 1155 | 0 | return (CustomEmailAttribute) GlobalResourceLoader.getObject(objDef); |
| 1156 | |
} |
| 1157 | |
|
| 1158 | |
public ObjectDefinition getAttributeObjectDefinition(String typeCode) { |
| 1159 | 0 | for (Iterator iter = getDocumentTypeAttributes().iterator(); iter.hasNext();) { |
| 1160 | 0 | RuleAttribute attribute = ((DocumentTypeAttribute) iter.next()).getRuleAttribute(); |
| 1161 | 0 | if (attribute.getType().equals(typeCode)) { |
| 1162 | 0 | return getAttributeObjectDefinition(attribute); |
| 1163 | |
} |
| 1164 | 0 | } |
| 1165 | 0 | if (getParentDocType() != null) { |
| 1166 | 0 | return getParentDocType().getAttributeObjectDefinition(typeCode); |
| 1167 | |
} |
| 1168 | 0 | return null; |
| 1169 | |
} |
| 1170 | |
|
| 1171 | |
public ObjectDefinition getAttributeObjectDefinition(RuleAttribute ruleAttribute) { |
| 1172 | 0 | if (ruleAttribute.getServiceNamespace() == null) { |
| 1173 | 0 | return new ObjectDefinition(ruleAttribute.getClassName(), this.getServiceNamespace()); |
| 1174 | |
} else { |
| 1175 | 0 | return new ObjectDefinition(ruleAttribute.getClassName(), ruleAttribute.getServiceNamespace()); |
| 1176 | |
} |
| 1177 | |
} |
| 1178 | |
|
| 1179 | |
public CustomNoteAttribute getCustomNoteAttribute() throws ResourceUnavailableException { |
| 1180 | 0 | ObjectDefinition objDef = getAttributeObjectDefinition(KEWConstants.NOTE_ATTRIBUTE_TYPE); |
| 1181 | 0 | if (objDef == null) { |
| 1182 | 0 | String defaultNoteClass = ConfigContext.getCurrentContextConfig().getDefaultKewNoteClass(); |
| 1183 | 0 | if (defaultNoteClass == null) { |
| 1184 | |
|
| 1185 | 0 | defaultNoteClass = ConfigContext.getCurrentContextConfig().getDefaultKewNoteClass(); |
| 1186 | 0 | if (ObjectUtils.isNull(defaultNoteClass)) { |
| 1187 | 0 | return null; |
| 1188 | |
} |
| 1189 | |
} |
| 1190 | 0 | objDef = new ObjectDefinition(defaultNoteClass); |
| 1191 | |
} |
| 1192 | 0 | return (CustomNoteAttribute) GlobalResourceLoader.getObject(objDef); |
| 1193 | |
} |
| 1194 | |
|
| 1195 | |
public ObjectDefinition getObjectDefinition(String objectName) { |
| 1196 | 0 | return new ObjectDefinition(objectName, getServiceNamespace()); |
| 1197 | |
} |
| 1198 | |
|
| 1199 | |
|
| 1200 | |
|
| 1201 | |
|
| 1202 | |
|
| 1203 | |
public boolean isRouteInherited() { |
| 1204 | 0 | return processes.isEmpty() && getParentDocType() != null; |
| 1205 | |
} |
| 1206 | |
|
| 1207 | |
|
| 1208 | |
|
| 1209 | |
|
| 1210 | |
|
| 1211 | |
public DocumentType getRouteDefiningDocumentType() { |
| 1212 | 0 | if (isRouteInherited()) { |
| 1213 | 0 | return getParentDocType().getRouteDefiningDocumentType(); |
| 1214 | |
} |
| 1215 | 0 | return this; |
| 1216 | |
} |
| 1217 | |
|
| 1218 | |
public boolean isDocTypeActive() { |
| 1219 | 0 | if (!getActive().booleanValue()) { |
| 1220 | 0 | return false; |
| 1221 | |
} |
| 1222 | 0 | if (getParentDocType() != null) { |
| 1223 | 0 | if (!getParentActiveInd(getParentDocType())) { |
| 1224 | 0 | return false; |
| 1225 | |
} |
| 1226 | |
} |
| 1227 | 0 | return true; |
| 1228 | |
} |
| 1229 | |
|
| 1230 | |
private boolean getParentActiveInd(DocumentType parentDocType) { |
| 1231 | 0 | if (parentDocType.getActive() == null || parentDocType.getActive().booleanValue()) { |
| 1232 | 0 | if (parentDocType.getParentDocType() != null) { |
| 1233 | 0 | return getParentActiveInd(parentDocType.getParentDocType()); |
| 1234 | |
} |
| 1235 | 0 | return true; |
| 1236 | |
} else { |
| 1237 | 0 | return false; |
| 1238 | |
} |
| 1239 | |
} |
| 1240 | |
|
| 1241 | |
|
| 1242 | |
|
| 1243 | |
|
| 1244 | |
public void setDocumentTypeAttributes(List<DocumentTypeAttribute> documentTypeAttributes) { |
| 1245 | 0 | this.documentTypeAttributes = documentTypeAttributes; |
| 1246 | 0 | } |
| 1247 | |
|
| 1248 | |
|
| 1249 | |
|
| 1250 | |
|
| 1251 | |
public List<DocumentTypeAttribute> getDocumentTypeAttributes() { |
| 1252 | 0 | return documentTypeAttributes; |
| 1253 | |
} |
| 1254 | |
|
| 1255 | |
|
| 1256 | |
|
| 1257 | |
|
| 1258 | |
|
| 1259 | |
|
| 1260 | |
|
| 1261 | |
|
| 1262 | |
|
| 1263 | |
|
| 1264 | |
|
| 1265 | |
|
| 1266 | |
public void addProcess(Process process) { |
| 1267 | 0 | processes.add(process); |
| 1268 | 0 | } |
| 1269 | |
|
| 1270 | |
|
| 1271 | |
|
| 1272 | |
|
| 1273 | |
|
| 1274 | |
|
| 1275 | |
|
| 1276 | |
|
| 1277 | |
|
| 1278 | |
|
| 1279 | |
|
| 1280 | |
public List getProcesses() { |
| 1281 | 0 | if (processes.isEmpty() && getParentDocType() != null) { |
| 1282 | 0 | return getParentProcesses(getParentDocType()); |
| 1283 | |
} |
| 1284 | 0 | return Collections.unmodifiableList(processes); |
| 1285 | |
} |
| 1286 | |
|
| 1287 | |
public void setProcesses(List routeNodes) { |
| 1288 | 0 | this.processes = routeNodes; |
| 1289 | 0 | } |
| 1290 | |
|
| 1291 | |
private List getParentProcesses(DocumentType parent) { |
| 1292 | 0 | List parentProcesses = parent.getProcesses(); |
| 1293 | 0 | if (parentProcesses == null) { |
| 1294 | 0 | parentProcesses = getParentProcesses(parent.getParentDocType()); |
| 1295 | |
} |
| 1296 | 0 | return parentProcesses; |
| 1297 | |
} |
| 1298 | |
|
| 1299 | |
public Process getPrimaryProcess() { |
| 1300 | 0 | for (Iterator iterator = getProcesses().iterator(); iterator.hasNext();) { |
| 1301 | 0 | Process process = (Process) iterator.next(); |
| 1302 | 0 | if (process.isInitial()) { |
| 1303 | 0 | return process; |
| 1304 | |
} |
| 1305 | 0 | } |
| 1306 | 0 | return null; |
| 1307 | |
} |
| 1308 | |
|
| 1309 | |
public Process getNamedProcess(String name) { |
| 1310 | 0 | for (Iterator iterator = getProcesses().iterator(); iterator.hasNext();) { |
| 1311 | 0 | Process process = (Process) iterator.next(); |
| 1312 | 0 | if (org.apache.commons.lang.ObjectUtils.equals(name, process.getName())) { |
| 1313 | 0 | return process; |
| 1314 | |
} |
| 1315 | 0 | } |
| 1316 | 0 | return null; |
| 1317 | |
} |
| 1318 | |
|
| 1319 | |
public String getRoutingVersion() { |
| 1320 | 0 | return routingVersion; |
| 1321 | |
} |
| 1322 | |
|
| 1323 | |
public void setRoutingVersion(String routingVersion) { |
| 1324 | 0 | this.routingVersion = routingVersion; |
| 1325 | 0 | } |
| 1326 | |
|
| 1327 | |
|
| 1328 | |
|
| 1329 | |
|
| 1330 | |
public String getActualNotificationFromAddress() { |
| 1331 | 0 | return this.actualNotificationFromAddress; |
| 1332 | |
} |
| 1333 | |
|
| 1334 | |
|
| 1335 | |
|
| 1336 | |
|
| 1337 | |
public void setActualNotificationFromAddress(String actualNotificationFromAddress) { |
| 1338 | 0 | this.actualNotificationFromAddress = actualNotificationFromAddress; |
| 1339 | 0 | } |
| 1340 | |
|
| 1341 | |
|
| 1342 | |
|
| 1343 | |
|
| 1344 | |
|
| 1345 | |
public String getDisplayableNotificationFromAddress() { |
| 1346 | 0 | return getNotificationFromAddress(true); |
| 1347 | |
} |
| 1348 | |
|
| 1349 | |
|
| 1350 | |
|
| 1351 | |
|
| 1352 | |
|
| 1353 | |
|
| 1354 | |
public void setDisplayableNotificationFromAddress(String displayableNotificationFromAddress) { |
| 1355 | |
|
| 1356 | 0 | } |
| 1357 | |
|
| 1358 | |
public String getNotificationFromAddress() { |
| 1359 | 0 | return getNotificationFromAddress(false); |
| 1360 | |
} |
| 1361 | |
|
| 1362 | |
|
| 1363 | |
|
| 1364 | |
|
| 1365 | |
|
| 1366 | |
|
| 1367 | |
|
| 1368 | |
|
| 1369 | |
|
| 1370 | |
|
| 1371 | |
|
| 1372 | |
|
| 1373 | |
|
| 1374 | |
|
| 1375 | |
protected String getNotificationFromAddress(boolean forDisplayPurposes) { |
| 1376 | 0 | if (StringUtils.isNotBlank(getActualNotificationFromAddress())) { |
| 1377 | |
|
| 1378 | 0 | return getActualNotificationFromAddress(); |
| 1379 | |
} |
| 1380 | 0 | if (ObjectUtils.isNotNull(getParentDocType())) { |
| 1381 | |
|
| 1382 | 0 | String parentNotificationFromAddress = getParentDocType().getActualNotificationFromAddress(); |
| 1383 | 0 | if (StringUtils.isNotBlank(parentNotificationFromAddress)) { |
| 1384 | |
|
| 1385 | 0 | if (forDisplayPurposes) { |
| 1386 | 0 | parentNotificationFromAddress += " " + KEWConstants.DOCUMENT_TYPE_INHERITED_VALUE_INDICATOR; |
| 1387 | |
} |
| 1388 | 0 | return parentNotificationFromAddress; |
| 1389 | |
} |
| 1390 | |
|
| 1391 | 0 | return getParentDocType().getNotificationFromAddress(forDisplayPurposes); |
| 1392 | |
} |
| 1393 | 0 | return null; |
| 1394 | |
} |
| 1395 | |
|
| 1396 | |
|
| 1397 | |
|
| 1398 | |
|
| 1399 | |
|
| 1400 | |
|
| 1401 | |
public void setNotificationFromAddress(String notificationFromAddress) { |
| 1402 | 0 | setActualNotificationFromAddress(notificationFromAddress); |
| 1403 | 0 | } |
| 1404 | |
|
| 1405 | |
public boolean isParentOf(DocumentType documentType) { |
| 1406 | |
|
| 1407 | 0 | for (Iterator iterator = getChildrenDocTypes().iterator(); iterator.hasNext();) { |
| 1408 | 0 | DocumentType child = (DocumentType) iterator.next(); |
| 1409 | 0 | if (child.getName().equals(documentType.getName()) || child.isParentOf(documentType)) { |
| 1410 | 0 | return true; |
| 1411 | |
} |
| 1412 | 0 | } |
| 1413 | 0 | return false; |
| 1414 | |
} |
| 1415 | |
|
| 1416 | |
|
| 1417 | |
|
| 1418 | |
|
| 1419 | |
|
| 1420 | |
|
| 1421 | |
|
| 1422 | |
public String getLookupParentName() { |
| 1423 | 0 | DocumentType parent = getParentDocType(); |
| 1424 | 0 | if (parent == null) { |
| 1425 | 0 | return "Root"; |
| 1426 | |
} |
| 1427 | 0 | return parent.getName(); |
| 1428 | |
} |
| 1429 | |
|
| 1430 | |
public boolean isSuperUser(String principalId) { |
| 1431 | 0 | Group workgroup = getSuperUserWorkgroup(); |
| 1432 | 0 | if (workgroup == null) { |
| 1433 | 0 | return false; |
| 1434 | |
} |
| 1435 | 0 | return getIdentityManagementService().isMemberOfGroup(principalId, workgroup.getGroupId()); |
| 1436 | |
} |
| 1437 | |
|
| 1438 | |
public boolean hasPreviousVersion() { |
| 1439 | 0 | if (this.documentTypeId == null) { |
| 1440 | 0 | return false; |
| 1441 | |
} |
| 1442 | 0 | return !this.documentTypeId.equals(this.previousVersionId); |
| 1443 | |
} |
| 1444 | |
|
| 1445 | |
|
| 1446 | |
|
| 1447 | |
|
| 1448 | |
public String getActualServiceNamespace() { |
| 1449 | 0 | return this.actualServiceNamespace; |
| 1450 | |
} |
| 1451 | |
|
| 1452 | |
|
| 1453 | |
|
| 1454 | |
|
| 1455 | |
public void setActualServiceNamespace(String actualServiceNamespace) { |
| 1456 | 0 | this.actualServiceNamespace = actualServiceNamespace; |
| 1457 | 0 | } |
| 1458 | |
|
| 1459 | |
|
| 1460 | |
|
| 1461 | |
|
| 1462 | |
|
| 1463 | |
public String getServiceNamespace() { |
| 1464 | 0 | return getServiceNamespace(false); |
| 1465 | |
} |
| 1466 | |
|
| 1467 | |
|
| 1468 | |
|
| 1469 | |
|
| 1470 | |
|
| 1471 | |
|
| 1472 | |
|
| 1473 | |
|
| 1474 | |
|
| 1475 | |
|
| 1476 | |
|
| 1477 | |
|
| 1478 | |
|
| 1479 | |
|
| 1480 | |
protected String getServiceNamespace(boolean forDisplayPurposes) { |
| 1481 | 0 | if (StringUtils.isNotBlank(getActualServiceNamespace())) { |
| 1482 | |
|
| 1483 | 0 | return getActualServiceNamespace(); |
| 1484 | |
} |
| 1485 | |
|
| 1486 | 0 | if (ObjectUtils.isNotNull(getParentDocType())) { |
| 1487 | |
|
| 1488 | 0 | String parentValue = getParentDocType().getActualServiceNamespace(); |
| 1489 | 0 | if (StringUtils.isNotBlank(parentValue)) { |
| 1490 | |
|
| 1491 | 0 | if (forDisplayPurposes) { |
| 1492 | 0 | parentValue += " " + KEWConstants.DOCUMENT_TYPE_INHERITED_VALUE_INDICATOR; |
| 1493 | |
} |
| 1494 | 0 | return parentValue; |
| 1495 | |
} |
| 1496 | |
|
| 1497 | 0 | return getParentDocType().getServiceNamespace(forDisplayPurposes); |
| 1498 | |
} |
| 1499 | 0 | String defaultValue = ConfigContext.getCurrentContextConfig().getServiceNamespace(); |
| 1500 | 0 | if (forDisplayPurposes && StringUtils.isNotBlank(defaultValue)) { |
| 1501 | 0 | defaultValue += " " + KEWConstants.DOCUMENT_TYPE_SYSTEM_DEFAULT_INDICATOR; |
| 1502 | |
} |
| 1503 | 0 | return defaultValue; |
| 1504 | |
} |
| 1505 | |
|
| 1506 | |
|
| 1507 | |
|
| 1508 | |
|
| 1509 | |
|
| 1510 | |
|
| 1511 | |
public void setServiceNamespace(String serviceNamespace) { |
| 1512 | 0 | setActualServiceNamespace(serviceNamespace); |
| 1513 | 0 | } |
| 1514 | |
|
| 1515 | |
|
| 1516 | |
|
| 1517 | |
|
| 1518 | |
|
| 1519 | |
public String getDisplayableServiceNamespace() { |
| 1520 | 0 | return getServiceNamespace(true); |
| 1521 | |
} |
| 1522 | |
|
| 1523 | |
|
| 1524 | |
|
| 1525 | |
|
| 1526 | |
|
| 1527 | |
|
| 1528 | |
public void setDisplayableServiceNamespace(String displayableServiceNamespace) { |
| 1529 | |
|
| 1530 | 0 | } |
| 1531 | |
|
| 1532 | |
|
| 1533 | |
|
| 1534 | |
|
| 1535 | |
|
| 1536 | |
|
| 1537 | |
public String getCustomEmailStylesheet() { |
| 1538 | 0 | return customEmailStylesheet; |
| 1539 | |
} |
| 1540 | |
|
| 1541 | |
|
| 1542 | |
|
| 1543 | |
|
| 1544 | |
|
| 1545 | |
|
| 1546 | |
public void setCustomEmailStylesheet(String customEmailStylesheet) { |
| 1547 | 0 | this.customEmailStylesheet = customEmailStylesheet; |
| 1548 | 0 | } |
| 1549 | |
|
| 1550 | |
|
| 1551 | |
|
| 1552 | |
|
| 1553 | |
public String getBlanketApproveWorkgroupId() { |
| 1554 | 0 | return this.blanketApproveWorkgroupId; |
| 1555 | |
} |
| 1556 | |
|
| 1557 | |
|
| 1558 | |
|
| 1559 | |
|
| 1560 | |
|
| 1561 | |
public void setBlanketApproveWorkgroupId(String blanketApproveWorkgroupId) { |
| 1562 | 0 | this.blanketApproveWorkgroupId = blanketApproveWorkgroupId; |
| 1563 | 0 | } |
| 1564 | |
|
| 1565 | |
|
| 1566 | |
|
| 1567 | |
|
| 1568 | |
public Boolean getApplyRetroactively() { |
| 1569 | 0 | return this.applyRetroactively; |
| 1570 | |
} |
| 1571 | |
|
| 1572 | |
|
| 1573 | |
|
| 1574 | |
|
| 1575 | |
public void setApplyRetroactively(Boolean applyRetroactively) { |
| 1576 | 0 | this.applyRetroactively = applyRetroactively; |
| 1577 | 0 | } |
| 1578 | |
|
| 1579 | |
private IdentityManagementService getIdentityManagementService() { |
| 1580 | 0 | return KIMServiceLocator.getIdentityManagementService(); |
| 1581 | |
} |
| 1582 | |
|
| 1583 | |
|
| 1584 | |
|
| 1585 | |
|
| 1586 | |
public boolean isActive() { |
| 1587 | 0 | boolean bRet = false; |
| 1588 | |
|
| 1589 | 0 | if (active != null) { |
| 1590 | 0 | bRet = active.booleanValue(); |
| 1591 | |
} |
| 1592 | |
|
| 1593 | 0 | return bRet; |
| 1594 | |
} |
| 1595 | |
|
| 1596 | |
|
| 1597 | |
|
| 1598 | |
|
| 1599 | |
public void setActive(boolean active) { |
| 1600 | 0 | this.active = Boolean.valueOf(active); |
| 1601 | 0 | } |
| 1602 | |
} |