com.almworks.jira.structure.api.sync.SyncEvents Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of structure-api Show documentation
Show all versions of structure-api Show documentation
Public API for the Structure Plugin for JIRA
package com.almworks.jira.structure.api.sync;
import com.almworks.jira.structure.api.util.La;
import com.almworks.jira.structure.api.util.StructureUtil;
import com.google.common.collect.ImmutableMap;
import org.jetbrains.annotations.NotNull;
import java.util.Map;
public class SyncEvents {
public static final La> JIRA_EVENT_TO_MAP = new La>() {
@Override
public Map la(SyncEvent.Jira event) {
if (event == null) return null;
return buildSyncEventMap(event,
ImmutableMap.builder()
.put("type", event.getEvent().getChangeType().toString())
.put("issues", SyncAuditLogHelper.ISSUE_INFO.arrayList(event.getEvent().getAffectedIssuesSorted().toList()))
);
}
};
public static final La> STRUCTURE_EVENT_TO_MAP = new La>() {
@Override
public Mapla(SyncEvent.Structure event) {
if (event == null) return null;
return buildSyncEventMap(event,
ImmutableMap.builder()
.put("version", event.getHistoryEntry().getVersion()));
}
};
@NotNull
private static Map buildSyncEventMap(@NotNull SyncEvent event, ImmutableMap.Builder builder) {
builder.put("timestamp", event.getTimestamp());
builder.put("syncInstanceId", StructureUtil.nnl(event.getSyncInstanceId()));
return builder.build();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy