Skip to content

Commit

Permalink
Merge pull request #574 from hashmapinc/Tempus-545
Browse files Browse the repository at this point in the history
Tempus 545
  • Loading branch information
Himanshu-it authored Jul 18, 2018
2 parents 8636820 + 4b0ce3d commit 7fdcb6a
Show file tree
Hide file tree
Showing 70 changed files with 596 additions and 762 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ public boolean equals(Object obj) {
if (getClass() != obj.getClass())
return false;
BaseData other = (BaseData) obj;
if (createdTime != other.createdTime)
return false;
return true;
return (createdTime == other.createdTime);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ public class CacheConstants {
public static final String DEVICE_CREDENTIALS_CACHE = "deviceCredentials";
public static final String RELATIONS_CACHE = "relations";
public static final String DEVICE_CACHE = "devices";

private CacheConstants(){}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class DashboardInfo extends SearchTextBased<DashboardId> implements HasNa

private TenantId tenantId;
private String title;
private Set<ShortCustomerInfo> assignedCustomers;
private transient Set<ShortCustomerInfo> assignedCustomers;

public DashboardInfo() {
super();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

public class DataConstants {

private DataConstants(){}

public static final String SYSTEM = "SYSTEM";
public static final String TENANT = "TENANT";
public static final String CUSTOMER = "CUSTOMER";
Expand Down Expand Up @@ -47,4 +49,5 @@ public static final String[] allScopes() {
public static final String CUSTOMER_USER_DEFAULT_ASSET_UPDATE_PERMISSION = Authority.CUSTOMER_USER.name() + ":" + EntityType.ASSET.name() + ":UPDATE";
public static final String CUSTOMER_USER_DEFAULT_DEVICE_READ_PERMISSION = Authority.CUSTOMER_USER.name() + ":" + EntityType.DEVICE.name() + ":READ";
public static final String CUSTOMER_USER_DEFAULT_DEVICE_UPDATE_PERMISSION = Authority.CUSTOMER_USER.name() + ":" + EntityType.DEVICE.name() + ":UPDATE";

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
*/

package com.hashmapinc.server.common.data;
import com.hashmapinc.server.common.data.BaseData;

import com.hashmapinc.server.common.data.id.LogoId;
import lombok.EqualsAndHashCode;


@EqualsAndHashCode(callSuper = true)
public class Logo extends BaseData<LogoId> {

private boolean display;
Expand All @@ -42,7 +42,6 @@ public Logo(Logo logo) {
this.name = logo.name;
}


public boolean isDisplay() {
return display;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
*/

package com.hashmapinc.server.common.data;
import com.hashmapinc.server.common.data.BaseData;

import com.hashmapinc.server.common.data.id.ThemeId;
import lombok.EqualsAndHashCode;


@EqualsAndHashCode(callSuper = true)
public class Theme extends BaseData<ThemeId> {

private String name;
private String value;
private boolean is_enabled;
private boolean isEnabled;

public Theme() {
super();
Expand All @@ -38,7 +38,7 @@ public Theme(Theme theme) {
super(theme);
this.name = theme.name;
this.value = theme.value;
this.is_enabled = theme.is_enabled;
this.isEnabled = theme.isEnabled;
}


Expand All @@ -60,19 +60,19 @@ public void setThemeValue(String value) {
}

public boolean getThemeStatus() {
return is_enabled;
return isEnabled;
}

public void setThemeStatus(boolean is_enabled) {
this.is_enabled = is_enabled;
public void setThemeStatus(boolean isEnabled) {
this.isEnabled = isEnabled;
}

@Override
public String toString() {
return "theme{" +
"name=" + name +
", value=" + value +
", is_enabled=" + is_enabled +
", is_enabled=" + isEnabled +
'}';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package com.hashmapinc.server.common.data;

import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
Expand All @@ -24,6 +25,8 @@
*/
public class UUIDConverter {

private UUIDConverter() {}

public static UUID fromString(String src) {
return UUID.fromString(src.substring(7, 15) + "-" + src.substring(3, 7) + "-1"
+ src.substring(0, 3) + "-" + src.substring(15, 19) + "-" + src.substring(19));
Expand All @@ -40,7 +43,7 @@ public static String fromTimeUUID(UUID src) {

public static List<String> fromTimeUUIDs(List<UUID> uuids) {
if (uuids == null) {
return null;
return Collections.emptyList();
}
return uuids.stream().map(UUIDConverter::fromTimeUUID).collect(Collectors.toList());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class User extends SearchTextBasedWithAdditionalInfo<UserId> implements H
private CustomerId customerId;
private String email;
private Authority authority;
private Collection<String> permissions = Collections.EMPTY_LIST;
private Collection<String> permissions = Collections.emptyList();
private String firstName;
private String lastName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;

Expand Down Expand Up @@ -57,17 +56,14 @@ private void parseExpression() {
if(expressionTokens[1].trim().equals("*"))
this.resources = Arrays.asList(EntityType.values());
else {
ArrayList<EntityType> resources = new ArrayList<>();
resources.add(new EnumUtil<>(EntityType.class).parse(expressionTokens[1]));
this.resources = resources;
this.resources = Arrays.asList(new EnumUtil<>(EntityType.class).parse(expressionTokens[1]));
}

if(expressionTokens[2].trim().equals("*"))
this.userActions = Arrays.asList(UserAction.values());
else {
ArrayList<UserAction> userActions = new ArrayList<>();
userActions.add(new EnumUtil<>(UserAction.class).parse(expressionTokens[2]));
this.userActions = userActions;
this.userActions = Arrays.asList(new EnumUtil<>(UserAction.class).parse(expressionTokens[2]));
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class AuditLog extends BaseData<AuditLogId> {
private UserId userId;
private String userName;
private ActionType actionType;
private JsonNode actionData;
private transient JsonNode actionData;
private ActionStatus actionStatus;
private String actionFailureDetails;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,5 @@
package com.hashmapinc.server.common.data.cluster;

public enum NodeStatus {
UP("UP"),
DOWN("DOWN");

private String nodeStatus;

public String getNodeStatus() {
return this.nodeStatus;
}

public void setNodeStatus(String nodeStatus) {
this.nodeStatus = nodeStatus;
}

private NodeStatus(String nodeStatus) {
this.nodeStatus = nodeStatus;
}
UP, DOWN
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class ComputationJob extends SearchTextBased<ComputationJobId> implements

private TenantId tenantId;
private ComputationId computationId;
private JsonNode argParameters;
private transient JsonNode argParameters;
private String name;
private ComponentLifecycleState state;
private String jobId;
Expand Down Expand Up @@ -61,8 +61,7 @@ public boolean equals(Object o) {
if (computationId != null ? !computationId.equals(that.computationId) : that.computationId != null) return false;
if (tenantId != null ? !tenantId.equals(that.tenantId) : that.tenantId != null) return false;
if (name != null ? !name.equals(that.name) : that.name != null) return false;
if (jobId != null ? !jobId.equals(that.jobId) : that.jobId != null) return false;
return true;
return (jobId != null ? jobId.equals(that.jobId) : that.jobId == null);
}

@Override
Expand Down Expand Up @@ -127,6 +126,6 @@ public String getName() {
}
@Override
public String getSearchText() {
return name;
return getName();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class Computations extends SearchTextBased<ComputationId> implements HasN
private TenantId tenantId;
private String jarName;
private String mainClass;
private JsonNode jsonDescriptor;
private transient JsonNode jsonDescriptor;
private String argsformat;
private String argsType;

Expand Down Expand Up @@ -58,16 +58,19 @@ public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;

Computations that = (Computations) o;
return checkObjEquality((Computations) o);
}

private boolean checkObjEquality(Computations o) {
Computations that = o;
if (name != null ? !name.equals(that.name) : that.name != null) return false;
if (jarPath != null ? !jarPath.equals(that.jarPath) : that.jarPath != null) return false;
if (jarName != null ? !jarName.equals(that.jarName) : that.jarName != null) return false;
if (tenantId != null ? !tenantId.equals(that.tenantId) : that.tenantId != null) return false;
if (argsformat != null ? !argsformat.equals(that.argsformat) : that.argsformat != null) return false;
if (jsonDescriptor != null ? !jsonDescriptor.equals(that.jsonDescriptor) : that.jsonDescriptor != null) return false;
if (mainClass != null ? !mainClass.equals(that.mainClass) : that.mainClass != null) return false;
if (argsType != null ? !argsType.equals(that.argsType) : that.argsType != null) return false;
return true;
return (argsType != null ? argsType.equals(that.argsType) : that.argsType == null);
}

@Override
Expand Down Expand Up @@ -151,6 +154,6 @@ public String getName() {
}
@Override
public String getSearchText() {
return name;
return getName();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public boolean equals(Object o) {
if (dataModelObjectId != null ? !dataModelObjectId.equals(that.dataModelObjectId) : that.dataModelObjectId != null) return false;
if (source != null ? !source.equals(that.source) : that.source != null) return false;
if (value != null ? !value.equals(that.value) : that.value != null) return false;
if (valueType != null ? !valueType.equals(that.valueType) : that.valueType != null) return false;
return true;
return (valueType != null ? valueType.equals(that.valueType) : that.valueType == null);

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@

public class DataModelObject extends SearchTextBased<DataModelObjectId> implements HasName {
private String name;
private JsonNode decription;
private transient JsonNode description;
private DataModelId dataModelId;
private String type;
private DataModelObjectId parentId;
private CustomerId customerId;
private List<AttributeDefinition> attributeDefinitions = new ArrayList<AttributeDefinition>();
private List<AttributeDefinition> attributeDefinitions = new ArrayList<>();

public DataModelObject() {
super();
Expand All @@ -43,7 +43,7 @@ public DataModelObject(DataModelObjectId id) {
public DataModelObject(DataModelObject dataModelObject) {
super(dataModelObject);
this.name = dataModelObject.name;
this.decription = dataModelObject.decription;
this.description = dataModelObject.description;
this.dataModelId = dataModelObject.dataModelId;
this.type = dataModelObject.type;
this.parentId = dataModelObject.parentId;
Expand All @@ -57,22 +57,25 @@ public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;

DataModelObject that = (DataModelObject) o;
if (name != null ? !name.equals(that.name) : that.name != null) return false;
if (decription != null ? !decription.equals(that.decription) : that.decription != null) return false;
if (dataModelId != null ? !dataModelId.equals(that.dataModelId) : that.dataModelId != null) return false;
if (type != null ? !type.equals(that.type) : that.type != null) return false;
if (parentId != null ? !parentId.equals(that.parentId) : that.parentId != null) return false;
if (customerId != null ? !customerId.equals(that.customerId) : that.customerId != null) return false;
if (attributeDefinitions != null ? !attributeDefinitions.equals(that.attributeDefinitions) : that.attributeDefinitions != null) return false;
return true;
return checkObjEquality((DataModelObject) o);
}

private boolean checkObjEquality(DataModelObject o) {
DataModelObject that = o;
if (name != null ? !name.equals(that.name) : that.name != null) return false;
if (description != null ? !description.equals(that.description) : that.description != null) return false;
if (dataModelId != null ? !dataModelId.equals(that.dataModelId) : that.dataModelId != null) return false;
if (type != null ? !type.equals(that.type) : that.type != null) return false;
if (parentId != null ? !parentId.equals(that.parentId) : that.parentId != null) return false;
if (customerId != null ? !customerId.equals(that.customerId) : that.customerId != null) return false;
return (attributeDefinitions != null ? attributeDefinitions.equals(that.attributeDefinitions) : that.attributeDefinitions == null);
}

@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (decription != null ? decription.hashCode() : 0);
result = 31 * result + (description != null ? description.hashCode() : 0);
result = 31 * result + (dataModelId != null ? dataModelId.hashCode() : 0);
result = 31 * result + (type != null ? type.hashCode() : 0);
result = 31 * result + (parentId != null ? parentId.hashCode() : 0);
Expand All @@ -85,12 +88,12 @@ public void setName(String name) {
this.name = name;
}

public JsonNode getDecription() {
return decription;
public JsonNode getDescription() {
return description;
}

public void setDecription(JsonNode decription) {
this.decription = decription;
public void setDescription(JsonNode description) {
this.description = description;
}

public DataModelId getDataModelId() {
Expand Down Expand Up @@ -140,7 +143,7 @@ public String getName() {

@Override
public String getSearchText() {
return name;
return getName();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package com.hashmapinc.server.common.data.id;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.ObjectCodec;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
Expand All @@ -30,7 +29,7 @@
public class EntityIdDeserializer extends JsonDeserializer<EntityId> {

@Override
public EntityId deserialize(JsonParser jsonParser, DeserializationContext ctx) throws IOException, JsonProcessingException {
public EntityId deserialize(JsonParser jsonParser, DeserializationContext ctx) throws IOException {
ObjectCodec oc = jsonParser.getCodec();
ObjectNode node = oc.readTree(jsonParser);
if (node.has("entityType") && node.has("id")) {
Expand Down
Loading

0 comments on commit 7fdcb6a

Please sign in to comment.