Skip to content
Snippets Groups Projects
Commit 2e30d3b8 authored by Lars Johansson's avatar Lars Johansson
Browse files

Add option to sort on date / time for read endpoints for names and structures

parent 3e474c29
No related branches found
No related tags found
No related merge requests found
Pipeline #111049 passed
Showing
with 36 additions and 8 deletions
......@@ -183,6 +183,8 @@ public class DeviceGroupRepository {
cq.orderBy(cb.asc(cb.function("get_mnemonic_path_devicegroup", String.class, from.get("uuid"))));
} else if (FieldStructure.DESCRIPTION.equals(orderBy)) {
cq.orderBy(cb.asc(from.get("description")));
} else if (FieldStructure.WHEN.equals(orderBy)) {
cq.orderBy(cb.asc(from.get("requested")));
} else {
cq.orderBy(cb.asc(from.get("convention_name")));
}
......@@ -197,6 +199,8 @@ public class DeviceGroupRepository {
cq.orderBy(cb.desc(cb.function("get_mnemonic_path_devicegroup", String.class, from.get("uuid"))));
} else if (FieldStructure.DESCRIPTION.equals(orderBy)) {
cq.orderBy(cb.desc(from.get("description")));
} else if (FieldStructure.WHEN.equals(orderBy)) {
cq.orderBy(cb.desc(from.get("requested")));
} else {
cq.orderBy(cb.desc(from.get("name")));
}
......
......@@ -183,6 +183,8 @@ public class DeviceTypeRepository {
cq.orderBy(cb.asc(cb.function("get_mnemonic_path_devicetype", String.class, from.get("uuid"))));
} else if (FieldStructure.DESCRIPTION.equals(orderBy)) {
cq.orderBy(cb.asc(from.get("description")));
} else if (FieldStructure.WHEN.equals(orderBy)) {
cq.orderBy(cb.asc(from.get("requested")));
} else {
cq.orderBy(cb.asc(from.get("convention_name")));
}
......@@ -197,6 +199,8 @@ public class DeviceTypeRepository {
cq.orderBy(cb.desc(cb.function("get_mnemonic_path_devicetype", String.class, from.get("uuid"))));
} else if (FieldStructure.DESCRIPTION.equals(orderBy)) {
cq.orderBy(cb.desc(from.get("description")));
} else if (FieldStructure.WHEN.equals(orderBy)) {
cq.orderBy(cb.desc(from.get("requested")));
} else {
cq.orderBy(cb.desc(from.get("name")));
}
......
......@@ -183,6 +183,8 @@ public class DisciplineRepository {
cq.orderBy(cb.asc(from.get("mnemonic")));
} else if (FieldStructure.DESCRIPTION.equals(orderBy)) {
cq.orderBy(cb.asc(from.get("description")));
} else if (FieldStructure.WHEN.equals(orderBy)) {
cq.orderBy(cb.asc(from.get("requested")));
} else {
cq.orderBy(cb.asc(from.get("convention_name")));
}
......@@ -197,6 +199,8 @@ public class DisciplineRepository {
cq.orderBy(cb.asc(from.get("mnemonic")));
} else if (FieldStructure.DESCRIPTION.equals(orderBy)) {
cq.orderBy(cb.desc(from.get("description")));
} else if (FieldStructure.WHEN.equals(orderBy)) {
cq.orderBy(cb.desc(from.get("requested")));
} else {
cq.orderBy(cb.desc(from.get("name")));
}
......
......@@ -173,6 +173,8 @@ public class NameRepository {
cq.orderBy(cb.asc(cb.function("get_mnemonic_path_device_structure", String.class, from.get("convention_name"))));
} else if (FieldName.DESCRIPTION.equals(orderBy)) {
cq.orderBy(cb.asc(from.get("description")));
} else if (FieldName.WHEN.equals(orderBy)) {
cq.orderBy(cb.asc(from.get("requested")));
} else {
cq.orderBy(cb.asc(from.get("convention_name")));
}
......@@ -187,6 +189,8 @@ public class NameRepository {
cq.orderBy(cb.desc(cb.function("get_mnemonic_path_device_structure", String.class, from.get("convention_name"))));
} else if (FieldName.DESCRIPTION.equals(orderBy)) {
cq.orderBy(cb.desc(from.get("description")));
} else if (FieldName.WHEN.equals(orderBy)) {
cq.orderBy(cb.desc(from.get("requested")));
} else {
cq.orderBy(cb.desc(from.get("convention_name")));
}
......
......@@ -183,6 +183,8 @@ public class SubsystemRepository {
cq.orderBy(cb.asc(cb.function("get_mnemonic_path_subsystem", String.class, from.get("uuid"))));
} else if (FieldStructure.DESCRIPTION.equals(orderBy)) {
cq.orderBy(cb.asc(from.get("description")));
} else if (FieldStructure.WHEN.equals(orderBy)) {
cq.orderBy(cb.asc(from.get("requested")));
} else {
cq.orderBy(cb.asc(from.get("convention_name")));
}
......@@ -197,6 +199,8 @@ public class SubsystemRepository {
cq.orderBy(cb.desc(cb.function("get_mnemonic_path_subsystem", String.class, from.get("uuid"))));
} else if (FieldStructure.DESCRIPTION.equals(orderBy)) {
cq.orderBy(cb.desc(from.get("description")));
} else if (FieldStructure.WHEN.equals(orderBy)) {
cq.orderBy(cb.desc(from.get("requested")));
} else {
cq.orderBy(cb.desc(from.get("name")));
}
......
......@@ -179,6 +179,8 @@ public class SystemGroupRepository {
cq.orderBy(cb.asc(from.get("mnemonic")));
} else if (FieldStructure.DESCRIPTION.equals(orderBy)) {
cq.orderBy(cb.asc(from.get("description")));
} else if (FieldStructure.WHEN.equals(orderBy)) {
cq.orderBy(cb.asc(from.get("requested")));
} else {
cq.orderBy(cb.asc(from.get("convention_name")));
}
......@@ -193,6 +195,8 @@ public class SystemGroupRepository {
cq.orderBy(cb.desc(from.get("mnemonic")));
} else if (FieldStructure.DESCRIPTION.equals(orderBy)) {
cq.orderBy(cb.desc(from.get("description")));
} else if (FieldStructure.WHEN.equals(orderBy)) {
cq.orderBy(cb.desc(from.get("requested")));
} else {
cq.orderBy(cb.desc(from.get("name")));
}
......
......@@ -183,6 +183,8 @@ public class SystemRepository {
cq.orderBy(cb.asc(cb.function("get_mnemonic_path_system", String.class, from.get("uuid"))));
} else if (FieldStructure.DESCRIPTION.equals(orderBy)) {
cq.orderBy(cb.asc(from.get("description")));
} else if (FieldStructure.WHEN.equals(orderBy)) {
cq.orderBy(cb.asc(from.get("requested")));
} else {
cq.orderBy(cb.asc(from.get("convention_name")));
}
......@@ -197,6 +199,8 @@ public class SystemRepository {
cq.orderBy(cb.desc(cb.function("get_mnemonic_path_system", String.class, from.get("uuid"))));
} else if (FieldStructure.DESCRIPTION.equals(orderBy)) {
cq.orderBy(cb.desc(from.get("description")));
} else if (FieldStructure.WHEN.equals(orderBy)) {
cq.orderBy(cb.desc(from.get("requested")));
} else {
cq.orderBy(cb.desc(from.get("name")));
}
......
......@@ -107,9 +107,8 @@ public interface INames {
read GET /names/{name} - both name and uuid (name - exact and search, uuid exact)
*/
public static final String DEFAULT_FALSE = "false";
public static final String DEFAULT_PAGE = "0";
public static final String DEFAULT_PAGE_SIZE = "100";
public static final String DEFAULT_PAGE = "0";
public static final String DEFAULT_PAGE_SIZE = "100";
/**
* Create names by list of name elements.
......
......@@ -114,9 +114,8 @@ public interface IStructures {
update PATCH /structures/reject - rejectStructures (List<StructureElement>)
*/
public static final String DEFAULT_FALSE = "false";
public static final String DEFAULT_PAGE = "0";
public static final String DEFAULT_PAGE_SIZE = "100";
public static final String DEFAULT_PAGE = "0";
public static final String DEFAULT_PAGE_SIZE = "100";
/**
* Create (propose) structures by list of structure elements.
......
......@@ -30,6 +30,7 @@ public enum FieldName {
NAMEEQUIVALENCE,
SYSTEMSTRUCTURE,
DEVICESTRUCTURE,
DESCRIPTION;
DESCRIPTION,
WHEN;
}
......@@ -31,6 +31,7 @@ public enum FieldStructure {
MNEMONIC,
MNEMONICEQUIVALENCE,
MNEMONICPATH,
DESCRIPTION;
DESCRIPTION,
WHEN;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment