use of com.hedera.mirror.common.domain.entity.EntityOperation in project hedera-mirror-node by hashgraph.
the class AbstractTransactionHandlerTest method getExpectedEntityWithTimestamp.
protected AbstractEntity getExpectedEntityWithTimestamp() {
AbstractEntity entity = getEntity();
EntityOperation entityOperation = transactionHandler.getType().getEntityOperation();
if (entityOperation == EntityOperation.CREATE) {
entity.setCreatedTimestamp(CREATED_TIMESTAMP_NS);
entity.setDeleted(false);
entity.setTimestampLower(CREATED_TIMESTAMP_NS);
} else if (entityOperation == EntityOperation.UPDATE) {
entity.setDeleted(false);
entity.setTimestampLower(MODIFIED_TIMESTAMP_NS);
} else {
entity.setTimestampLower(MODIFIED_TIMESTAMP_NS);
}
return entity;
}
use of com.hedera.mirror.common.domain.entity.EntityOperation in project hedera-mirror-node by hashgraph.
the class AbstractEntityCrudTransactionHandler method updateEntity.
protected final void updateEntity(EntityId entityId, RecordItem recordItem) {
long consensusTimestamp = recordItem.getConsensusTimestamp();
T entity = entityId.toEntity();
EntityOperation entityOperation = type.getEntityOperation();
if (entityOperation == EntityOperation.CREATE) {
entity.setCreatedTimestamp(consensusTimestamp);
entity.setDeleted(false);
} else if (entityOperation == EntityOperation.UPDATE) {
entity.setDeleted(false);
} else if (entityOperation == EntityOperation.DELETE) {
entity.setDeleted(true);
}
entity.setTimestampLower(consensusTimestamp);
doUpdateEntity(entity, recordItem);
}
use of com.hedera.mirror.common.domain.entity.EntityOperation in project hedera-mirror-node by hashgraph.
the class AbstractEntityCrudTransactionHandler method updateTransaction.
@Override
public final void updateTransaction(Transaction transaction, RecordItem recordItem) {
doUpdateTransaction(transaction, recordItem);
EntityId entityId = transaction.getEntityId();
EntityOperation entityOperation = type.getEntityOperation();
if (entityOperation != EntityOperation.NONE && !EntityId.isEmpty(entityId) && recordItem.isSuccessful()) {
updateEntity(entityId, recordItem);
}
}
Aggregations