/** * Queries the results with the given {@link RolePermissionQuery} parameter. * * @param scopeId The {@link ScopeId} in which to search results. * @param roleId The {@link Role} id in which to search results. * @param query The {@link RolePermissionQuery} to use to filter results. * @return The {@link RolePermissionListResult} of all the result matching the given {@link RolePermissionQuery} parameter. * @throws Exception Whenever something bad happens. See specific {@link KapuaService} exceptions. * @since 1.0.0 */ @ApiOperation(nickname = "rolePermissionQuery", value = "Queries the RolePermissions", notes = "Queries the RolePermissions with the given RolePermissionQuery parameter returning all matching RolePermissions", response = RolePermissionListResult.class) @POST @Path("_query") @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) public RolePermissionListResult query( @ApiParam(value = "The ScopeId in which to search results.", required = true, defaultValue = DEFAULT_SCOPE_ID) @PathParam("scopeId") ScopeId scopeId, @ApiParam(value = "The Role id in which to search results.") @PathParam("roleId") EntityId roleId, @ApiParam(value = "The RolePermissionQuery to use to filter results.", required = true) RolePermissionQuery query) throws Exception { query.setScopeId(scopeId); AndPredicateImpl andPredicate = new AndPredicateImpl(); andPredicate.and(new AttributePredicateImpl<>(RolePermissionAttributes.ROLE_ID, roleId)); andPredicate.and(query.getPredicate()); query.setPredicate(andPredicate); return rolePermissionService.query(query); }
/** * Queries the results with the given {@link ManagementOperationNotificationQuery} parameter. * * @param scopeId The {@link ScopeId} in which to search results. * @param operationId The id of the {@link Device} in which to search results * @param query The {@link ManagementOperationNotificationQuery} to use to filter results. * @return The {@link ManagementOperationNotificationListResult} of all the result matching the given {@link ManagementOperationNotificationQuery} parameter. * @throws Exception Whenever something bad happens. See specific {@link KapuaService} exceptions. * @since 1.0.0 */ @ApiOperation(nickname = "ManagementOperationNotificationQuery", value = "Queries the ManagementOperationNotifications", notes = "Queries the ManagementOperationNotifications with the given ManagementOperationNotifications parameter returning all matching ManagementOperationNotifications", response = ManagementOperationNotificationListResult.class) @POST @Path("_query") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public ManagementOperationNotificationListResult query( @ApiParam(value = "The ScopeId in which to search results.", required = true, defaultValue = DEFAULT_SCOPE_ID) @PathParam("scopeId") ScopeId scopeId, @ApiParam(value = "The device id to filter results.") @PathParam("deviceId") EntityId deviceId, @ApiParam(value = "The id of the Device in which to search results") @PathParam("operationId") EntityId operationId, @ApiParam(value = "The ManagementOperationNotificationQuery to use to filter results.", required = true) ManagementOperationNotificationQuery query) throws Exception { query.setScopeId(scopeId); AndPredicateImpl andPredicate = new AndPredicateImpl(); andPredicate.and(new AttributePredicateImpl<>(ManagementOperationNotificationAttributes.OPERATION_ID, operationId)); query.setPredicate(andPredicate); return managementOperationNotificationService.query(query); }
/** * Queries the results with the given {@link DeviceManagementOperationQuery} parameter. * * @param scopeId The {@link ScopeId} in which to search results. * @param deviceId The id of the {@link Device} in which to search results * @param query The {@link DeviceManagementOperationQuery} to use to filter results. * @return The {@link DeviceManagementOperationListResult} of all the result matching the given {@link DeviceManagementOperationQuery} parameter. * @throws Exception Whenever something bad happens. See specific {@link KapuaService} exceptions. * @since 1.0.0 */ @ApiOperation(nickname = "deviceManagementOperationQuery", value = "Queries the DeviceManagementOperations", notes = "Queries the DeviceManagementOperations with the given DeviceManagementOperations parameter returning all matching DeviceManagementOperations", response = DeviceManagementOperationListResult.class) @POST @Path("_query") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public DeviceManagementOperationListResult query( @ApiParam(value = "The ScopeId in which to search results.", required = true, defaultValue = DEFAULT_SCOPE_ID) @PathParam("scopeId") ScopeId scopeId, @ApiParam(value = "The id of the Device in which to search results") @PathParam("deviceId") EntityId deviceId, @ApiParam(value = "The DeviceManagementOperationQuery to use to filter results.", required = true) DeviceManagementOperationQuery query) throws Exception { query.setScopeId(scopeId); AndPredicateImpl andPredicate = new AndPredicateImpl(); andPredicate.and(new AttributePredicateImpl<>(DeviceManagementOperationAttributes.DEVICE_ID, deviceId)); query.setPredicate(andPredicate); return deviceManagementOperationRegistryService.query(query); }
/** * Queries the results with the given {@link DeviceEventQuery} parameter. * * @param scopeId * The {@link ScopeId} in which to search results. * @param deviceId * The id of the {@link Device} in which to search results * @param query * The {@link DeviceEventQuery} to use to filter results. * @return The {@link DeviceEventListResult} of all the result matching the given {@link DeviceEventQuery} parameter. * @throws Exception * Whenever something bad happens. See specific {@link KapuaService} exceptions. * @since 1.0.0 */ @ApiOperation(nickname = "deviceEventQuery", value = "Queries the DeviceEvents", notes = "Queries the DeviceEvents with the given DeviceEvents parameter returning all matching DeviceEvents", response = DeviceEventListResult.class) @POST @Path("_query") @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) public DeviceEventListResult query( @ApiParam(value = "The ScopeId in which to search results.", required = true, defaultValue = DEFAULT_SCOPE_ID) @PathParam("scopeId") ScopeId scopeId, @ApiParam(value = "The id of the Device in which to search results") @PathParam("deviceId") EntityId deviceId, @ApiParam(value = "The DeviceEventQuery to use to filter results.", required = true) DeviceEventQuery query) throws Exception { query.setScopeId(scopeId); AndPredicateImpl andPredicate = new AndPredicateImpl(); andPredicate.and(new AttributePredicateImpl<>(DeviceEventAttributes.DEVICE_ID, deviceId)); andPredicate.and(query.getPredicate()); query.setPredicate(andPredicate); return deviceEventService.query(query); }
/** * Gets the {@link ManagementOperationNotification} list in the scope. * * @param scopeId The {@link ScopeId} in which to search results. * @param operationId The id of the {@link Device} in which to search results * @param resource The resource of the {@link ManagementOperationNotification} in which to search results * @param offset The result set offset. * @param limit The result set limit. * @return The {@link ManagementOperationNotificationListResult} of all the ManagementOperationNotifications associated to the current selected scope. * @throws Exception Whenever something bad happens. See specific {@link KapuaService} exceptions. * @since 1.0.0 */ @ApiOperation(nickname = "ManagementOperationNotificationSimpleQuery", value = "Gets the ManagementOperationNotification list in the scope", notes = "Returns the list of all the ManagementOperationNotifications associated to the current selected scope.", response = ManagementOperationNotificationListResult.class) @GET @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public ManagementOperationNotificationListResult simpleQuery( @ApiParam(value = "The ScopeId in which to search results.", required = true, defaultValue = DEFAULT_SCOPE_ID) @PathParam("scopeId") ScopeId scopeId, @ApiParam(value = "The device id to filter results.") @PathParam("deviceId") EntityId deviceId, @ApiParam(value = "The operation id to filter results.") @PathParam("operationId") EntityId operationId, @ApiParam(value = "The resource of the ManagementOperationNotification in which to search results") @QueryParam("resource") String resource, @ApiParam(value = "The result set offset.", defaultValue = "0") @QueryParam("offset") @DefaultValue("0") int offset, @ApiParam(value = "The result set limit.", defaultValue = "50") @QueryParam("limit") @DefaultValue("50") int limit) throws Exception { ManagementOperationNotificationQuery query = managementOperationNotificationFactory.newQuery(scopeId); AndPredicateImpl andPredicate = new AndPredicateImpl(); andPredicate.and(new AttributePredicateImpl<>(ManagementOperationNotificationAttributes.OPERATION_ID, operationId)); query.setPredicate(andPredicate); query.setOffset(offset); query.setLimit(limit); return query(scopeId, deviceId, operationId, query); }
/** * Gets the {@link Domain} list in the scope. * * @param scopeId The {@link ScopeId} in which to search results. * @param name The {@link Domain} name in which to search results. * @param offset The result set offset. * @param limit The result set limit. * @return The {@link DomainListResult} of all the domains associated to the current selected scope. * @throws Exception Whenever something bad happens. See specific {@link KapuaService} exceptions. * @since 1.0.0 */ @ApiOperation(nickname = "domainSimpleQuery", value = "Gets the Domain list in the scope", notes = "Returns the list of all the domains associated to the current selected scope.", response = DomainListResult.class) @GET @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) public DomainListResult simpleQuery( @ApiParam(value = "The ScopeId in which to search results.", required = true, defaultValue = DEFAULT_SCOPE_ID) @PathParam("scopeId") ScopeId scopeId, @ApiParam(value = "The domain name to filter results.") @QueryParam("name") String name, @ApiParam(value = "The result set offset.", defaultValue = "0") @QueryParam("offset") @DefaultValue("0") int offset, @ApiParam(value = "The result set limit.", defaultValue = "50") @QueryParam("limit") @DefaultValue("50") int limit) throws Exception { DomainQuery query = domainFactory.newQuery(null); AndPredicateImpl andPredicate = new AndPredicateImpl(); if (!Strings.isNullOrEmpty(name)) { andPredicate.and(new AttributePredicateImpl<>(DomainAttributes.NAME, name)); } query.setPredicate(andPredicate); query.setOffset(offset); query.setLimit(limit); return query(scopeId, query); }
private EventStoreRecordListResult getUnsentEvents(String serviceName, EventsProcessType eventsProcessType) throws KapuaException { EventStoreRecordQuery query = new EventStoreFactoryImpl().newQuery(null); AndPredicateImpl andPredicate = new AndPredicateImpl(); andPredicate.and(new AttributePredicateImpl<>(EventStoreRecordAttributes.SERVICE_NAME, serviceName)); if (EventsProcessType.SEND_ERROR.equals(eventsProcessType)) { LOGGER.trace("Looking for SENT_ERROR events. Add EventStatus=SENT_ERROR query predicate."); andPredicate.and(new AttributePredicateImpl<>(EventStoreRecordAttributes.EVENT_STATUS, EventStatus.SEND_ERROR)); } else { LOGGER.trace("Looking for OLD events. Add EventStatus=RAISED query predicate."); andPredicate.and(new AttributePredicateImpl<>(EventStoreRecordAttributes.EVENT_STATUS, EventStatus.TRIGGERED)); //add timestamp predicate Date eventDateBound = Date.from(KapuaDateUtils.getKapuaSysDate().minusMillis(OLD_MESSAGES_TIME_WINDOW)); LOGGER.trace("Looking for OLD events. Add timestamp condition query predicate. Date before {}", eventDateBound); andPredicate.and(new AttributePredicateImpl<>(EventStoreRecordAttributes.MODIFIED_ON, eventDateBound, Operator.LESS_THAN_OR_EQUAL)); } query.setPredicate(andPredicate); query.setLimit(EVENT_SCAN_WINDOW); return kapuaEventService.query(query); }
private EventStoreRecordListResult getUnsentEvents(String serviceName, EventsProcessType eventsProcessType) throws KapuaException { EventStoreRecordQuery query = new EventStoreFactoryImpl().newQuery(null); AndPredicateImpl andPredicate = new AndPredicateImpl(); andPredicate.and(new AttributePredicateImpl<>(EventStoreRecordAttributes.SERVICE_NAME, serviceName)); if (EventsProcessType.SEND_ERROR.equals(eventsProcessType)) { LOGGER.trace("Looking for SENT_ERROR events. Add EventStatus=SENT_ERROR query predicate."); andPredicate.and(new AttributePredicateImpl<>(EventStoreRecordAttributes.EVENT_STATUS, EventStatus.SEND_ERROR)); } else { LOGGER.trace("Looking for OLD events. Add EventStatus=RAISED query predicate."); andPredicate.and(new AttributePredicateImpl<>(EventStoreRecordAttributes.EVENT_STATUS, EventStatus.TRIGGERED)); //add timestamp predicate Date eventDateBound = Date.from(KapuaDateUtils.getKapuaSysDate().minusMillis(OLD_MESSAGES_TIME_WINDOW)); LOGGER.trace("Looking for OLD events. Add timestamp condition query predicate. Date before {}", eventDateBound); andPredicate.and(new AttributePredicateImpl<>(EventStoreRecordAttributes.MODIFIED_ON, eventDateBound, Operator.LESS_THAN_OR_EQUAL)); } query.setPredicate(andPredicate); query.setLimit(EVENT_SCAN_WINDOW); return kapuaEventService.query(query); }
/** * This method apply {@link AttributePredicate}s according to the parameters contained into the {@link JobContextWrapper} and {@link StepContextWrapper}. * <p> * It manages the options of resetting the status of the target to a certain {@link JobStepIndex}. * <p> * When no {@link JobStepIndex} is specified, the methods selects all targets that are set to the current {@link StepContextWrapper#getStepIndex()} and that don't have the * {@link JobTargetStatus} set to {@link JobTargetStatus#PROCESS_OK}. * <p> * When a {@link JobStepIndex} is specified, the methods ignores all targets until the {@link StepContextWrapper#getStepIndex()} doesn't match the {@link JobContextWrapper#getFromStepIndex()}. * When they match all the {@link JobTarget}s are seleted regardless of their {@link JobTargetStatus}. After passing the given {@link JobContextWrapper#getFromStepIndex()} {@link JobTarget}s * will be selected as regularly. * <p> * Regardless of the status of the {@link org.eclipse.kapua.service.job.Job} of the {@link StepContextWrapper#getStepIndex()} and the {@link JobContextWrapper#getFromStepIndex()} values, * {@link #targetSublistFiltering(JobContextWrapper, AndPredicateImpl)} can apply filter that will reduce the {@link JobTarget}s selected. * * @param jobContextWrapper The {@link JobContextWrapper} from which extract data * @param stepContextWrapper The {@link StepContextWrapper} from which extract data * @param andPredicate The {@link org.eclipse.kapua.model.query.predicate.AndPredicate} where to apply {@link org.eclipse.kapua.model.query.predicate.QueryPredicate} * @since 1.0.0 */ protected void stepIndexFiltering(JobContextWrapper jobContextWrapper, StepContextWrapper stepContextWrapper, AndPredicateImpl andPredicate) { Integer fromStepIndex = jobContextWrapper.getFromStepIndex(); if (fromStepIndex == null || fromStepIndex < stepContextWrapper.getStepIndex()) { andPredicate.and(new AttributePredicateImpl<>(JobTargetAttributes.STEP_INDEX, stepContextWrapper.getStepIndex())); andPredicate.and(new AttributePredicateImpl<>(JobTargetAttributes.STATUS, JobTargetStatus.PROCESS_OK, AttributePredicate.Operator.NOT_EQUAL)); } else if (fromStepIndex > stepContextWrapper.getStepIndex()) { andPredicate.and(new AttributePredicateImpl<>(JobTargetAttributes.STEP_INDEX, JobStepIndex.NONE)); } }
/** * This method apply {@link AttributePredicate}s according to the parameters contained into the {@link JobContextWrapper} and {@link StepContextWrapper}. * <p> * It manages the options of resetting the status of the target to a certain {@link JobStepIndex}. * <p> * When no {@link JobStepIndex} is specified, the methods selects all targets that are set to the current {@link StepContextWrapper#getStepIndex()} and that don't have the * {@link JobTargetStatus} set to {@link JobTargetStatus#PROCESS_OK}. * <p> * When a {@link JobStepIndex} is specified, the methods ignores all targets until the {@link StepContextWrapper#getStepIndex()} doesn't match the {@link JobContextWrapper#getFromStepIndex()}. * When they match all the {@link JobTarget}s are seleted regardless of their {@link JobTargetStatus}. After passing the given {@link JobContextWrapper#getFromStepIndex()} {@link JobTarget}s * will be selected as regularly. * <p> * Regardless of the status of the {@link org.eclipse.kapua.service.job.Job} of the {@link StepContextWrapper#getStepIndex()} and the {@link JobContextWrapper#getFromStepIndex()} values, * {@link #targetSublistFiltering(JobContextWrapper, AndPredicateImpl)} can apply filter that will reduce the {@link JobTarget}s selected. * * @param jobContextWrapper The {@link JobContextWrapper} from which extract data * @param stepContextWrapper The {@link StepContextWrapper} from which extract data * @param andPredicate The {@link org.eclipse.kapua.model.query.predicate.AndPredicate} where to apply {@link org.eclipse.kapua.model.query.predicate.QueryPredicate} * @since 1.0.0 */ protected void stepIndexFiltering(JobContextWrapper jobContextWrapper, StepContextWrapper stepContextWrapper, AndPredicateImpl andPredicate) { Integer fromStepIndex = jobContextWrapper.getFromStepIndex(); if (fromStepIndex == null || fromStepIndex < stepContextWrapper.getStepIndex()) { andPredicate.and(new AttributePredicateImpl<>(JobTargetAttributes.STEP_INDEX, stepContextWrapper.getStepIndex())); andPredicate.and(new AttributePredicateImpl<>(JobTargetAttributes.STATUS, JobTargetStatus.PROCESS_OK, AttributePredicate.Operator.NOT_EQUAL)); } else if (fromStepIndex > stepContextWrapper.getStepIndex()) { andPredicate.and(new AttributePredicateImpl<>(JobTargetAttributes.STEP_INDEX, JobStepIndex.NONE)); } }
private long countExistingCredentials(CredentialType credentialType, KapuaId scopeId, KapuaId userId) throws KapuaException { KapuaLocator locator = KapuaLocator.getInstance(); CredentialFactory credentialFactory = locator.getFactory(CredentialFactory.class); KapuaQuery<Credential> credentialQuery = credentialFactory.newQuery(scopeId); CredentialType ct = credentialType; QueryPredicate credentialTypePredicate = new AttributePredicateImpl<>(CredentialAttributes.CREDENTIAL_TYPE, ct); QueryPredicate userIdPredicate = new AttributePredicateImpl<>(CredentialAttributes.USER_ID, userId); QueryPredicate andPredicate = new AndPredicateImpl().and(credentialTypePredicate).and(userIdPredicate); credentialQuery.setPredicate(andPredicate); return count(credentialQuery); }
private long countExistingCredentials(CredentialType credentialType, KapuaId scopeId, KapuaId userId) throws KapuaException { KapuaLocator locator = KapuaLocator.getInstance(); CredentialFactory credentialFactory = locator.getFactory(CredentialFactory.class); KapuaQuery<Credential> credentialQuery = credentialFactory.newQuery(scopeId); CredentialType ct = credentialType; QueryPredicate credentialTypePredicate = new AttributePredicateImpl<>(CredentialAttributes.CREDENTIAL_TYPE, ct); QueryPredicate userIdPredicate = new AttributePredicateImpl<>(CredentialAttributes.USER_ID, userId); QueryPredicate andPredicate = new AndPredicateImpl().and(credentialTypePredicate).and(userIdPredicate); credentialQuery.setPredicate(andPredicate); return count(credentialQuery); }
/** * This method apply {@link AttributePredicate}s according to the parameters contained into the {@link JobContextWrapper#getTargetSublist()}. * <p> * If the {@link JobContextWrapper#getTargetSublist()} has one or more {@link org.eclipse.kapua.model.id.KapuaId}s they will be added to the * {@link org.eclipse.kapua.model.query.predicate.AndPredicate} to select only given {@link JobTarget}. * * @param jobContextWrapper The {@link JobContextWrapper} from which extract data * @param andPredicate The {@link org.eclipse.kapua.model.query.predicate.AndPredicate} where to apply {@link org.eclipse.kapua.model.query.predicate.QueryPredicate} * @since 1.0.0 */ protected void targetSublistFiltering(JobContextWrapper jobContextWrapper, AndPredicateImpl andPredicate) { if (!jobContextWrapper.getTargetSublist().isEmpty()) { andPredicate.and(new AttributePredicateImpl<>(JobTargetAttributes.ENTITY_ID, jobContextWrapper.getTargetSublist().toArray())); } }
/** * This method apply {@link AttributePredicate}s according to the parameters contained into the {@link JobContextWrapper#getTargetSublist()}. * <p> * If the {@link JobContextWrapper#getTargetSublist()} has one or more {@link org.eclipse.kapua.model.id.KapuaId}s they will be added to the * {@link org.eclipse.kapua.model.query.predicate.AndPredicate} to select only given {@link JobTarget}. * * @param jobContextWrapper The {@link JobContextWrapper} from which extract data * @param andPredicate The {@link org.eclipse.kapua.model.query.predicate.AndPredicate} where to apply {@link org.eclipse.kapua.model.query.predicate.QueryPredicate} * @since 1.0.0 */ protected void targetSublistFiltering(JobContextWrapper jobContextWrapper, AndPredicateImpl andPredicate) { if (!jobContextWrapper.getTargetSublist().isEmpty()) { andPredicate.and(new AttributePredicateImpl<>(JobTargetAttributes.ENTITY_ID, jobContextWrapper.getTargetSublist().toArray())); } }
/** * Check the connection count for a specific reserved user id<br> * <b>Utility method used by the connection logic</b> * * @param scopeId * @param userId * @param count * @throws KapuaException */ protected void checkConnectionCountByReservedUserId(KapuaId scopeId, KapuaId userId, long count) throws KapuaException { // check that no devices have this user as strict user DeviceConnectionOptionQuery query = deviceConnectionOptionFactory.newQuery(scopeId); AndPredicateImpl andPredicate = new AndPredicateImpl(); andPredicate.and(new AttributePredicateImpl<>(DeviceConnectionOptionAttributes.RESERVED_USER_ID, userId)); query.setPredicate(andPredicate); query.setLimit(1); Long connectionCountByReservedUserId = KapuaSecurityUtils.doPrivileged(() -> deviceConnectionOptionService.count(query)); if (connectionCountByReservedUserId != null && connectionCountByReservedUserId > count) { throw new SecurityException("User not authorized!"); // TODO manage the error message. is it better to throw a more specific exception or keep it obfuscated for security reason? } }
.and(new AttributePredicateImpl<>(TriggerAttributes.TRIGGER_PROPERTIES_NAME, "jobId")) .and(new AttributePredicateImpl<>(TriggerAttributes.TRIGGER_PROPERTIES_VALUE, jobId.toCompactId())) .and(new AttributePredicateImpl<>(TriggerAttributes.TRIGGER_PROPERTIES_TYPE, KapuaId.class.getName())); query.setPredicate(andPredicate);
@Override public Map<String, Object> getConfigValues(KapuaId scopeId) throws KapuaException { KapuaLocator locator = KapuaLocator.getInstance(); AuthorizationService authorizationService = locator.getService(AuthorizationService.class); PermissionFactory permissionFactory = locator.getFactory(PermissionFactory.class); authorizationService.checkPermission(permissionFactory.newPermission(domain, Actions.read, scopeId)); AndPredicateImpl predicate = new AndPredicateImpl() .and(new AttributePredicateImpl<>(ServiceConfigAttributes.SERVICE_ID, pid, Operator.EQUAL)) .and(new AttributePredicateImpl<>(KapuaEntityAttributes.SCOPE_ID, scopeId, Operator.EQUAL)); ServiceConfigQueryImpl query = new ServiceConfigQueryImpl(scopeId); query.setPredicate(predicate); ServiceConfigListResult result = entityManagerSession.onResult(em -> ServiceDAO.query(em, ServiceConfig.class, ServiceConfigImpl.class, new ServiceConfigListResultImpl(), query)); Properties properties = null; if (result != null && !result.isEmpty()) { properties = result.getFirstItem().getConfigurations(); } KapuaTocd ocd = getConfigMetadata(scopeId); return toValues(ocd, properties); }
@Override public Map<String, Object> getConfigValues(KapuaId scopeId) throws KapuaException { KapuaLocator locator = KapuaLocator.getInstance(); AuthorizationService authorizationService = locator.getService(AuthorizationService.class); PermissionFactory permissionFactory = locator.getFactory(PermissionFactory.class); authorizationService.checkPermission(permissionFactory.newPermission(domain, Actions.read, scopeId)); AndPredicateImpl predicate = new AndPredicateImpl() .and(new AttributePredicateImpl<>(ServiceConfigAttributes.SERVICE_ID, pid, Operator.EQUAL)) .and(new AttributePredicateImpl<>(KapuaEntityAttributes.SCOPE_ID, scopeId, Operator.EQUAL)); ServiceConfigQueryImpl query = new ServiceConfigQueryImpl(scopeId); query.setPredicate(predicate); ServiceConfigListResult result = entityManagerSession.onResult(em -> ServiceDAO.query(em, ServiceConfig.class, ServiceConfigImpl.class, new ServiceConfigListResultImpl(), query)); Properties properties = null; if (result != null && !result.isEmpty()) { properties = result.getFirstItem().getConfigurations(); } KapuaTocd ocd = getConfigMetadata(scopeId); return toValues(ocd, properties); }