Skip to content

Commit

Permalink
javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
sqshq committed Mar 5, 2016
1 parent c2f5620 commit 53baceb
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,30 @@

public interface AccountService {

Account create(User user);
/**
* Finds account by given name
*
* @param accountName
* @return found account
*/
Account findByName(String accountName);

Account findByName(String name);
/**
* Checks if account with the same name already exists
* Invokes Auth Service user creation
* Creates new account with default parameters
*
* @param user
* @return created account
*/
Account create(User user);

/**
* Validates and applies incoming account updates
* Invokes Statistics Service update
*
* @param name
* @param update
*/
void saveChanges(String name, Account update);
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,17 @@ public class AccountServiceImpl implements AccountService {
@Autowired
private AccountRepository repository;

/**
* {@inheritDoc}
*/
@Override
public Account findByName(String name) {
Assert.hasLength(name);
log.info("access {} account info", name);
return repository.findByName(name);
public Account findByName(String accountName) {
Assert.hasLength(accountName);
return repository.findByName(accountName);
}

/**
* Checks if account with the same name already exists
* Invokes Auth Service user creation
* Creates new account with default parameters
*
* @param user
* @return created account
* {@inheritDoc}
*/
@Override
public Account create(User user) {
Expand Down Expand Up @@ -73,11 +70,7 @@ public Account create(User user) {
}

/**
* Validates and applies incoming account updates
* Invokes Statistics Service update
*
* @param name
* @param update
* {@inheritDoc}
*/
@Override
public void saveChanges(String name, Account update) {
Expand All @@ -93,6 +86,8 @@ public void saveChanges(String name, Account update) {

repository.save(account);

log.debug("account {} changes has been saved", name);

try {
statisticsClient.updateStatistics(name, account);
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

public interface NotificationService {

void sendVisitReminderNotifications();

void sendBackupNotifications();

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,21 @@

public interface ExchangeRatesService {

/**
* Requests today's foreign exchange rates from a provider
* or reuses values from the last request (if they are still relevant)
*
* @return current date rates
*/
Map<Currency, BigDecimal> getCurrentRates();

/**
* Converts given amount to specified currency
*
* @param from {@link Currency}
* @param to {@link Currency}
* @param amount to be converted
* @return converted amount
*/
BigDecimal convert(Currency from, Currency to, BigDecimal amount);
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ public class ExchangeRatesServiceImpl implements ExchangeRatesService {
@Autowired
private ExchangeRatesClient client;

/**
* {@inheritDoc}
*/
@Override
public Map<Currency, BigDecimal> getCurrentRates() {

Expand All @@ -40,6 +43,9 @@ public Map<Currency, BigDecimal> getCurrentRates() {
);
}

/**
* {@inheritDoc}
*/
@Override
public BigDecimal convert(Currency from, Currency to, BigDecimal amount) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,24 @@

public interface StatisticsService {

/**
* Finds account by given name
*
* @param accountName
* @return found account
*/
List<DataPoint> findByAccountName(String accountName);

/**
* Converts given {@link Account} object to {@link DataPoint} with
* a set of significant statistic metrics.
*
* Compound {@link DataPoint#id} forces to rewrite the object
* for each account within a day.
*
* @param accountName
* @param account
*/
DataPoint save(String accountName, Account account);

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,17 @@ public class StatisticsServiceImpl implements StatisticsService {
@Autowired
private ExchangeRatesService ratesService;

/**
* {@inheritDoc}
*/
@Override
public List<DataPoint> findByAccountName(String accountName) {
Assert.hasLength(accountName);
return repository.findByIdAccount(accountName);
}

/**
* Converts given {@link Account} object to {@link DataPoint} with
* a set of significant statistic metrics.
*
* Compound {@link DataPoint#id} forces to rewrite the object
* for each account within a day.
*
* @param accountName
* @param account
* {@inheritDoc}
*/
@Override
public DataPoint save(String accountName, Account account) {
Expand Down

0 comments on commit 53baceb

Please sign in to comment.