Details
diff --git a/util/src/main/java/com/ning/billing/util/tag/dao/TagDefinitionModelDao.java b/util/src/main/java/com/ning/billing/util/tag/dao/TagDefinitionModelDao.java
index c83f06d..e7b341e 100644
--- a/util/src/main/java/com/ning/billing/util/tag/dao/TagDefinitionModelDao.java
+++ b/util/src/main/java/com/ning/billing/util/tag/dao/TagDefinitionModelDao.java
@@ -30,6 +30,7 @@ public class TagDefinitionModelDao extends EntityBase implements EntityModelDao<
private String name;
private String description;
+ private Boolean isActive;
public TagDefinitionModelDao() { /* For the DAO mapper */ }
@@ -37,6 +38,7 @@ public class TagDefinitionModelDao extends EntityBase implements EntityModelDao<
super(id, createdDate, updatedDate);
this.name = name;
this.description = description;
+ this.isActive = true;
}
public TagDefinitionModelDao(final ControlTagType tag) {
@@ -60,12 +62,17 @@ public class TagDefinitionModelDao extends EntityBase implements EntityModelDao<
return description;
}
+ public Boolean getActive() {
+ return isActive;
+ }
+
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("TagDefinitionModelDao");
sb.append("{name='").append(name).append('\'');
sb.append(", description='").append(description).append('\'');
+ sb.append(", isActive=").append(isActive);
sb.append('}');
return sb.toString();
}
@@ -87,6 +94,9 @@ public class TagDefinitionModelDao extends EntityBase implements EntityModelDao<
if (description != null ? !description.equals(that.description) : that.description != null) {
return false;
}
+ if (isActive != null ? !isActive.equals(that.isActive) : that.isActive != null) {
+ return false;
+ }
if (name != null ? !name.equals(that.name) : that.name != null) {
return false;
}
@@ -99,6 +109,7 @@ public class TagDefinitionModelDao extends EntityBase implements EntityModelDao<
int result = super.hashCode();
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (description != null ? description.hashCode() : 0);
+ result = 31 * result + (isActive != null ? isActive.hashCode() : 0);
return result;
}
diff --git a/util/src/main/java/com/ning/billing/util/tag/dao/TagModelDao.java b/util/src/main/java/com/ning/billing/util/tag/dao/TagModelDao.java
index 9f4bc7d..8d381df 100644
--- a/util/src/main/java/com/ning/billing/util/tag/dao/TagModelDao.java
+++ b/util/src/main/java/com/ning/billing/util/tag/dao/TagModelDao.java
@@ -31,6 +31,7 @@ public class TagModelDao extends EntityBase implements EntityModelDao<Tag> {
private UUID tagDefinitionId;
private UUID objectId;
private ObjectType objectType;
+ private Boolean isActive;
public TagModelDao() { /* For the DAO mapper */ }
@@ -45,6 +46,7 @@ public class TagModelDao extends EntityBase implements EntityModelDao<Tag> {
this.tagDefinitionId = tagDefinitionId;
this.objectId = objectId;
this.objectType = objectType;
+ this.isActive = true;
}
public TagModelDao(final Tag tag) {
@@ -63,6 +65,10 @@ public class TagModelDao extends EntityBase implements EntityModelDao<Tag> {
return objectType;
}
+ public Boolean getIsActive() {
+ return isActive;
+ }
+
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
@@ -70,6 +76,7 @@ public class TagModelDao extends EntityBase implements EntityModelDao<Tag> {
sb.append("{tagDefinitionId=").append(tagDefinitionId);
sb.append(", objectId=").append(objectId);
sb.append(", objectType=").append(objectType);
+ sb.append(", isActive=").append(isActive);
sb.append('}');
return sb.toString();
}
@@ -88,6 +95,9 @@ public class TagModelDao extends EntityBase implements EntityModelDao<Tag> {
final TagModelDao that = (TagModelDao) o;
+ if (isActive != null ? !isActive.equals(that.isActive) : that.isActive != null) {
+ return false;
+ }
if (objectId != null ? !objectId.equals(that.objectId) : that.objectId != null) {
return false;
}
@@ -107,6 +117,7 @@ public class TagModelDao extends EntityBase implements EntityModelDao<Tag> {
result = 31 * result + (tagDefinitionId != null ? tagDefinitionId.hashCode() : 0);
result = 31 * result + (objectId != null ? objectId.hashCode() : 0);
result = 31 * result + (objectType != null ? objectType.hashCode() : 0);
+ result = 31 * result + (isActive != null ? isActive.hashCode() : 0);
return result;
}
diff --git a/util/src/main/resources/com/ning/billing/util/tag/dao/TagDefinitionSqlDao.sql.stg b/util/src/main/resources/com/ning/billing/util/tag/dao/TagDefinitionSqlDao.sql.stg
index 6c2b883..2d796c1 100644
--- a/util/src/main/resources/com/ning/billing/util/tag/dao/TagDefinitionSqlDao.sql.stg
+++ b/util/src/main/resources/com/ning/billing/util/tag/dao/TagDefinitionSqlDao.sql.stg
@@ -5,6 +5,7 @@ tableName() ::= "tag_definitions"
tableFields(prefix) ::= <<
<prefix>name
, <prefix>description
+, <prefix>is_active
, <prefix>created_by
, <prefix>created_date
, <prefix>updated_by
@@ -14,6 +15,7 @@ tableFields(prefix) ::= <<
tableValues() ::= <<
:name
, :description
+, :isActive
, :createdBy
, :createdDate
, :updatedBy
@@ -28,7 +30,7 @@ historyTableName() ::= "tag_definition_history"
markTagDefinitionAsDeleted() ::= <<
update <tableName()> t
-set is_active = 0
+set t.is_active = 0
where <idField("t.")> = :id
<AND_CHECK_TENANT("t.")>
;
diff --git a/util/src/main/resources/com/ning/billing/util/tag/dao/TagSqlDao.sql.stg b/util/src/main/resources/com/ning/billing/util/tag/dao/TagSqlDao.sql.stg
index 87d1fe2..410f56b 100644
--- a/util/src/main/resources/com/ning/billing/util/tag/dao/TagSqlDao.sql.stg
+++ b/util/src/main/resources/com/ning/billing/util/tag/dao/TagSqlDao.sql.stg
@@ -6,6 +6,7 @@ tableFields(prefix) ::= <<
<prefix>tag_definition_id
, <prefix>object_id
, <prefix>object_type
+, <prefix>is_active
, <prefix>created_by
, <prefix>created_date
, <prefix>updated_by
@@ -16,6 +17,7 @@ tableValues() ::= <<
:tagDefinitionId
, :objectId
, :objectType
+, :isActive
, :createdBy
, :createdDate
, :updatedBy
@@ -26,7 +28,7 @@ historyTableName() ::= "tag_history"
markTagAsDeleted() ::= <<
update <tableName()> t
-set is_active = 0
+set t.is_active = 0
where <idField("t.")> = :id
<AND_CHECK_TENANT("t.")>
;