-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
64884db
commit ee8b1b7
Showing
40 changed files
with
558 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 3 additions & 4 deletions
7
.../flashcards/repository/TagRepository.java → ...s/cassandra/repository/TagRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
package org.robbins.flashcards.repository; | ||
package org.robbins.flashcards.cassandra.repository; | ||
|
||
import org.robbins.flashcards.repository.domain.TagCassandra; | ||
import org.springframework.data.cassandra.repository.CassandraRepository; | ||
import org.robbins.flashcards.cassandra.repository.domain.TagCassandraDto; | ||
import org.springframework.data.cassandra.repository.TypedIdCassandraRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.UUID; | ||
|
||
@Repository("tagRepository") | ||
public interface TagRepository extends TypedIdCassandraRepository<TagCassandra, UUID> { | ||
public interface TagRepository extends TypedIdCassandraRepository<TagCassandraDto, UUID> { | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
...y_Cassandra/src/main/java/org/robbins/flashcards/cassandra/repository/UserRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.robbins.flashcards.cassandra.repository; | ||
|
||
import org.robbins.flashcards.cassandra.repository.domain.UserCassandraDto; | ||
import org.springframework.data.cassandra.repository.Query; | ||
import org.springframework.data.cassandra.repository.TypedIdCassandraRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.UUID; | ||
|
||
@Repository("userRepository") | ||
public interface UserRepository extends TypedIdCassandraRepository<UserCassandraDto, UUID> { | ||
|
||
@Query("SELECT * FROM user WHERE openid = ?0") | ||
public UserCassandraDto findUserByOpenid(final String openid); | ||
} |
25 changes: 13 additions & 12 deletions
25
...nversion/impl/DefaultTagDtoConverter.java → ...nversion/impl/DefaultTagDtoConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
.../org/robbins/flashcards/cassandra/repository/conversion/impl/DefaultUserDtoConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package org.robbins.flashcards.cassandra.repository.conversion.impl; | ||
|
||
import org.apache.commons.lang3.NotImplementedException; | ||
import org.robbins.flashcards.cassandra.repository.domain.UserCassandraDto; | ||
import org.robbins.flashcards.conversion.DtoConverter; | ||
import org.robbins.flashcards.dto.UserDto; | ||
import org.robbins.flashcards.exceptions.RepositoryException; | ||
import org.robbins.flashcards.repository.conversion.impl.AbstractDtoConverter; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
@Component("userDtoConverter") | ||
public class DefaultUserDtoConverter extends AbstractDtoConverter implements DtoConverter<UserDto, UserCassandraDto> { | ||
|
||
@Override | ||
public UserDto getDto(final UserCassandraDto entity) throws RepositoryException { | ||
return getMapper().map(entity, UserDto.class); | ||
} | ||
|
||
@Override | ||
public UserDto getDto(final UserCassandraDto entity, final Set<String> fields) | ||
throws RepositoryException | ||
{ | ||
throw new NotImplementedException("method not yet implemented in Cassandra repository"); | ||
} | ||
|
||
@Override | ||
public UserCassandraDto getEntity(final UserDto dto) { | ||
return getMapper().map(dto, UserCassandraDto.class); | ||
} | ||
|
||
@Override | ||
public List<UserDto> getDtos(List<UserCassandraDto> entities) throws RepositoryException { | ||
List<UserDto> dtos = new ArrayList<>(); | ||
for (UserCassandraDto entity : entities) { | ||
dtos.add(getDto(entity)); | ||
} | ||
return dtos; | ||
} | ||
|
||
@Override | ||
public List<UserDto> getDtos(final List<UserCassandraDto> entities, final Set<String> fields) | ||
throws RepositoryException {throw new NotImplementedException("method not yet implemented in Cassandra repository"); | ||
} | ||
|
||
@Override | ||
public List<UserCassandraDto> getEntities(final List<UserDto> dtos) { | ||
List<UserCassandraDto> entities = new ArrayList<>(); | ||
for (UserDto dto : dtos) { | ||
entities.add(getEntity(dto)); | ||
} | ||
return entities; | ||
} | ||
} |
5 changes: 3 additions & 2 deletions
5
...cards/repository/domain/TagCassandra.java → ...ra/repository/domain/TagCassandraDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 110 additions & 0 deletions
110
...ra/src/main/java/org/robbins/flashcards/cassandra/repository/domain/UserCassandraDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
|
||
package org.robbins.flashcards.cassandra.repository.domain; | ||
|
||
import org.springframework.data.cassandra.mapping.PrimaryKey; | ||
import org.springframework.data.cassandra.mapping.Table; | ||
|
||
import java.io.Serializable; | ||
import java.util.Date; | ||
import java.util.UUID; | ||
|
||
@Table(value = "user") | ||
public class UserCassandraDto implements Serializable { | ||
|
||
@PrimaryKey | ||
private UUID id; | ||
|
||
private String openid; | ||
private String firstName; | ||
private String lastName; | ||
private String fullName; | ||
private String email; | ||
private String nickname; | ||
private String country; | ||
private String language; | ||
private Date lastLoginDate; | ||
|
||
public UserCassandraDto() { | ||
} | ||
|
||
public UUID getId() { | ||
return id; | ||
} | ||
|
||
public void setId(UUID id) { | ||
this.id = id; | ||
} | ||
|
||
public String getOpenid() { | ||
return this.openid; | ||
} | ||
|
||
public void setOpenid(final String openid) { | ||
this.openid = openid; | ||
} | ||
|
||
public String getFirstName() { | ||
return this.firstName; | ||
} | ||
|
||
public void setFirstName(final String firstName) { | ||
this.firstName = firstName; | ||
} | ||
|
||
public String getLastName() { | ||
return this.lastName; | ||
} | ||
|
||
public void setLastName(final String lastName) { | ||
this.lastName = lastName; | ||
} | ||
|
||
public String getFullName() { | ||
return this.fullName; | ||
} | ||
|
||
public void setFullName(final String fullName) { | ||
this.fullName = fullName; | ||
} | ||
|
||
public String getEmail() { | ||
return this.email; | ||
} | ||
|
||
public void setEmail(final String email) { | ||
this.email = email; | ||
} | ||
|
||
public String getNickname() { | ||
return this.nickname; | ||
} | ||
|
||
public void setNickname(final String nickname) { | ||
this.nickname = nickname; | ||
} | ||
|
||
public String getCountry() { | ||
return this.country; | ||
} | ||
|
||
public void setCountry(final String country) { | ||
this.country = country; | ||
} | ||
|
||
public String getLanguage() { | ||
return this.language; | ||
} | ||
|
||
public void setLanguage(final String language) { | ||
this.language = language; | ||
} | ||
|
||
public Date getLastLoginDate() { | ||
return null == lastLoginDate ? null : new Date(); | ||
} | ||
|
||
public void setLastLoginDate(final Date lastLoginDate) { | ||
this.lastLoginDate = null == lastLoginDate ? null : lastLoginDate; | ||
} | ||
|
||
} |
93 changes: 93 additions & 0 deletions
93
.../main/java/org/robbins/flashcards/cassandra/repository/facade/DefaultFlashcardFacade.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
|
||
package org.robbins.flashcards.cassandra.repository.facade; | ||
|
||
import org.apache.commons.lang3.NotImplementedException; | ||
import org.robbins.flashcards.dto.FlashCardDto; | ||
import org.robbins.flashcards.dto.TagDto; | ||
import org.robbins.flashcards.exceptions.FlashcardsException; | ||
import org.robbins.flashcards.facade.FlashcardFacade; | ||
import org.springframework.data.domain.PageRequest; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
|
||
@Component("flashcardRepositoryFacade") | ||
public class DefaultFlashcardFacade implements | ||
FlashcardFacade { | ||
|
||
@Override | ||
public List<FlashCardDto> findByTagsIn(final Set<TagDto> tags) throws FlashcardsException { | ||
throw new NotImplementedException("method not yet implemented in Cassandra repository"); | ||
} | ||
|
||
@Override | ||
public List<FlashCardDto> findByTagsIn(final Set<TagDto> tags, final PageRequest page) throws FlashcardsException { | ||
throw new NotImplementedException("method not yet implemented in Cassandra repository"); | ||
} | ||
|
||
@Override | ||
public List<FlashCardDto> findByQuestionLike(final String question) throws FlashcardsException { | ||
throw new NotImplementedException("method not yet implemented in Cassandra repository"); | ||
} | ||
|
||
@Override | ||
public List<FlashCardDto> findByQuestionLike(final String question, final PageRequest page) throws FlashcardsException { | ||
throw new NotImplementedException("method not yet implemented in Cassandra repository"); | ||
} | ||
|
||
@Override | ||
public FlashCardDto findByQuestion(final String question) throws FlashcardsException { | ||
throw new NotImplementedException("method not yet implemented in Cassandra repository"); | ||
} | ||
|
||
@Override | ||
public List<FlashCardDto> findFlashcardsForTag(final String tagId, final Set<String> fields) throws FlashcardsException { | ||
throw new NotImplementedException("method not yet implemented in Cassandra repository"); | ||
} | ||
|
||
@Override | ||
public List<FlashCardDto> list() throws FlashcardsException { | ||
throw new NotImplementedException("method not yet implemented in Cassandra repository"); | ||
} | ||
|
||
@Override | ||
public List<FlashCardDto> list(final Integer page, final Integer size, final String sort, final String direction) throws FlashcardsException { | ||
throw new NotImplementedException("method not yet implemented in Cassandra repository"); | ||
} | ||
|
||
@Override | ||
public List<FlashCardDto> list(final Integer page, final Integer size, final String sort, final String direction, final Set<String> fields) throws FlashcardsException { | ||
throw new NotImplementedException("method not yet implemented in Cassandra repository"); | ||
} | ||
|
||
@Override | ||
public Long count() { | ||
throw new NotImplementedException("method not yet implemented in Cassandra repository"); | ||
} | ||
|
||
@Override | ||
public FlashCardDto findOne(final String s) throws FlashcardsException { | ||
throw new NotImplementedException("method not yet implemented in Cassandra repository"); | ||
} | ||
|
||
@Override | ||
public FlashCardDto findOne(final String s, final Set<String> fields) throws FlashcardsException { | ||
throw new NotImplementedException("method not yet implemented in Cassandra repository"); | ||
} | ||
|
||
@Override | ||
public FlashCardDto save(final FlashCardDto entity) throws FlashcardsException { | ||
throw new NotImplementedException("method not yet implemented in Cassandra repository"); | ||
} | ||
|
||
@Override | ||
public void delete(String s) { | ||
throw new NotImplementedException("method not yet implemented in Cassandra repository"); | ||
} | ||
|
||
@Override | ||
public List<FlashCardDto> findByCreatedBy(final String userId, final Set<String> fields) throws FlashcardsException { | ||
throw new NotImplementedException("method not yet implemented in Cassandra repository"); | ||
} | ||
} |
Oops, something went wrong.