Skip to content

Commit 29d41ce

Browse files
committed
asd
Signed-off-by: Alberto Codutti <[email protected]>
1 parent c32ecaf commit 29d41ce

File tree

6 files changed

+15
-213
lines changed

6 files changed

+15
-213
lines changed

commons-rest/errors/src/main/java/org/eclipse/kapua/commons/rest/errors/StorableNotFoundExceptionMapper.java

Lines changed: 0 additions & 46 deletions
This file was deleted.

commons-rest/model/src/main/java/org/eclipse/kapua/commons/rest/model/errors/StorableNotFoundExceptionInfo.java

Lines changed: 0 additions & 78 deletions
This file was deleted.

rest-api/core/src/main/java/org/eclipse/kapua/app/api/core/resources/AbstractKapuaResource.java

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import org.eclipse.kapua.KapuaEntityNotFoundException;
1616
import org.eclipse.kapua.model.KapuaEntity;
1717
import org.eclipse.kapua.model.id.KapuaId;
18-
import org.eclipse.kapua.service.storable.exception.StorableNotFoundException;
1918
import org.eclipse.kapua.service.storable.model.Storable;
2019
import org.eclipse.kapua.service.storable.model.id.StorableId;
2120

@@ -64,34 +63,30 @@ public <T> T returnNotNullEntity(T object) {
6463
* @since 2.0.0
6564
*/
6665
public <T extends KapuaEntity> T returnNotNullEntity(T entity, String entityType, KapuaId entityId) throws KapuaEntityNotFoundException {
67-
if (entity == null) {
68-
throw new KapuaEntityNotFoundException(entityType, entityId);
69-
}
70-
71-
return entity;
66+
return returnNotNullEntity(entity, entityType, entityId.getId().toString());
7267
}
7368

7469
/**
75-
* Checks id the given {@link Storable} is {@code null}.
76-
* <p>
77-
* Similar to {@link #returnNotNullEntity(KapuaEntity, String, KapuaId)} but for {@link Storable}s.
70+
* Checks id the given {@link Object} is {@code null}.
7871
*
79-
* @param storable The {@link Storable} to check.
80-
* @param storableType The {@link Storable#getType()}
81-
* @param storableId The {@link StorableId}
82-
* @return The given {@link Storable} if not {@code null}
83-
* @param <T> The type of the {@link Storable}.
84-
* @throws StorableNotFoundException if given {@link Storable} is {@code null}.
72+
* @param entity The {@link Object} to check.
73+
* @param entityType The {@link Object} type.
74+
* @param entityId The {@link Object} id.
75+
* @return The given entity if not {@code null}
76+
* @param <T> The {@link Object} type.
77+
* @throws KapuaEntityNotFoundException if given {@link Object} is {@code null}.
8578
* @since 2.0.0
8679
*/
87-
public <T extends Storable> T returnNotNullStorable(T storable, String storableType, StorableId storableId) throws StorableNotFoundException {
88-
if (storable == null) {
89-
throw new StorableNotFoundException(storableType, storableId);
80+
public <T> T returnNotNullEntity(T entity, String entityType, String entityId) throws KapuaEntityNotFoundException {
81+
if (entity == null) {
82+
throw new KapuaEntityNotFoundException(entityType, entityId);
9083
}
9184

92-
return storable;
85+
return entity;
9386
}
9487

88+
89+
9590
/**
9691
* Builds a 200 HTTP Response.
9792
*

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,6 @@ public ChannelInfo find(@PathParam("scopeId") ScopeId scopeId,
160160
throws KapuaException {
161161
ChannelInfo channelInfo = channelInfoRegistryService.find(scopeId, channelInfoId);
162162

163-
return returnNotNullStorable(channelInfo, ChannelInfo.TYPE, channelInfoId);
163+
return returnNotNullEntity(channelInfo, ChannelInfo.TYPE, channelInfoId.getId());
164164
}
165165
}

service/commons/storable/api/src/main/java/org/eclipse/kapua/service/storable/exception/StorableErrorCodes.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,4 @@ public enum StorableErrorCodes implements KapuaErrorCode {
3434
* @since 1.3.0
3535
*/
3636
UNSUPPORTED_TYPE,
37-
38-
/**
39-
* See {@link StorableNotFoundException}
40-
*
41-
* @since 2.0.0
42-
*/
43-
STORABLE_NOT_FOUND
4437
}

service/commons/storable/api/src/main/java/org/eclipse/kapua/service/storable/exception/StorableNotFoundException.java

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)