Skip to content

Commit

Permalink
Fix about 70 warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Serega290696 authored and sbeltser committed Oct 4, 2016
1 parent 14bc620 commit 33db477
Show file tree
Hide file tree
Showing 47 changed files with 407 additions and 134 deletions.
Expand Up @@ -77,7 +77,11 @@ public interface EventClassService {
* @param eventClassFamilyVersion the event class family version * @param eventClassFamilyVersion the event class family version
* @param createdUsername the created username * @param createdUsername the created username
*/ */
void addEventClassFamilyVersion(String eventClassFamilyId, EventClassFamilyVersionDto eventClassFamilyVersion, String createdUsername); void addEventClassFamilyVersion(
String eventClassFamilyId,
EventClassFamilyVersionDto eventClassFamilyVersion,
String createdUsername
);


/** /**
* Find event classes by event class family Id and version. * Find event classes by event class family Id and version.
Expand All @@ -87,7 +91,11 @@ public interface EventClassService {
* @param type the type * @param type the type
* @return the list of found event classes * @return the list of found event classes
*/ */
List<EventClassDto> findEventClassesByFamilyIdVersionAndType(String ecfId, int version, EventClassType type); List<EventClassDto> findEventClassesByFamilyIdVersionAndType(
String ecfId,
int version,
EventClassType type
);


/** /**
* Check passed FQNs if they are present in event class family. * Check passed FQNs if they are present in event class family.
Expand All @@ -97,7 +105,10 @@ public interface EventClassService {
* @param fqns list of fqns to check against family fqns * @param fqns list of fqns to check against family fqns
* @return true is fqns are unique * @return true is fqns are unique
*/ */
boolean validateEventClassFamilyFqns(String ecfId, List<String> fqns); boolean validateEventClassFamilyFqns(
String ecfId,
List<String> fqns
);


/** /**
* Find event class family by tenant id and name. * Find event class family by tenant id and name.
Expand All @@ -106,7 +117,10 @@ public interface EventClassService {
* @param name the event class family name * @param name the event class family name
* @return the event class family * @return the event class family
*/ */
EventClassFamilyDto findEventClassFamilyByTenantIdAndName(String tenantId, String name); EventClassFamilyDto findEventClassFamilyByTenantIdAndName(
String tenantId,
String name
);


/** /**
* Find event class by tenant id and fqn. * Find event class by tenant id and fqn.
Expand All @@ -115,7 +129,7 @@ public interface EventClassService {
* @param fqn the event class fqn * @param fqn the event class fqn
* @return the event class * @return the event class
*/ */
List<EventClassDto> findEventClassByTenantIdAndFQN(String tenantId, String fqn); List<EventClassDto> findEventClassByTenantIdAndFqn(String tenantId, String fqn);




/** /**
Expand All @@ -126,7 +140,7 @@ public interface EventClassService {
* @param version the schema version * @param version the schema version
* @return the event class dto * @return the event class dto
*/ */
EventClassDto findEventClassByTenantIdAndFQNAndVersion(String tenantId, String fqn, int version); EventClassDto findEventClassByTenantIdAndFqnAndVersion(String tenantId, String fqn, int version);


/** /**
* Find event class by id. * Find event class by id.
Expand All @@ -143,13 +157,13 @@ public interface EventClassService {
* @param ecfList the list of AefMapInfoDto * @param ecfList the list of AefMapInfoDto
* @return the event class dto * @return the event class dto
*/ */
boolean isValidECFListInSdkProfile(List<AefMapInfoDto> ecfList); boolean isValidEcfListInSdkProfile(List<AefMapInfoDto> ecfList);


/** /**
* Get list of all events class FQNs in event class family. * Get list of all events class FQNs in event class family.
* *
* @param ecfId string of the event class family id * @param ecfId string of the event class family id
* @return list of all FQNs * @return list of all FQNs
*/ */
Set<String> getFqnSetForECF(String ecfId); Set<String> getFqnSetForEcf(String ecfId);
} }
Expand Up @@ -25,7 +25,7 @@
import org.hibernate.criterion.Criterion; import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Restrictions; import org.hibernate.criterion.Restrictions;
import org.kaaproject.kaa.server.common.dao.impl.CtlSchemaMetaInfoDao; import org.kaaproject.kaa.server.common.dao.impl.CtlSchemaMetaInfoDao;
import org.kaaproject.kaa.server.common.dao.model.sql.CTLSchemaMetaInfo; import org.kaaproject.kaa.server.common.dao.model.sql.CtlSchemaMetaInfo;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
Expand All @@ -38,29 +38,29 @@
import java.util.List; import java.util.List;


