Skip to content

Commit

Permalink
Fix NeedBraces
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill380 committed Sep 27, 2016
1 parent f864c0a commit 58729e8
Show file tree
Hide file tree
Showing 9 changed files with 128 additions and 60 deletions.
Expand Up @@ -45,8 +45,9 @@ public class TopicListHashCalculator {
* @return the integer * @return the integer
*/ */
public static Integer calculateTopicListHash(List<Topic> topics) { public static Integer calculateTopicListHash(List<Topic> topics) {
if (topics == null) if (topics == null) {
return NULL_LIST_HASH; return NULL_LIST_HASH;
}


int result = EMPTRY_LIST_HASH; int result = EMPTRY_LIST_HASH;
if (!topics.isEmpty()) { if (!topics.isEmpty()) {
Expand Down
Expand Up @@ -122,7 +122,11 @@ private static JsonNode injectUuidsFromJsonNodes(JsonNode json, Schema schema) {
.filter(f -> !f.name().equals(UUID_FIELD)) .filter(f -> !f.name().equals(UUID_FIELD))
.forEach(f -> injectUuidsFromJsonNodes(json.get(f.name()), f.schema())); .forEach(f -> injectUuidsFromJsonNodes(json.get(f.name()), f.schema()));


boolean addressable = schema.getFields().stream().filter(f -> f.name().equals(UUID_FIELD)).findFirst().isPresent(); boolean addressable = schema.getFields().stream()
.filter(f -> f.name().equals(UUID_FIELD))
.findFirst()
.isPresent();

if (addressable) { if (addressable) {
((ObjectNode) json).put(UUID_FIELD, (Integer) null); ((ObjectNode) json).put(UUID_FIELD, (Integer) null);
} }
Expand Down Expand Up @@ -151,8 +155,10 @@ public static void removeUuids(JsonNode json) {
} }


for (JsonNode node : json) { for (JsonNode node : json) {
if (node.isContainerNode()) if (node.isContainerNode()) {
removeUuids(node); removeUuids(node);
}
} }
} }

} }
Expand Up @@ -203,45 +203,61 @@ public int hashCode() {


@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) if (this == obj) {
return true; return true;
if (obj == null) }
if (obj == null) {
return false; return false;
if (getClass() != obj.getClass()) }
if (getClass() != obj.getClass()) {
return false; return false;
}
CTLSchema other = (CTLSchema) obj; CTLSchema other = (CTLSchema) obj;
if (body == null) { if (body == null) {
if (other.body != null) if (other.body != null) {
return false; return false;
} else if (!body.equals(other.body)) }
} else if (!body.equals(other.body)) {
return false; return false;
if (createdTime != other.createdTime) }
if (createdTime != other.createdTime) {
return false; return false;
}
if (createdUsername == null) { if (createdUsername == null) {
if (other.createdUsername != null) if (other.createdUsername != null) {
return false; return false;
} else if (!createdUsername.equals(other.createdUsername)) }
} else if (!createdUsername.equals(other.createdUsername)) {
return false; return false;
}
if (defaultRecord == null) { if (defaultRecord == null) {
if (other.defaultRecord != null) if (other.defaultRecord != null) {
return false; return false;
} else if (!defaultRecord.equals(other.defaultRecord)) }
} else if (!defaultRecord.equals(other.defaultRecord)) {
return false; return false;
}
if (dependencySet == null) { if (dependencySet == null) {
if (other.dependencySet != null) if (other.dependencySet != null) {
return false; return false;
} else if (!dependencySet.equals(other.dependencySet)) }
} else if (!dependencySet.equals(other.dependencySet)) {
return false; return false;
}
if (metaInfo == null) { if (metaInfo == null) {
if (other.metaInfo != null) if (other.metaInfo != null) {
return false; return false;
} else if (!metaInfo.equals(other.metaInfo)) }
} else if (!metaInfo.equals(other.metaInfo)) {
return false; return false;
}
if (version == null) { if (version == null) {
if (other.version != null) if (other.version != null) {
return false; return false;
} else if (!version.equals(other.version)) }
} else if (!version.equals(other.version)) {
return false; return false;
}
return true; return true;
} }


