Merge branch 'master' of github.com:thingsboard/thingsboard

This commit is contained in:
Andrew Shvayka 2019-11-27 08:32:20 +02:00
commit f75dc9aff1
5 changed files with 33 additions and 11 deletions

View File

@ -33,9 +33,7 @@ import javax.persistence.PersistenceContext;
import javax.persistence.Query;
@Slf4j
@SqlDao
@Repository
public abstract class AbstractComponentDescriptorInsertRepository {
public abstract class AbstractComponentDescriptorInsertRepository implements ComponentDescriptorInsertRepository {
@PersistenceContext
protected EntityManager entityManager;
@ -43,8 +41,6 @@ public abstract class AbstractComponentDescriptorInsertRepository {
@Autowired
protected PlatformTransactionManager transactionManager;
public abstract ComponentDescriptorEntity saveOrUpdate(ComponentDescriptorEntity entity);
protected ComponentDescriptorEntity saveAndGet(ComponentDescriptorEntity entity, String insertOrUpdateOnPrimaryKeyConflict, String insertOrUpdateOnUniqueKeyConflict) {
ComponentDescriptorEntity componentDescriptorEntity = null;
TransactionStatus insertTransaction = getTransactionStatus(TransactionDefinition.PROPAGATION_REQUIRED);

View File

@ -0,0 +1,24 @@
/**
* Copyright © 2016-2019 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.component;
import org.thingsboard.server.dao.model.sql.ComponentDescriptorEntity;
public interface ComponentDescriptorInsertRepository {
ComponentDescriptorEntity saveOrUpdate(ComponentDescriptorEntity entity);
}

View File

@ -19,9 +19,10 @@ import org.springframework.stereotype.Repository;
import org.thingsboard.server.common.data.UUIDConverter;
import org.thingsboard.server.dao.model.sql.ComponentDescriptorEntity;
import org.thingsboard.server.dao.util.HsqlDao;
import org.thingsboard.server.dao.util.SqlDao;
import org.thingsboard.server.dao.util.SqlTsDao;
@SqlTsDao
@SqlDao
@HsqlDao
@Repository
public class HsqlComponentDescriptorInsertRepository extends AbstractComponentDescriptorInsertRepository {

View File

@ -52,7 +52,7 @@ public class JpaBaseComponentDescriptorDao extends JpaAbstractSearchTextDao<Comp
private ComponentDescriptorRepository componentDescriptorRepository;
@Autowired
private AbstractComponentDescriptorInsertRepository componentDescriptorInsertRepository;
private ComponentDescriptorInsertRepository componentDescriptorInsertRepository;
@Override
protected Class<ComponentDescriptorEntity> getEntityClass() {

View File

@ -18,9 +18,10 @@ package org.thingsboard.server.dao.sql.component;
import org.springframework.stereotype.Repository;
import org.thingsboard.server.dao.model.sql.ComponentDescriptorEntity;
import org.thingsboard.server.dao.util.PsqlDao;
import org.thingsboard.server.dao.util.SqlDao;
import org.thingsboard.server.dao.util.SqlTsDao;
@SqlTsDao
@SqlDao
@PsqlDao
@Repository
public class PsqlComponentDescriptorInsertRepository extends AbstractComponentDescriptorInsertRepository {