Skip to content

Commit

Permalink
add AppUserReference to allow storing simple copyed version of appUser
Browse files Browse the repository at this point in the history
  • Loading branch information
melistik committed Jul 10, 2018
1 parent b58f820 commit b2b4d6c
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,20 @@ protected void checkKeyValue(String key, String value) {
Assert.hasLength(value, "Value must not be empty");
Assert.state(value.length() <= 4000, "Value is too long - at least 4000 chars");
}

/**
* convert current instance to a simple reference copy
*
* @return fresh created reference based on this {@link AppUser}
*/
public AppUserReference toReference() {
return AppUserReference.builder()
.id(getId())
.username(getUsername())
.firstName(getFirstName())
.lastName(getLastName())
.email(getEmail())
.avatar(getAvatar())
.build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package io.rocketbase.commons.model;

import lombok.*;

import java.io.Serializable;

/**
* simplified {@link AppUser} without keyValues pairs, password etc...<br>
* used to store a simple representation as a copy of {@link AppUser}
*/
@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AppUserReference implements Serializable {

private String id;

private String username;

private String firstName;

private String lastName;

private String email;

private String avatar;
}

0 comments on commit b2b4d6c

Please sign in to comment.