Skip to content

Commit a37a6f5

Browse files
committed
💥 stripping storable creators from false extension points
Signed-off-by: dseurotech <[email protected]>
1 parent b543bff commit a37a6f5

File tree

8 files changed

+158
-346
lines changed

8 files changed

+158
-346
lines changed

rest-api/resources/src/main/java/org/eclipse/kapua/app/api/resources/v1/resources/Roles.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,10 @@
4141
import org.eclipse.kapua.service.KapuaService;
4242
import org.eclipse.kapua.service.authorization.role.Role;
4343
import org.eclipse.kapua.service.authorization.role.RoleCreator;
44-
import org.eclipse.kapua.service.authorization.role.RoleFactory;
4544
import org.eclipse.kapua.service.authorization.role.RoleListResult;
4645
import org.eclipse.kapua.service.authorization.role.RoleQuery;
4746
import org.eclipse.kapua.service.authorization.role.RoleService;
4847
import org.eclipse.kapua.service.user.User;
49-
import org.eclipse.kapua.service.user.UserFactory;
5048
import org.eclipse.kapua.service.user.UserListResult;
5149
import org.eclipse.kapua.service.user.UserQuery;
5250
import org.eclipse.kapua.service.user.UserService;
@@ -59,11 +57,7 @@ public class Roles extends AbstractKapuaResource {
5957
@Inject
6058
public RoleService roleService;
6159
@Inject
62-
public RoleFactory roleFactory;
63-
@Inject
6460
public UserService userService;
65-
@Inject
66-
public UserFactory userFactory;
6761

6862
/**
6963
* Gets the {@link Role} list in the scope.

service/commons/storable/api/src/main/java/org/eclipse/kapua/service/storable/model/StorableCreator.java

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,39 @@
1919
* <p>
2020
* It is the base {@code interface} for all {@link Object} creators that are {@link Storable}.
2121
*
22-
* @param <E> The {@link Storable} for which this is a {@link StorableCreator} for.
22+
* @param <E>
23+
* The {@link Storable} for which this is a {@link StorableCreator} for.
2324
* @since 1.0.0
2425
*/
25-
public interface StorableCreator<E extends Storable> {
26+
public class StorableCreator<E extends Storable> {
27+
28+
private KapuaId scopeId;
29+
30+
public StorableCreator() {
31+
}
32+
33+
public StorableCreator(KapuaId scopeId) {
34+
this.scopeId = scopeId;
35+
}
2636

2737
/**
2838
* Gets the scope {@link KapuaId}.
2939
*
3040
* @return The scope {@link KapuaId}.
3141
* @since 1.0.0
3242
*/
33-
KapuaId getScopeId();
43+
public KapuaId getScopeId() {
44+
return scopeId;
45+
}
3446

3547
/**
3648
* Sets the scope {@link KapuaId}.
3749
*
38-
* @param scopeId The scope {@link KapuaId}.
50+
* @param scopeId
51+
* The scope {@link KapuaId}.
3952
* @since 1.3.0
4053
*/
41-
void setScopeId(KapuaId scopeId);
54+
public void setScopeId(KapuaId scopeId) {
55+
this.scopeId = scopeId;
56+
}
4257
}

service/datastore/api/src/main/java/org/eclipse/kapua/service/datastore/model/ChannelInfoCreator.java

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,77 +12,107 @@
1212
*******************************************************************************/
1313
package org.eclipse.kapua.service.datastore.model;
1414

15+
import java.util.Date;
16+
17+
import org.eclipse.kapua.model.id.KapuaId;
1518
import org.eclipse.kapua.service.storable.model.StorableCreator;
1619
import org.eclipse.kapua.service.storable.model.id.StorableId;
1720

18-
import java.util.Date;
19-
2021
/**
2122
* Channel information schema creator definition
2223
*
2324
* @since 1.0.0
2425
*/
25-
public interface ChannelInfoCreator extends StorableCreator<ChannelInfo> {
26+
public class ChannelInfoCreator extends StorableCreator<ChannelInfo> {
27+
28+
private String clientId;
29+
private String name;
30+
private StorableId messageId;
31+
private Date messageTimestamp;
32+
33+
public ChannelInfoCreator() {
34+
}
35+
36+
public ChannelInfoCreator(KapuaId scopeId) {
37+
super(scopeId);
38+
}
2639

2740
/**
2841
* Get the client identifier
2942
*
3043
* @return
3144
* @since 1.0.0
3245
*/
33-
String getClientId();
46+
public String getClientId() {
47+
return this.clientId;
48+
}
3449

3550
/**
3651
* @param clientId
3752
* @since 1.3.0
3853
*/
39-
void setClientId(String clientId);
54+
public void setClientId(String clientId) {
55+
this.clientId = clientId;
56+
}
4057

4158
/**
4259
* Get the name
4360
*
4461
* @return
4562
* @since 1.0.0
4663
*/
47-
String getName();
64+
public String getName() {
65+
return name;
66+
}
4867

4968
/**
5069
* Set the channel name
5170
*
5271
* @param name
5372
* @since 1.0.0
5473
*/
55-
void setName(String name);
74+
public void setName(String name) {
75+
this.name = name;
76+
}
5677

5778
/**
5879
* Get the message identifier (of the first message published on this channel)
5980
*
6081
* @return
6182
* @since 1.0.0
6283
*/
63-
StorableId getMessageId();
84+
public StorableId getMessageId() {
85+
return messageId;
86+
}
6487

6588
/**
6689
* Set the message identifier (of the first message published on this channel)
6790
*
6891
* @param messageId
6992
* @since 1.0.0
7093
*/
71-
void setMessageId(StorableId messageId);
94+
public void setMessageId(StorableId messageId) {
95+
this.messageId = messageId;
96+
}
7297

7398
/**
7499
* Get the message timestamp (of the first message published on this channel)
75100
*
76101
* @return
77102
* @since 1.0.0
78103
*/
79-
Date getMessageTimestamp();
104+
public Date getMessageTimestamp() {
105+
return messageTimestamp;
106+
}
80107

81108
/**
82109
* Set the message timestamp (of the first message published on this channel)
83110
*
84111
* @param messageTimestamp
85112
* @since 1.0.0
86113
*/
87-
void setMessageTimestamp(Date messageTimestamp);
114+
public void setMessageTimestamp(Date messageTimestamp) {
115+
this.messageTimestamp = messageTimestamp;
116+
}
117+
88118
}

service/datastore/api/src/main/java/org/eclipse/kapua/service/datastore/model/ClientInfoCreator.java

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,72 +12,95 @@
1212
*******************************************************************************/
1313
package org.eclipse.kapua.service.datastore.model;
1414

15+
import java.util.Date;
16+
1517
import org.eclipse.kapua.model.id.KapuaId;
1618
import org.eclipse.kapua.service.storable.model.StorableCreator;
1719
import org.eclipse.kapua.service.storable.model.id.StorableId;
1820

19-
import java.util.Date;
20-
2121
/**
2222
* Client information schema creator definition
2323
*
2424
* @since 1.0.0
2525
*/
26-
public interface ClientInfoCreator extends StorableCreator<ClientInfo> {
26+
public class ClientInfoCreator extends StorableCreator<ClientInfo> {
27+
28+
private String clientId;
29+
private StorableId messageId;
30+
private Date messageTimestamp;
31+
32+
public ClientInfoCreator() {
33+
}
2734

2835
/**
29-
* Get the account
36+
* Construct a client information creator for the given account
3037
*
31-
* @return
38+
* @param scopeId
39+
* The scope {@link KapuaId}
3240
* @since 1.0.0
3341
*/
34-
KapuaId getScopeId();
42+
public ClientInfoCreator(KapuaId scopeId) {
43+
super(scopeId);
44+
}
3545

3646
/**
3747
* Get the client identifier
3848
*
3949
* @return
4050
* @since 1.0.0
4151
*/
42-
String getClientId();
52+
public String getClientId() {
53+
return clientId;
54+
}
4355

4456
/**
4557
* Set the client identifier
4658
*
4759
* @param clientId
4860
* @since 1.0.0
4961
*/
50-
void setClientId(String clientId);
62+
public void setClientId(String clientId) {
63+
this.clientId = clientId;
64+
}
5165

5266
/**
5367
* Get the message identifier (of the first message published by this client)
5468
*
5569
* @return
5670
* @since 1.0.0
5771
*/
58-
StorableId getMessageId();
72+
public StorableId getMessageId() {
73+
return messageId;
74+
}
5975

6076
/**
6177
* Set the message identifier (of the first message published by this client)
6278
*
6379
* @param messageId
6480
* @since 1.0.0
6581
*/
66-
void setMessageId(StorableId messageId);
82+
public void setMessageId(StorableId messageId) {
83+
this.messageId = messageId;
84+
}
6785

6886
/**
6987
* Get the message timestamp (of the first message published by this client)
7088
*
7189
* @return
7290
* @since 1.0.0
7391
*/
74-
Date getMessageTimestamp();
92+
public Date getMessageTimestamp() {
93+
return messageTimestamp;
94+
}
7595

7696
/**
7797
* Set the message timestamp (of the first message published by this client)
7898
*
7999
* @param messageTimestamp
80100
* @since 1.0.0
81101
*/
82-
void setMessageTimestamp(Date messageTimestamp);
102+
public void setMessageTimestamp(Date messageTimestamp) {
103+
this.messageTimestamp = messageTimestamp;
104+
}
105+
83106
}

0 commit comments

Comments
 (0)