Skip to content

Commit

Permalink
add "note" to chargepoint and ocpptag queries
Browse files Browse the repository at this point in the history
  • Loading branch information
goekay committed Jan 26, 2025
1 parent 7893695 commit 4149309
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ private Result<Record5<Integer, String, String, String, DateTime>> getOverviewIn
selectQuery.addConditions(includes(CHARGE_BOX.CHARGE_BOX_ID, form.getChargeBoxId()));
}

if (form.isSetNote()) {
selectQuery.addConditions(includes(CHARGE_BOX.NOTE, form.getNote()));
}

switch (form.getHeartbeatPeriod()) {
case ALL:
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import java.util.List;
import java.util.stream.Collectors;

import static de.rwth.idsg.steve.utils.CustomDSL.includes;
import static de.rwth.idsg.steve.utils.DateTimeUtils.humanize;
import static de.rwth.idsg.steve.utils.DateTimeUtils.toDateTime;
import static jooq.steve.db.tables.OcppTag.OCPP_TAG;
Expand Down Expand Up @@ -98,6 +99,10 @@ public List<Overview> getOverview(OcppTagQueryForm form) {
selectQuery.addConditions(OCPP_TAG_ACTIVITY.PARENT_ID_TAG.eq(form.getParentIdTag()));
}

if (form.isNoteSet()) {
selectQuery.addConditions(includes(OCPP_TAG_ACTIVITY.NOTE, form.getNote()));
}

switch (form.getExpired()) {
case ALL:
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package de.rwth.idsg.steve.web.dto;

import com.google.common.base.Strings;
import de.rwth.idsg.steve.ocpp.OcppVersion;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
Expand All @@ -35,6 +36,7 @@ public class ChargePointQueryForm {

private String chargeBoxId;
private String description;
private String note;
private OcppVersion ocppVersion;
private QueryPeriodType heartbeatPeriod;

Expand All @@ -57,6 +59,10 @@ public boolean isSetChargeBoxId() {
return chargeBoxId != null;
}

public boolean isSetNote() {
return !Strings.isNullOrEmpty(note);
}

@RequiredArgsConstructor
public enum QueryPeriodType {
ALL("All"),
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/de/rwth/idsg/steve/web/dto/OcppTagQueryForm.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package de.rwth.idsg.steve.web.dto;

import com.google.common.base.Strings;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -53,6 +54,13 @@ public class OcppTagQueryForm {
@Schema(description = "Return blocked, not blocked, or all Ocpp tags? Defaults to ALL")
private BooleanType blocked = BooleanType.FALSE;

@Schema(description = """
Query by the note associated with the OCPP tag.
The value of this field does not have to exactly match the note.
A substring is also accepted.
""")
private String note;

@Schema(hidden = true)
public boolean isOcppTagPkSet() {
return ocppTagPk != null;
Expand All @@ -68,6 +76,11 @@ public boolean isParentIdTagSet() {
return parentIdTag != null;
}

@Schema(hidden = true)
public boolean isNoteSet() {
return !Strings.isNullOrEmpty(note);
}

public BooleanType getExpired() {
return Objects.requireNonNullElse(expired, BooleanType.ALL);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@
</form:select>
</td>
</tr>
<tr>
<td>Note:</td>
<td><form:input path="note"/></td>
</tr>
<tr>
<td></td>
<td id="add_space">
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/webapp/WEB-INF/views/data-man/ocppTags.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@
</form:select>
</td>
</tr>
<tr>
<td>Note:</td>
<td><form:input path="note"/></td>
</tr>
<tr>
<td></td>
<td id="add_space">
Expand Down

0 comments on commit 4149309

Please sign in to comment.