• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Commonjava / indy-tracking-service / 44786446415

20 Nov 2026 05:46PM UTC coverage: 37.562% (-29.5%) from 67.036%
44786446415

push

github

rnc
Bump org.commonjava.atlas:atlas-relationships-api from 1.2.2 to 1.2.3

Bumps [org.commonjava.atlas:atlas-relationships-api](https://github.com/Commonjava/atlas) from 1.2.2 to 1.2.3.
- [Release notes](https://github.com/Commonjava/atlas/releases)
- [Commits](https://github.com/Commonjava/atlas/compare/atlas-parent-1.2.2...atlas-parent-1.2.3)

---
updated-dependencies:
- dependency-name: org.commonjava.atlas:atlas-relationships-api
  dependency-version: 1.2.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

678 of 1805 relevant lines covered (37.56%)

0.75 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

3.08
/src/main/java/org/commonjava/indy/service/tracking/data/cassandra/DtxTrackingRecord.java
1
/**
2
 * Copyright (C) 2022-2023 Red Hat, Inc. (https://github.com/Commonjava/indy-tracking-service)
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *         http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package org.commonjava.indy.service.tracking.data.cassandra;
17

18
import com.datastax.driver.core.Row;
19
import com.datastax.driver.mapping.annotations.ClusteringColumn;
20
import com.datastax.driver.mapping.annotations.Column;
21
import com.datastax.driver.mapping.annotations.PartitionKey;
22
import com.datastax.driver.mapping.annotations.Table;
23
import org.commonjava.indy.service.tracking.model.AccessChannel;
24
import org.commonjava.indy.service.tracking.model.StoreEffect;
25
import org.commonjava.indy.service.tracking.model.StoreKey;
26
import org.commonjava.indy.service.tracking.model.TrackedContentEntry;
27
import org.commonjava.indy.service.tracking.model.TrackingKey;
28

29
import java.util.HashSet;
30
import java.util.Set;
31

32
import static org.commonjava.indy.service.tracking.data.cassandra.CassandraFoloUtil.TABLE_FOLO;
33

34
@Table( name = TABLE_FOLO, readConsistency = "QUORUM", writeConsistency = "QUORUM" )
35
public class DtxTrackingRecord
36
{
37

38
    private final static Boolean SEALED = true;
2 ✔
39

40
    private final static Boolean IN_PROGRESS = false;
2 ✔
41

42
    @PartitionKey
43
    @Column( name = "tracking_key" )
44
    String trackingKey;
45

46
    @Column( name = "sealed" )
47
    Boolean state;
48

49
    @ClusteringColumn( 0 )
50
    @Column( name = "store_key" )
51
    String storeKey;
52

53
    @Column( name = "access_channel" )
54
    String accessChannel;
55

56
    @ClusteringColumn( 1 )
57
    @Column( name = "path" )
58
    String path;
59

60
    @Column( name = "origin_url" )
61
    String originUrl;
62

63
    @Column( name = "local_url" )
64
    String localUrl;
65

66
    @ClusteringColumn( 2 )
67
    @Column( name = "store_effect" )
68
    String storeEffect;
69

70
    @Column( name = "md5" )
71
    String md5;
72

73
    @Column( name = "sha256" )
74
    String sha256;
75

76
    @Column( name = "sha1" )
77
    String sha1;
78

79
    @Column( name = "size" )
80
    Long size;
81

82
    @Column( name = "started" ) // started timestamp *
83
    Long started;
84

85
    @Column( name = "timestamps" )
86
    Set<Long> timestamps;
87

88
    public DtxTrackingRecord()
89
    {
2 ✔
90
    }
2 ✔
91

92
    public DtxTrackingRecord( String trackingKey, Boolean state, String storeKey, String accessChannel, String path,
93
                              String originUrl, String localUrl, String storeEffect, String md5, String sha256,
94
                              String sha1, Long size, Long started, Set<Long> timestamps )
95
    {
×
96
        this.trackingKey = trackingKey;
×
97
        this.state = state;
×
98
        this.storeKey = storeKey;
×
99
        this.accessChannel = accessChannel;
×
100
        this.path = path;
×
101
        this.originUrl = originUrl;
×
102
        this.localUrl = localUrl;
×
103
        this.storeEffect = storeEffect;
×
104
        this.md5 = md5;
×
105
        this.sha256 = sha256;
×
106
        this.sha1 = sha1;
×
107
        this.size = size;
×
108
        this.started = started;  // started timestamp *
×
109
        this.timestamps = timestamps;
×
110
    }
×
111

112
    public DtxTrackingRecord( TrackedContentEntry entry )
113
    {
×
114
        this.trackingKey = entry.getTrackingKey().getId();
×
115
        this.state = IN_PROGRESS;
×
116
        this.storeKey = entry.getStoreKey().toString();
×
117
        this.accessChannel = entry.getAccessChannel().toString();
×
118
        this.path = entry.getPath();
×
119
        this.originUrl = entry.getOriginUrl() == null || entry.getOriginUrl().isEmpty() ? "" : entry.getOriginUrl();
×
120
        this.localUrl = "";
×
121
        this.storeEffect = entry.getEffect().toString();
×
122
        this.md5 = entry.getMd5();
×
123
        this.sha256 = entry.getSha256();
×
124
        this.sha1 = entry.getSha1();
×
125
        this.size = entry.getSize();
×
126
        this.started = System.currentTimeMillis();  // started timestamp *
×
127
        this.timestamps = ( ( entry.getTimestamps() == null ) || entry.getTimestamps().isEmpty() ) ?
×
128
                        new HashSet<>() :
×
129
                        entry.getTimestamps();
×
130
    }
×
131

132
    public static DtxTrackingRecord fromTrackedContentEntry( TrackedContentEntry entry, Boolean sealed )
133
    {
134
        if ( entry == null )
×
135
        {
136
            return new DtxTrackingRecord();  // TODO  check for  null value
×
137
        }
138
        boolean sealedRecord = sealed ? SEALED : IN_PROGRESS;
×
139
        DtxTrackingRecord dtxTrackingRecord = new DtxTrackingRecord();
×
140
        dtxTrackingRecord.setTrackingKey( entry.getTrackingKey().getId() );
×
141
        dtxTrackingRecord.setState( sealedRecord );
×
142
        dtxTrackingRecord.setAccessChannel( entry.getAccessChannel().toString() );
×
143
        dtxTrackingRecord.setMd5( entry.getMd5() );
×
144
        dtxTrackingRecord.setSha1( entry.getSha1() );
×
145
        dtxTrackingRecord.setSha256( entry.getSha256() );
×
146
        dtxTrackingRecord.setOriginUrl( entry.getOriginUrl() == null ? "" : entry.getOriginUrl() );
×
147
        dtxTrackingRecord.setLocalUrl( "" );  // TODO  localURL from ttrackingcontententry???
×
148
        dtxTrackingRecord.setPath( entry.getPath() );
×
149
        dtxTrackingRecord.setSize( entry.getSize() );
×
150
        dtxTrackingRecord.setStoreEffect( entry.getEffect().toString() );
×
151
        dtxTrackingRecord.setStarted( System.currentTimeMillis() ); // started timestamp *
×
152
        dtxTrackingRecord.setTimestamps( entry.getTimestamps() == null ? new HashSet<>() : entry.getTimestamps() );
×
153
        dtxTrackingRecord.setStoreKey( entry.getStoreKey().toString() );
×
154
        return dtxTrackingRecord;
×
155
    }
156

157
    public static TrackedContentEntry toTrackingContentEntry( DtxTrackingRecord record )
158
    {
159

160
        TrackedContentEntry trackedContentEntry = new TrackedContentEntry();
×
161

162
        trackedContentEntry.setTrackingKey( new TrackingKey( record.getTrackingKey() ) );
×
163
        if ( record.getAccessChannel() == null || record.getAccessChannel().isEmpty() )
×
164
        {
165
            trackedContentEntry.setAccessChannel( AccessChannel.NATIVE );
×
166
        }
167
        else
168
        {
169
            trackedContentEntry.setAccessChannel( AccessChannel.valueOf( record.getAccessChannel() ) );
×
170
        }
171
        trackedContentEntry.setEffect( StoreEffect.valueOf( record.getStoreEffect() ) );
×
172
        trackedContentEntry.setMd5( record.getMd5() );
×
173
        trackedContentEntry.setSha1( record.getSha1() );
×
174
        trackedContentEntry.setSha256( record.getSha256() );
×
175
        trackedContentEntry.setSize( record.getSize() );
×
176
        trackedContentEntry.setStoreKey( StoreKey.fromString( record.getStoreKey() ) );
×
177
        trackedContentEntry.setOriginUrl( record.getOriginUrl() );
×
178
        trackedContentEntry.setPath( record.getPath() );
×
179
        trackedContentEntry.setTimestamps( record.getTimestamps() );
×
180

181
        return trackedContentEntry;
×
182
    }
183

184
    public static DtxTrackingRecord fromCassandraRow( Row row )
185
    {
186

187
        DtxTrackingRecord dtxTrackingRecord = new DtxTrackingRecord();
×
188
        dtxTrackingRecord.setTrackingKey( row.getString( "tracking_key" ) );
×
189
        dtxTrackingRecord.setState( row.getBool( "sealed" ) );
×
190
        dtxTrackingRecord.setLocalUrl( row.getString( "local_url" ) );
×
191
        dtxTrackingRecord.setOriginUrl( row.getString( "origin_url" ) );
×
192
        dtxTrackingRecord.setTimestamps( row.getSet( "timestamps", Long.class ) );
×
193
        dtxTrackingRecord.setPath( row.getString( "path" ) );
×
194
        dtxTrackingRecord.setStoreEffect( row.getString( "store_effect" ) );
×
195
        dtxTrackingRecord.setSha256( row.getString( "sha256" ) );
×
196
        dtxTrackingRecord.setSha1( row.getString( "sha1" ) );
×
197
        dtxTrackingRecord.setMd5( row.getString( "md5" ) );
×
198
        dtxTrackingRecord.setSize( row.getLong( "size" ) );
×
199
        dtxTrackingRecord.setStoreKey( row.getString( "store_key" ) );
×
200
        dtxTrackingRecord.setAccessChannel( row.getString( "access_channel" ) );
×
201
        dtxTrackingRecord.setStarted( row.getLong( "started" ) ); // started timestamp *
×
202

203
        return dtxTrackingRecord;
×
204
    }
205

206
    public String getLocalUrl()
207
    {
208
        return localUrl;
×
209
    }
210

211
    public void setLocalUrl( String localUrl )
212
    {
213
        this.localUrl = localUrl;
×
214
    }
×
215

216
    public Boolean getState()
217
    {
218
        return state;
×
219
    }
220

221
    public void setState( Boolean state )
222
    {
223
        this.state = state;
×
224
    }
×
225

226
    public String getTrackingKey()
227
    {
228
        return trackingKey;
×
229
    }
230

231
    public void setTrackingKey( String trackingKey )
232
    {
233
        this.trackingKey = trackingKey;
×
234
    }
×
235

236
    public String getStoreKey()
237
    {
238
        return storeKey;
×
239
    }
240

241
    public void setStoreKey( String storeKey )
242
    {
243
        this.storeKey = storeKey;
×
244
    }
×
245

246
    public String getAccessChannel()
247
    {
248
        return accessChannel;
×
249
    }
250

251
    public void setAccessChannel( String accessChannel )
252
    {
253
        this.accessChannel = accessChannel;
×
254
    }
×
255

256
    public String getPath()
257
    {
258
        return path;
×
259
    }
260

261
    public void setPath( String path )
262
    {
263
        this.path = path;
×
264
    }
×
265

266
    public String getOriginUrl()
267
    {
268
        return originUrl;
×
269
    }
270

271
    public void setOriginUrl( String originUrl )
272
    {
273
        this.originUrl = originUrl;
×
274
    }
×
275

276
    public String getStoreEffect()
277
    {
278
        return storeEffect;
×
279
    }
280

281
    public void setStoreEffect( String storeEffect )
282
    {
283
        this.storeEffect = storeEffect;
×
284
    }
×
285

286
    public String getMd5()
287
    {
288
        return md5;
×
289
    }
290

291
    public void setMd5( String md5 )
292
    {
293
        this.md5 = md5;
×
294
    }
×
295

296
    public String getSha256()
297
    {
298
        return sha256;
×
299
    }
300

301
    public void setSha256( String sha256 )
302
    {
303
        this.sha256 = sha256;
×
304
    }
×
305

306
    public String getSha1()
307
    {
308
        return sha1;
×
309
    }
310

311
    public void setSha1( String sha1 )
312
    {
313
        this.sha1 = sha1;
×
314
    }
×
315

316
    public Long getSize()
317
    {
318
        return size;
×
319
    }
320

321
    public void setSize( Long size )
322
    {
323
        this.size = size;
×
324
    }
×
325

326
    public Long getStarted()
327
    {
328
        return started;
×
329
    }
330

331
    public void setStarted( Long started )
332
    {
333
        this.started = started;
×
334
    }
×
335

336
    public Set<Long> getTimestamps()
337
    {
338
        return timestamps;
×
339
    }
340

341
    public void setTimestamps( Set<Long> timestamps )
342
    {
343
        this.timestamps = timestamps;
×
344
    }
×
345
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc