I want to write a doIf block which checks if either “studentPersonalRefId” OR “teacherAssignmentRefId” are null. If so, output a message that something is null. Otherwise, continue with the “getCanvasAssignments” requests:
.doIfEqualsOrElse((session -> String.valueOf(session.getString("studentPersonalRefId")),"null") || ( session -> String.valueOf(session.getString("teacherAssignmentRefId")),"null").then( exec(session -> { log.info("studentPersonalRefId or teacherAssingnmentRefId is null"); log.info("studentPersonalRefId = " + session.getString("studentPersonalRefId") + " teacherAssignmentRefId = " + session.getString("teacherAssignmentRefId")); return session; }) }).orElse( //Fetch the assignment which takes refId as a param, if the refId exists exec(getCanvasAssignments); )
Is something similar to this possible?
Advertisement
Answer
.doIfOrElse(session -> !session.contains("studentPersonalRefId") || !session.contains("teacherAssignmentRefId") ).then(