Search in sources :

Example 1 with CIEventCause

use of com.hp.octane.integrations.dto.causes.CIEventCause in project octane-gitlab-service by MicroFocus.

the class EventListener method getCauses.

private List<CIEventCause> getCauses(JSONObject event, boolean isScmNull) {
    List<CIEventCause> causes = new ArrayList<>();
    CIEventCauseType type = convertCiEventCauseType(event, isScmNull);
    CIEventCause rootCause = dtoFactory.newDTO(CIEventCause.class);
    rootCause.setType(type);
    rootCause.setUser(type == CIEventCauseType.USER ? getUser(event) : null);
    if (isDeleteBranchEvent(event) || isPipelineEvent(event)) {
        causes.add(rootCause);
    } else {
        CIEventCause cause = dtoFactory.newDTO(CIEventCause.class);
        cause.setType(CIEventCauseType.UPSTREAM);
        // /
        cause.setProject(getProjectCiId(event));
        cause.setBuildCiId(getRootId(event).toString());
        cause.getCauses().add(rootCause);
        causes.add(cause);
    }
    return causes;
}
Also used : CIEventCause(com.hp.octane.integrations.dto.causes.CIEventCause) CIEventCauseType(com.hp.octane.integrations.dto.causes.CIEventCauseType)

Example 2 with CIEventCause

use of com.hp.octane.integrations.dto.causes.CIEventCause in project octane-ci-java-sdk by MicroFocus.

the class SCMDataServiceImpl method generateScmCauses.

private List<CIEventCause> generateScmCauses() {
    CIEventCause scmEventCause = dtoFactory.newDTO(CIEventCause.class);
    scmEventCause.setType(CIEventCauseType.SCM);
    Map<String, CIEventCause> mapScmEventCause = new LinkedHashMap();
    mapScmEventCause.put(scmEventCause.generateKey(), scmEventCause);
    return new ArrayList<>(mapScmEventCause.values());
}
Also used : CIEventCause(com.hp.octane.integrations.dto.causes.CIEventCause)

Aggregations

CIEventCause (com.hp.octane.integrations.dto.causes.CIEventCause)2 CIEventCauseType (com.hp.octane.integrations.dto.causes.CIEventCauseType)1