|
| 1 | +/** |
| 2 | + * @description This class is used to represent an get case query in the Public 360 API. |
| 3 | + * See the Public 360 API documentation for more information on the fields. |
| 4 | + * The class is intended to be used in conjunction with the Public 360 API. |
| 5 | + * Features: |
| 6 | + * - The class can be serialized to and deserialized from JSON. |
| 7 | + * - The class has a private `constructor` for use with the `fromJson` method. |
| 8 | + * |
| 9 | + * @author Kenneth Soerensen <[email protected]>, Nav |
| 10 | + * @since 0.1.0, February 2025 |
| 11 | + * @group Public 360 Integration |
| 12 | + * @see [Public 360 SIF API Documentation](https://help.360online.com/ReleaseInformation/SIF%20APIs%20-%20Documentation.pdf) |
| 13 | + * @example |
| 14 | + * |
| 15 | + */ |
| 16 | +@SuppressWarnings('PMD.FieldNamingConventions') |
| 17 | +public class GetCasesQuery implements IJsonSerializable { |
| 18 | + /** |
| 19 | + * @description The AD context user for the query. |
| 20 | + * See Public 360 API documentation for details. |
| 21 | + * |
| 22 | + * @author Kenneth Soerensen <[email protected]>, Nav |
| 23 | + * @since 0.1.0, February 2025 |
| 24 | + * @see [Public 360 SIF API Documentation](https://help.360online.com/ReleaseInformation/SIF%20APIs%20-%20Documentation.pdf) |
| 25 | + */ |
| 26 | + public String ADContextUser; |
| 27 | + /** |
| 28 | + * @description The maximum number of cases to return. |
| 29 | + * See Public 360 API documentation for details. |
| 30 | + * |
| 31 | + * @author Kenneth Soerensen <[email protected]>, Nav |
| 32 | + * @since 0.1.0, February 2025 |
| 33 | + * @see [Public 360 SIF API Documentation](https://help.360online.com/ReleaseInformation/SIF%20APIs%20-%20Documentation.pdf) |
| 34 | + */ |
| 35 | + public Integer MaxReturnedCases; |
| 36 | + /** |
| 37 | + * @description The page number for the query. |
| 38 | + * See Public 360 API documentation for details. |
| 39 | + * |
| 40 | + * @author Kenneth Soerensen <[email protected]>, Nav |
| 41 | + * @since 0.1.0, February 2025 |
| 42 | + * @see [Public 360 SIF API Documentation](https://help.360online.com/ReleaseInformation/SIF%20APIs%20-%20Documentation.pdf) |
| 43 | + */ |
| 44 | + public Integer Page; |
| 45 | + /** |
| 46 | + * @description The sort criterion for the query. |
| 47 | + * See Public 360 API documentation for details. |
| 48 | + * |
| 49 | + * @author Kenneth Soerensen <[email protected]>, Nav |
| 50 | + * @since 0.1.0, February 2025 |
| 51 | + * @see [Public 360 SIF API Documentation](https://help.360online.com/ReleaseInformation/SIF%20APIs%20-%20Documentation.pdf) |
| 52 | + */ |
| 53 | + public String SortCriterion; |
| 54 | + /** |
| 55 | + * @description The record number for the query. |
| 56 | + * See Public 360 API documentation for details. |
| 57 | + * |
| 58 | + * @author Kenneth Soerensen <[email protected]>, Nav |
| 59 | + * @since 0.1.0, February 2025 |
| 60 | + * @see [Public 360 SIF API Documentation](https://help.360online.com/ReleaseInformation/SIF%20APIs%20-%20Documentation.pdf) |
| 61 | + */ |
| 62 | + public String Recno; |
| 63 | + /** |
| 64 | + * @description The case number for the query. |
| 65 | + * See Public 360 API documentation for details. |
| 66 | + * |
| 67 | + * @author Kenneth Soerensen <[email protected]>, Nav |
| 68 | + * @since 0.1.0, February 2025 |
| 69 | + * @see [Public 360 SIF API Documentation](https://help.360online.com/ReleaseInformation/SIF%20APIs%20-%20Documentation.pdf) |
| 70 | + */ |
| 71 | + public String CaseNumber; |
| 72 | + /** |
| 73 | + * @description The external id for the query. |
| 74 | + * See Public 360 API documentation for details. |
| 75 | + * |
| 76 | + * @author Kenneth Soerensen <[email protected]>, Nav |
| 77 | + * @since 0.1.0, February 2025 |
| 78 | + * @see ExternalIdParameter |
| 79 | + * @see [Public 360 SIF API Documentation](https://help.360online.com/ReleaseInformation/SIF%20APIs%20-%20Documentation.pdf) |
| 80 | + */ |
| 81 | + public ExternalIdParameter ExternalId; |
| 82 | + /** |
| 83 | + * @description The title for the query. |
| 84 | + * See Public 360 API documentation for details. |
| 85 | + * |
| 86 | + * @author Kenneth Soerensen <[email protected]>, Nav |
| 87 | + * @since 0.1.0, February 2025 |
| 88 | + * @see [Public 360 SIF API Documentation](https://help.360online.com/ReleaseInformation/SIF%20APIs%20-%20Documentation.pdf) |
| 89 | + */ |
| 90 | + public String Title; |
| 91 | + /** |
| 92 | + * @description The archive code for the query. |
| 93 | + * See Public 360 API documentation for details. |
| 94 | + * |
| 95 | + * @author Kenneth Soerensen <[email protected]>, Nav |
| 96 | + * @since 0.1.0, February 2025 |
| 97 | + * @see [Public 360 SIF API Documentation](https://help.360online.com/ReleaseInformation/SIF%20APIs%20-%20Documentation.pdf) |
| 98 | + */ |
| 99 | + public String ArchiveCode; |
| 100 | + /** |
| 101 | + * @description The project number for the query. |
| 102 | + * See Public 360 API documentation for details. |
| 103 | + * |
| 104 | + * @author Kenneth Soerensen <[email protected]>, Nav |
| 105 | + * @since 0.1.0, February 2025 |
| 106 | + * @see [Public 360 SIF API Documentation](https://help.360online.com/ReleaseInformation/SIF%20APIs%20-%20Documentation.pdf) |
| 107 | + */ |
| 108 | + public String ProjectNumber; |
| 109 | + /** |
| 110 | + * @description The category code for the query. |
| 111 | + * See Public 360 API documentation for details. |
| 112 | + * |
| 113 | + * @author Kenneth Soerensen <[email protected]>, Nav |
| 114 | + * @since 0.1.0, February 2025 |
| 115 | + * @see [Public 360 SIF API Documentation](https://help.360online.com/ReleaseInformation/SIF%20APIs%20-%20Documentation.pdf) |
| 116 | + */ |
| 117 | + public String CategoryCode; |
| 118 | + /** |
| 119 | + * @description The last date for the query. |
| 120 | + * See Public 360 API documentation for details. |
| 121 | + * |
| 122 | + * @author Kenneth Soerensen <[email protected]>, Nav |
| 123 | + * @since 0.1.0, February 2025 |
| 124 | + * @see [Public 360 SIF API Documentation](https://help.360online.com/ReleaseInformation/SIF%20APIs%20-%20Documentation.pdf) |
| 125 | + */ |
| 126 | + public String LastDate; |
| 127 | + /** |
| 128 | + * @description The contact reference number for the query. |
| 129 | + * See Public 360 API documentation for details. |
| 130 | + * |
| 131 | + * @author Kenneth Soerensen <[email protected]>, Nav |
| 132 | + * @since 0.1.0, February 2025 |
| 133 | + * @see [Public 360 SIF API Documentation](https://help.360online.com/ReleaseInformation/SIF%20APIs%20-%20Documentation.pdf) |
| 134 | + */ |
| 135 | + public String ContactReferenceNumber; |
| 136 | + /** |
| 137 | + * @description The contact external id for the query. |
| 138 | + * See Public 360 API documentation for details. |
| 139 | + * |
| 140 | + * @author Kenneth Soerensen <[email protected]>, Nav |
| 141 | + * @since 0.1.0, February 2025 |
| 142 | + * @see [Public 360 SIF API Documentation](https://help.360online.com/ReleaseInformation/SIF%20APIs%20-%20Documentation.pdf) |
| 143 | + */ |
| 144 | + public String ContactExternalId; |
| 145 | + /** |
| 146 | + * @description The contact recnos for the query. |
| 147 | + * See Public 360 API documentation for details. |
| 148 | + * |
| 149 | + * @author Kenneth Soerensen <[email protected]>, Nav |
| 150 | + * @since 0.1.0, February 2025 |
| 151 | + * @see [Public 360 SIF API Documentation](https://help.360online.com/ReleaseInformation/SIF%20APIs%20-%20Documentation.pdf) |
| 152 | + */ |
| 153 | + public String ContactRecnos; |
| 154 | + /** |
| 155 | + * @description The sub archive for the query. |
| 156 | + * See Public 360 API documentation for details. |
| 157 | + * |
| 158 | + * @author Kenneth Soerensen <[email protected]>, Nav |
| 159 | + * @since 0.1.0, February 2025 |
| 160 | + * @see [Public 360 SIF API Documentation](https://help.360online.com/ReleaseInformation/SIF%20APIs%20-%20Documentation.pdf) |
| 161 | + */ |
| 162 | + public String SubArchive; |
| 163 | + /** |
| 164 | + * @description The case type for the query. |
| 165 | + * See Public 360 API documentation for details. |
| 166 | + * |
| 167 | + * @author Kenneth Soerensen <[email protected]>, Nav |
| 168 | + * @since 0.1.0, February 2025 |
| 169 | + * @see [Public 360 SIF API Documentation](https://help.360online.com/ReleaseInformation/SIF%20APIs%20-%20Documentation.pdf) |
| 170 | + */ |
| 171 | + public String CaseType; |
| 172 | + //public DateCriteriaType DateCriteria; |
| 173 | + //public List<AdditionalFieldParameter> AdditionalFields; |
| 174 | + |
| 175 | + /** |
| 176 | + * @description Returns a JSON representation of the object. |
| 177 | + * |
| 178 | + * @author Kenneth Soerensen <[email protected]>, Nav |
| 179 | + * @since 0.1.0, February 2025 |
| 180 | + * @return `String` JSON representation of the object. |
| 181 | + */ |
| 182 | + @SuppressWarnings('PMD.CognitiveComplexity, PMD.NcssMethodCount') |
| 183 | + public String toJson() { |
| 184 | + //this.validate(); // Ensure mandatory fields are present before serialization |
| 185 | + JsonHelper jsonHelper = new JsonHelper(); |
| 186 | + jsonHelper.writeStartObject(); |
| 187 | + jsonHelper.writeStringFieldIfNotNull('ADContextUser', ADContextUser); |
| 188 | + jsonHelper.writeIntegerFieldIfNotNull( |
| 189 | + 'MaxReturnedCases', |
| 190 | + MaxReturnedCases |
| 191 | + ); |
| 192 | + jsonHelper.writeIntegerFieldIfNotNull('Page', Page); |
| 193 | + jsonHelper.writeStringFieldIfNotNull('SortCriterion', SortCriterion); |
| 194 | + jsonHelper.writeStringFieldIfNotNull('Recno', Recno); |
| 195 | + jsonHelper.writeStringFieldIfNotNull('CaseNumber', CaseNumber); |
| 196 | + jsonHelper.writeNestedObject('ExternalId', ExternalId); |
| 197 | + jsonHelper.writeStringFieldIfNotNull('Title', Title); |
| 198 | + jsonHelper.writeStringFieldIfNotNull('ArchiveCode', ArchiveCode); |
| 199 | + jsonHelper.writeStringFieldIfNotNull('ProjectNumber', ProjectNumber); |
| 200 | + jsonHelper.writeStringFieldIfNotNull('CategoryCode', CategoryCode); |
| 201 | + jsonHelper.writeStringFieldIfNotNull('LastDate', LastDate); |
| 202 | + jsonHelper.writeStringFieldIfNotNull( |
| 203 | + 'ContactReferenceNumber', |
| 204 | + ContactReferenceNumber |
| 205 | + ); |
| 206 | + jsonHelper.writeStringFieldIfNotNull( |
| 207 | + 'ContactExternalId', |
| 208 | + ContactExternalId |
| 209 | + ); |
| 210 | + jsonHelper.writeStringFieldIfNotNull('ContactRecnos', ContactRecnos); |
| 211 | + jsonHelper.writeStringFieldIfNotNull('SubArchive', SubArchive); |
| 212 | + jsonHelper.writeStringFieldIfNotNull('CaseType', CaseType); |
| 213 | + //jsonHelper.writeNestedObject('DateCriteria', DateCriteria); |
| 214 | + //jsonHelper.writeNestedObjectList('AdditionalFields', AdditionalFields); |
| 215 | + jsonHelper.writeEndObject(); |
| 216 | + |
| 217 | + return jsonHelper.getAsString(); |
| 218 | + } |
| 219 | + |
| 220 | + /** |
| 221 | + * @description Deserializes a JSON string into an `GetCasesQuery` object instance. |
| 222 | + * |
| 223 | + * @author Kenneth Soerensen <[email protected]>, Nav |
| 224 | + * @since 0.1.0, February 2025 |
| 225 | + * @param jsonString JSON string to deserialize. |
| 226 | + * @return `GetCasesQuery` The deserialized object instance from the JSON string. |
| 227 | + */ |
| 228 | + public static GetCasesQuery fromJson(String jsonString) { |
| 229 | + return (GetCasesQuery) JSON.deserialize( |
| 230 | + jsonString, |
| 231 | + GetCasesQuery.class |
| 232 | + ); |
| 233 | + } |
| 234 | +} |
0 commit comments