Browse Source
* Version set to 3.3.0-SNAPSHOT * added resource dao * added resource support in transport lvl (get resources and "update", "delete" notifications) * refactoring * added resource table to hsql schema * added check for models dir in InstallScripts * added pageLink support to getResourcespull/4232/head
committed by
GitHub
29 changed files with 801 additions and 9 deletions
@ -0,0 +1,90 @@ |
|||
/** |
|||
* Copyright © 2016-2021 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.controller; |
|||
|
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.PathVariable; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RequestParam; |
|||
import org.springframework.web.bind.annotation.ResponseBody; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import org.thingsboard.server.common.data.exception.ThingsboardException; |
|||
import org.thingsboard.server.common.data.id.TenantId; |
|||
import org.thingsboard.server.common.data.page.PageData; |
|||
import org.thingsboard.server.common.data.page.PageLink; |
|||
import org.thingsboard.server.common.data.transport.resource.Resource; |
|||
import org.thingsboard.server.common.data.transport.resource.ResourceType; |
|||
import org.thingsboard.server.dao.resource.ResourceService; |
|||
import org.thingsboard.server.queue.util.TbCoreComponent; |
|||
|
|||
@Slf4j |
|||
@RestController |
|||
@TbCoreComponent |
|||
@RequestMapping("/api") |
|||
public class ResourceController extends BaseController { |
|||
|
|||
private final ResourceService resourceService; |
|||
|
|||
public ResourceController(ResourceService resourceService) { |
|||
this.resourceService = resourceService; |
|||
} |
|||
|
|||
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") |
|||
@RequestMapping(value = "/resource", method = RequestMethod.POST) |
|||
@ResponseBody |
|||
public Resource saveResource(Resource resource) throws ThingsboardException { |
|||
try { |
|||
resource.setTenantId(getTenantId()); |
|||
Resource savedResource = checkNotNull(resourceService.saveResource(resource)); |
|||
tbClusterService.onResourceChange(savedResource, null); |
|||
return savedResource; |
|||
} catch (Exception e) { |
|||
throw handleException(e); |
|||
} |
|||
} |
|||
|
|||
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") |
|||
@RequestMapping(value = "/resource", method = RequestMethod.GET) |
|||
@ResponseBody |
|||
public PageData<Resource> getResources(@RequestParam(required = false) boolean system, |
|||
@RequestParam int pageSize, |
|||
@RequestParam int page, |
|||
@RequestParam(required = false) String sortProperty, |
|||
@RequestParam(required = false) String sortOrder) throws ThingsboardException { |
|||
try { |
|||
PageLink pageLink = createPageLink(pageSize, page, null, sortProperty, sortOrder); |
|||
return checkNotNull(resourceService.findResourcesByTenantId(system ? TenantId.SYS_TENANT_ID : getTenantId(), pageLink)); |
|||
} catch (Exception e) { |
|||
throw handleException(e); |
|||
} |
|||
} |
|||
|
|||
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") |
|||
@RequestMapping(value = "/resource/{resourceType}/{resourceId}", method = RequestMethod.DELETE) |
|||
@ResponseBody |
|||
public void deleteResource(@PathVariable("resourceType") ResourceType resourceType, |
|||
@PathVariable("resourceId") String resourceId) throws ThingsboardException { |
|||
try { |
|||
Resource resource = checkNotNull(resourceService.getResource(getTenantId(), resourceType, resourceId)); |
|||
resourceService.deleteResource(getTenantId(), resourceType, resourceId); |
|||
tbClusterService.onResourceDeleted(resource, null); |
|||
} catch (Exception e) { |
|||
throw handleException(e); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
/** |
|||
* Copyright © 2016-2021 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.dao.resource; |
|||
|
|||
import org.thingsboard.server.common.data.id.TenantId; |
|||
import org.thingsboard.server.common.data.page.PageData; |
|||
import org.thingsboard.server.common.data.page.PageLink; |
|||
import org.thingsboard.server.common.data.transport.resource.Resource; |
|||
import org.thingsboard.server.common.data.transport.resource.ResourceType; |
|||
|
|||
|
|||
public interface ResourceService { |
|||
Resource saveResource(Resource resource); |
|||
|
|||
Resource getResource(TenantId tenantId, ResourceType resourceType, String resourceId); |
|||
|
|||
PageData<Resource> findResourcesByTenantId(TenantId tenantId, PageLink pageLink); |
|||
|
|||
void deleteResource(TenantId tenantId, ResourceType resourceType, String resourceId); |
|||
|
|||
void deleteResourcesByTenantId(TenantId tenantId); |
|||
} |
|||
@ -0,0 +1,37 @@ |
|||
/** |
|||
* Copyright © 2016-2021 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.common.data.transport.resource; |
|||
|
|||
import lombok.Data; |
|||
import org.thingsboard.server.common.data.HasTenantId; |
|||
import org.thingsboard.server.common.data.id.TenantId; |
|||
|
|||
@Data |
|||
public class Resource implements HasTenantId { |
|||
private TenantId tenantId; |
|||
private ResourceType resourceType; |
|||
private String resourceId; |
|||
private String value; |
|||
|
|||
@Override |
|||
public String toString() { |
|||
return "Resource{" + |
|||
"tenantId=" + tenantId + |
|||
", resourceType=" + resourceType + |
|||
", resourceId='" + resourceId + '\'' + |
|||
'}'; |
|||
} |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
/** |
|||
* Copyright © 2016-2021 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.common.data.transport.resource; |
|||
|
|||
public enum ResourceType { |
|||
LWM2M_MODEL, JKS, PKCS_12 |
|||
} |
|||
@ -0,0 +1,45 @@ |
|||
/** |
|||
* Copyright © 2016-2021 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.dao.model.sql; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
import org.thingsboard.server.common.data.relation.EntityRelation; |
|||
import org.thingsboard.server.common.data.transport.resource.Resource; |
|||
|
|||
import javax.persistence.Transient; |
|||
import java.io.Serializable; |
|||
import java.util.UUID; |
|||
|
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
@Data |
|||
public class ResourceCompositeKey implements Serializable { |
|||
|
|||
@Transient |
|||
private static final long serialVersionUID = -3789469030818742769L; |
|||
|
|||
private UUID tenantId; |
|||
private String resourceType; |
|||
private String resourceId; |
|||
|
|||
public ResourceCompositeKey(Resource resource) { |
|||
this.tenantId = resource.getTenantId().getId(); |
|||
this.resourceType = resource.getResourceType().name(); |
|||
this.resourceId = resource.getResourceId(); |
|||
} |
|||
} |
|||
@ -0,0 +1,77 @@ |
|||
/** |
|||
* Copyright © 2016-2021 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.dao.model.sql; |
|||
|
|||
import lombok.Data; |
|||
import org.thingsboard.server.common.data.id.TenantId; |
|||
import org.thingsboard.server.common.data.transport.resource.Resource; |
|||
import org.thingsboard.server.common.data.transport.resource.ResourceType; |
|||
import org.thingsboard.server.dao.model.ToData; |
|||
|
|||
import javax.persistence.Column; |
|||
import javax.persistence.Entity; |
|||
import javax.persistence.Id; |
|||
import javax.persistence.IdClass; |
|||
import javax.persistence.Table; |
|||
import java.util.UUID; |
|||
|
|||
import static org.thingsboard.server.dao.model.ModelConstants.RESOURCE_ID_COLUMN; |
|||
import static org.thingsboard.server.dao.model.ModelConstants.RESOURCE_TABLE_NAME; |
|||
import static org.thingsboard.server.dao.model.ModelConstants.RESOURCE_TENANT_ID_COLUMN; |
|||
import static org.thingsboard.server.dao.model.ModelConstants.RESOURCE_TYPE_COLUMN; |
|||
import static org.thingsboard.server.dao.model.ModelConstants.RESOURCE_VALUE_COLUMN; |
|||
|
|||
@Data |
|||
@Entity |
|||
@Table(name = RESOURCE_TABLE_NAME) |
|||
@IdClass(ResourceCompositeKey.class) |
|||
public class ResourceEntity implements ToData<Resource> { |
|||
|
|||
@Id |
|||
@Column(name = RESOURCE_TENANT_ID_COLUMN, columnDefinition = "uuid") |
|||
private UUID tenantId; |
|||
|
|||
@Id |
|||
@Column(name = RESOURCE_TYPE_COLUMN) |
|||
private String resourceType; |
|||
|
|||
@Id |
|||
@Column(name = RESOURCE_ID_COLUMN) |
|||
private String resourceId; |
|||
|
|||
@Column(name = RESOURCE_VALUE_COLUMN) |
|||
private String value; |
|||
|
|||
public ResourceEntity() { |
|||
} |
|||
|
|||
public ResourceEntity(Resource resource) { |
|||
this.tenantId = resource.getTenantId().getId(); |
|||
this.resourceType = resource.getResourceType().name(); |
|||
this.resourceId = resource.getResourceId(); |
|||
this.value = resource.getValue(); |
|||
} |
|||
|
|||
@Override |
|||
public Resource toData() { |
|||
Resource resource = new Resource(); |
|||
resource.setTenantId(new TenantId(tenantId)); |
|||
resource.setResourceType(ResourceType.valueOf(resourceType)); |
|||
resource.setResourceId(resourceId); |
|||
resource.setValue(value); |
|||
return resource; |
|||
} |
|||
} |
|||
@ -0,0 +1,96 @@ |
|||
/** |
|||
* Copyright © 2016-2021 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.dao.resource; |
|||
|
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import org.thingsboard.server.common.data.id.TenantId; |
|||
import org.thingsboard.server.common.data.page.PageData; |
|||
import org.thingsboard.server.common.data.page.PageLink; |
|||
import org.thingsboard.server.common.data.transport.resource.Resource; |
|||
import org.thingsboard.server.common.data.transport.resource.ResourceType; |
|||
import org.thingsboard.server.dao.exception.DataValidationException; |
|||
|
|||
import static org.thingsboard.server.dao.device.DeviceServiceImpl.INCORRECT_TENANT_ID; |
|||
import static org.thingsboard.server.dao.service.Validator.validateId; |
|||
|
|||
@Service |
|||
@Slf4j |
|||
public class BaseResourceService implements ResourceService { |
|||
|
|||
private final ResourceDao resourceDao; |
|||
|
|||
public BaseResourceService(ResourceDao resourceDao) { |
|||
this.resourceDao = resourceDao; |
|||
} |
|||
|
|||
@Override |
|||
public Resource saveResource(Resource resource) { |
|||
log.trace("Executing saveResource [{}]", resource); |
|||
validate(resource); |
|||
return resourceDao.saveResource(resource); |
|||
} |
|||
|
|||
@Override |
|||
public Resource getResource(TenantId tenantId, ResourceType resourceType, String resourceId) { |
|||
log.trace("Executing getResource [{}] [{}] [{}]", tenantId, resourceType, resourceId); |
|||
validate(tenantId, resourceType, resourceId); |
|||
return resourceDao.getResource(tenantId, resourceType, resourceId); |
|||
} |
|||
|
|||
@Override |
|||
public void deleteResource(TenantId tenantId, ResourceType resourceType, String resourceId) { |
|||
log.trace("Executing deleteResource [{}] [{}] [{}]", tenantId, resourceType, resourceId); |
|||
validate(tenantId, resourceType, resourceId); |
|||
resourceDao.deleteResource(tenantId, resourceType, resourceId); |
|||
} |
|||
|
|||
@Override |
|||
public PageData<Resource> findResourcesByTenantId(TenantId tenantId, PageLink pageLink) { |
|||
log.trace("Executing findByTenantId [{}]", tenantId); |
|||
validateId(tenantId, INCORRECT_TENANT_ID + tenantId); |
|||
return resourceDao.findAllByTenantId(tenantId, pageLink); |
|||
} |
|||
|
|||
@Override |
|||
public void deleteResourcesByTenantId(TenantId tenantId) { |
|||
log.trace("Executing deleteDevicesByTenantId, tenantId [{}]", tenantId); |
|||
validateId(tenantId, INCORRECT_TENANT_ID + tenantId); |
|||
resourceDao.removeAllByTenantId(tenantId); |
|||
} |
|||
|
|||
protected void validate(Resource resource) { |
|||
if (resource == null) { |
|||
throw new DataValidationException("Resource should be specified!"); |
|||
} |
|||
|
|||
if (resource.getValue() == null) { |
|||
throw new DataValidationException("Resource value should be specified!"); |
|||
} |
|||
validate(resource.getTenantId(), resource.getResourceType(), resource.getResourceId()); |
|||
} |
|||
|
|||
protected void validate(TenantId tenantId, ResourceType resourceType, String resourceId) { |
|||
if (resourceType == null) { |
|||
throw new DataValidationException("Resource type should be specified!"); |
|||
} |
|||
if (resourceId == null) { |
|||
throw new DataValidationException("Resource id should be specified!"); |
|||
} |
|||
validateId(tenantId, "Incorrect tenantId "); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
/** |
|||
* Copyright © 2016-2021 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.dao.resource; |
|||
|
|||
import org.thingsboard.server.common.data.id.TenantId; |
|||
import org.thingsboard.server.common.data.page.PageData; |
|||
import org.thingsboard.server.common.data.page.PageLink; |
|||
import org.thingsboard.server.common.data.transport.resource.Resource; |
|||
import org.thingsboard.server.common.data.transport.resource.ResourceType; |
|||
|
|||
public interface ResourceDao { |
|||
|
|||
Resource saveResource(Resource resource); |
|||
|
|||
Resource getResource(TenantId tenantId, ResourceType resourceType, String resourceId); |
|||
|
|||
void deleteResource(TenantId tenantId, ResourceType resourceType, String resourceId); |
|||
|
|||
PageData<Resource> findAllByTenantId(TenantId tenantId, PageLink pageLink); |
|||
|
|||
void removeAllByTenantId(TenantId tenantId); |
|||
} |
|||
@ -0,0 +1,77 @@ |
|||
/** |
|||
* Copyright © 2016-2021 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.dao.sql.resource; |
|||
|
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.thingsboard.server.common.data.id.TenantId; |
|||
import org.thingsboard.server.common.data.page.PageData; |
|||
import org.thingsboard.server.common.data.page.PageLink; |
|||
import org.thingsboard.server.common.data.transport.resource.Resource; |
|||
import org.thingsboard.server.common.data.transport.resource.ResourceType; |
|||
import org.thingsboard.server.dao.DaoUtil; |
|||
import org.thingsboard.server.dao.model.sql.ResourceCompositeKey; |
|||
import org.thingsboard.server.dao.model.sql.ResourceEntity; |
|||
import org.thingsboard.server.dao.resource.ResourceDao; |
|||
|
|||
@Slf4j |
|||
@Component |
|||
public class ResourceDaoImpl implements ResourceDao { |
|||
|
|||
private final ResourceRepository resourceRepository; |
|||
|
|||
public ResourceDaoImpl(ResourceRepository resourceRepository) { |
|||
this.resourceRepository = resourceRepository; |
|||
} |
|||
|
|||
@Override |
|||
@Transactional |
|||
public Resource saveResource(Resource resource) { |
|||
return DaoUtil.getData(resourceRepository.save(new ResourceEntity(resource))); |
|||
} |
|||
|
|||
@Override |
|||
public Resource getResource(TenantId tenantId, ResourceType resourceType, String resourceId) { |
|||
ResourceCompositeKey key = new ResourceCompositeKey(); |
|||
key.setTenantId(tenantId.getId()); |
|||
key.setResourceType(resourceType.name()); |
|||
key.setResourceId(resourceId); |
|||
|
|||
return DaoUtil.getData(resourceRepository.findById(key)); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional |
|||
public void deleteResource(TenantId tenantId, ResourceType resourceType, String resourceId) { |
|||
ResourceCompositeKey key = new ResourceCompositeKey(); |
|||
key.setTenantId(tenantId.getId()); |
|||
key.setResourceType(resourceType.name()); |
|||
key.setResourceId(resourceId); |
|||
|
|||
resourceRepository.deleteById(key); |
|||
} |
|||
|
|||
@Override |
|||
public PageData<Resource> findAllByTenantId(TenantId tenantId, PageLink pageLink) { |
|||
return DaoUtil.toPageData(resourceRepository.findAllByTenantId(tenantId.getId(), DaoUtil.toPageable(pageLink))); |
|||
} |
|||
|
|||
@Override |
|||
public void removeAllByTenantId(TenantId tenantId) { |
|||
resourceRepository.removeAllByTenantId(tenantId.getId()); |
|||
} |
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
/** |
|||
* Copyright © 2016-2021 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.dao.sql.resource; |
|||
|
|||
import org.springframework.data.domain.Page; |
|||
import org.springframework.data.domain.Pageable; |
|||
import org.springframework.data.repository.CrudRepository; |
|||
import org.thingsboard.server.dao.model.sql.ResourceCompositeKey; |
|||
import org.thingsboard.server.dao.model.sql.ResourceEntity; |
|||
|
|||
import java.util.UUID; |
|||
|
|||
public interface ResourceRepository extends CrudRepository<ResourceEntity, ResourceCompositeKey> { |
|||
|
|||
Page<ResourceEntity> findAllByTenantId(UUID tenantId, Pageable pageable); |
|||
|
|||
void removeAllByTenantId(UUID tenantId); |
|||
} |
|||
Loading…
Reference in new issue