code: private static OptionalEntity<AccessToken> getEntity(final CreateForm form, final String username, final long currentTime) {
          switch (form.crudMode) {
          case CrudMode.CREATE:
              return OptionalEntity.of(new AccessToken()).map(entity -> {
                  entity.setCreatedBy(username);
                  entity.setCreatedTime(currentTime);
                  return entity;
              });
          case CrudMode.EDIT:
              if (form instanceof EditForm) {
                  return ComponentUtil.getComponent(AccessTokenService.class).getAccessToken(((EditForm) form).id);
              }
              break;
          default:
              break;
          }
          return OptionalEntity.empty();
      }
docs: ============