コード例 #1
0
 protected boolean hasTtl(AtreusManagedEntity managedEntity) {
   AtreusMetaEntity metaEntity = managedEntity.getMetaEntity();
   AtreusMetaField ttlMetaField = metaEntity.getTtlField();
   if (ttlMetaField != null && managedEntity.getFieldValue(ttlMetaField) != null) {
     return true;
   }
   return false;
 }
コード例 #2
0
 protected void bindPrimaryKey(BoundStatement boundStatement, AtreusManagedEntity managedEntity) {
   AtreusMetaEntity metaEntity = managedEntity.getMetaEntity();
   AtreusMetaField primaryKeyMetaField = metaEntity.getPrimaryKeyField();
   for (AtreusMetaField metaField : iterateMetaSimpleFields(primaryKeyMetaField)) {
     metaField.bindValue(boundStatement, metaField.getValue(managedEntity));
   }
 }
コード例 #3
0
  @SuppressWarnings("unchecked")
  protected void bindTtl(AtreusManagedEntity managedEntity, BoundStatement boundStatement) {
    AtreusMetaEntity metaEntity = managedEntity.getMetaEntity();
    AtreusMetaField ttlMetaField = metaEntity.getTtlField();
    if (ttlMetaField == null) {
      return;
    }
    Object value = managedEntity.getFieldValue(ttlMetaField);
    if (value == null) {
      return;
    }

    Integer ttlValue = metaEntity.getTtlStrategy().translate(new Date(), value);
    if (ttlValue == null || ttlValue < 1) {
      throw new AtreusDataBindingException(
          AtreusDataBindingException.ERROR_CODE_INVALID_TIME_TO_LIVE_VALUE, ttlMetaField, ttlValue);
    }
    ttlMetaField.bindValue(boundStatement, ttlValue);
  }
コード例 #4
0
 protected void bindColumnsAll(BoundStatement boundStatement, AtreusManagedEntity managedEntity) {
   AtreusMetaEntity metaEntity = managedEntity.getMetaEntity();
   for (AtreusMetaField metaField : iterateMetaSimpleFields(metaEntity.getFields())) {
     metaField.bindEntity(boundStatement, managedEntity);
   }
 }