List of usage examples for org.apache.commons.collections4.map AbstractLinkedMap values
Collection<V> values();
From source file:org.pentaho.di.trans.steps.zendesk.ZendeskTicketAuditHistory.java
@SuppressWarnings("unchecked") void processEvents(List<Event> events, AbstractLinkedMap<Long, ZendeskTicketAuditHistory> auditSummaries) throws KettleValueException { for (Event event : events) { String fieldType = event.getClass().getName(); String fieldName = ""; Object fieldValueObject = new Object(); String fieldValue = ""; if (fieldType.equals(ExternalEvent.class.getName()) || fieldType.equals(NotificationEvent.class.getName()) || fieldType.equals(ErrorEvent.class.getName()) || fieldType.equals(OrganizationActivityEvent.class.getName()) || fieldType.equals(AttachmentRedactionEvent.class.getName()) || fieldType.equals(CommentRedactionEvent.class.getName())) { // TODO: Replace OrgActivity and RedactionEvents with class references, pending upstream project commit // Do nothing } else if (fieldType.equals(CommentPrivacyChangeEvent.class.getName())) { if (auditSummaries != null) { Long commentId = ((CommentPrivacyChangeEvent) event).getCommentId(); Boolean commentVisibility = ((CommentPrivacyChangeEvent) event).getPublic(); if (commentId != null) { for (ZendeskTicketAuditHistory auditEntry : auditSummaries.values()) { if (auditEntry.comment != null && commentId.equals(auditEntry.comment.commentId)) { auditEntry.comment.publicComment = commentVisibility; auditEntry.comment.changedToPrivate = this.createdTime; }// ww w . j av a 2 s . c om } } } } else if (fieldType.equals(CreateEvent.class.getName())) { fieldName = ((CreateEvent) event).getFieldName(); fieldValueObject = ((CreateEvent) event).getValueObject(); fieldValue = ((CreateEvent) event).getValue(); } else if (fieldType.equals(ChangeEvent.class.getName())) { fieldName = ((ChangeEvent) event).getFieldName(); fieldValueObject = ((ChangeEvent) event).getValueObject(); fieldValue = ((ChangeEvent) event).getValue(); } else if (fieldType.equals(CommentEvent.class.getName())) { this.comment = new TicketAuditComment((CommentEvent) event); } else if (fieldType.equals(VoiceCommentEvent.class.getName())) { this.comment = new TicketAuditComment((VoiceCommentEvent) event); } else if (fieldType.equals(CcEvent.class.getName())) { this.collaborators = ((CcEvent) event).getRecipients(); } if (!Const.isEmpty(fieldName)) { switch (fieldName) { case "organization_id": this.organizationId = Const.isEmpty(fieldValue) ? null : Long.valueOf(fieldValue); break; case "requester_id": this.requesterId = Const.isEmpty(fieldValue) ? null : Long.valueOf(fieldValue); break; case "assignee_id": this.assigneeId = Const.isEmpty(fieldValue) ? null : Long.valueOf(fieldValue); break; case "group_id": this.groupId = Const.isEmpty(fieldValue) ? null : Long.valueOf(fieldValue); break; case "subject": this.subject = fieldValue; break; case "tags": this.tags = (fieldValueObject instanceof List) ? (List<String>) fieldValueObject : null; break; case "status": this.status = fieldValue; break; case "priority": this.priority = fieldValue; break; case "channel": this.channel = fieldValue; break; case "type": this.type = fieldValue; break; case "satisfaction_score": this.satisfaction = fieldValue; break; case "brand_id": this.brandId = Long.valueOf(fieldValue); break; case "ticket_form_id": this.formId = Long.valueOf(fieldValue); break; case "locale_id": this.locale = Long.valueOf(fieldValue); break; case "satisfaction_comment": this.satisfactionComment = fieldValue; break; case "due_at": try { this.dueAt = DUE_AT_DATE_FORMAT.parse(fieldValue); } catch (ParseException e) { throw new KettleValueException("Unable to parse [" + fieldValue + "] + with format [" + DUE_AT_DATE_FORMAT_STRING + "]", e); } case "current_collaborators": // Ignore, these are "pretty-printed emails", // and the CcEvent is used above instead break; default: this.customFields.put(fieldName, fieldValue); break; } } } }