Expand Down
Expand Up @@ -152,28 +152,37 @@ public int hashCode() {


@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) if (this == obj) {
return true; return true;
if (obj == null) }
if (obj == null) {
return false; return false;
if (getClass() != obj.getClass()) }
if (getClass() != obj.getClass()) {
return false; return false;
}
CTLSchemaMetaInfo other = (CTLSchemaMetaInfo) obj; CTLSchemaMetaInfo other = (CTLSchemaMetaInfo) obj;
if (application == null) { if (application == null) {
if (other.application != null) if (other.application != null) {
return false; return false;
} else if (!application.equals(other.application)) }
} else if (!application.equals(other.application)) {
return false; return false;
}
if (fqn == null) { if (fqn == null) {
if (other.fqn != null) if (other.fqn != null) {
return false; return false;
} else if (!fqn.equals(other.fqn)) }
} else if (!fqn.equals(other.fqn)) {
return false; return false;
}
if (tenant == null) { if (tenant == null) {
if (other.tenant != null) if (other.tenant != null) {
return false; return false;
} else if (!tenant.equals(other.tenant)) }
} else if (!tenant.equals(other.tenant)) {
return false; return false;
}
return true; return true;
} }


Expand Down
Expand Up @@ -204,11 +204,14 @@ private void setBackreference(List<EventClassFamilyVersion> ecfvList) {
ecfvList.forEach(ecfv -> ecfv.getRecords().forEach(ec -> ec.setEcfv(ecfv))); ecfvList.forEach(ecfv -> ecfv.getRecords().forEach(ec -> ec.setEcfv(ecfv)));
} }



@Override @Override
public boolean validateEventClassFamilyFqns(String eventClassFamilyId, List<String> fqns) { public boolean validateEventClassFamilyFqns(String eventClassFamilyId, List<String> fqns) {
Set<String> storedFQNs = getFqnSetForECF(eventClassFamilyId); Set<String> storedFQNs = getFqnSetForECF(eventClassFamilyId);
for (String fqn : fqns) { for (String fqn : fqns) {
if (storedFQNs.contains(fqn)) return false; if (storedFQNs.contains(fqn)) {
return false;
}
} }
return true; return true;
} }
Expand Down Expand Up @@ -278,7 +281,9 @@ public boolean isValidECFListInSdkProfile(List<AefMapInfoDto> aefList) {
.findFirst(); .findFirst();
if (optEcfv.isPresent()) { if (optEcfv.isPresent()) {
for (EventClass ec : optEcfv.get().getRecords()) { for (EventClass ec : optEcfv.get().getRecords()) {
if (!ecList.add(ec)) return false; if (!ecList.add(ec)) {
return false;
}
} }
} }
} }
Expand All @@ -291,7 +296,8 @@ public Set<String> getFqnSetForECF(String ecfId) {
LOG.debug("Get fqn list for event class family by id [{}] ", ecfId); LOG.debug("Get fqn list for event class family by id [{}] ", ecfId);
Set<String> storedFQNs = new HashSet<>(); Set<String> storedFQNs = new HashSet<>();
EventClassFamily ecf = eventClassFamilyDao.findById(ecfId); EventClassFamily ecf = eventClassFamilyDao.findById(ecfId);
ecf.getSchemas().forEach(ecfv -> ecfv.getRecords().forEach(ec -> storedFQNs.add(ec.getFqn()))); ecf.getSchemas()
.forEach(ecfv -> ecfv.getRecords().forEach(ec -> storedFQNs.add(ec.getFqn())));
return storedFQNs; return storedFQNs;
} else { } else {
throw new IncorrectParameterException("Incorrect event class family id: " + ecfId); throw new IncorrectParameterException("Incorrect event class family id: " + ecfId);
Expand Down
Expand Up @@ -67,13 +67,21 @@ public void setMail(String mail) {


@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) {
if (o == null || getClass() != o.getClass()) return false; return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}


UserProfileUpdateDto that = (UserProfileUpdateDto) o; UserProfileUpdateDto that = (UserProfileUpdateDto) o;


if (!firstName.equals(that.firstName)) return false; if (!firstName.equals(that.firstName)) {
if (!lastName.equals(that.lastName)) return false; return false;
}
if (!lastName.equals(that.lastName)) {
return false;
}
return mail.equals(that.mail); return mail.equals(that.mail);


} }
Expand All @@ -88,10 +96,11 @@ public int hashCode() {


@Override @Override
public String toString() { public String toString() {
return "UserProfileUpdateDto{" + final StringBuilder sb = new StringBuilder("UserProfileUpdateDto{");
"firstName='" + firstName + '\'' + sb.append("firstName='").append(firstName).append('\'');
", lastName='" + lastName + '\'' + sb.append(", lastName='").append(lastName).append('\'');
", mail='" + mail + '\'' + sb.append(", mail='").append(mail).append('\'');
'}'; sb.append('}');
return sb.toString();
} }
} }
Expand Up @@ -120,37 +120,48 @@ public int hashCode() {


@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) if (this == obj) {
return true; return true;
if (obj == null) }
if (obj == null) {
return false; return false;
if (getClass() != obj.getClass()) }
if (getClass() != obj.getClass()) {
return false; return false;
}
CTLSchemaDto other = (CTLSchemaDto) obj; CTLSchemaDto other = (CTLSchemaDto) obj;


