use of teammates.storage.entity.Account in project teammates by TEAMMATES.
the class AccountAttributesTest method testValueOf.
@Test
public void testValueOf() {
Account genericAccount = new Account("id", "Joe", true, "joe@example.com", "Teammates Institute");
AccountAttributes observedAccountAttributes = AccountAttributes.valueOf(genericAccount);
assertEquals(genericAccount.getGoogleId(), observedAccountAttributes.getGoogleId());
assertEquals(genericAccount.getName(), observedAccountAttributes.getName());
assertEquals(genericAccount.isInstructor(), observedAccountAttributes.isInstructor());
assertEquals(genericAccount.getEmail(), observedAccountAttributes.getEmail());
assertEquals(genericAccount.getInstitute(), observedAccountAttributes.getInstitute());
assertEquals(genericAccount.getCreatedAt(), observedAccountAttributes.createdAt);
assertEquals(genericAccount.getStudentProfile(), observedAccountAttributes.studentProfile);
}
use of teammates.storage.entity.Account in project teammates by TEAMMATES.
the class AccountsDb method deleteAccount.
/**
* Note: This is a non-cascade delete. <br>
* <br> Fails silently if there is no such account.
* <br> Preconditions:
* <br> * {@code googleId} is not null.
*/
public void deleteAccount(String googleId) {
Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, googleId);
Account accountToDelete = getAccountEntity(googleId, true);
if (accountToDelete == null) {
return;
}
StudentProfile studentProfile = accountToDelete.getStudentProfile();
if (studentProfile != null) {
BlobKey pictureKey = studentProfile.getPictureKey();
if (!pictureKey.getKeyString().isEmpty()) {
deletePicture(pictureKey);
}
profilesDb.deleteEntityDirect(studentProfile);
}
deleteEntityDirect(accountToDelete);
}
use of teammates.storage.entity.Account in project teammates by TEAMMATES.
the class AccountsDb method getAccountEntity.
private Account getAccountEntity(String googleId, boolean retrieveStudentProfile) {
Account account = load().id(googleId).now();
if (account == null) {
return null;
}
account.setIsStudentProfileEnabled(retrieveStudentProfile);
return account;
}
Aggregations