org.xlcloud.console.accounts.controllers.AccountsBean Maven / Gradle / Ivy
The newest version!
/*
* Copyright 2012 AMG.lab, a Bull Group Company
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.xlcloud.console.accounts.controllers;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Named;
import org.xlcloud.console.accounts.service.AccountRepository;
import org.xlcloud.console.extensions.scope.ViewScoped;
import org.xlcloud.service.Account;
/**
* The controller class, which is used to retrieve accounts list.
* @author Piotr Kulasek-Szwed, AMG.net
*/
@Named
@ViewScoped
public class AccountsBean {
@Inject
private AccountRepository accountRepository;
private List accounts;
private List filteredAccounts;
/**
* Initializes bean by loading all accounts from accounts api.
*/
@PostConstruct
public void loadAccounts() {
this.accounts = accountRepository.getAll();
}
/**
* Returns accounts list.
* @return admin account list
*/
public List getAccounts() {
return accounts;
}
/**
* Returns the value of accounts filtered by datatable.
* @return filtered accounts
*/
public List getFilteredAccounts() {
return filteredAccounts;
}
/**
* Sets the value of accounts filtered by datatable
* @param filteredAccounts - filtered accounts list
*/
public void setFilteredAccounts(List filteredAccounts) {
this.filteredAccounts = filteredAccounts;
}
/**
* Sets the value of {@link #accountRepository}.
* @param accountRepository
*/
public void setAccountRepository(AccountRepository accountRepository) {
this.accountRepository = accountRepository;
}
}