if (id == null) { if (id == null) {
if (other.id != null) if (other.id != null) {
return false; return false;
} else if (!id.equals(other.id)) }
} else if (!id.equals(other.id)) {
return false; return false;
}


if (dependencySet == null) { if (dependencySet == null) {
if (other.dependencySet != null) if (other.dependencySet != null) {
return false; return false;
} else if (!dependencySet.equals(other.dependencySet)) }
} else if (!dependencySet.equals(other.dependencySet)) {
return false; return false;
}


if (metaInfo == null) { if (metaInfo == null) {
if (other.metaInfo != null) if (other.metaInfo != null) {
return false; return false;
} else if (!metaInfo.equals(other.metaInfo)) }
} else if (!metaInfo.equals(other.metaInfo)) {
return false; return false;
}


if (version == null) { if (version == null) {
if (other.version != null) if (other.version != null) {
return false; return false;
} else if (!version.equals(other.version)) }
} else if (!version.equals(other.version)) {
return false; return false;
}


return true; return true;
} }
Expand Down
Expand Up @@ -117,28 +117,37 @@ public int hashCode() {


@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) if (this == obj) {
return true; return true;
if (obj == null) }
if (obj == null) {
return false; return false;
if (getClass() != obj.getClass()) }
if (getClass() != obj.getClass()) {
return false; return false;
}
CTLSchemaMetaInfoDto other = (CTLSchemaMetaInfoDto) obj; CTLSchemaMetaInfoDto other = (CTLSchemaMetaInfoDto) obj;
if (applicationId == null) { if (applicationId == null) {
if (other.applicationId != null) if (other.applicationId != null) {
return false; return false;
} else if (!applicationId.equals(other.applicationId)) }
} else if (!applicationId.equals(other.applicationId)) {
return false; return false;
}
if (fqn == null) { if (fqn == null) {
if (other.fqn != null) if (other.fqn != null) {
return false; return false;
} else if (!fqn.equals(other.fqn)) }
} else if (!fqn.equals(other.fqn)) {
return false; return false;
}
if (tenantId == null) { if (tenantId == null) {
if (other.tenantId != null) if (other.tenantId != null) {
return false; return false;
} else if (!tenantId.equals(other.tenantId)) }
} else if (!tenantId.equals(other.tenantId)) {
return false; return false;
}
return true; return true;
} }


Expand Down
Expand Up @@ -19,6 +19,7 @@
import java.io.Serializable; import java.io.Serializable;


public final class EventClassFamilyVersion implements Serializable { public final class EventClassFamilyVersion implements Serializable {

/** /**
* *
*/ */
Expand Down

0 comments on commit 58729e8

Please sign in to comment.