@@ -27,7 +27,6 @@ import at.techbee.jtx.contract.JtxContract.JtxICalObject.GEO_LAT
2727import at.techbee.jtx.contract.JtxContract.JtxICalObject.GEO_LONG
2828import at.techbee.jtx.contract.JtxContract.JtxICalObject.TZ_ALLDAY
2929import net.fortuna.ical4j.model.ParameterList
30- import net.fortuna.ical4j.model.Property
3130import net.fortuna.ical4j.model.PropertyList
3231import net.fortuna.ical4j.model.parameter.XParameter
3332import net.fortuna.ical4j.model.property.XProperty
@@ -36,7 +35,6 @@ import java.util.logging.Level
3635import java.util.logging.Logger
3736
3837
39- @Suppress(" unused" )
4038object JtxContract {
4139
4240 private val logger
@@ -101,8 +99,8 @@ object JtxContract {
10199 * @param [string] that should be parsed
102100 * @return The list of XProperty parsed from the string
103101 */
104- fun getXPropertyListFromJson (string : String ): PropertyList < Property > {
105- val propertyList = PropertyList < Property > ()
102+ fun getXPropertyListFromJson (string : String ): PropertyList {
103+ val propertyList = PropertyList ()
106104
107105 if (string.isBlank())
108106 return propertyList
@@ -136,7 +134,10 @@ object JtxContract {
136134 return null
137135
138136 val jsonObject = JSONObject ()
139- parameters.forEach { parameter ->
137+
138+ // Note: probably the contract should be separated from methods that do things, especially if they depend on ical4j
139+
140+ parameters.all.forEach { parameter ->
140141 jsonObject.put(parameter.name, parameter.value)
141142 }
142143 return if (jsonObject.length() == 0 )
@@ -151,12 +152,14 @@ object JtxContract {
151152 * @param [propertyList] The PropertyList that should be transformed into a Json String
152153 * @return The generated Json object as a [String]
153154 */
154- fun getJsonStringFromXProperties (propertyList : PropertyList < * > ? ): String? {
155+ fun getJsonStringFromXProperties (propertyList : PropertyList ? ): String? {
155156 if (propertyList == null )
156157 return null
157158
159+ // Note: probably the contract should be separated from methods that do things, especially if they depend on ical4j
160+
158161 val jsonObject = JSONObject ()
159- propertyList.forEach { property ->
162+ propertyList.all. forEach { property ->
160163 jsonObject.put(property.name, property.value)
161164 }
162165 return if (jsonObject.length() == 0 )
@@ -181,7 +184,7 @@ object JtxContract {
181184 stringList.forEach {
182185 try {
183186 longList.add(it.toLong())
184- } catch (e : NumberFormatException ) {
187+ } catch (_ : NumberFormatException ) {
185188 logger.log(Level .WARNING , " String could not be cast to Long ($it )" )
186189 return @forEach
187190 }
@@ -190,7 +193,6 @@ object JtxContract {
190193 }
191194
192195
193- @Suppress(" unused" )
194196 object JtxICalObject {
195197
196198 /* * The name of the the content URI for IcalObjects.
@@ -208,7 +210,7 @@ object JtxContract {
208210 val VIEW_INTENT_URI : Uri by lazy { " content://$VIEW_INTENT_HOST /$CONTENT_URI_PATH " .toUri() }
209211
210212 /* Convenience function to directly build the content URI to view a specific ICalObject in jtx Board by its ID */
211- fun getViewIntentUriFor (iCalObjectId : Long ) = Uri .withAppendedPath(VIEW_INTENT_URI , iCalObjectId.toString())
213+ fun getViewIntentUriFor (iCalObjectId : Long ): Uri = Uri .withAppendedPath(VIEW_INTENT_URI , iCalObjectId.toString())
212214
213215
214216
@@ -648,7 +650,6 @@ object JtxContract {
648650 }
649651
650652
651- @Suppress(" unused" )
652653 object JtxAttendee {
653654
654655 /* * The name of the the table for Attendees that are linked to an ICalObject.
@@ -807,19 +808,16 @@ object JtxContract {
807808 }
808809
809810 /* * This enum class defines the possible values for the attribute [JtxAttendee] for the Component VJOURNAL */
810- @Suppress(" unused" )
811811 enum class PartstatJournal {
812812 `NEEDS - ACTION `, ACCEPTED , DECLINED
813813 }
814814
815815 /* * This enum class defines the possible values for the attribute [JtxAttendee] for the Component VTODO */
816- @Suppress(" unused" )
817816 enum class PartstatTodo {
818817 `NEEDS - ACTION `, ACCEPTED , DECLINED , TENTATIVE , DELEGATED , COMPLETED , `IN - PROCESS `
819818 }
820819 }
821820
822- @Suppress(" unused" )
823821 object JtxCategory {
824822
825823 /* * The name of the the table for Categories that are linked to an ICalObject.
@@ -869,7 +867,7 @@ object JtxContract {
869867 const val OTHER = " other"
870868 }
871869
872- @Suppress( " unused " )
870+
873871 object JtxComment {
874872
875873 /* * The name of the the table for Comments that are linked to an ICalObject.
@@ -927,7 +925,7 @@ object JtxContract {
927925 }
928926
929927
930- @Suppress( " unused " )
928+
931929 object JtxOrganizer {
932930 /* * The name of the the table for Organizer that are linked to an ICalObject.
933931 * [https://tools.ietf.org/html/rfc5545#section-3.8.4.3]
@@ -1006,7 +1004,7 @@ object JtxContract {
10061004
10071005 }
10081006
1009- @Suppress( " unused " )
1007+
10101008 object JtxRelatedto {
10111009
10121010 /* * The name of the the table for Relationships (related-to) that are linked to an ICalObject.
@@ -1076,7 +1074,7 @@ object JtxContract {
10761074
10771075 }
10781076
1079- @Suppress( " unused " )
1077+
10801078 object JtxResource {
10811079 /* * The name of the the table for Resources that are linked to an ICalObject.
10821080 * [https://tools.ietf.org/html/rfc5545#section-3.8.1.10]*/
@@ -1126,7 +1124,7 @@ object JtxContract {
11261124
11271125 }
11281126
1129- @Suppress( " unused " )
1127+
11301128 object JtxCollection {
11311129
11321130 /* * The name of the the table for Collections
@@ -1250,7 +1248,7 @@ object JtxContract {
12501248 }
12511249
12521250
1253- @Suppress( " unused " )
1251+
12541252 object JtxAttachment {
12551253
12561254 /* * The name of the the table for Attachments that are linked to an ICalObject.*/
@@ -1314,7 +1312,7 @@ object JtxContract {
13141312 }
13151313
13161314
1317- @Suppress( " unused " )
1315+
13181316 object JtxAlarm {
13191317
13201318 /* * The name of the the table for Alarms that are linked to an ICalObject.*/
@@ -1448,19 +1446,17 @@ object JtxContract {
14481446 const val TRIGGER_RELATIVE_DURATION = " triggerRelativeDuration"
14491447
14501448 /* * This enum class defines the possible values for the attribute [TRIGGER_RELATIVE_TO] for the Component VALARM */
1451- @Suppress(" unused" )
14521449 enum class AlarmRelativeTo {
14531450 START , END
14541451 }
14551452
14561453 /* * This enum class defines the possible values for the attribute [ACTION] for the Component VALARM */
1457- @Suppress(" unused" )
14581454 enum class AlarmAction {
14591455 AUDIO , DISPLAY , EMAIL
14601456 }
14611457 }
14621458
1463- @Suppress( " unused " )
1459+
14641460 object JtxUnknown {
14651461
14661462 /* * The name of the the table for Unknown properties that are linked to an ICalObject.*/
0 commit comments