30 changed files with 386 additions and 542 deletions
@ -1,92 +0,0 @@ |
|||
/** |
|||
* Copyright © 2016-2017 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.asset; |
|||
|
|||
import org.thingsboard.server.common.data.UUIDConverter; |
|||
import org.thingsboard.server.common.data.id.TenantId; |
|||
|
|||
import java.util.UUID; |
|||
|
|||
public class TenantAssetType { |
|||
|
|||
private static final long serialVersionUID = 8057290243855622101L; |
|||
|
|||
private String type; |
|||
private TenantId tenantId; |
|||
|
|||
public TenantAssetType() { |
|||
super(); |
|||
} |
|||
|
|||
public TenantAssetType(String type, TenantId tenantId) { |
|||
this.type = type; |
|||
this.tenantId = tenantId; |
|||
} |
|||
|
|||
public TenantAssetType(String type, UUID tenantId) { |
|||
this.type = type; |
|||
this.tenantId = new TenantId(tenantId); |
|||
} |
|||
|
|||
public TenantAssetType(String type, String tenantId) { |
|||
this.type = type; |
|||
this.tenantId = new TenantId(UUIDConverter.fromString(tenantId)); |
|||
} |
|||
|
|||
public String getType() { |
|||
return type; |
|||
} |
|||
|
|||
public void setType(String type) { |
|||
this.type = type; |
|||
} |
|||
|
|||
public TenantId getTenantId() { |
|||
return tenantId; |
|||
} |
|||
|
|||
public void setTenantId(TenantId tenantId) { |
|||
this.tenantId = tenantId; |
|||
} |
|||
|
|||
@Override |
|||
public int hashCode() { |
|||
int result = type != null ? type.hashCode() : 0; |
|||
result = 31 * result + (tenantId != null ? tenantId.hashCode() : 0); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
public boolean equals(Object o) { |
|||
if (this == o) return true; |
|||
if (o == null || getClass() != o.getClass()) return false; |
|||
|
|||
TenantAssetType that = (TenantAssetType) o; |
|||
|
|||
if (type != null ? !type.equals(that.type) : that.type != null) return false; |
|||
return tenantId != null ? tenantId.equals(that.tenantId) : that.tenantId == null; |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
final StringBuilder sb = new StringBuilder("TenantAssetType{"); |
|||
sb.append("type='").append(type).append('\''); |
|||
sb.append(", tenantId=").append(tenantId); |
|||
sb.append('}'); |
|||
return sb.toString(); |
|||
} |
|||
} |
|||
@ -0,0 +1,123 @@ |
|||
/** |
|||
* Copyright © 2016-2017 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; |
|||
|
|||
import com.datastax.driver.mapping.annotations.Column; |
|||
import com.datastax.driver.mapping.annotations.PartitionKey; |
|||
import com.datastax.driver.mapping.annotations.Table; |
|||
import com.datastax.driver.mapping.annotations.Transient; |
|||
import org.thingsboard.server.common.data.EntitySubtype; |
|||
import org.thingsboard.server.common.data.EntityType; |
|||
import org.thingsboard.server.common.data.id.TenantId; |
|||
import org.thingsboard.server.dao.model.type.EntityTypeCodec; |
|||
|
|||
import java.util.UUID; |
|||
|
|||
import static org.thingsboard.server.dao.model.ModelConstants.*; |
|||
|
|||
@Table(name = ENTITY_SUBTYPE_COLUMN_FAMILY_NAME) |
|||
public class EntitySubtypeEntity { |
|||
|
|||
@Transient |
|||
private static final long serialVersionUID = -1268181961886910152L; |
|||
|
|||
@PartitionKey(value = 0) |
|||
@Column(name = ENTITY_SUBTYPE_TENANT_ID_PROPERTY) |
|||
private UUID tenantId; |
|||
|
|||
@PartitionKey(value = 1) |
|||
@Column(name = ENTITY_SUBTYPE_ENTITY_TYPE_PROPERTY, codec = EntityTypeCodec.class) |
|||
private EntityType entityType; |
|||
|
|||
@PartitionKey(value = 2) |
|||
@Column(name = ENTITY_SUBTYPE_TYPE_PROPERTY) |
|||
private String type; |
|||
|
|||
public EntitySubtypeEntity() { |
|||
super(); |
|||
} |
|||
|
|||
public EntitySubtypeEntity(EntitySubtype entitySubtype) { |
|||
this.tenantId = entitySubtype.getTenantId().getId(); |
|||
this.entityType = entitySubtype.getEntityType(); |
|||
this.type = entitySubtype.getType(); |
|||
} |
|||
|
|||
public UUID getTenantId() { |
|||
return tenantId; |
|||
} |
|||
|
|||
public void setTenantId(UUID tenantId) { |
|||
this.tenantId = tenantId; |
|||
} |
|||
|
|||
public EntityType getEntityType() { |
|||
return entityType; |
|||
} |
|||
|
|||
public void setEntityType(EntityType entityType) { |
|||
this.entityType = entityType; |
|||
} |
|||
|
|||
public String getType() { |
|||
return type; |
|||
} |
|||
|
|||
public void setType(String type) { |
|||
this.type = type; |
|||
} |
|||
|
|||
|
|||
@Override |
|||
public boolean equals(Object o) { |
|||
if (this == o) return true; |
|||
if (o == null || getClass() != o.getClass()) return false; |
|||
|
|||
EntitySubtypeEntity that = (EntitySubtypeEntity) o; |
|||
|
|||
if (tenantId != null ? !tenantId.equals(that.tenantId) : that.tenantId != null) return false; |
|||
if (entityType != that.entityType) return false; |
|||
return type != null ? type.equals(that.type) : that.type == null; |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public int hashCode() { |
|||
int result = tenantId != null ? tenantId.hashCode() : 0; |
|||
result = 31 * result + (entityType != null ? entityType.hashCode() : 0); |
|||
result = 31 * result + (type != null ? type.hashCode() : 0); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
final StringBuilder sb = new StringBuilder("EntitySubtypeEntity{"); |
|||
sb.append("tenantId=").append(tenantId); |
|||
sb.append(", entityType=").append(entityType); |
|||
sb.append(", type='").append(type).append('\''); |
|||
sb.append('}'); |
|||
return sb.toString(); |
|||
} |
|||
|
|||
public EntitySubtype toEntitySubtype() { |
|||
EntitySubtype entitySubtype = new EntitySubtype(); |
|||
entitySubtype.setTenantId(new TenantId(tenantId)); |
|||
entitySubtype.setEntityType(entityType); |
|||
entitySubtype.setType(type); |
|||
return entitySubtype; |
|||
} |
|||
} |
|||
@ -1,107 +0,0 @@ |
|||
/** |
|||
* Copyright © 2016-2017 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; |
|||
|
|||
import com.datastax.driver.mapping.annotations.Column; |
|||
import com.datastax.driver.mapping.annotations.PartitionKey; |
|||
import com.datastax.driver.mapping.annotations.Table; |
|||
import com.datastax.driver.mapping.annotations.Transient; |
|||
import org.thingsboard.server.common.data.asset.TenantAssetType; |
|||
import org.thingsboard.server.common.data.id.TenantId; |
|||
|
|||
import java.util.UUID; |
|||
|
|||
import static org.thingsboard.server.dao.model.ModelConstants.*; |
|||
|
|||
@Table(name = ASSET_TYPES_BY_TENANT_VIEW_NAME) |
|||
public class TenantAssetTypeEntity { |
|||
|
|||
@Transient |
|||
private static final long serialVersionUID = -1268181161886910152L; |
|||
|
|||
@PartitionKey(value = 0) |
|||
@Column(name = ASSET_TYPE_PROPERTY) |
|||
private String type; |
|||
|
|||
@PartitionKey(value = 1) |
|||
@Column(name = ASSET_TENANT_ID_PROPERTY) |
|||
private UUID tenantId; |
|||
|
|||
public TenantAssetTypeEntity() { |
|||
super(); |
|||
} |
|||
|
|||
public TenantAssetTypeEntity(TenantAssetType tenantAssetType) { |
|||
this.type = tenantAssetType.getType(); |
|||
if (tenantAssetType.getTenantId() != null) { |
|||
this.tenantId = tenantAssetType.getTenantId().getId(); |
|||
} |
|||
} |
|||
|
|||
public String getType() { |
|||
return type; |
|||
} |
|||
|
|||
public void setType(String type) { |
|||
this.type = type; |
|||
} |
|||
|
|||
public UUID getTenantId() { |
|||
return tenantId; |
|||
} |
|||
|
|||
public void setTenantId(UUID tenantId) { |
|||
this.tenantId = tenantId; |
|||
} |
|||
|
|||
@Override |
|||
public int hashCode() { |
|||
int result = type != null ? type.hashCode() : 0; |
|||
result = 31 * result + (tenantId != null ? tenantId.hashCode() : 0); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
public boolean equals(Object o) { |
|||
if (this == o) return true; |
|||
if (o == null || getClass() != o.getClass()) return false; |
|||
|
|||
TenantAssetTypeEntity that = (TenantAssetTypeEntity) o; |
|||
|
|||
if (type != null ? !type.equals(that.type) : that.type != null) return false; |
|||
return tenantId != null ? tenantId.equals(that.tenantId) : that.tenantId == null; |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
final StringBuilder sb = new StringBuilder("TenantAssetTypeEntity{"); |
|||
sb.append("type='").append(type).append('\''); |
|||
sb.append(", tenantId=").append(tenantId); |
|||
sb.append('}'); |
|||
return sb.toString(); |
|||
} |
|||
|
|||
public TenantAssetType toTenantAssetType() { |
|||
TenantAssetType tenantAssetType = new TenantAssetType(); |
|||
tenantAssetType.setType(type); |
|||
if (tenantId != null) { |
|||
tenantAssetType.setTenantId(new TenantId(tenantId)); |
|||
} |
|||
return tenantAssetType; |
|||
} |
|||
} |
|||
@ -1,107 +0,0 @@ |
|||
/** |
|||
* Copyright © 2016-2017 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; |
|||
|
|||
import com.datastax.driver.mapping.annotations.Column; |
|||
import com.datastax.driver.mapping.annotations.PartitionKey; |
|||
import com.datastax.driver.mapping.annotations.Table; |
|||
import com.datastax.driver.mapping.annotations.Transient; |
|||
import org.thingsboard.server.common.data.TenantDeviceType; |
|||
import org.thingsboard.server.common.data.id.TenantId; |
|||
|
|||
import java.util.UUID; |
|||
|
|||
import static org.thingsboard.server.dao.model.ModelConstants.*; |
|||
|
|||
@Table(name = DEVICE_TYPES_BY_TENANT_VIEW_NAME) |
|||
public class TenantDeviceTypeEntity { |
|||
|
|||
@Transient |
|||
private static final long serialVersionUID = -1268181166886910152L; |
|||
|
|||
@PartitionKey(value = 0) |
|||
@Column(name = DEVICE_TYPE_PROPERTY) |
|||
private String type; |
|||
|
|||
@PartitionKey(value = 1) |
|||
@Column(name = DEVICE_TENANT_ID_PROPERTY) |
|||
private UUID tenantId; |
|||
|
|||
public TenantDeviceTypeEntity() { |
|||
super(); |
|||
} |
|||
|
|||
public TenantDeviceTypeEntity(TenantDeviceType tenantDeviceType) { |
|||
this.type = tenantDeviceType.getType(); |
|||
if (tenantDeviceType.getTenantId() != null) { |
|||
this.tenantId = tenantDeviceType.getTenantId().getId(); |
|||
} |
|||
} |
|||
|
|||
public String getType() { |
|||
return type; |
|||
} |
|||
|
|||
public void setType(String type) { |
|||
this.type = type; |
|||
} |
|||
|
|||
public UUID getTenantId() { |
|||
return tenantId; |
|||
} |
|||
|
|||
public void setTenantId(UUID tenantId) { |
|||
this.tenantId = tenantId; |
|||
} |
|||
|
|||
@Override |
|||
public int hashCode() { |
|||
int result = type != null ? type.hashCode() : 0; |
|||
result = 31 * result + (tenantId != null ? tenantId.hashCode() : 0); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
public boolean equals(Object o) { |
|||
if (this == o) return true; |
|||
if (o == null || getClass() != o.getClass()) return false; |
|||
|
|||
TenantDeviceTypeEntity that = (TenantDeviceTypeEntity) o; |
|||
|
|||
if (type != null ? !type.equals(that.type) : that.type != null) return false; |
|||
return tenantId != null ? tenantId.equals(that.tenantId) : that.tenantId == null; |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
final StringBuilder sb = new StringBuilder("TenantDeviceTypeEntity{"); |
|||
sb.append("type='").append(type).append('\''); |
|||
sb.append(", tenantId=").append(tenantId); |
|||
sb.append('}'); |
|||
return sb.toString(); |
|||
} |
|||
|
|||
public TenantDeviceType toTenantDeviceType() { |
|||
TenantDeviceType tenantDeviceType = new TenantDeviceType(); |
|||
tenantDeviceType.setType(type); |
|||
if (tenantId != null) { |
|||
tenantDeviceType.setTenantId(new TenantId(tenantId)); |
|||
} |
|||
return tenantDeviceType; |
|||
} |
|||
} |
|||
@ -1,26 +0,0 @@ |
|||
/** |
|||
* Copyright © 2016-2017 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; |
|||
|
|||
@AllArgsConstructor |
|||
@Data |
|||
public class TenantDeviceTypeEntity { |
|||
private String tenantId; |
|||
private String type; |
|||
} |
|||
Loading…
Reference in new issue