@Repository @Repository
public class HibernateCtlSchemaMetaInfoDao extends HibernateAbstractDao<CTLSchemaMetaInfo> public class HibernateCtlSchemaMetaInfoDao extends HibernateAbstractDao<CtlSchemaMetaInfo>
implements CtlSchemaMetaInfoDao<CTLSchemaMetaInfo> { implements CtlSchemaMetaInfoDao<CtlSchemaMetaInfo> {


private static final Logger LOG = LoggerFactory.getLogger(HibernateCtlSchemaMetaInfoDao.class); private static final Logger LOG = LoggerFactory.getLogger(HibernateCtlSchemaMetaInfoDao.class);


public HibernateCtlSchemaMetaInfoDao() { public HibernateCtlSchemaMetaInfoDao() {
} }


@Override @Override
protected Class<CTLSchemaMetaInfo> getEntityClass() { protected Class<CtlSchemaMetaInfo> getEntityClass() {
return CTLSchemaMetaInfo.class; return CtlSchemaMetaInfo.class;
} }


@Override @Override
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public CTLSchemaMetaInfo save(CTLSchemaMetaInfo object) { public CtlSchemaMetaInfo save(CtlSchemaMetaInfo object) {
String tenantId = object.getTenant() != null ? object.getTenant().getStringId() : null; String tenantId = object.getTenant() != null ? object.getTenant().getStringId() : null;
String applicationId = object.getApplication() String applicationId = object.getApplication()
!= null ? object.getApplication().getStringId() : null; != null ? object.getApplication().getStringId() : null;
LOG.debug("Try to save or find meta info with fqn [{}], tenantId [{}] and applicationId [{}]", LOG.debug("Try to save or find meta info with fqn [{}], tenantId [{}] and applicationId [{}]",
object.getFqn(), object.getFqn(),
tenantId, applicationId); tenantId, applicationId);
CTLSchemaMetaInfo uniqueMetaInfo = findByFqnTenantIdAndApplicationId( CtlSchemaMetaInfo uniqueMetaInfo = findByFqnTenantIdAndApplicationId(
object.getFqn(), tenantId, applicationId); object.getFqn(), tenantId, applicationId);
if (uniqueMetaInfo == null) { if (uniqueMetaInfo == null) {
uniqueMetaInfo = super.save(object, true); uniqueMetaInfo = super.save(object, true);
Expand Down Expand Up @@ -91,11 +91,11 @@ private Criterion buildSearchCriterion(String fqn, String tenantId, String appli


@Override @Override
@Transactional(propagation = Propagation.REQUIRED) @Transactional(propagation = Propagation.REQUIRED)
public CTLSchemaMetaInfo findByFqnTenantIdAndApplicationId(String fqn, String tenantId, public CtlSchemaMetaInfo findByFqnTenantIdAndApplicationId(String fqn, String tenantId,
String applicationId) { String applicationId) {
LOG.debug("Searching ctl metadata by fqn [{}], tenantId [{}] and applicationId [{}]", LOG.debug("Searching ctl metadata by fqn [{}], tenantId [{}] and applicationId [{}]",
fqn, tenantId, applicationId); fqn, tenantId, applicationId);
CTLSchemaMetaInfo ctlSchemaMetaInfo = findOneByCriterion(buildSearchCriterion( CtlSchemaMetaInfo ctlSchemaMetaInfo = findOneByCriterion(buildSearchCriterion(
fqn, tenantId, applicationId)); fqn, tenantId, applicationId));
if (LOG.isTraceEnabled()) { if (LOG.isTraceEnabled()) {
LOG.trace("[{},{},{}] Search result: {}.", fqn, tenantId, applicationId, ctlSchemaMetaInfo); LOG.trace("[{},{},{}] Search result: {}.", fqn, tenantId, applicationId, ctlSchemaMetaInfo);
Expand All @@ -107,11 +107,11 @@ public CTLSchemaMetaInfo findByFqnTenantIdAndApplicationId(String fqn, String te
} }


@Override @Override
public List<CTLSchemaMetaInfo> findSiblingsByFqnTenantIdAndApplicationId( public List<CtlSchemaMetaInfo> findSiblingsByFqnTenantIdAndApplicationId(
String fqn, String tenantId, String applicationId) { String fqn, String tenantId, String applicationId) {
LOG.debug("Searching siblings of ctl by fqn [{}], tenantId [{}] and applicationId [{}]", LOG.debug("Searching siblings of ctl by fqn [{}], tenantId [{}] and applicationId [{}]",
fqn, tenantId, applicationId); fqn, tenantId, applicationId);
List<CTLSchemaMetaInfo> ctlSchemaMetaInfos; List<CtlSchemaMetaInfo> ctlSchemaMetaInfos;
if (isNotBlank(fqn) && isNotBlank(tenantId) && isNotBlank(applicationId)) { if (isNotBlank(fqn) && isNotBlank(tenantId) && isNotBlank(applicationId)) {
ctlSchemaMetaInfos = findListByCriterion( ctlSchemaMetaInfos = findListByCriterion(
Restrictions.and( Restrictions.and(
Expand Down Expand Up @@ -156,12 +156,12 @@ private Criterion buildExludingSearchCriterion(
} }


@Override @Override
public List<CTLSchemaMetaInfo> findExistingFqns( public List<CtlSchemaMetaInfo> findExistingFqns(
String fqn, String excludingTenantId, String excludingApplicationId) { String fqn, String excludingTenantId, String excludingApplicationId) {
LOG.debug("Searching ctl metadata by fqn [{}], excludingTenantId [{}] " LOG.debug("Searching ctl metadata by fqn [{}], excludingTenantId [{}] "
+ "and excludingApplicationId [{}]", + "and excludingApplicationId [{}]",
fqn, excludingTenantId, excludingApplicationId); fqn, excludingTenantId, excludingApplicationId);
List<CTLSchemaMetaInfo> ctlSchemasMetaInfos = findListByCriterion(buildExludingSearchCriterion( List<CtlSchemaMetaInfo> ctlSchemasMetaInfos = findListByCriterion(buildExludingSearchCriterion(
fqn, excludingTenantId, excludingApplicationId)); fqn, excludingTenantId, excludingApplicationId));
if (LOG.isTraceEnabled()) { if (LOG.isTraceEnabled()) {
LOG.trace("[{},{},{}] Search result: {}.", fqn, excludingTenantId, excludingApplicationId, LOG.trace("[{},{},{}] Search result: {}.", fqn, excludingTenantId, excludingApplicationId,
Expand All @@ -174,11 +174,11 @@ public List<CTLSchemaMetaInfo> findExistingFqns(
} }


@Override @Override
public List<CTLSchemaMetaInfo> findOthersByFqnAndTenantId( public List<CtlSchemaMetaInfo> findOthersByFqnAndTenantId(
String fqn, String tenantId, String excludingId) { String fqn, String tenantId, String excludingId) {
LOG.debug("Searching other ctl schema meta infos by fqn [{}], " LOG.debug("Searching other ctl schema meta infos by fqn [{}], "
+ "tenant id [{}] and excluding id [{}]", fqn, tenantId, excludingId); + "tenant id [{}] and excluding id [{}]", fqn, tenantId, excludingId);
List<CTLSchemaMetaInfo> availableSchemas = findListByCriterion( List<CtlSchemaMetaInfo> availableSchemas = findListByCriterion(
Restrictions.and(Restrictions.ne(ID_PROPERTY, Long.valueOf(excludingId)), Restrictions.and(Restrictions.ne(ID_PROPERTY, Long.valueOf(excludingId)),
Restrictions.eq(CTL_SCHEMA_META_INFO_FQN, fqn), Restrictions.eq(CTL_SCHEMA_META_INFO_FQN, fqn),
Restrictions.or( Restrictions.or(
Expand All @@ -195,9 +195,9 @@ public List<CTLSchemaMetaInfo> findOthersByFqnAndTenantId(
} }


@Override @Override
public CTLSchemaMetaInfo updateScope(CTLSchemaMetaInfo ctlSchemaMetaInfo) { public CtlSchemaMetaInfo updateScope(CtlSchemaMetaInfo ctlSchemaMetaInfo) {
LOG.debug("Updating ctl meta info scope {}", ctlSchemaMetaInfo); LOG.debug("Updating ctl meta info scope {}", ctlSchemaMetaInfo);
CTLSchemaMetaInfo metaInfo = findById(ctlSchemaMetaInfo.getStringId()); CtlSchemaMetaInfo metaInfo = findById(ctlSchemaMetaInfo.getStringId());
if (metaInfo != null) { if (metaInfo != null) {
metaInfo.setTenant(ctlSchemaMetaInfo.getTenant()); metaInfo.setTenant(ctlSchemaMetaInfo.getTenant());
metaInfo.setApplication(ctlSchemaMetaInfo.getApplication()); metaInfo.setApplication(ctlSchemaMetaInfo.getApplication());
Expand Down
Expand Up @@ -55,7 +55,8 @@
@Entity @Entity
@Table(name = ABSTRACT_STRUCTURE_TABLE_NAME) @Table(name = ABSTRACT_STRUCTURE_TABLE_NAME)
@Inheritance(strategy = InheritanceType.JOINED) @Inheritance(strategy = InheritanceType.JOINED)
public abstract class AbstractStructure<T extends AbstractStructureDto> extends GenericModel<T> implements Serializable { public abstract class AbstractStructure<T extends AbstractStructureDto>
extends GenericModel<T> implements Serializable {


private static final long serialVersionUID = 5871567091169424733L; private static final long serialVersionUID = 5871567091169424733L;


Expand Down Expand Up @@ -117,6 +118,11 @@ public AbstractStructure(Long id) {
this.id = id; this.id = id;
} }


/**
* Create new instace of <code>AbstractStructure</code>.
* @param dto data transfer object contain data that
* assign on fields of new instance
*/
public AbstractStructure(AbstractStructureDto dto) { public AbstractStructure(AbstractStructureDto dto) {
if (dto != null) { if (dto != null) {
this.id = getLongId(dto); this.id = getLongId(dto);
Expand Down
Expand Up @@ -39,7 +39,7 @@


@Entity @Entity
@Table(name = APPLICATION_TABLE_NAME, uniqueConstraints = { @Table(name = APPLICATION_TABLE_NAME, uniqueConstraints = {
@UniqueConstraint(columnNames = {APPLICATION_TENANT_ID, APPLICATION_NAME})}) @UniqueConstraint(columnNames = {APPLICATION_TENANT_ID, APPLICATION_NAME})})
public class Application extends GenericModel<ApplicationDto> implements Serializable { public class Application extends GenericModel<ApplicationDto> implements Serializable {


private static final long serialVersionUID = 3402917989585810543L; private static final long serialVersionUID = 3402917989585810543L;
Expand Down Expand Up @@ -68,6 +68,11 @@ public Application(Long id) {
this.id = id; this.id = id;
} }


/**
* Create new instance of <code>Application</code>.
* @param dto data transfer object contain data that
* assign on fields of new instance
*/
public Application(ApplicationDto dto) { public Application(ApplicationDto dto) {
if (dto != null) { if (dto != null) {
this.id = getLongId(dto); this.id = getLongId(dto);
Expand Down Expand Up @@ -128,8 +133,12 @@ public int incrementSequenceNumber() {


@Override @Override
public String toString() { public String toString() {
return "Application [id=" + id + ", applicationToken=" + applicationToken + ", name=" + name + ", sequenceNumber=" + sequenceNumber return "Application [id=" + id
+ ", tenant=" + tenant + ", credentialsServiceName=" + credentialsServiceName + "]"; + ", applicationToken=" + applicationToken
+ ", name=" + name
+ ", sequenceNumber=" + sequenceNumber
+ ", tenant=" + tenant
+ ", credentialsServiceName=" + credentialsServiceName + "]";
} }


@Override @Override
Expand Down
Expand Up @@ -63,7 +63,7 @@ public class CtlSchema extends GenericModel<CTLSchemaDto> implements Serializabl
@ManyToOne(optional = true, fetch = FetchType.EAGER) @ManyToOne(optional = true, fetch = FetchType.EAGER)
@JoinColumn(nullable = false, name = CTL_SCHEMA_META_INFO_ID, @JoinColumn(nullable = false, name = CTL_SCHEMA_META_INFO_ID,
foreignKey = @ForeignKey(name = CTL_SCHEMA_META_INFO_FK)) foreignKey = @ForeignKey(name = CTL_SCHEMA_META_INFO_FK))
private CTLSchemaMetaInfo metaInfo; private CtlSchemaMetaInfo metaInfo;
@Column(name = CTL_SCHEMA_VERSION) @Column(name = CTL_SCHEMA_VERSION)
private Integer version; private Integer version;
@Lob @Lob
Expand Down Expand Up @@ -94,7 +94,7 @@ public CtlSchema(Long id) {


public CtlSchema(CTLSchemaDto dto) { public CtlSchema(CTLSchemaDto dto) {
this.id = getLongId(dto.getId()); this.id = getLongId(dto.getId());
this.metaInfo = new CTLSchemaMetaInfo(dto.getMetaInfo()); this.metaInfo = new CtlSchemaMetaInfo(dto.getMetaInfo());
this.version = dto.getVersion(); this.version = dto.getVersion();
this.createdUsername = dto.getCreatedUsername(); this.createdUsername = dto.getCreatedUsername();
this.createdTime = dto.getCreatedTime(); this.createdTime = dto.getCreatedTime();
Expand All @@ -112,11 +112,11 @@ public void update(CTLSchemaDto dto) {
} }
} }


public CTLSchemaMetaInfo getMetaInfo() { public CtlSchemaMetaInfo getMetaInfo() {
return metaInfo; return metaInfo;
} }


public void setMetaInfo(CTLSchemaMetaInfo metaInfo) { public void setMetaInfo(CtlSchemaMetaInfo metaInfo) {
this.metaInfo = metaInfo; this.metaInfo = metaInfo;
} }


Expand Down

0 comments on commit 33db477

Please sign in to comment.