<repo_name>ncalderon/sf-web-client<file_sep>/src/test/java/com/calderon/sf/web/rest/AccountTransactionResourceIntTest.java
package com.calderon.sf.web.rest;

import com.calderon.sf.SfWebClientApp;

import com.calderon.sf.domain.AccountTransaction;
import com.calderon.sf.domain.FinanceAccount;
import com.calderon.sf.repository.AccountTransactionRepository;
import com.calderon.sf.web.rest.errors.ExceptionTranslator;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.MockitoAnnotations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;

import javax.persistence.EntityManager;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.List;

import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;

import com.calderon.sf.domain.enumeration.TranType;
import com.calderon.sf.domain.enumeration.PaymentMethod;
/**
 * Test class for the AccountTransactionResource REST controller.
 *
 * @see AccountTransactionResource
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SfWebClientApp.class)
public class AccountTransactionResourceIntTest {

    private static final TranType DEFAULT_TRAN_TYPE = TranType.EXPENSE;
    private static final TranType UPDATED_TRAN_TYPE = TranType.INCOME;

    private static final String DEFAULT_TRAN_NUMBER = "AAAAAAAAAA";
    private static final String UPDATED_TRAN_NUMBER = "BBBBBBBBBB";

    private static final String DEFAULT_REFERENCE_NUMBER = "AAAAAAAAAA";
    private static final String UPDATED_REFERENCE_NUMBER = "BBBBBBBBBB";

    private static final LocalDate DEFAULT_POST_DATE = LocalDate.ofEpochDay(0L);
    private static final LocalDate UPDATED_POST_DATE = LocalDate.now(ZoneId.systemDefault());

    private static final String DEFAULT_DESCRIPTION = "AAAAAAAAAA";
    private static final String UPDATED_DESCRIPTION = "BBBBBBBBBB";

    private static final BigDecimal DEFAULT_AMOUNT = new BigDecimal(1);
    private static final BigDecimal UPDATED_AMOUNT = new BigDecimal(2);

    private static final PaymentMethod DEFAULT_PAYMENT_METHOD = PaymentMethod.UNSPECIFIED;
    private static final PaymentMethod UPDATED_PAYMENT_METHOD = PaymentMethod.CASH;

    @Autowired
    private AccountTransactionRepository accountTransactionRepository;

    @Autowired
    private MappingJackson2HttpMessageConverter jacksonMessageConverter;

    @Autowired
    private PageableHandlerMethodArgumentResolver pageableArgumentResolver;

    @Autowired
    private ExceptionTranslator exceptionTranslator;

    @Autowired
    private EntityManager em;

    private MockMvc restAccountTransactionMockMvc;

    private AccountTransaction accountTransaction;

    @Before
    public void setup() {
        MockitoAnnotations.initMocks(this);
        final AccountTransactionResource accountTransactionResource = new AccountTransactionResource(accountTransactionRepository);
        this.restAccountTransactionMockMvc = MockMvcBuilders.standaloneSetup(accountTransactionResource)
            .setCustomArgumentResolvers(pageableArgumentResolver)
            .setControllerAdvice(exceptionTranslator)
            .setMessageConverters(jacksonMessageConverter).build();
    }

    /**
     * Create an entity for this test.
     *
     * This is a static method, as tests for other entities might also need it,
     * if they test an entity which requires the current entity.
     */
    public static AccountTransaction createEntity(EntityManager em) {
        AccountTransaction accountTransaction = new AccountTransaction()
            .tranType(DEFAULT_TRAN_TYPE)
            .tranNumber(DEFAULT_TRAN_NUMBER)
            .referenceNumber(DEFAULT_REFERENCE_NUMBER)
            .postDate(DEFAULT_POST_DATE)
            .description(DEFAULT_DESCRIPTION)
            .amount(DEFAULT_AMOUNT)
            .paymentMethod(DEFAULT_PAYMENT_METHOD);
        // Add required entity
        FinanceAccount financeAccount = FinanceAccountResourceIntTest.createEntity(em);
        em.persist(financeAccount);
        em.flush();
        accountTransaction.setFinanceAccount(financeAccount);
        return accountTransaction;
    }

    @Before
    public void initTest() {
        accountTransaction = createEntity(em);
    }

    @Test
    @Transactional
    public void createAccountTransaction() throws Exception {
        int databaseSizeBeforeCreate = accountTransactionRepository.findAll().size();

        // Create the AccountTransaction
        restAccountTransactionMockMvc.perform(post("/api/account-transactions")
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
            .content(TestUtil.convertObjectToJsonBytes(accountTransaction)))
            .andExpect(status().isCreated());

        // Validate the AccountTransaction in the database
        List<AccountTransaction> accountTransactionList = accountTransactionRepository.findAll();
        assertThat(accountTransactionList).hasSize(databaseSizeBeforeCreate + 1);
        AccountTransaction testAccountTransaction = accountTransactionList.get(accountTransactionList.size() - 1);
        assertThat(testAccountTransaction.getTranType()).isEqualTo(DEFAULT_TRAN_TYPE);
        assertThat(testAccountTransaction.getTranNumber()).isEqualTo(DEFAULT_TRAN_NUMBER);
        assertThat(testAccountTransaction.getReferenceNumber()).isEqualTo(DEFAULT_REFERENCE_NUMBER);
        assertThat(testAccountTransaction.getPostDate()).isEqualTo(DEFAULT_POST_DATE);
        assertThat(testAccountTransaction.getDescription()).isEqualTo(DEFAULT_DESCRIPTION);
        assertThat(testAccountTransaction.getAmount()).isEqualTo(DEFAULT_AMOUNT);
        assertThat(testAccountTransaction.getPaymentMethod()).isEqualTo(DEFAULT_PAYMENT_METHOD);
    }

    @Test
    @Transactional
    public void createAccountTransactionWithExistingId() throws Exception {
        int databaseSizeBeforeCreate = accountTransactionRepository.findAll().size();

        // Create the AccountTransaction with an existing ID
        accountTransaction.setId(1L);

        // An entity with an existing ID cannot be created, so this API call must fail
        restAccountTransactionMockMvc.perform(post("/api/account-transactions")
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
            .content(TestUtil.convertObjectToJsonBytes(accountTransaction)))
            .andExpect(status().isBadRequest());

        // Validate the AccountTransaction in the database
        List<AccountTransaction> accountTransactionList = accountTransactionRepository.findAll();
        assertThat(accountTransactionList).hasSize(databaseSizeBeforeCreate);
    }

    @Test
    @Transactional
    public void checkTranTypeIsRequired() throws Exception {
        int databaseSizeBeforeTest = accountTransactionRepository.findAll().size();
        // set the field null
        accountTransaction.setTranType(null);

        // Create the AccountTransaction, which fails.

        restAccountTransactionMockMvc.perform(post("/api/account-transactions")
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
            .content(TestUtil.convertObjectToJsonBytes(accountTransaction)))
            .andExpect(status().isBadRequest());

        List<AccountTransaction> accountTransactionList = accountTransactionRepository.findAll();
        assertThat(accountTransactionList).hasSize(databaseSizeBeforeTest);
    }

    @Test
    @Transactional
    public void checkPostDateIsRequired() throws Exception {
        int databaseSizeBeforeTest = accountTransactionRepository.findAll().size();
        // set the field null
        accountTransaction.setPostDate(null);

        // Create the AccountTransaction, which fails.

        restAccountTransactionMockMvc.perform(post("/api/account-transactions")
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
            .content(TestUtil.convertObjectToJsonBytes(accountTransaction)))
            .andExpect(status().isBadRequest());

        List<AccountTransaction> accountTransactionList = accountTransactionRepository.findAll();
        assertThat(accountTransactionList).hasSize(databaseSizeBeforeTest);
    }

    @Test
    @Transactional
    public void checkAmountIsRequired() throws Exception {
        int databaseSizeBeforeTest = accountTransactionRepository.findAll().size();
        // set the field null
        accountTransaction.setAmount(null);

        // Create the AccountTransaction, which fails.

        restAccountTransactionMockMvc.perform(post("/api/account-transactions")
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
            .content(TestUtil.convertObjectToJsonBytes(accountTransaction)))
            .andExpect(status().isBadRequest());

        List<AccountTransaction> accountTransactionList = accountTransactionRepository.findAll();
        assertThat(accountTransactionList).hasSize(databaseSizeBeforeTest);
    }

    @Test
    @Transactional
    public void getAllAccountTransactions() throws Exception {
        // Initialize the database
        accountTransactionRepository.saveAndFlush(accountTransaction);

        // Get all the accountTransactionList
        restAccountTransactionMockMvc.perform(get("/api/account-transactions?sort=id,desc"))
            .andExpect(status().isOk())
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
            .andExpect(jsonPath("$.[*].id").value(hasItem(accountTransaction.getId().intValue())))
            .andExpect(jsonPath("$.[*].tranType").value(hasItem(DEFAULT_TRAN_TYPE.toString())))
            .andExpect(jsonPath("$.[*].tranNumber").value(hasItem(DEFAULT_TRAN_NUMBER.toString())))
            .andExpect(jsonPath("$.[*].referenceNumber").value(hasItem(DEFAULT_REFERENCE_NUMBER.toString())))
            .andExpect(jsonPath("$.[*].postDate").value(hasItem(DEFAULT_POST_DATE.toString())))
            .andExpect(jsonPath("$.[*].description").value(hasItem(DEFAULT_DESCRIPTION.toString())))
            .andExpect(jsonPath("$.[*].amount").value(hasItem(DEFAULT_AMOUNT.intValue())))
            .andExpect(jsonPath("$.[*].paymentMethod").value(hasItem(DEFAULT_PAYMENT_METHOD.toString())));
    }

    @Test
    @Transactional
    public void getAccountTransaction() throws Exception {
        // Initialize the database
        accountTransactionRepository.saveAndFlush(accountTransaction);

        // Get the accountTransaction
        restAccountTransactionMockMvc.perform(get("/api/account-transactions/{id}", accountTransaction.getId()))
            .andExpect(status().isOk())
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
            .andExpect(jsonPath("$.id").value(accountTransaction.getId().intValue()))
            .andExpect(jsonPath("$.tranType").value(DEFAULT_TRAN_TYPE.toString()))
            .andExpect(jsonPath("$.tranNumber").value(DEFAULT_TRAN_NUMBER.toString()))
            .andExpect(jsonPath("$.referenceNumber").value(DEFAULT_REFERENCE_NUMBER.toString()))
            .andExpect(jsonPath("$.postDate").value(DEFAULT_POST_DATE.toString()))
            .andExpect(jsonPath("$.description").value(DEFAULT_DESCRIPTION.toString()))
            .andExpect(jsonPath("$.amount").value(DEFAULT_AMOUNT.intValue()))
            .andExpect(jsonPath("$.paymentMethod").value(DEFAULT_PAYMENT_METHOD.toString()));
    }

    @Test
    @Transactional
    public void getNonExistingAccountTransaction() throws Exception {
        // Get the accountTransaction
        restAccountTransactionMockMvc.perform(get("/api/account-transactions/{id}", Long.MAX_VALUE))
            .andExpect(status().isNotFound());
    }

    @Test
    @Transactional
    public void updateAccountTransaction() throws Exception {
        // Initialize the database
        accountTransactionRepository.saveAndFlush(accountTransaction);
        int databaseSizeBeforeUpdate = accountTransactionRepository.findAll().size();

        // Update the accountTransaction
        AccountTransaction updatedAccountTransaction = accountTransactionRepository.findOne(accountTransaction.getId());
        updatedAccountTransaction
            .tranType(UPDATED_TRAN_TYPE)
            .tranNumber(UPDATED_TRAN_NUMBER)
            .referenceNumber(UPDATED_REFERENCE_NUMBER)
            .postDate(UPDATED_POST_DATE)
            .description(UPDATED_DESCRIPTION)
            .amount(UPDATED_AMOUNT)
            .paymentMethod(UPDATED_PAYMENT_METHOD);

        restAccountTransactionMockMvc.perform(put("/api/account-transactions")
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
            .content(TestUtil.convertObjectToJsonBytes(updatedAccountTransaction)))
            .andExpect(status().isOk());

        // Validate the AccountTransaction in the database
        List<AccountTransaction> accountTransactionList = accountTransactionRepository.findAll();
        assertThat(accountTransactionList).hasSize(databaseSizeBeforeUpdate);
        AccountTransaction testAccountTransaction = accountTransactionList.get(accountTransactionList.size() - 1);
        assertThat(testAccountTransaction.getTranType()).isEqualTo(UPDATED_TRAN_TYPE);
        assertThat(testAccountTransaction.getTranNumber()).isEqualTo(UPDATED_TRAN_NUMBER);
        assertThat(testAccountTransaction.getReferenceNumber()).isEqualTo(UPDATED_REFERENCE_NUMBER);
        assertThat(testAccountTransaction.getPostDate()).isEqualTo(UPDATED_POST_DATE);
        assertThat(testAccountTransaction.getDescription()).isEqualTo(UPDATED_DESCRIPTION);
        assertThat(testAccountTransaction.getAmount()).isEqualTo(UPDATED_AMOUNT);
        assertThat(testAccountTransaction.getPaymentMethod()).isEqualTo(UPDATED_PAYMENT_METHOD);
    }

    @Test
    @Transactional
    public void updateNonExistingAccountTransaction() throws Exception {
        int databaseSizeBeforeUpdate = accountTransactionRepository.findAll().size();

        // Create the AccountTransaction

        // If the entity doesn't have an ID, it will be created instead of just being updated
        restAccountTransactionMockMvc.perform(put("/api/account-transactions")
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
            .content(TestUtil.convertObjectToJsonBytes(accountTransaction)))
            .andExpect(status().isCreated());

        // Validate the AccountTransaction in the database
        List<AccountTransaction> accountTransactionList = accountTransactionRepository.findAll();
        assertThat(accountTransactionList).hasSize(databaseSizeBeforeUpdate + 1);
    }

    @Test
    @Transactional
    public void deleteAccountTransaction() throws Exception {
        // Initialize the database
        accountTransactionRepository.saveAndFlush(accountTransaction);
        int databaseSizeBeforeDelete = accountTransactionRepository.findAll().size();

        // Get the accountTransaction
        restAccountTransactionMockMvc.perform(delete("/api/account-transactions/{id}", accountTransaction.getId())
            .accept(TestUtil.APPLICATION_JSON_UTF8))
            .andExpect(status().isOk());

        // Validate the database is empty
        List<AccountTransaction> accountTransactionList = accountTransactionRepository.findAll();
        assertThat(accountTransactionList).hasSize(databaseSizeBeforeDelete - 1);
    }

    @Test
    @Transactional
    public void equalsVerifier() throws Exception {
        TestUtil.equalsVerifier(AccountTransaction.class);
        AccountTransaction accountTransaction1 = new AccountTransaction();
        accountTransaction1.setId(1L);
        AccountTransaction accountTransaction2 = new AccountTransaction();
        accountTransaction2.setId(accountTransaction1.getId());
        assertThat(accountTransaction1).isEqualTo(accountTransaction2);
        accountTransaction2.setId(2L);
        assertThat(accountTransaction1).isNotEqualTo(accountTransaction2);
        accountTransaction1.setId(null);
        assertThat(accountTransaction1).isNotEqualTo(accountTransaction2);
    }
}
<file_sep>/src/main/webapp/app/entities/finance-account/finance-account.module.ts
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { RouterModule } from '@angular/router';

import { SfWebClientSharedModule } from '../../shared';
import { SfWebClientAdminModule } from '../../admin/admin.module';
import {
    FinanceAccountService,
    FinanceAccountPopupService,
    FinanceAccountComponent,
    FinanceAccountDetailComponent,
    FinanceAccountDialogComponent,
    FinanceAccountPopupComponent,
    FinanceAccountDeletePopupComponent,
    FinanceAccountDeleteDialogComponent,
    financeAccountRoute,
    financeAccountPopupRoute,
    FinanceAccountResolvePagingParams,
} from './';

const ENTITY_STATES = [
    ...financeAccountRoute,
    ...financeAccountPopupRoute,
];

@NgModule({
    imports: [
        SfWebClientSharedModule,
        SfWebClientAdminModule,
        RouterModule.forRoot(ENTITY_STATES, { useHash: true })
    ],
    declarations: [
        FinanceAccountComponent,
        FinanceAccountDetailComponent,
        FinanceAccountDialogComponent,
        FinanceAccountDeleteDialogComponent,
        FinanceAccountPopupComponent,
        FinanceAccountDeletePopupComponent,
    ],
    entryComponents: [
        FinanceAccountComponent,
        FinanceAccountDialogComponent,
        FinanceAccountPopupComponent,
        FinanceAccountDeleteDialogComponent,
        FinanceAccountDeletePopupComponent,
    ],
    providers: [
        FinanceAccountService,
        FinanceAccountPopupService,
        FinanceAccountResolvePagingParams,
    ],
    schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class SfWebClientFinanceAccountModule {}
<file_sep>/src/main/java/com/calderon/sf/service/dto/package-info.java
/**
 * Data Transfer Objects.
 */
package com.calderon.sf.service.dto;
<file_sep>/src/main/webapp/app/sf-entities/finance-account/index.ts
export * from './finance-account.model';
export * from './finance-account-popup.service';
export * from './finance-account.service';
export * from './finance-account-dialog.component';
export * from './finance-account-delete-dialog.component';
export * from './finance-account-detail.component';
export * from './finance-account.component';
export * from './finance-account.route';
export * from './transaction/transaction.module'
<file_sep>/src/main/webapp/app/app.module.ts
import './vendor.ts';

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import { Ng2Webstorage } from 'ng2-webstorage';

import { SfWebClientSharedModule, UserRouteAccessService } from './shared';
import { SfWebClientHomeModule } from './home/home.module';
import { SfWebClientAdminModule } from './admin/admin.module';
import { SfWebClientAccountModule } from './account/account.module';

/*import { SfWebClientEntityModule } from './entities/entity.module';*/
import { SfWebClientEntityModule as AppSfWebClientEntityModule } from './sf-entities/entity.module';

import { customHttpProvider } from './blocks/interceptor/http.provider';
import { PaginationConfig } from './blocks/config/uib-pagination.config';

// jhipster-needle-angular-add-module-import JHipster will add new module here

import {
    JhiMainComponent,
    LayoutRoutingModule,
    NavbarComponent,
    FooterComponent,
    ProfileService,
    PageRibbonComponent,
    ActiveMenuDirective,
    ErrorComponent
} from './layouts';

@NgModule({
    imports: [
        BrowserModule,
        BrowserAnimationsModule,
        LayoutRoutingModule,
        Ng2Webstorage.forRoot({ prefix: 'jhi', separator: '-'}),
        SfWebClientSharedModule,
        SfWebClientHomeModule,
        SfWebClientAdminModule,
        SfWebClientAccountModule,
        /*SfWebClientEntityModule,*/
        // jhipster-needle-angular-add-module JHipster will add new module here
        AppSfWebClientEntityModule
    ],
    declarations: [
        JhiMainComponent,
        NavbarComponent,
        ErrorComponent,
        PageRibbonComponent,
        ActiveMenuDirective,
        FooterComponent
    ],
    providers: [
        ProfileService,
        customHttpProvider(),
        PaginationConfig,
        UserRouteAccessService
    ],
    bootstrap: [ JhiMainComponent ]
})
export class SfWebClientAppModule {}
<file_sep>/src/main/webapp/app/sf-entities/tran-category/tran-category-dialog.component.ts
import { Component, OnInit, OnDestroy } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Response } from '@angular/http';

import { Observable } from 'rxjs/Rx';
import { NgbActiveModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
import { JhiEventManager, JhiAlertService } from 'ng-jhipster';

import { TranCategory } from './tran-category.model';
import { TranCategoryPopupService } from './tran-category-popup.service';
import { TranCategoryService } from './tran-category.service';
import { User, UserService } from '../../shared';
import { TranCategoryRegex, TranCategoryRegexService } from '../tran-category-regex';
import { ResponseWrapper } from '../../shared';

@Component({
    selector: 'jhi-tran-category-dialog',
    templateUrl: './tran-category-dialog.component.html'
})
export class TranCategoryDialogComponent implements OnInit {

    tranCategory: TranCategory;
    isSaving: boolean;

    users: User[];

    trancategoryregexes: TranCategoryRegex[];

    constructor(
        public activeModal: NgbActiveModal,
        private alertService: JhiAlertService,
        private tranCategoryService: TranCategoryService,
        private userService: UserService,
        private tranCategoryRegexService: TranCategoryRegexService,
        private eventManager: JhiEventManager
    ) {
    }

    ngOnInit() {
        this.isSaving = false;
        this.userService.query()
            .subscribe((res: ResponseWrapper) => { this.users = res.json; }, (res: ResponseWrapper) => this.onError(res.json));
        this.tranCategoryRegexService.query()
            .subscribe((res: ResponseWrapper) => { this.trancategoryregexes = res.json; }, (res: ResponseWrapper) => this.onError(res.json));
    }

    clear() {
        this.activeModal.dismiss('cancel');
    }

    save() {
        this.isSaving = true;
        if (this.tranCategory.id !== undefined) {
            this.subscribeToSaveResponse(
                this.tranCategoryService.update(this.tranCategory));
        } else {
            this.subscribeToSaveResponse(
                this.tranCategoryService.create(this.tranCategory));
        }
    }

    private subscribeToSaveResponse(result: Observable<TranCategory>) {
        result.subscribe((res: TranCategory) =>
            this.onSaveSuccess(res), (res: Response) => this.onSaveError());
    }

    private onSaveSuccess(result: TranCategory) {
        this.eventManager.broadcast({ name: 'tranCategoryListModification', content: 'OK'});
        this.isSaving = false;
        this.activeModal.dismiss(result);
    }

    private onSaveError() {
        this.isSaving = false;
    }

    private onError(error: any) {
        this.alertService.error(error.message, null, null);
    }

    trackUserById(index: number, item: User) {
        return item.id;
    }

    trackTranCategoryRegexById(index: number, item: TranCategoryRegex) {
        return item.id;
    }
}

@Component({
    selector: 'jhi-tran-category-popup',
    template: ''
})
export class TranCategoryPopupComponent implements OnInit, OnDestroy {

    routeSub: any;

    constructor(
        private route: ActivatedRoute,
        private tranCategoryPopupService: TranCategoryPopupService
    ) {}

    ngOnInit() {
        this.routeSub = this.route.params.subscribe((params) => {
            if ( params['id'] ) {
                this.tranCategoryPopupService
                    .open(TranCategoryDialogComponent as Component, params['id']);
            } else {
                this.tranCategoryPopupService
                    .open(TranCategoryDialogComponent as Component);
            }
        });
    }

    ngOnDestroy() {
        this.routeSub.unsubscribe();
    }
}
<file_sep>/src/main/webapp/app/sf-entities/account-transaction/account-transaction.service.ts
import {Injectable} from '@angular/core';
import {Http, Response,  URLSearchParams} from '@angular/http';
import {Observable} from 'rxjs/Rx';
import {SERVER_API_URL} from '../../app.constants';
import {AccountTransaction} from './account-transaction.model';
import {createRequestOption, ResponseWrapper} from '../../shared';
import {JhiDateUtils} from 'ng-jhipster';

@Injectable()
export class AccountTransactionService {

    private resourceUrl = SERVER_API_URL + 'api/account-transactions';

    constructor(private http: Http, private dateUtils: JhiDateUtils) {
    }

    create(accountTransaction: AccountTransaction): Observable<AccountTransaction> {
        const copy = this.convert(accountTransaction);
        return this.http.post(this.resourceUrl, copy).map((res: Response) => {
            const jsonResponse = res.json();
            this.convertItemFromServer(jsonResponse);
            return jsonResponse;
        });
    }

    createBulk(transactions: AccountTransaction[]): Observable<AccountTransaction[]> {
        const copy = this.convertArray(transactions);
        return this.http.post(this.resourceUrl + "/bulk", copy).map((res: Response) => {
            const jsonResponse = res.json();
            this.convertItemFromServer(jsonResponse);
            return jsonResponse;
        });
    }

    update(accountTransaction: AccountTransaction): Observable<AccountTransaction> {
        const copy = this.convert(accountTransaction);
        return this.http.put(this.resourceUrl, copy).map((res: Response) => {
            const jsonResponse = res.json();
            this.convertItemFromServer(jsonResponse);
            return jsonResponse;
        });
    }

    find(id: number): Observable<AccountTransaction> {
        return this.http.get(`${this.resourceUrl}/${id}`).map((res: Response) => {
            const jsonResponse = res.json();
            this.convertItemFromServer(jsonResponse);
            return jsonResponse;
        });
    }

    query(req?: any): Observable<ResponseWrapper> {
        const options = createRequestOption(req);
        return this.http.get(this.resourceUrl, options)
            .map((res: Response) => this.convertResponse(res));
    }

    delete(id: number): Observable<Response> {
        return this.http.delete(`${this.resourceUrl}/${id}`);
    }

    private convertResponse(res: Response): ResponseWrapper {
        const jsonResponse = res.json();
        for (let i = 0; i < jsonResponse.length; i++) {
            this.convertItemFromServer(jsonResponse[i]);
        }
        return new ResponseWrapper(res.headers, jsonResponse, res.status);
    }

    private convertItemsFromServer(accountTransactions: AccountTransaction[]) {
        for (let tran of accountTransactions) {
            this.convertItemFromServer(tran);
        }
    }

    private convertItemFromServer(entity: any) {
        entity.postDate = this.dateUtils
            .convertLocalDateFromServer(entity.postDate);
    }

    private convert(accountTransaction: AccountTransaction): AccountTransaction {
        const copy: AccountTransaction = Object.assign({}, accountTransaction);
        copy.postDate = this.dateUtils.convertLocalDateToServer(accountTransaction.postDate);
        return copy;
    }

    private convertArray(accountTransactions: AccountTransaction[]): AccountTransaction[] {
        const copyTrans: AccountTransaction[] = [];
        for (let tran of accountTransactions) {
            copyTrans.push(this.convert(tran));
        }
        return copyTrans;
    }

    findTransactionsByAccounts(accountsId: number[]): Observable<AccountTransaction[]> {
        return this.findTransactionsByAccountsAndYear(accountsId, 0);
    }

    findTransactionsByAccountsAndYear(accountsId: number[], year: number): Observable<AccountTransaction[]> {
        const options = createRequestOption();
        const params: URLSearchParams = new URLSearchParams();
        params.set('accountsId', <any>accountsId);
        params.set('year', year + '');
        options.params = params;
        return this.http.get(`${this.resourceUrl}/findByAccountsIdAndYear`, options).map((res: Response) => {
            const jsonResponse = res.json();
            this.convertTransactionsFromServer(jsonResponse);
            return jsonResponse;
        });
    }

    private convertTransactionsFromServer(accountTransactions: AccountTransaction[]) {
        for (let tran of accountTransactions) {
            this.convertTransactionFromServer(tran);
        }
    }

    private convertTransactionFromServer(entity: any) {
        entity.postDate = this.dateUtils
            .convertLocalDateFromServer(entity.postDate);
    }
}
<file_sep>/src/main/java/com/calderon/sf/web/rest/BankResource.java
package com.calderon.sf.web.rest;

import com.calderon.sf.domain.Bank;
import com.calderon.sf.repository.BankRepository;
import com.calderon.sf.web.rest.util.HeaderUtil;
import com.calderon.sf.web.rest.util.PaginationUtil;
import com.codahale.metrics.annotation.Timed;
import io.github.jhipster.web.util.ResponseUtil;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;

/**
 * REST controller for managing Bank.
 */
@RestController
@RequestMapping("/api")
public class BankResource {

    private final Logger log = LoggerFactory.getLogger(BankResource.class);

    private static final String ENTITY_NAME = "bank";

    private final BankRepository bankRepository;

    public BankResource(BankRepository bankRepository) {
        this.bankRepository = bankRepository;
    }

    /**
     * POST  /banks : Create a new bank.
     *
     * @param bank the bank to create
     * @return the ResponseEntity with status 201 (Created) and with body the new bank, or with status 400 (Bad Request) if the bank has already an ID
     * @throws URISyntaxException if the Location URI syntax is incorrect
     */
    @PostMapping("/banks")
    @Timed
    public ResponseEntity<Bank> createBank(@Valid @RequestBody Bank bank) throws URISyntaxException {
        log.debug("REST request to save Bank : {}", bank);
        if (bank.getId() != null) {
            return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(ENTITY_NAME, "idexists", "A new bank cannot already have an ID")).body(null);
        }
        Bank result = bankRepository.save(bank);
        return ResponseEntity.created(new URI("/api/banks/" + result.getId()))
            .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
            .body(result);
    }

    /**
     * PUT  /banks : Updates an existing bank.
     *
     * @param bank the bank to update
     * @return the ResponseEntity with status 200 (OK) and with body the updated bank,
     * or with status 400 (Bad Request) if the bank is not valid,
     * or with status 500 (Internal Server Error) if the bank couldn't be updated
     * @throws URISyntaxException if the Location URI syntax is incorrect
     */
    @PutMapping("/banks")
    @Timed
    public ResponseEntity<Bank> updateBank(@Valid @RequestBody Bank bank) throws URISyntaxException {
        log.debug("REST request to update Bank : {}", bank);
        if (bank.getId() == null) {
            return createBank(bank);
        }
        Bank result = bankRepository.save(bank);
        return ResponseEntity.ok()
            .headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, bank.getId().toString()))
            .body(result);
    }

    /**
     * GET  /banks : get all the banks.
     *
     * @param pageable the pagination information
     * @return the ResponseEntity with status 200 (OK) and the list of banks in body
     */
    @GetMapping("/banks")
    @Timed
    public ResponseEntity<List<Bank>> getAllBanks(@ApiParam Pageable pageable) {
        log.debug("REST request to get a page of Banks");
        Page<Bank> page = bankRepository.findAll(pageable);
        HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/banks");
        return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
    }

    /**
     * GET  /banks/:id : get the "id" bank.
     *
     * @param id the id of the bank to retrieve
     * @return the ResponseEntity with status 200 (OK) and with body the bank, or with status 404 (Not Found)
     */
    @GetMapping("/banks/{id}")
    @Timed
    public ResponseEntity<Bank> getBank(@PathVariable Long id) {
        log.debug("REST request to get Bank : {}", id);
        Bank bank = bankRepository.findOne(id);
        return ResponseUtil.wrapOrNotFound(Optional.ofNullable(bank));
    }

    /**
     * DELETE  /banks/:id : delete the "id" bank.
     *
     * @param id the id of the bank to delete
     * @return the ResponseEntity with status 200 (OK)
     */
    @DeleteMapping("/banks/{id}")
    @Timed
    public ResponseEntity<Void> deleteBank(@PathVariable Long id) {
        log.debug("REST request to delete Bank : {}", id);
        bankRepository.delete(id);
        return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
    }
}
<file_sep>/src/main/webapp/app/sf-entities/finance-account/transaction/transaction-dialog/transaction-dialog.component.ts
import {Component, OnDestroy, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {TransactionPopupService} from '../transaction-popup.service';
import {AccountTransaction} from '../../../account-transaction/account-transaction.model';
import {User} from '../../../../shared/user/user.model';
import {TranCategory} from '../../../tran-category/tran-category.model';
import {NgbActiveModal} from '@ng-bootstrap/ng-bootstrap';
import {JhiAlertService, JhiEventManager} from 'ng-jhipster';
import {AccountTransactionService} from '../../../account-transaction/account-transaction.service';
import {FinanceAccountService} from '../../finance-account.service';
import {TranCategoryService} from '../../../tran-category/tran-category.service';
import {LoggerService} from '../../../../shared/logger/logger.service';
import {ResponseWrapper} from '../../../../shared/model/response-wrapper.model';
import {Observable} from 'rxjs/Observable';
import {TranType} from '../../../../sf-entities/account-transaction/account-transaction.model';
import {FinanceAccount} from '../../finance-account.model';

@Component({
    selector: 'jhi-transaction-dialog',
    templateUrl: './transaction-dialog.component.html'
})
export class TransactionDialogComponent implements OnInit {

    accountId: number;
    currentAccount: FinanceAccount;
    transaction: AccountTransaction;

    isSaving: boolean;

    categoryTypeaheadValue: string;
    categories: TranCategory[] = [];
    postDateDp: any;

    isDetailsCollapsed = true;

    constructor(private activatedRoute: ActivatedRoute,
                public activeModal: NgbActiveModal,
                private alertService: JhiAlertService,
                private tranService: AccountTransactionService,
                private accountService: FinanceAccountService,
                private tranCategoryService: TranCategoryService,
                private eventManager: JhiEventManager,
                private logger: LoggerService) {
    }

    ngOnInit() {
        this.activatedRoute.children.find((value) => {
            if (value.outlet === 'popup') {
                value.params.subscribe((params) => {
                    this.accountId = params['accountId'];
                    this.load();
                });
                return true;
            }
        });
        /*this.activatedRoute.params.subscribe((params) => {
            this.accountId = params['accountId'];
            this.load();
        });*/
    }

    load() {
        this.isSaving = false;
        this.accountService.find(this.accountId)
            .subscribe((account) => {
                this.currentAccount = account;
                this.transaction.financeAccount = account;
            }, (res: ResponseWrapper) => this.onError(res.json));
        this.tranCategoryService.query()
            .subscribe((res: ResponseWrapper) => {
                this.categories = res.json;
            }, (res: ResponseWrapper) => this.onError(res.json));
    }

    clear() {
        this.activeModal.dismiss('cancel');
    }

    save() {
        this.isSaving = true;
        if (this.transaction.id !== undefined) {
            this.subscribeToSaveResponse(
                this.tranService.update(this.transaction));
        } else {
            this.subscribeToSaveResponse(
                this.tranService.create(this.transaction));
        }
    }

    private subscribeToSaveResponse(result: Observable<AccountTransaction>) {
        result.subscribe((res: AccountTransaction) =>
            this.onSaveSuccess(res), (res: Response) => this.onSaveError());
    }

    private onSaveSuccess(result: AccountTransaction) {
        this.eventManager.broadcast({name: 'transactionListModification', content: 'OK'});
        this.isSaving = false;
        this.activeModal.dismiss(result);
    }

    private onSaveError() {
        this.isSaving = false;
    }

    private onError(error: any) {
        this.alertService.error(error.message, null, null);
    }

    trackUserById(index: number, item: User) {
        return item.id;
    }

    trackTranCategoryById(index: number, item: TranCategory) {
        return item.id;
    }

    getDetailsCollapseClass() {
        return {
            'form-row': !this.isDetailsCollapsed,
            'collapse': this.isDetailsCollapsed
        };
    }

    getTranIncomeClass() {
        return {
            'btn': true,
            'btn-secondary': this.transaction.tranType == <TranType><any>'EXPENSE',
            'btn-success': this.transaction.tranType == <TranType><any>'INCOME'
        };
    }

    getTranExpenseClass() {
        return {
            'btn': true,
            'btn-danger': this.transaction.tranType == <TranType><any>'EXPENSE',
            'btn-secondary': this.transaction.tranType == <TranType><any>'INCOME'
        };
    }

    onTypeaheadSelect(event: any) {
        this.transaction.tranCategory = event.item;
    }
}

@Component({
    selector: 'jhi-transaction-popup',
    template: ''
})
export class TransactionPopupComponent implements OnInit, OnDestroy {

    routeSub: any;

    constructor(private route: ActivatedRoute,
                private accountTransactionPopupService: TransactionPopupService) {
    }

    ngOnInit() {

        this.routeSub = this.route.params.subscribe((params) => {
            if (params['id']) {
                this.accountTransactionPopupService
                    .open(TransactionDialogComponent as Component, params['id']);
            } else {
                this.accountTransactionPopupService
                    .open(TransactionDialogComponent as Component);
            }
        });
    }

    ngOnDestroy() {
        this.routeSub.unsubscribe();
    }
}
<file_sep>/src/main/webapp/app/entities/finance-account/finance-account-detail.component.ts
import { Component, OnInit, OnDestroy } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Subscription } from 'rxjs/Rx';
import { JhiEventManager } from 'ng-jhipster';

import { FinanceAccount } from './finance-account.model';
import { FinanceAccountService } from './finance-account.service';

@Component({
    selector: 'jhi-finance-account-detail',
    templateUrl: './finance-account-detail.component.html'
})
export class FinanceAccountDetailComponent implements OnInit, OnDestroy {

    financeAccount: FinanceAccount;
    private subscription: Subscription;
    private eventSubscriber: Subscription;

    constructor(
        private eventManager: JhiEventManager,
        private financeAccountService: FinanceAccountService,
        private route: ActivatedRoute
    ) {
    }

    ngOnInit() {
        this.subscription = this.route.params.subscribe((params) => {
            this.load(params['id']);
        });
        this.registerChangeInFinanceAccounts();
    }

    load(id) {
        this.financeAccountService.find(id).subscribe((financeAccount) => {
            this.financeAccount = financeAccount;
        });
    }
    previousState() {
        window.history.back();
    }

    ngOnDestroy() {
        this.subscription.unsubscribe();
        this.eventManager.destroy(this.eventSubscriber);
    }

    registerChangeInFinanceAccounts() {
        this.eventSubscriber = this.eventManager.subscribe(
            'financeAccountListModification',
            (response) => this.load(this.financeAccount.id)
        );
    }
}
<file_sep>/src/test/javascript/e2e/entities/tran-category.spec.ts
import { browser, element, by, $ } from 'protractor';
import { NavBarPage } from './../page-objects/jhi-page-objects';
const path = require('path');

describe('TranCategory e2e test', () => {

    let navBarPage: NavBarPage;
    let tranCategoryDialogPage: TranCategoryDialogPage;
    let tranCategoryComponentsPage: TranCategoryComponentsPage;
    const fileToUpload = '../../../../main/webapp/content/images/logo-jhipster.png';
    const absolutePath = path.resolve(__dirname, fileToUpload);
    

    beforeAll(() => {
        browser.get('/');
        browser.waitForAngular();
        navBarPage = new NavBarPage();
        navBarPage.getSignInPage().autoSignInUsing('admin', 'admin');
        browser.waitForAngular();
    });

    it('should load TranCategories', () => {
        navBarPage.goToEntity('tran-category');
        tranCategoryComponentsPage = new TranCategoryComponentsPage();
        expect(tranCategoryComponentsPage.getTitle()).toMatch(/sfWebClientApp.tranCategory.home.title/);

    });

    it('should load create TranCategory dialog', () => {
        tranCategoryComponentsPage.clickOnCreateButton();
        tranCategoryDialogPage = new TranCategoryDialogPage();
        expect(tranCategoryDialogPage.getModalTitle()).toMatch(/sfWebClientApp.tranCategory.home.createOrEditLabel/);
        tranCategoryDialogPage.close();
    });

    it('should create and save TranCategories', () => {
        tranCategoryComponentsPage.clickOnCreateButton();
        tranCategoryDialogPage.setNameInput('name');
        expect(tranCategoryDialogPage.getNameInput()).toMatch('name');
        tranCategoryDialogPage.setDescriptionInput('description');
        expect(tranCategoryDialogPage.getDescriptionInput()).toMatch('description');
        tranCategoryDialogPage.userSelectLastOption();
        tranCategoryDialogPage.tranCategoryRegexSelectLastOption();
        tranCategoryDialogPage.save();
        expect(tranCategoryDialogPage.getSaveButton().isPresent()).toBeFalsy();
    }); 

    afterAll(() => {
        navBarPage.autoSignOut();
    });
});

export class TranCategoryComponentsPage {
    createButton = element(by.css('.jh-create-entity'));
    title = element.all(by.css('jhi-tran-category div h2 span')).first();

    clickOnCreateButton() {
        return this.createButton.click();
    }

    getTitle() {
        return this.title.getAttribute('jhiTranslate');
    }
}

export class TranCategoryDialogPage {
    modalTitle = element(by.css('h4#myTranCategoryLabel'));
    saveButton = element(by.css('.modal-footer .btn.btn-primary'));
    closeButton = element(by.css('button.close'));
    nameInput = element(by.css('input#field_name'));
    descriptionInput = element(by.css('input#field_description'));
    userSelect = element(by.css('select#field_user'));
    tranCategoryRegexSelect = element(by.css('select#field_tranCategoryRegex'));

    getModalTitle() {
        return this.modalTitle.getAttribute('jhiTranslate');
    }

    setNameInput = function (name) {
        this.nameInput.sendKeys(name);
    }

    getNameInput = function () {
        return this.nameInput.getAttribute('value');
    }

    setDescriptionInput = function (description) {
        this.descriptionInput.sendKeys(description);
    }

    getDescriptionInput = function () {
        return this.descriptionInput.getAttribute('value');
    }

    userSelectLastOption = function () {
        this.userSelect.all(by.tagName('option')).last().click();
    }

    userSelectOption = function (option) {
        this.userSelect.sendKeys(option);
    }

    getUserSelect = function () {
        return this.userSelect;
    }

    getUserSelectedOption = function () {
        return this.userSelect.element(by.css('option:checked')).getText();
    }

    tranCategoryRegexSelectLastOption = function () {
        this.tranCategoryRegexSelect.all(by.tagName('option')).last().click();
    }

    tranCategoryRegexSelectOption = function (option) {
        this.tranCategoryRegexSelect.sendKeys(option);
    }

    getTranCategoryRegexSelect = function () {
        return this.tranCategoryRegexSelect;
    }

    getTranCategoryRegexSelectedOption = function () {
        return this.tranCategoryRegexSelect.element(by.css('option:checked')).getText();
    }

    save() {
        this.saveButton.click();
    }

    close() {
        this.closeButton.click();
    }

    getSaveButton() {
        return this.saveButton;
    }
}
<file_sep>/src/main/java/com/calderon/sf/service/FinanceService.java
package com.calderon.sf.service;

import com.calderon.sf.domain.AccountTransaction;
import com.calderon.sf.domain.FinanceAccount;
import com.calderon.sf.domain.enumeration.PaymentMethod;
import com.calderon.sf.domain.enumeration.TranType;
import com.calderon.sf.repository.AccountTransactionRepository;
import com.calderon.sf.repository.FinanceAccountRepository;
import com.querydsl.core.types.Predicate;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

@Service
public class FinanceService {
    private AccountTransactionRepository tranRepository;
    private FinanceAccountRepository accountRepository;

    public FinanceService(AccountTransactionRepository tranRepository, FinanceAccountRepository accountRepository) {
        this.tranRepository = tranRepository;
        this.accountRepository = accountRepository;
    }

    public List<AccountTransaction> findTransactionBy(Long accountId){
        return tranRepository.findByUserIsCurrentUserAndFinanceAccount_Id(accountId);
    }

    public Page<AccountTransaction> findTransactionBy(Long accountId, Pageable page){
        return tranRepository.findByUserIsCurrentUserAndFinanceAccount_Id(accountId, page);
    }

    public Page<AccountTransaction> findTransactionBy(Predicate predicate, Pageable page){
        return tranRepository.findAll(predicate, page);
    }

    /*public Page<AccountTransaction> findTransactionBy(Long accountId, Pageable page, Predicate predicate){
        return tranRepository.findByUserIsCurrentUserAndFinanceAccount_Id(accountId, page, predicate);
    }*/

    public Page<AccountTransaction> findTransactionBy(FinanceAccount account, Pageable pageable){
        return tranRepository.findByUserIsCurrentUserAndFinanceAccount_Id(account.getId(), pageable);
    }

    public List<AccountTransaction> findTransactionBy(Long accountId, LocalDate start, LocalDate end) {
        return tranRepository.findByUserIsCurrentUserAndFinanceAccount_IdAndPostDateGreaterThanEqualAndPostDateLessThanEqual(accountId, start, end);
    }

    public List<AccountTransaction> findTransactionBy(LocalDate start, LocalDate end) {
        return tranRepository.findByUserIsCurrentUserAndPostDateGreaterThanEqualAndPostDateLessThanEqual(start, end);
    }

    public List<AccountTransaction> findTransactionBy(long[] accountId, LocalDate start, LocalDate end) {
        return tranRepository.findByUserIsCurrentUserAndFinanceAccount_IdIsInAndPostDateGreaterThanEqualAndPostDateLessThanEqual(accountId, start, end);
    }

    @Transactional
    public AccountTransaction saveTransaction(AccountTransaction tran){
        FinanceAccount account = tran.getFinanceAccount();
        account.setBalance(calcNewBalance(account.getBalance(), tran.getAmount(), tran.getTranType()== TranType.INCOME));
        AccountTransaction transaction = tranRepository.save(tran);
        accountRepository.save(account);
        return transaction;
    }

    private BigDecimal calcNewBalance(BigDecimal currentBalance, BigDecimal tranValue, boolean isIncomeType){
        if (isIncomeType)
            return currentBalance.add(tranValue);
        else
            return currentBalance.subtract(tranValue);
    }

    @Transactional
    public List<AccountTransaction> saveTransactions(List<AccountTransaction> transactions) {
        FinanceAccount account = transactions.get(0).getFinanceAccount();
        transactions.stream().forEach(tran -> {
            account.setBalance(calcNewBalance(account.getBalance(), tran.getAmount(), tran.getTranType()== TranType.INCOME));
        });
        List<AccountTransaction> transactionPersited = tranRepository.save(transactions);
        accountRepository.save(account);
        return transactionPersited;
    }

    @Transactional
    public void deleteTransaction(Long id) {
        AccountTransaction tran = tranRepository.getOne(id);
        FinanceAccount account = tran.getFinanceAccount();
        account.setBalance(calcNewBalance(account.getBalance(), tran.getAmount(), tran.getTranType()== TranType.INCOME));
        tranRepository.delete(id);
        accountRepository.save(account);
    }

    public FinanceAccount saveAccount(FinanceAccount account) {
        return saveAccount(account, true);
    }

    public FinanceAccount saveAccount(FinanceAccount account, boolean createDefaultTrans){
        FinanceAccount persistedAccount = accountRepository.save(account);
        if(createDefaultTrans)
            saveTransactions(createDefaultTransactions(persistedAccount));
        return persistedAccount;
    }

    public List<FinanceAccount> saveAccounts(List<FinanceAccount> accounts){
        return saveAccounts(accounts, true);
    }

    public List<FinanceAccount> saveAccounts(List<FinanceAccount> accounts, boolean createDefaultTrans){
        List<FinanceAccount> persistedAccounts = accountRepository.save(accounts);
        persistedAccounts.forEach(account -> {
            if(createDefaultTrans)
                saveTransactions(createDefaultTransactions(account));
        });
        return persistedAccounts;
    }

    private List<AccountTransaction> createDefaultTransactions(FinanceAccount account){
        List<AccountTransaction> transactions = new ArrayList<>();
        transactions.add(new AccountTransaction().amount(new BigDecimal(0)).description("Initial Balance").paymentMethod(PaymentMethod.UNSPECIFIED).postDate(LocalDate.now()).tranType(TranType.INCOME).user(account.getUser()).financeAccount(account));
        return transactions;
    }

    public Page<FinanceAccount> findAccounts(Pageable pageable) {
        return accountRepository.findAll(pageable);
    }

    public FinanceAccount findAccount(Long id) {
        return accountRepository.findOne(id);
    }


    public void deleteAccount(Long id) {
        accountRepository.delete(id);
    }

    public Page<FinanceAccount> findAccountsByCurrentUserAndActive(Pageable pageable) {
        return accountRepository.findByUserIsCurrentUserAndAccountStatusIsActive(pageable);
    }
}
<file_sep>/src/test/java/com/calderon/sf/web/rest/TranCategoryResourceIntTest.java
package com.calderon.sf.web.rest;

import com.calderon.sf.SfWebClientApp;

import com.calderon.sf.domain.TranCategory;
import com.calderon.sf.repository.TranCategoryRepository;
import com.calderon.sf.web.rest.errors.ExceptionTranslator;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.MockitoAnnotations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;

import javax.persistence.EntityManager;
import java.util.List;

import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;

/**
 * Test class for the TranCategoryResource REST controller.
 *
 * @see TranCategoryResource
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SfWebClientApp.class)
public class TranCategoryResourceIntTest {

    private static final String DEFAULT_NAME = "AAAAAAAAAA";
    private static final String UPDATED_NAME = "BBBBBBBBBB";

    private static final String DEFAULT_DESCRIPTION = "AAAAAAAAAA";
    private static final String UPDATED_DESCRIPTION = "BBBBBBBBBB";

    @Autowired
    private TranCategoryRepository tranCategoryRepository;

    @Autowired
    private MappingJackson2HttpMessageConverter jacksonMessageConverter;

    @Autowired
    private PageableHandlerMethodArgumentResolver pageableArgumentResolver;

    @Autowired
    private ExceptionTranslator exceptionTranslator;

    @Autowired
    private EntityManager em;

    private MockMvc restTranCategoryMockMvc;

    private TranCategory tranCategory;

    @Before
    public void setup() {
        MockitoAnnotations.initMocks(this);
        final TranCategoryResource tranCategoryResource = new TranCategoryResource(tranCategoryRepository);
        this.restTranCategoryMockMvc = MockMvcBuilders.standaloneSetup(tranCategoryResource)
            .setCustomArgumentResolvers(pageableArgumentResolver)
            .setControllerAdvice(exceptionTranslator)
            .setMessageConverters(jacksonMessageConverter).build();
    }

    /**
     * Create an entity for this test.
     *
     * This is a static method, as tests for other entities might also need it,
     * if they test an entity which requires the current entity.
     */
    public static TranCategory createEntity(EntityManager em) {
        TranCategory tranCategory = new TranCategory()
            .name(DEFAULT_NAME)
            .description(DEFAULT_DESCRIPTION);
        return tranCategory;
    }

    @Before
    public void initTest() {
        tranCategory = createEntity(em);
    }

    @Test
    @Transactional
    public void createTranCategory() throws Exception {
        int databaseSizeBeforeCreate = tranCategoryRepository.findAll().size();

        // Create the TranCategory
        restTranCategoryMockMvc.perform(post("/api/tran-categories")
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
            .content(TestUtil.convertObjectToJsonBytes(tranCategory)))
            .andExpect(status().isCreated());

        // Validate the TranCategory in the database
        List<TranCategory> tranCategoryList = tranCategoryRepository.findAll();
        assertThat(tranCategoryList).hasSize(databaseSizeBeforeCreate + 1);
        TranCategory testTranCategory = tranCategoryList.get(tranCategoryList.size() - 1);
        assertThat(testTranCategory.getName()).isEqualTo(DEFAULT_NAME);
        assertThat(testTranCategory.getDescription()).isEqualTo(DEFAULT_DESCRIPTION);
    }

    @Test
    @Transactional
    public void createTranCategoryWithExistingId() throws Exception {
        int databaseSizeBeforeCreate = tranCategoryRepository.findAll().size();

        // Create the TranCategory with an existing ID
        tranCategory.setId(1L);

        // An entity with an existing ID cannot be created, so this API call must fail
        restTranCategoryMockMvc.perform(post("/api/tran-categories")
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
            .content(TestUtil.convertObjectToJsonBytes(tranCategory)))
            .andExpect(status().isBadRequest());

        // Validate the TranCategory in the database
        List<TranCategory> tranCategoryList = tranCategoryRepository.findAll();
        assertThat(tranCategoryList).hasSize(databaseSizeBeforeCreate);
    }

    @Test
    @Transactional
    public void checkNameIsRequired() throws Exception {
        int databaseSizeBeforeTest = tranCategoryRepository.findAll().size();
        // set the field null
        tranCategory.setName(null);

        // Create the TranCategory, which fails.

        restTranCategoryMockMvc.perform(post("/api/tran-categories")
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
            .content(TestUtil.convertObjectToJsonBytes(tranCategory)))
            .andExpect(status().isBadRequest());

        List<TranCategory> tranCategoryList = tranCategoryRepository.findAll();
        assertThat(tranCategoryList).hasSize(databaseSizeBeforeTest);
    }

    @Test
    @Transactional
    public void getAllTranCategories() throws Exception {
        // Initialize the database
        tranCategoryRepository.saveAndFlush(tranCategory);

        // Get all the tranCategoryList
        restTranCategoryMockMvc.perform(get("/api/tran-categories?sort=id,desc"))
            .andExpect(status().isOk())
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
            .andExpect(jsonPath("$.[*].id").value(hasItem(tranCategory.getId().intValue())))
            .andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME.toString())))
            .andExpect(jsonPath("$.[*].description").value(hasItem(DEFAULT_DESCRIPTION.toString())));
    }

    @Test
    @Transactional
    public void getTranCategory() throws Exception {
        // Initialize the database
        tranCategoryRepository.saveAndFlush(tranCategory);

        // Get the tranCategory
        restTranCategoryMockMvc.perform(get("/api/tran-categories/{id}", tranCategory.getId()))
            .andExpect(status().isOk())
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
            .andExpect(jsonPath("$.id").value(tranCategory.getId().intValue()))
            .andExpect(jsonPath("$.name").value(DEFAULT_NAME.toString()))
            .andExpect(jsonPath("$.description").value(DEFAULT_DESCRIPTION.toString()));
    }

    @Test
    @Transactional
    public void getNonExistingTranCategory() throws Exception {
        // Get the tranCategory
        restTranCategoryMockMvc.perform(get("/api/tran-categories/{id}", Long.MAX_VALUE))
            .andExpect(status().isNotFound());
    }

    @Test
    @Transactional
    public void updateTranCategory() throws Exception {
        // Initialize the database
        tranCategoryRepository.saveAndFlush(tranCategory);
        int databaseSizeBeforeUpdate = tranCategoryRepository.findAll().size();

        // Update the tranCategory
        TranCategory updatedTranCategory = tranCategoryRepository.findOne(tranCategory.getId());
        updatedTranCategory
            .name(UPDATED_NAME)
            .description(UPDATED_DESCRIPTION);

        restTranCategoryMockMvc.perform(put("/api/tran-categories")
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
            .content(TestUtil.convertObjectToJsonBytes(updatedTranCategory)))
            .andExpect(status().isOk());

        // Validate the TranCategory in the database
        List<TranCategory> tranCategoryList = tranCategoryRepository.findAll();
        assertThat(tranCategoryList).hasSize(databaseSizeBeforeUpdate);
        TranCategory testTranCategory = tranCategoryList.get(tranCategoryList.size() - 1);
        assertThat(testTranCategory.getName()).isEqualTo(UPDATED_NAME);
        assertThat(testTranCategory.getDescription()).isEqualTo(UPDATED_DESCRIPTION);
    }

    @Test
    @Transactional
    public void updateNonExistingTranCategory() throws Exception {
        int databaseSizeBeforeUpdate = tranCategoryRepository.findAll().size();

        // Create the TranCategory

        // If the entity doesn't have an ID, it will be created instead of just being updated
        restTranCategoryMockMvc.perform(put("/api/tran-categories")
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
            .content(TestUtil.convertObjectToJsonBytes(tranCategory)))
            .andExpect(status().isCreated());

        // Validate the TranCategory in the database
        List<TranCategory> tranCategoryList = tranCategoryRepository.findAll();
        assertThat(tranCategoryList).hasSize(databaseSizeBeforeUpdate + 1);
    }

    @Test
    @Transactional
    public void deleteTranCategory() throws Exception {
        // Initialize the database
        tranCategoryRepository.saveAndFlush(tranCategory);
        int databaseSizeBeforeDelete = tranCategoryRepository.findAll().size();

        // Get the tranCategory
        restTranCategoryMockMvc.perform(delete("/api/tran-categories/{id}", tranCategory.getId())
            .accept(TestUtil.APPLICATION_JSON_UTF8))
            .andExpect(status().isOk());

        // Validate the database is empty
        List<TranCategory> tranCategoryList = tranCategoryRepository.findAll();
        assertThat(tranCategoryList).hasSize(databaseSizeBeforeDelete - 1);
    }

    @Test
    @Transactional
    public void equalsVerifier() throws Exception {
        TestUtil.equalsVerifier(TranCategory.class);
        TranCategory tranCategory1 = new TranCategory();
        tranCategory1.setId(1L);
        TranCategory tranCategory2 = new TranCategory();
        tranCategory2.setId(tranCategory1.getId());
        assertThat(tranCategory1).isEqualTo(tranCategory2);
        tranCategory2.setId(2L);
        assertThat(tranCategory1).isNotEqualTo(tranCategory2);
        tranCategory1.setId(null);
        assertThat(tranCategory1).isNotEqualTo(tranCategory2);
    }
}
<file_sep>/src/main/webapp/app/shared/charts/sf-charts.module.ts
import {CUSTOM_ELEMENTS_SCHEMA, NgModule} from '@angular/core';
import {LineChartComponent} from './line-chart/line-chart.component';
import {ChartsModule} from 'ng2-charts';
import {SfWebClientSharedModule} from '../shared.module';
import {BarChartComponent} from './bar-chart/bar-chart.component';

@NgModule({
    imports: [
        ChartsModule, SfWebClientSharedModule
    ],
    declarations: [LineChartComponent, BarChartComponent],
    exports: [LineChartComponent, BarChartComponent],
    providers: [],
    entryComponents: [],
    schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class SfChartsModule {
}
<file_sep>/src/main/webapp/app/shared/charts/tran-chart-data.ts
import {AccountTransaction, TranType} from '../../sf-entities/account-transaction/account-transaction.model';

export class TranChartData {

    constructor(private _transactions: AccountTransaction[]) {

    }


    set transactions(value: AccountTransaction[]) {
        this._transactions = value;
    }

    getChartData(year: number): Array<any> {
        let arr = [];
        let expenseDataObj = { data: [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], label: 'EXPENSES', backgroundColor: 'rgb(255, 99, 132)',
            borderColor: 'rgb(255, 99, 132)'};
        let incomesDataObj = { data: [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], label: 'INCOMES'
            , backgroundColor: 'rgb(54, 162, 235)',
            borderColor: 'rgb(54, 162, 235)'};

        for(const tran of this._transactions){
            if (tran.postDate.getFullYear() !== year) {
                continue;
            }

            const month = tran.postDate.getMonth();
            let currentValExp = expenseDataObj.data[month];
            currentValExp = currentValExp === -1 ? 0 : currentValExp;
            let currentValInc = incomesDataObj.data[month];
            currentValInc = currentValInc === -1 ? 0 : currentValInc;
            if (<string><any>tran.tranType === 'EXPENSE') {
                currentValExp = tran.amount + currentValExp;
            }else {
                currentValInc = tran.amount + currentValInc;
            }
            expenseDataObj.data[month] = currentValExp;
            incomesDataObj.data[month] = currentValInc;
            /*let label = new DecimalPipe('USD').transform(acc, '2.2-2');*/
        }

        expenseDataObj.data = expenseDataObj.data.filter((value) => {
            return value !== -1;
        });

        incomesDataObj.data = incomesDataObj.data.filter((value) => {
            return value !== -1;
        });

        arr.push(expenseDataObj);
        arr.push(incomesDataObj);
        return arr;
    }

    getChartLabels(year: number) {
        const arr = [];
        const months = {
            'Jan' : false,
            'Feb' : false,
            'Mar' : false,
            'Apr' : false,
            'May' : false,
            'Jun' : false,
            'Jul' : false,
            'Aug' : false,
            'Sep': false,
            'Oct' : false,
            'Nov' : false,
            'Dec' : false
        };
        const chartLabels = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
        for (const tran of this._transactions) {
            if (tran.postDate.getFullYear() !== year) {
                continue;
            }
            const month = tran.postDate.getMonth();
            months[chartLabels[month]] = true;
        }

        for (const val in months) {
            if (months[val] === true) {
                arr.push(val);
            }
        }
        return arr;
    }

}
<file_sep>/src/main/java/com/calderon/sf/domain/TranCategory.java
package com.calderon.sf.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;

/**
 * A TranCategory.
 */
@Entity
@Table(name = "tran_category")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class TranCategory extends AbstractAuditingEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @NotNull
    @Size(min = 2, max = 64)
    @Column(name = "name", length = 64, nullable = false)
    private String name;

    @Size(max = 256)
    @Column(name = "description", length = 256)
    private String description;

    @OneToMany(mappedBy = "tranCategory")
    @JsonIgnore
    @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
    private Set<AccountTransaction> transactions = new HashSet<>();

    @ManyToOne
    private User user;

    @ManyToOne
    private TranCategoryRegex tranCategoryRegex;

    // jhipster-needle-entity-add-field - Jhipster will add fields here, do not remove
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public TranCategory name(String name) {
        this.name = name;
        return this;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public TranCategory description(String description) {
        this.description = description;
        return this;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Set<AccountTransaction> getTransactions() {
        return transactions;
    }

    public TranCategory transactions(Set<AccountTransaction> accountTransactions) {
        this.transactions = accountTransactions;
        return this;
    }

    public TranCategory addTransaction(AccountTransaction accountTransaction) {
        this.transactions.add(accountTransaction);
        accountTransaction.setTranCategory(this);
        return this;
    }

    public TranCategory removeTransaction(AccountTransaction accountTransaction) {
        this.transactions.remove(accountTransaction);
        accountTransaction.setTranCategory(null);
        return this;
    }

    public void setTransactions(Set<AccountTransaction> accountTransactions) {
        this.transactions = accountTransactions;
    }

    public User getUser() {
        return user;
    }

    public TranCategory user(User user) {
        this.user = user;
        return this;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public TranCategoryRegex getTranCategoryRegex() {
        return tranCategoryRegex;
    }

    public TranCategory tranCategoryRegex(TranCategoryRegex tranCategoryRegex) {
        this.tranCategoryRegex = tranCategoryRegex;
        return this;
    }

    public void setTranCategoryRegex(TranCategoryRegex tranCategoryRegex) {
        this.tranCategoryRegex = tranCategoryRegex;
    }
    // jhipster-needle-entity-add-getters-setters - Jhipster will add getters and setters here, do not remove

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        TranCategory tranCategory = (TranCategory) o;
        if (tranCategory.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), tranCategory.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    @Override
    public String toString() {
        return "TranCategory{" +
            "id=" + getId() +
            ", name='" + getName() + "'" +
            ", description='" + getDescription() + "'" +
            "}";
    }
}
<file_sep>/src/main/webapp/app/shared/search/search-options.ts
export interface SearchOptions {
    cssClass: string[];
    placeHolder: string;
}
<file_sep>/src/main/java/com/calderon/sf/repository/BankRepository.java
package com.calderon.sf.repository;

import com.calderon.sf.domain.Bank;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

/**
 * Spring Data JPA repository for the Bank entity.
 */
@SuppressWarnings("unused")
@Repository
public interface BankRepository extends JpaRepository<Bank, Long> {

}
<file_sep>/src/main/webapp/app/sf-entities/tran-category-regex/tran-category-regex-dialog.component.ts
import { Component, OnInit, OnDestroy } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Response } from '@angular/http';

import { Observable } from 'rxjs/Rx';
import { NgbActiveModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
import { JhiEventManager, JhiAlertService } from 'ng-jhipster';

import { TranCategoryRegex } from './tran-category-regex.model';
import { TranCategoryRegexPopupService } from './tran-category-regex-popup.service';
import { TranCategoryRegexService } from './tran-category-regex.service';
import { User, UserService } from '../../shared';
import { ResponseWrapper } from '../../shared';

@Component({
    selector: 'jhi-tran-category-regex-dialog',
    templateUrl: './tran-category-regex-dialog.component.html'
})
export class TranCategoryRegexDialogComponent implements OnInit {

    tranCategoryRegex: TranCategoryRegex;
    isSaving: boolean;

    users: User[];

    constructor(
        public activeModal: NgbActiveModal,
        private alertService: JhiAlertService,
        private tranCategoryRegexService: TranCategoryRegexService,
        private userService: UserService,
        private eventManager: JhiEventManager
    ) {
    }

    ngOnInit() {
        this.isSaving = false;
        this.userService.query()
            .subscribe((res: ResponseWrapper) => { this.users = res.json; }, (res: ResponseWrapper) => this.onError(res.json));
    }

    clear() {
        this.activeModal.dismiss('cancel');
    }

    save() {
        this.isSaving = true;
        if (this.tranCategoryRegex.id !== undefined) {
            this.subscribeToSaveResponse(
                this.tranCategoryRegexService.update(this.tranCategoryRegex));
        } else {
            this.subscribeToSaveResponse(
                this.tranCategoryRegexService.create(this.tranCategoryRegex));
        }
    }

    private subscribeToSaveResponse(result: Observable<TranCategoryRegex>) {
        result.subscribe((res: TranCategoryRegex) =>
            this.onSaveSuccess(res), (res: Response) => this.onSaveError());
    }

    private onSaveSuccess(result: TranCategoryRegex) {
        this.eventManager.broadcast({ name: 'tranCategoryRegexListModification', content: 'OK'});
        this.isSaving = false;
        this.activeModal.dismiss(result);
    }

    private onSaveError() {
        this.isSaving = false;
    }

    private onError(error: any) {
        this.alertService.error(error.message, null, null);
    }

    trackUserById(index: number, item: User) {
        return item.id;
    }
}

@Component({
    selector: 'jhi-tran-category-regex-popup',
    template: ''
})
export class TranCategoryRegexPopupComponent implements OnInit, OnDestroy {

    routeSub: any;

    constructor(
        private route: ActivatedRoute,
        private tranCategoryRegexPopupService: TranCategoryRegexPopupService
    ) {}

    ngOnInit() {
        this.routeSub = this.route.params.subscribe((params) => {
            if ( params['id'] ) {
                this.tranCategoryRegexPopupService
                    .open(TranCategoryRegexDialogComponent as Component, params['id']);
            } else {
                this.tranCategoryRegexPopupService
                    .open(TranCategoryRegexDialogComponent as Component);
            }
        });
    }

    ngOnDestroy() {
        this.routeSub.unsubscribe();
    }
}
<file_sep>/src/main/webapp/app/sf-entities/tran-category/tran-category-popup.service.ts
import { Injectable, Component } from '@angular/core';
import { Router } from '@angular/router';
import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
import { TranCategory } from './tran-category.model';
import { TranCategoryService } from './tran-category.service';
import {Principal} from '../../shared/auth/principal.service';
import {DatetimeService} from '../../shared/datetime/datetime.service';
import {LoggerService} from '../../shared/logger/logger.service';
import {User} from '../../shared/user/user.model';

@Injectable()
export class TranCategoryPopupService {
    private ngbModalRef: NgbModalRef;
    private currentUser: User;

    constructor(
        private modalService: NgbModal,
        private router: Router,
        private tranCategoryService: TranCategoryService,
        private principal: Principal,
        private logger: LoggerService,
        private dateTimeService: DatetimeService

    ) {
        this.ngbModalRef = null;
    }

    newCategory(): TranCategory{
        const category: TranCategory = new TranCategory();
        this.principal.identity().then((user) => {
            this.currentUser = user;
            category.user = user;
        });
        return category;
    }

    open(component: Component, id?: number | any): Promise<NgbModalRef> {
        return new Promise<NgbModalRef>((resolve, reject) => {
            const isOpen = this.ngbModalRef !== null;
            if (isOpen) {
                resolve(this.ngbModalRef);
            }

            if (id) {
                this.tranCategoryService.find(id).subscribe((tranCategory) => {
                    this.ngbModalRef = this.tranCategoryModalRef(component, tranCategory);
                    resolve(this.ngbModalRef);
                });
            } else {
                // setTimeout used as a workaround for getting ExpressionChangedAfterItHasBeenCheckedError
                setTimeout(() => {
                    this.ngbModalRef = this.tranCategoryModalRef(component, this.newCategory());
                    resolve(this.ngbModalRef);
                }, 0);
            }
        });
    }

    tranCategoryModalRef(component: Component, tranCategory: TranCategory): NgbModalRef {
        const modalRef = this.modalService.open(component, { size: 'lg', backdrop: 'static'});
        modalRef.componentInstance.tranCategory = tranCategory;
        modalRef.result.then((result) => {
            this.router.navigate([{ outlets: { popup: null }}], { replaceUrl: true });
            this.ngbModalRef = null;
        }, (reason) => {
            this.router.navigate([{ outlets: { popup: null }}], { replaceUrl: true });
            this.ngbModalRef = null;
        });
        return modalRef;
    }
}
<file_sep>/src/main/webapp/app/sf-entities/tran-category-regex/tran-category-regex-detail.component.ts
import { Component, OnInit, OnDestroy } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Subscription } from 'rxjs/Rx';
import { JhiEventManager } from 'ng-jhipster';

import { TranCategoryRegex } from './tran-category-regex.model';
import { TranCategoryRegexService } from './tran-category-regex.service';

@Component({
    selector: 'jhi-tran-category-regex-detail',
    templateUrl: './tran-category-regex-detail.component.html'
})
export class TranCategoryRegexDetailComponent implements OnInit, OnDestroy {

    tranCategoryRegex: TranCategoryRegex;
    private subscription: Subscription;
    private eventSubscriber: Subscription;

    constructor(
        private eventManager: JhiEventManager,
        private tranCategoryRegexService: TranCategoryRegexService,
        private route: ActivatedRoute
    ) {
    }

    ngOnInit() {
        this.subscription = this.route.params.subscribe((params) => {
            this.load(params['id']);
        });
        this.registerChangeInTranCategoryRegexes();
    }

    load(id) {
        this.tranCategoryRegexService.find(id).subscribe((tranCategoryRegex) => {
            this.tranCategoryRegex = tranCategoryRegex;
        });
    }
    previousState() {
        window.history.back();
    }

    ngOnDestroy() {
        this.subscription.unsubscribe();
        this.eventManager.destroy(this.eventSubscriber);
    }

    registerChangeInTranCategoryRegexes() {
        this.eventSubscriber = this.eventManager.subscribe(
            'tranCategoryRegexListModification',
            (response) => this.load(this.tranCategoryRegex.id)
        );
    }
}
<file_sep>/src/main/webapp/app/shared/datetime/datetime.service.ts
import {Injectable} from '@angular/core';

@Injectable()
export class DatetimeService {

    constructor() {
    }

    now(): string {
        const date: Date = new Date();
        return date.toString();
    }

    nowLocalDate(): any {
        const date: Date = new Date();
        return {
            year: date.getFullYear()
            , month: date.getMonth()+1
            , day: date.getDate()
        };
    }

    convertToObjDate(date: any): any {
        return {
            year: date.getFullYear()
            , month: date.getMonth()+1
            , day: date.getDate()
        };
    }

}
<file_sep>/src/main/webapp/app/shared/animation/enter-leave-animation.ts
import { trigger, state, style, animate, transition, stagger, query} from '@angular/animations';

export const ENTER_LEAVE_ANIMATION = [
    trigger('in-out', [
        state('in', style({
            transform: 'translateX(0)',
            opacity: 1
        })),
        transition('void => *', [
            style({
                transform: 'translateX(-100%)',
                opacity: 1
            }),
            animate('0.4s ease-in')

        ]),
        transition('* => void', [
            style({
                transform: 'translateX(100%)',
                opacity: 0
            }),
            animate('0.2s 0.5s ease-out')
        ])
    ])
];
<file_sep>/src/test/java/com/calderon/sf/web/rest/BankResourceIntTest.java
package com.calderon.sf.web.rest;

import com.calderon.sf.SfWebClientApp;

import com.calderon.sf.domain.Bank;
import com.calderon.sf.repository.BankRepository;
import com.calderon.sf.web.rest.errors.ExceptionTranslator;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.MockitoAnnotations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;

import javax.persistence.EntityManager;
import java.util.List;

import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;

/**
 * Test class for the BankResource REST controller.
 *
 * @see BankResource
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SfWebClientApp.class)
public class BankResourceIntTest {

    private static final String DEFAULT_NAME = "AAAAAAAAAA";
    private static final String UPDATED_NAME = "BBBBBBBBBB";

    private static final String DEFAULT_DESCRIPTION = "AAAAAAAAAA";
    private static final String UPDATED_DESCRIPTION = "BBBBBBBBBB";

    @Autowired
    private BankRepository bankRepository;

    @Autowired
    private MappingJackson2HttpMessageConverter jacksonMessageConverter;

    @Autowired
    private PageableHandlerMethodArgumentResolver pageableArgumentResolver;

    @Autowired
    private ExceptionTranslator exceptionTranslator;

    @Autowired
    private EntityManager em;

    private MockMvc restBankMockMvc;

    private Bank bank;

    @Before
    public void setup() {
        MockitoAnnotations.initMocks(this);
        final BankResource bankResource = new BankResource(bankRepository);
        this.restBankMockMvc = MockMvcBuilders.standaloneSetup(bankResource)
            .setCustomArgumentResolvers(pageableArgumentResolver)
            .setControllerAdvice(exceptionTranslator)
            .setMessageConverters(jacksonMessageConverter).build();
    }

    /**
     * Create an entity for this test.
     *
     * This is a static method, as tests for other entities might also need it,
     * if they test an entity which requires the current entity.
     */
    public static Bank createEntity(EntityManager em) {
        Bank bank = new Bank()
            .name(DEFAULT_NAME)
            .description(DEFAULT_DESCRIPTION);
        return bank;
    }

    @Before
    public void initTest() {
        bank = createEntity(em);
    }

    @Test
    @Transactional
    public void createBank() throws Exception {
        int databaseSizeBeforeCreate = bankRepository.findAll().size();

        // Create the Bank
        restBankMockMvc.perform(post("/api/banks")
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
            .content(TestUtil.convertObjectToJsonBytes(bank)))
            .andExpect(status().isCreated());

        // Validate the Bank in the database
        List<Bank> bankList = bankRepository.findAll();
        assertThat(bankList).hasSize(databaseSizeBeforeCreate + 1);
        Bank testBank = bankList.get(bankList.size() - 1);
        assertThat(testBank.getName()).isEqualTo(DEFAULT_NAME);
        assertThat(testBank.getDescription()).isEqualTo(DEFAULT_DESCRIPTION);
    }

    @Test
    @Transactional
    public void createBankWithExistingId() throws Exception {
        int databaseSizeBeforeCreate = bankRepository.findAll().size();

        // Create the Bank with an existing ID
        bank.setId(1L);

        // An entity with an existing ID cannot be created, so this API call must fail
        restBankMockMvc.perform(post("/api/banks")
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
            .content(TestUtil.convertObjectToJsonBytes(bank)))
            .andExpect(status().isBadRequest());

        // Validate the Bank in the database
        List<Bank> bankList = bankRepository.findAll();
        assertThat(bankList).hasSize(databaseSizeBeforeCreate);
    }

    @Test
    @Transactional
    public void checkNameIsRequired() throws Exception {
        int databaseSizeBeforeTest = bankRepository.findAll().size();
        // set the field null
        bank.setName(null);

        // Create the Bank, which fails.

        restBankMockMvc.perform(post("/api/banks")
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
            .content(TestUtil.convertObjectToJsonBytes(bank)))
            .andExpect(status().isBadRequest());

        List<Bank> bankList = bankRepository.findAll();
        assertThat(bankList).hasSize(databaseSizeBeforeTest);
    }

    @Test
    @Transactional
    public void getAllBanks() throws Exception {
        // Initialize the database
        bankRepository.saveAndFlush(bank);

        // Get all the bankList
        restBankMockMvc.perform(get("/api/banks?sort=id,desc"))
            .andExpect(status().isOk())
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
            .andExpect(jsonPath("$.[*].id").value(hasItem(bank.getId().intValue())))
            .andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME.toString())))
            .andExpect(jsonPath("$.[*].description").value(hasItem(DEFAULT_DESCRIPTION.toString())));
    }

    @Test
    @Transactional
    public void getBank() throws Exception {
        // Initialize the database
        bankRepository.saveAndFlush(bank);

        // Get the bank
        restBankMockMvc.perform(get("/api/banks/{id}", bank.getId()))
            .andExpect(status().isOk())
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
            .andExpect(jsonPath("$.id").value(bank.getId().intValue()))
            .andExpect(jsonPath("$.name").value(DEFAULT_NAME.toString()))
            .andExpect(jsonPath("$.description").value(DEFAULT_DESCRIPTION.toString()));
    }

    @Test
    @Transactional
    public void getNonExistingBank() throws Exception {
        // Get the bank
        restBankMockMvc.perform(get("/api/banks/{id}", Long.MAX_VALUE))
            .andExpect(status().isNotFound());
    }

    @Test
    @Transactional
    public void updateBank() throws Exception {
        // Initialize the database
        bankRepository.saveAndFlush(bank);
        int databaseSizeBeforeUpdate = bankRepository.findAll().size();

        // Update the bank
        Bank updatedBank = bankRepository.findOne(bank.getId());
        updatedBank
            .name(UPDATED_NAME)
            .description(UPDATED_DESCRIPTION);

        restBankMockMvc.perform(put("/api/banks")
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
            .content(TestUtil.convertObjectToJsonBytes(updatedBank)))
            .andExpect(status().isOk());

        // Validate the Bank in the database
        List<Bank> bankList = bankRepository.findAll();
        assertThat(bankList).hasSize(databaseSizeBeforeUpdate);
        Bank testBank = bankList.get(bankList.size() - 1);
        assertThat(testBank.getName()).isEqualTo(UPDATED_NAME);
        assertThat(testBank.getDescription()).isEqualTo(UPDATED_DESCRIPTION);
    }

    @Test
    @Transactional
    public void updateNonExistingBank() throws Exception {
        int databaseSizeBeforeUpdate = bankRepository.findAll().size();

        // Create the Bank

        // If the entity doesn't have an ID, it will be created instead of just being updated
        restBankMockMvc.perform(put("/api/banks")
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
            .content(TestUtil.convertObjectToJsonBytes(bank)))
            .andExpect(status().isCreated());

        // Validate the Bank in the database
        List<Bank> bankList = bankRepository.findAll();
        assertThat(bankList).hasSize(databaseSizeBeforeUpdate + 1);
    }

    @Test
    @Transactional
    public void deleteBank() throws Exception {
        // Initialize the database
        bankRepository.saveAndFlush(bank);
        int databaseSizeBeforeDelete = bankRepository.findAll().size();

        // Get the bank
        restBankMockMvc.perform(delete("/api/banks/{id}", bank.getId())
            .accept(TestUtil.APPLICATION_JSON_UTF8))
            .andExpect(status().isOk());

        // Validate the database is empty
        List<Bank> bankList = bankRepository.findAll();
        assertThat(bankList).hasSize(databaseSizeBeforeDelete - 1);
    }

    @Test
    @Transactional
    public void equalsVerifier() throws Exception {
        TestUtil.equalsVerifier(Bank.class);
        Bank bank1 = new Bank();
        bank1.setId(1L);
        Bank bank2 = new Bank();
        bank2.setId(bank1.getId());
        assertThat(bank1).isEqualTo(bank2);
        bank2.setId(2L);
        assertThat(bank1).isNotEqualTo(bank2);
        bank1.setId(null);
        assertThat(bank1).isNotEqualTo(bank2);
    }
}
<file_sep>/src/main/java/com/calderon/sf/domain/predicates/TransactionCriteria.java
package com.calderon.sf.domain.predicates;

import com.fasterxml.jackson.annotation.JsonInclude;
import org.json.JSONObject;

import java.math.BigDecimal;
import java.time.LocalDate;

@JsonInclude(JsonInclude.Include.NON_NULL)
public class TransactionCriteria {
    private boolean active;
    private LocalDate startDate;
    private LocalDate endDate;
    private BigDecimal startAmount;
    private BigDecimal endAmount;
    private String desc;

    public TransactionCriteria(JSONObject json) {
        this.active = json.optBoolean("active", false);
        this.desc = json.optString("desc", "");
        String startDate = json.optString("startDate", "");
        if (!startDate.isEmpty()){
            this.startDate = LocalDate.parse(startDate);
        }
        String endDate = json.optString("endDate", "");
        if (!endDate.isEmpty()){
            this.endDate = LocalDate.parse(endDate);
        }

        String startAmount = json.optString("startAmount", "");
        if (!startAmount.isEmpty()){
            this.startAmount = new BigDecimal(startAmount);
        }

        String endAmount = json.optString("endAmount", "");
        if (!endAmount.isEmpty()){
            this.endAmount = new BigDecimal(endAmount);
        }
    }

    public boolean isActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    public LocalDate getStartDate() {
        return startDate;
    }

    public void setStartDate(LocalDate startDate) {
        this.startDate = startDate;
    }

    public LocalDate getEndDate() {
        return endDate;
    }

    public void setEndDate(LocalDate endDate) {
        this.endDate = endDate;
    }

    public BigDecimal getStartAmount() {
        return startAmount;
    }

    public void setStartAmount(BigDecimal startAmount) {
        this.startAmount = startAmount;
    }

    public BigDecimal getEndAmount() {
        return endAmount;
    }

    public void setEndAmount(BigDecimal endAmount) {
        this.endAmount = endAmount;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    /*private String desc;

        public boolean isActive() {
            return active;
        }

        public void setActive(boolean active) {
            this.active = active;
        }

        public LocalDate getStartDate() {
            return startDate;
        }

        public void setStartDate(LocalDate startDate) {
            this.startDate = startDate;
        }

        public LocalDate getEndDate() {
            return endDate;
        }

        public void setEndDate(LocalDate endDate) {
            this.endDate = endDate;
        }

        public BigDecimal getStartAmount() {
            return startAmount;
        }

        public void setStartAmount(BigDecimal startAmount) {
            this.startAmount = startAmount;
        }

        public BigDecimal getEndAmount() {
            return endAmount;
        }

        public void setEndAmount(BigDecimal endAmount) {
            this.endAmount = endAmount;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }

        public TransactionCriteria active(boolean active) {
            this.active = active;
            return this;
        }

        public TransactionCriteria startDate(LocalDate startDate) {
            this.startDate = startDate;
            return this;
        }

        public TransactionCriteria endDate(LocalDate endDate) {
            this.endDate = endDate;
            return this;
        }

        public TransactionCriteria startAmount(BigDecimal startAmount) {
            this.startAmount = startAmount;
            return this;
        }

        public TransactionCriteria endAmount(BigDecimal endAmount) {
            this.endAmount = endAmount;
            return this;
        }

        public TransactionCriteria desc(String desc) {
            this.desc = desc;
            return this;
        }*/
}
<file_sep>/src/main/webapp/app/sf-entities/tran-category-regex/tran-category-regex.module.ts
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { RouterModule } from '@angular/router';

import { SfWebClientSharedModule } from '../../shared';
import { SfWebClientAdminModule } from '../../admin/admin.module';
import {
    TranCategoryRegexService,
    TranCategoryRegexPopupService,
    TranCategoryRegexComponent,
    TranCategoryRegexDetailComponent,
    TranCategoryRegexDialogComponent,
    TranCategoryRegexPopupComponent,
    TranCategoryRegexDeletePopupComponent,
    TranCategoryRegexDeleteDialogComponent,
    tranCategoryRegexRoute,
    tranCategoryRegexPopupRoute,
    TranCategoryRegexResolvePagingParams,
} from './';

const ENTITY_STATES = [
    ...tranCategoryRegexRoute,
    ...tranCategoryRegexPopupRoute,
];

@NgModule({
    imports: [
        SfWebClientSharedModule,
        SfWebClientAdminModule,
        RouterModule.forRoot(ENTITY_STATES, { useHash: true })
    ],
    declarations: [
        TranCategoryRegexComponent,
        TranCategoryRegexDetailComponent,
        TranCategoryRegexDialogComponent,
        TranCategoryRegexDeleteDialogComponent,
        TranCategoryRegexPopupComponent,
        TranCategoryRegexDeletePopupComponent,
    ],
    entryComponents: [
        TranCategoryRegexComponent,
        TranCategoryRegexDialogComponent,
        TranCategoryRegexPopupComponent,
        TranCategoryRegexDeleteDialogComponent,
        TranCategoryRegexDeletePopupComponent,
    ],
    providers: [
        TranCategoryRegexService,
        TranCategoryRegexPopupService,
        TranCategoryRegexResolvePagingParams,
    ],
    schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class SfWebClientTranCategoryRegexModule {}
<file_sep>/src/main/webapp/app/entities/tran-category/tran-category.route.ts
import { Injectable } from '@angular/core';
import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot, Routes, CanActivate } from '@angular/router';

import { UserRouteAccessService } from '../../shared';
import { JhiPaginationUtil } from 'ng-jhipster';

import { TranCategoryComponent } from './tran-category.component';
import { TranCategoryDetailComponent } from './tran-category-detail.component';
import { TranCategoryPopupComponent } from './tran-category-dialog.component';
import { TranCategoryDeletePopupComponent } from './tran-category-delete-dialog.component';

@Injectable()
export class TranCategoryResolvePagingParams implements Resolve<any> {

    constructor(private paginationUtil: JhiPaginationUtil) {}

    resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
        const page = route.queryParams['page'] ? route.queryParams['page'] : '1';
        const sort = route.queryParams['sort'] ? route.queryParams['sort'] : 'id,asc';
        return {
            page: this.paginationUtil.parsePage(page),
            predicate: this.paginationUtil.parsePredicate(sort),
            ascending: this.paginationUtil.parseAscending(sort)
      };
    }
}

export const tranCategoryRoute: Routes = [
    {
        path: 'tran-category',
        component: TranCategoryComponent,
        resolve: {
            'pagingParams': TranCategoryResolvePagingParams
        },
        data: {
            authorities: ['ROLE_USER'],
            pageTitle: 'sfWebClientApp.tranCategory.home.title'
        },
        canActivate: [UserRouteAccessService]
    }, {
        path: 'tran-category/:id',
        component: TranCategoryDetailComponent,
        data: {
            authorities: ['ROLE_USER'],
            pageTitle: 'sfWebClientApp.tranCategory.home.title'
        },
        canActivate: [UserRouteAccessService]
    }
];

export const tranCategoryPopupRoute: Routes = [
    {
        path: 'tran-category-new',
        component: TranCategoryPopupComponent,
        data: {
            authorities: ['ROLE_USER'],
            pageTitle: 'sfWebClientApp.tranCategory.home.title'
        },
        canActivate: [UserRouteAccessService],
        outlet: 'popup'
    },
    {
        path: 'tran-category/:id/edit',
        component: TranCategoryPopupComponent,
        data: {
            authorities: ['ROLE_USER'],
            pageTitle: 'sfWebClientApp.tranCategory.home.title'
        },
        canActivate: [UserRouteAccessService],
        outlet: 'popup'
    },
    {
        path: 'tran-category/:id/delete',
        component: TranCategoryDeletePopupComponent,
        data: {
            authorities: ['ROLE_USER'],
            pageTitle: 'sfWebClientApp.tranCategory.home.title'
        },
        canActivate: [UserRouteAccessService],
        outlet: 'popup'
    }
];
<file_sep>/src/main/webapp/app/shared/search/searcher.ts
import {Observable} from "rxjs/Observable";

export class Searcher {
    onSearch(term: string): Observable<any[]>{
        return Observable.of<any[]>([]);
    }
}
<file_sep>/src/main/java/com/calderon/sf/web/rest/TranCategoryResource.java
package com.calderon.sf.web.rest;

import com.calderon.sf.domain.TranCategory;
import com.calderon.sf.repository.TranCategoryRepository;
import com.calderon.sf.web.rest.util.HeaderUtil;
import com.calderon.sf.web.rest.util.PaginationUtil;
import com.codahale.metrics.annotation.Timed;
import io.github.jhipster.web.util.ResponseUtil;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;

/**
 * REST controller for managing TranCategory.
 */
@RestController
@RequestMapping("/api")
public class TranCategoryResource {

    private final Logger log = LoggerFactory.getLogger(TranCategoryResource.class);

    private static final String ENTITY_NAME = "tranCategory";

    private final TranCategoryRepository tranCategoryRepository;

    public TranCategoryResource(TranCategoryRepository tranCategoryRepository) {
        this.tranCategoryRepository = tranCategoryRepository;
    }

    /**
     * POST  /tran-categories : Create a new tranCategory.
     *
     * @param tranCategory the tranCategory to create
     * @return the ResponseEntity with status 201 (Created) and with body the new tranCategory, or with status 400 (Bad Request) if the tranCategory has already an ID
     * @throws URISyntaxException if the Location URI syntax is incorrect
     */
    @PostMapping("/tran-categories")
    @Timed
    public ResponseEntity<TranCategory> createTranCategory(@Valid @RequestBody TranCategory tranCategory) throws URISyntaxException {
        log.debug("REST request to save TranCategory : {}", tranCategory);
        if (tranCategory.getId() != null) {
            return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(ENTITY_NAME, "idexists", "A new tranCategory cannot already have an ID")).body(null);
        }
        TranCategory result = tranCategoryRepository.save(tranCategory);
        return ResponseEntity.created(new URI("/api/tran-categories/" + result.getId()))
            .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
            .body(result);
    }

    /**
     * PUT  /tran-categories : Updates an existing tranCategory.
     *
     * @param tranCategory the tranCategory to update
     * @return the ResponseEntity with status 200 (OK) and with body the updated tranCategory,
     * or with status 400 (Bad Request) if the tranCategory is not valid,
     * or with status 500 (Internal Server Error) if the tranCategory couldn't be updated
     * @throws URISyntaxException if the Location URI syntax is incorrect
     */
    @PutMapping("/tran-categories")
    @Timed
    public ResponseEntity<TranCategory> updateTranCategory(@Valid @RequestBody TranCategory tranCategory) throws URISyntaxException {
        log.debug("REST request to update TranCategory : {}", tranCategory);
        if (tranCategory.getId() == null) {
            return createTranCategory(tranCategory);
        }
        TranCategory result = tranCategoryRepository.save(tranCategory);
        return ResponseEntity.ok()
            .headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, tranCategory.getId().toString()))
            .body(result);
    }

    /**
     * GET  /tran-categories : get all the tranCategories.
     *
     * @param pageable the pagination information
     * @return the ResponseEntity with status 200 (OK) and the list of tranCategories in body
     */
    @GetMapping("/tran-categories")
    @Timed
    public ResponseEntity<List<TranCategory>> getAllTranCategories(@ApiParam Pageable pageable) {
        log.debug("REST request to get a page of TranCategories");
        /*Page<TranCategory> page = tranCategoryRepository.findAll(pageable);*/
        Page<TranCategory> page = tranCategoryRepository.findByUserIsCurrentUser(pageable);
        HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/tran-categories");
        return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
    }

    /**
     * GET  /tran-categories/:id : get the "id" tranCategory.
     *
     * @param id the id of the tranCategory to retrieve
     * @return the ResponseEntity with status 200 (OK) and with body the tranCategory, or with status 404 (Not Found)
     */
    @GetMapping("/tran-categories/{id}")
    @Timed
    public ResponseEntity<TranCategory> getTranCategory(@PathVariable Long id) {
        log.debug("REST request to get TranCategory : {}", id);
        TranCategory tranCategory = tranCategoryRepository.findOne(id);
        return ResponseUtil.wrapOrNotFound(Optional.ofNullable(tranCategory));
    }

    /**
     * DELETE  /tran-categories/:id : delete the "id" tranCategory.
     *
     * @param id the id of the tranCategory to delete
     * @return the ResponseEntity with status 200 (OK)
     */
    @DeleteMapping("/tran-categories/{id}")
    @Timed
    public ResponseEntity<Void> deleteTranCategory(@PathVariable Long id) {
        log.debug("REST request to delete TranCategory : {}", id);
        tranCategoryRepository.delete(id);
        return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
    }
}
<file_sep>/src/main/java/com/calderon/sf/service/TranFileReaderService.java
package com.calderon.sf.service;

import com.calderon.sf.domain.AccountTransaction;
import com.calderon.sf.domain.Bank;
import com.calderon.sf.reader.CsvReader;
import com.calderon.sf.reader.Reader;
import com.calderon.sf.service.mapper.TransactionMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.nio.file.Path;
import java.util.List;

@Service
public class TranFileReaderService {

    private final Logger log = LoggerFactory.getLogger(TranFileReaderService.class);

    private TransactionMapper tranMapper;
    @Autowired
    public void setTranMapper(TransactionMapper tranMapper) {
        this.tranMapper = tranMapper;
    }

    public List<AccountTransaction> read(Bank bank, Path from){
        return tranMapper.TransactionToAccountTransaction(Readers.of(Integer.parseInt(bank.getId().toString()), from).getTransactions());
    }


    private static class Readers {
        public static Reader of(int bankId, Path from){
            switch (bankId){
                case 1:
                    return new CsvReader(from);
                default:
                    return new CsvReader(from);
            }
        }
    }

}


<file_sep>/src/main/webapp/app/dashboard/dashboard.component.ts
import {Component, OnInit} from '@angular/core';
import {FinanceAccount} from '../sf-entities/finance-account/finance-account.model';
import {TranChartData} from '../shared/charts/tran-chart-data';
import {AccountTransactionService} from '../sf-entities/account-transaction/account-transaction.service';
import {FinanceAccountService} from '../sf-entities/finance-account/finance-account.service';
import {LoggerService} from '../shared/logger/logger.service';
import {Principal} from '../shared/auth/principal.service';
import {JhiAlertService} from 'ng-jhipster';
import {AccountTransaction} from '../sf-entities/account-transaction/account-transaction.model';
import {ResponseWrapper} from '../shared/model/response-wrapper.model';
import {ENTER_LEAVE_ANIMATION} from '../shared/animation/enter-leave-animation';

@Component({
    selector: 'jhi-dashboard',
    templateUrl: './dashboard.component.html',
    styles: [],
    animations: ENTER_LEAVE_ANIMATION
})
export class DashboardComponent implements OnInit {

    accChecked: number[] = [];
    currentUser: any;
    accounts: FinanceAccount[];

    year: number = new Date().getFullYear();
    tranYears: number[] = [];
    tranChartData: TranChartData = new TranChartData([]);
    transactions: AccountTransaction[];

    // chart
    chartData: Array<any> = [
        {data: [], label: 'EXPENSES'},
        {data: [], label: 'INCOMES'}
    ];
    chartLabels: Array<any> = [];

    constructor(private tranService: AccountTransactionService,
                private accountService: FinanceAccountService,
                private logger: LoggerService,
                private principal: Principal,
                private alertService: JhiAlertService
                ) {
    }

    ngOnInit() {
        this.principal.identity().then((user) => {
            this.currentUser = user;
        });
        this.load();
    }

    isAuthenticated() {
        return this.principal.isAuthenticated();
    }

    private load() {
        this.tranYears.push(this.year);
        this.accountService.query()
            .subscribe((res: ResponseWrapper) => {
                this.accounts = res.json;
                const allAcc = new FinanceAccount();
                allAcc.id = -1;
                allAcc.name = 'ALL';
                this.accounts.unshift(allAcc);
                for (let account of this.accounts) {
                    this.accChecked.push(account.id);
                }
                this.loadTransactions()
            }, (res: ResponseWrapper) => this.onError(res.json));
    }

    onRefresh() {
        this.loadTransactions();
    }

    private loadTransactions() {
        const accoundsId = this.accChecked.filter((value) => {
            return value !== -1;
        });
        this.tranService.findTransactionsByAccountsAndYear(accoundsId, this.year)
            .subscribe((transactions: AccountTransaction[]) => {
                this.transactions = transactions;
                this.refreshChart();
            });
    }

    refreshChart() {
        this.tranChartData.transactions = this.transactions;
        this.chartLabels = this.tranChartData.getChartLabels(this.year);
        this.chartData = this.tranChartData.getChartData(this.year);
    }

    // events
    public chartClicked(e: any): void {
        //console.log(e);
    }

    public chartHovered(e: any): void {
        //console.log(e);
    }

    private onError(error) {
        this.alertService.error(error.message, null, null);
    }

    isChecked(id: number): boolean {
        return -1 !== this.accChecked.indexOf(id)
    }

    onChangeAcc(checked: boolean, acc: FinanceAccount) {
        if (checked) {

            if (acc.id === -1) {
                for (let account of this.accounts) {
                    this.accChecked.push(account.id);
                }
            }else {
                this.accChecked.push(acc.id);
            }
        } else {
            if (acc.id === -1) {
                this.accChecked = [];
            } else {
                this.accChecked = this.accChecked.filter((value, index, array) => {
                    return value !== acc.id;
                });
            }
        }
    }
}
<file_sep>/src/main/webapp/app/entities/entity.module.ts
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';

import { SfWebClientBankModule } from './bank/bank.module';
import { SfWebClientTranCategoryModule } from './tran-category/tran-category.module';
import { SfWebClientTranCategoryRegexModule } from './tran-category-regex/tran-category-regex.module';
import { SfWebClientAccountTransactionModule } from './account-transaction/account-transaction.module';
import { SfWebClientFinanceAccountModule } from './finance-account/finance-account.module';
/* jhipster-needle-add-entity-module-import - JHipster will add entity modules imports here */

@NgModule({
    imports: [
        SfWebClientBankModule,
        SfWebClientTranCategoryModule,
        SfWebClientTranCategoryRegexModule,
        SfWebClientAccountTransactionModule,
        SfWebClientFinanceAccountModule,
        /* jhipster-needle-add-entity-module - JHipster will add entity modules here */
    ],
    declarations: [],
    entryComponents: [],
    providers: [],
    schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class SfWebClientEntityModule {}
<file_sep>/src/main/webapp/app/sf-entities/finance-account/transaction/transaction.component.ts
import {Component, Input, OnDestroy, OnInit} from '@angular/core';
import {AccountTransaction} from '../../account-transaction/account-transaction.model';
import {Subscription} from 'rxjs/Subscription';
import {JhiAlertService, JhiEventManager, JhiPaginationUtil, JhiParseLinks} from 'ng-jhipster';
import {ActivatedRoute, Router} from '@angular/router';
import {PaginationConfig} from '../../../blocks/config/uib-pagination.config';
import {ITEMS_PER_PAGE} from '../../../shared/constants/pagination.constants';
import {ResponseWrapper} from '../../../shared/model/response-wrapper.model';
import {FinanceAccount} from '../finance-account.model';
import {FinanceAccountService} from '../finance-account.service';
import {LoggerService} from '../../../shared/logger/logger.service';
import {ENTER_LEAVE_ANIMATION} from '../../../shared/animation/enter-leave-animation';

@Component({
    selector: 'jhi-transaction',
    templateUrl: './transaction.component.html',
    animations: ENTER_LEAVE_ANIMATION
})
export class TransactionComponent implements OnInit, OnDestroy {

    accountId: number;
    @Input()
    currentAccount: FinanceAccount;
    transactions: AccountTransaction[];

    error: any;
    success: any;
    eventSubscriber: Subscription;
    routeData: any;
    links: any;
    totalItems: any;
    queryCount: any;
    itemsPerPage: any;
    page: any;
    predicate: any;
    previousPage: any;
    reverse: any;
    private subscription: Subscription;

    hidePagingDiv = false;
    /****** filter ******/

    dateRange: Date[];
    filterObj = {
        description: '',
        amount: 0,
        operator: 1
    };

    constructor(private accountService: FinanceAccountService,
                private parseLinks: JhiParseLinks,
                private alertService: JhiAlertService,
                private activatedRoute: ActivatedRoute,
                private router: Router,
                private eventManager: JhiEventManager,
                private paginationUtil: JhiPaginationUtil,
                private paginationConfig: PaginationConfig,
                private logger: LoggerService) {
        this.itemsPerPage = ITEMS_PER_PAGE;
        this.routeData = this.activatedRoute.data.subscribe((data) => {
            this.page = data['pagingParams'].page;
            this.previousPage = data['pagingParams'].page;
            this.reverse = data['pagingParams'].ascending;
            this.predicate = data['pagingParams'].predicate;
        });
    }

    loadAll() {
        if (!this.currentAccount) {
            this.accountService.find(this.accountId)
                .subscribe((account) => {
                    this.currentAccount = account;
                }, (res: ResponseWrapper) => this.onError(res.json));
        }
        this.accountService.queryTransactions(this.accountId, {
            page: this.page - 1,
            size: this.itemsPerPage,
            sort: this.sort()
        }).subscribe(
            (res: ResponseWrapper) => this.onSuccess(res.json, res.headers),
            (res: ResponseWrapper) => this.onError(res.json)
        );
    }

    loadPage(page: number) {
        if (page !== this.previousPage) {
            this.previousPage = page;
            this.transition();
        }
    }

    transition() {
        this.router.navigate(['./finance-account', this.accountId], {
            queryParams:
                {
                    page: this.page,
                    size: this.itemsPerPage,
                    sort: this.predicate + ',' + (this.reverse ? 'asc' : 'desc')
                }
        });
        this.loadAll();
    }

    clear() {
        this.page = 0;
        this.router.navigate(['./finance-account/' + this.accountId, {
            page: this.page,
            sort: this.predicate + ',' + (this.reverse ? 'asc' : 'desc')
        }]);
        this.loadAll();
    }

    ngOnInit() {
        this.subscription = this.activatedRoute.params.subscribe((params) => {
            this.accountId = params['id'];
        });
        this.predicate = 'createdDate';
        this.reverse = false;
        this.loadAll();
        this.registerChangeInAccountTransactions();
    }

    ngOnDestroy() {
        this.eventManager.destroy(this.eventSubscriber);
    }

    trackId(index: number, item: AccountTransaction) {
        return item.id;
    }

    registerChangeInAccountTransactions() {
        this.eventSubscriber = this.eventManager.subscribe('transactionListModification', (response) => {

            if(!response.data)
                this.loadAll();

            if(response.data.action === "transactionDeleted"){
                this.transactions = this.transactions.filter(value => {
                    return value.id != response.data.item.id;
                });
            }
        });
    }

    sort() {
        const result = [this.predicate + ',' + (this.reverse ? 'asc' : 'desc')];
        if (this.predicate !== 'id') {
            result.push('id');
        }
        return result;
    }

    private onSuccess(data, headers) {
        this.links = this.parseLinks.parse(headers.get('link'));
        this.totalItems = headers.get('X-Total-Count');
        this.queryCount = this.totalItems;
        // this.page = pagingParams.page;
        this.transactions = data;
    }

    private onError(error) {
        this.alertService.error(error.message, null, null);
    }

    onFilterClick() {
        this.logger.info("****** On Filter click *****");
        this.accountService.queryTransactionsBy(this.accountId, {
            page: this.page - 1,
            size: this.itemsPerPage,
            sort: this.sort()
        }, this.mapToTranCriteria(this.filterObj)).subscribe(
            (res: ResponseWrapper) => this.onSuccess(res.json, res.headers),
            (res: ResponseWrapper) => this.onError(res.json)
        );
    }

    mapToTranCriteria(filterObj: any): any{
        let tranCriteria = {};
        this.filterObj["dateRange"] = this.dateRange;
        if (filterObj.dateRange && filterObj.dateRange.length>0){
            tranCriteria["startDate"]=filterObj.dateRange[0];
            tranCriteria["endDate"]=filterObj.dateRange[1];
        }
        if (filterObj.description.length>0){
            tranCriteria["desc"]=filterObj.description;
        }
        if (filterObj.amount != null){
            if(filterObj.operator>0){
                tranCriteria["startAmount"]=filterObj.amount;
            }
            else {
                tranCriteria["endAmount"]=filterObj.amount;
            }
        }
        return tranCriteria;
    }

    onDateRangeShown(): any{
        this.hidePagingDiv = true;
    }

    onDateRangeHidden(): any{
        this.hidePagingDiv = false;
    }


}
<file_sep>/src/main/webapp/app/entities/finance-account/finance-account.route.ts
import { Injectable } from '@angular/core';
import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot, Routes, CanActivate } from '@angular/router';

import { UserRouteAccessService } from '../../shared';
import { JhiPaginationUtil } from 'ng-jhipster';

import { FinanceAccountComponent } from './finance-account.component';
import { FinanceAccountDetailComponent } from './finance-account-detail.component';
import { FinanceAccountPopupComponent } from './finance-account-dialog.component';
import { FinanceAccountDeletePopupComponent } from './finance-account-delete-dialog.component';

@Injectable()
export class FinanceAccountResolvePagingParams implements Resolve<any> {

    constructor(private paginationUtil: JhiPaginationUtil) {}

    resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
        const page = route.queryParams['page'] ? route.queryParams['page'] : '1';
        const sort = route.queryParams['sort'] ? route.queryParams['sort'] : 'id,asc';
        return {
            page: this.paginationUtil.parsePage(page),
            predicate: this.paginationUtil.parsePredicate(sort),
            ascending: this.paginationUtil.parseAscending(sort)
      };
    }
}

export const financeAccountRoute: Routes = [
    {
        path: 'finance-account',
        component: FinanceAccountComponent,
        resolve: {
            'pagingParams': FinanceAccountResolvePagingParams
        },
        data: {
            authorities: ['ROLE_USER'],
            pageTitle: 'sfWebClientApp.financeAccount.home.title'
        },
        canActivate: [UserRouteAccessService]
    }, {
        path: 'finance-account/:id',
        component: FinanceAccountDetailComponent,
        data: {
            authorities: ['ROLE_USER'],
            pageTitle: 'sfWebClientApp.financeAccount.home.title'
        },
        canActivate: [UserRouteAccessService]
    }
];

export const financeAccountPopupRoute: Routes = [
    {
        path: 'finance-account-new',
        component: FinanceAccountPopupComponent,
        data: {
            authorities: ['ROLE_USER'],
            pageTitle: 'sfWebClientApp.financeAccount.home.title'
        },
        canActivate: [UserRouteAccessService],
        outlet: 'popup'
    },
    {
        path: 'finance-account/:id/edit',
        component: FinanceAccountPopupComponent,
        data: {
            authorities: ['ROLE_USER'],
            pageTitle: 'sfWebClientApp.financeAccount.home.title'
        },
        canActivate: [UserRouteAccessService],
        outlet: 'popup'
    },
    {
        path: 'finance-account/:id/delete',
        component: FinanceAccountDeletePopupComponent,
        data: {
            authorities: ['ROLE_USER'],
            pageTitle: 'sfWebClientApp.financeAccount.home.title'
        },
        canActivate: [UserRouteAccessService],
        outlet: 'popup'
    }
];
<file_sep>/src/main/webapp/app/sf-entities/account-transaction/account-transaction.model.ts
import { BaseEntity, User } from './../../shared';

export const enum TranType {
    'EXPENSE',
    'INCOME'
}

export const enum PaymentMethod {
    'UNSPECIFIED',
    'CASH',
    'CHECK',
    'CREDIT_CARD',
    'DEBIT',
    'ELECTRONIC_TRANSFER',
    'OTHER'
}

export class AccountTransaction implements BaseEntity {
    constructor(
        public id?: number,
        public tranType?: TranType,
        public tranNumber?: string,
        public referenceNumber?: string,
        public postDate?: any,
        public createdDate?: any,
        public description?: string,
        public amount?: number,
        public paymentMethod?: PaymentMethod,
        public user?: User,
        public financeAccount?: BaseEntity,
        public tranCategory?: BaseEntity,
    ) {
    }
}
<file_sep>/src/main/webapp/app/sf-entities/tran-category-regex/index.ts
export * from './tran-category-regex.model';
export * from './tran-category-regex-popup.service';
export * from './tran-category-regex.service';
export * from './tran-category-regex-dialog.component';
export * from './tran-category-regex-delete-dialog.component';
export * from './tran-category-regex-detail.component';
export * from './tran-category-regex.component';
export * from './tran-category-regex.route';
<file_sep>/src/main/webapp/app/shared/search/search.directive.ts
import {Directive, ElementRef, HostListener, Input, Output} from '@angular/core';
import {Searcher} from "./searcher";
import {Subject} from "rxjs/Subject";
import {Observable} from "rxjs/Observable";

@Directive({
    selector: '[jhiSearch]'
})
export class SearchDirective {

    @Input() searcher: Searcher;
    @Input() items: Observable<any[]>;
    private searchTerms = new Subject<string>();
    constructor(private el: ElementRef) {
        this.searchTerms
            .debounceTime(300)        // wait 300ms after each keystroke before considering the term
            .distinctUntilChanged()
            .subscribe((term: string) => this.searcher.onSearch(term), (res: Response) => Observable.of<any[]>([]));
    }

    @HostListener("keyup") onKeyUp(){
        this.searchTerms.next(this.el.nativeElement.value);
        //this.searcher.onSearch(this.el.nativeElement.value);
    }


}
<file_sep>/src/main/java/com/calderon/sf/config/audit/package-info.java
/**
 * Audit specific code.
 */
package com.calderon.sf.config.audit;
<file_sep>/src/main/webapp/app/entities/tran-category-regex/tran-category-regex.route.ts
import { Injectable } from '@angular/core';
import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot, Routes, CanActivate } from '@angular/router';

import { UserRouteAccessService } from '../../shared';
import { JhiPaginationUtil } from 'ng-jhipster';

import { TranCategoryRegexComponent } from './tran-category-regex.component';
import { TranCategoryRegexDetailComponent } from './tran-category-regex-detail.component';
import { TranCategoryRegexPopupComponent } from './tran-category-regex-dialog.component';
import { TranCategoryRegexDeletePopupComponent } from './tran-category-regex-delete-dialog.component';

@Injectable()
export class TranCategoryRegexResolvePagingParams implements Resolve<any> {

    constructor(private paginationUtil: JhiPaginationUtil) {}

    resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
        const page = route.queryParams['page'] ? route.queryParams['page'] : '1';
        const sort = route.queryParams['sort'] ? route.queryParams['sort'] : 'id,asc';
        return {
            page: this.paginationUtil.parsePage(page),
            predicate: this.paginationUtil.parsePredicate(sort),
            ascending: this.paginationUtil.parseAscending(sort)
      };
    }
}

export const tranCategoryRegexRoute: Routes = [
    {
        path: 'tran-category-regex',
        component: TranCategoryRegexComponent,
        resolve: {
            'pagingParams': TranCategoryRegexResolvePagingParams
        },
        data: {
            authorities: ['ROLE_USER'],
            pageTitle: 'sfWebClientApp.tranCategoryRegex.home.title'
        },
        canActivate: [UserRouteAccessService]
    }, {
        path: 'tran-category-regex/:id',
        component: TranCategoryRegexDetailComponent,
        data: {
            authorities: ['ROLE_USER'],
            pageTitle: 'sfWebClientApp.tranCategoryRegex.home.title'
        },
        canActivate: [UserRouteAccessService]
    }
];

export const tranCategoryRegexPopupRoute: Routes = [
    {
        path: 'tran-category-regex-new',
        component: TranCategoryRegexPopupComponent,
        data: {
            authorities: ['ROLE_USER'],
            pageTitle: 'sfWebClientApp.tranCategoryRegex.home.title'
        },
        canActivate: [UserRouteAccessService],
        outlet: 'popup'
    },
    {
        path: 'tran-category-regex/:id/edit',
        component: TranCategoryRegexPopupComponent,
        data: {
            authorities: ['ROLE_USER'],
            pageTitle: 'sfWebClientApp.tranCategoryRegex.home.title'
        },
        canActivate: [UserRouteAccessService],
        outlet: 'popup'
    },
    {
        path: 'tran-category-regex/:id/delete',
        component: TranCategoryRegexDeletePopupComponent,
        data: {
            authorities: ['ROLE_USER'],
            pageTitle: 'sfWebClientApp.tranCategoryRegex.home.title'
        },
        canActivate: [UserRouteAccessService],
        outlet: 'popup'
    }
];
<file_sep>/src/main/webapp/app/dashboard/dashboard.module.ts
import {CUSTOM_ELEMENTS_SCHEMA, NgModule} from '@angular/core';
import {SfChartsModule} from '../shared/charts/sf-charts.module';
import {DashboardComponent} from './dashboard.component';
import {SfWebClientSharedModule} from '../shared/shared.module';

@NgModule({
    imports: [
        SfWebClientSharedModule,
        /*RouterModule.forRoot([ DASHBOARD_ROUTE ], { useHash: true }),*/
        SfChartsModule
    ],
    declarations: [DashboardComponent],
    exports: [DashboardComponent],
    entryComponents: [],
    providers: [],
    schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class DashboardModule {
}
<file_sep>/src/main/webapp/app/shared/charts/line-chart/line-chart.component.ts
import {Component, Input, OnInit} from '@angular/core';
import {DecimalPipe} from '@angular/common';

@Component({
    selector: 'jhi-line-chart',
    templateUrl: './line-chart.component.html',
    styles: []
})
export class LineChartComponent implements OnInit {
    @Input()
    chartLabels: Array<any> = [];

    @Input()
        // chart
    chartData: Array<any> = [
        {data: [], label: 'EXPENSES'},
        {data: [], label: 'INCOMES'}
    ];

    chartOptions: any = {
        responsive: true,
        title: {
            display: false,
            text: 'Line Chart'
        }
        ,
        hover: {
            mode: 'nearest',
            intersect: true
        },
        scales: {
            xAxes: [{
                display: true,
                scaleLabel: {
                    display: false,
                    labelString: 'Month'
                }
            }],
            yAxes: [{
                display: true,
                scaleLabel: {
                    display: false,
                    labelString: 'Value'
                },
                ticks: {
                    // Include a dollar sign in the ticks
                    callback: (value: any, index: any, values: any) => {
                        return this.formatTick(value, index, values);
                    }
                }
            }]
        },
        tooltips: {
            mode: 'index',
            intersect: false,
            callbacks: {
                label: (value: any, data: any) => {
                    return this.formatTooltip(value, data);
                }
            }
        }
        /*tooltipTemplate: '<%if (label){%><%=label %>: <%}%><%= value + \' %\' %>',
        // String - Template string for multiple tooltips
        multiTooltipTemplate: '<%= value + \' %\' %>'*/
    };
    chartLegend = true;
    chartType = 'line';
    chartColors = [
        /*{
            backgroundColor: 'rgb(255, 99, 132)',
            borderColor: 'rgb(255, 99, 132)'
        },
        {
            backgroundColor: 'rgb(54, 162, 235)',
            borderColor: 'rgb(54, 162, 235)'
        }*/
    ];

    constructor() {

    }

    ngOnInit() {

    }

    formatTick(value: any, index: any, values: any): any {
        return new DecimalPipe('USD').transform(value, '2.2-2');
        ;
    }

    formatTooltip(value: any, values: any): any {
        return new DecimalPipe('USD').transform(value.yLabel, '2.2-2');
        ;
    }

// events
    chartClicked(e: any): void {
        console.log(e);
    }

    chartHovered(e: any): void {
        console.log(e);
    }

}
<file_sep>/src/main/webapp/app/entities/account-transaction/account-transaction.module.ts
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { RouterModule } from '@angular/router';

import { SfWebClientSharedModule } from '../../shared';
import { SfWebClientAdminModule } from '../../admin/admin.module';
import {
    AccountTransactionService,
    AccountTransactionPopupService,
    AccountTransactionComponent,
    AccountTransactionDetailComponent,
    AccountTransactionDialogComponent,
    AccountTransactionPopupComponent,
    AccountTransactionDeletePopupComponent,
    AccountTransactionDeleteDialogComponent,
    accountTransactionRoute,
    accountTransactionPopupRoute,
    AccountTransactionResolvePagingParams,
} from './';

const ENTITY_STATES = [
    ...accountTransactionRoute,
    ...accountTransactionPopupRoute,
];

@NgModule({
    imports: [
        SfWebClientSharedModule,
        SfWebClientAdminModule,
        RouterModule.forRoot(ENTITY_STATES, { useHash: true })
    ],
    declarations: [
        AccountTransactionComponent,
        AccountTransactionDetailComponent,
        AccountTransactionDialogComponent,
        AccountTransactionDeleteDialogComponent,
        AccountTransactionPopupComponent,
        AccountTransactionDeletePopupComponent,
    ],
    entryComponents: [
        AccountTransactionComponent,
        AccountTransactionDialogComponent,
        AccountTransactionPopupComponent,
        AccountTransactionDeleteDialogComponent,
        AccountTransactionDeletePopupComponent,
    ],
    providers: [
        AccountTransactionService,
        AccountTransactionPopupService,
        AccountTransactionResolvePagingParams,
    ],
    schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class SfWebClientAccountTransactionModule {}
<file_sep>/src/main/webapp/app/sf-entities/finance-account/transaction/index.ts
export * from './transaction-popup.service';
export * from './transaction-dialog/transaction-dialog.component';
export * from './transaction-delete-dialog/transaction-delete-dialog.component';
export * from './transaction.component';
export * from './tran-upload/tran-upload.component';
export * from './transaction.route';
<file_sep>/src/main/webapp/app/sf-entities/finance-account/transaction/tran-upload/tran-upload.component.ts
import {Component, OnDestroy, OnInit} from '@angular/core';
import {Searcher} from '../../../../shared/search/searcher';
import {FileItem, FileUploader, ParsedResponseHeaders} from 'ng2-file-upload';
import {FinanceAccount} from '../../finance-account.model';
import {TranCategory} from '../../../tran-category/tran-category.model';
import {AccountTransaction} from '../../../account-transaction/account-transaction.model';
import {Observable} from 'rxjs/Observable';
import {Bank} from '../../../bank/bank.model';
import {User} from '../../../../shared/user/user.model';
import {LoggerService} from '../../../../shared/logger/logger.service';
import {JhiAlertService, JhiDateUtils, JhiEventManager} from 'ng-jhipster';
import {FinanceAccountService} from '../../finance-account.service';
import {TranCategoryService} from '../../../tran-category/tran-category.service';
import {AccountTransactionService} from '../../../account-transaction/account-transaction.service';
import {BankService} from '../../../bank/bank.service';
import {ActivatedRoute} from '@angular/router';
import {AuthServerProvider} from '../../../../shared/auth/auth-jwt.service';
import {Principal} from '../../../../shared/auth/principal.service';
import {ResponseWrapper} from '../../../../shared/model/response-wrapper.model';
import {ENTER_LEAVE_ANIMATION} from '../../../../shared/animation/enter-leave-animation';

@Component({
    selector: 'jhi-tran-upload',
    templateUrl: './tran-upload.component.html',
    styles: [],
    animations: ENTER_LEAVE_ANIMATION
})
export class TranUploadComponent implements OnInit, OnDestroy {
    searcher: Searcher;
    /*component property*/
    hasBaseDropZoneOver = false;
    isSaving: boolean;
    uploader: FileUploader;

    /*dropdown data*/
    categories: TranCategory[];
    categoryValues: string[];

    /*model*/
    accountId: number;
    transactions: AccountTransaction[] = [];
    transactionsObservables: Observable<AccountTransaction[]> = Observable.of([]);
    account: FinanceAccount;
    bank: Bank;
    banks: Bank[] = [];
    currentUser: User;
    fileInput: any;

    constructor(private logger: LoggerService,
                private alertService: JhiAlertService,
                private activatedRoute: ActivatedRoute,
                private accountService: FinanceAccountService,
                private tranCategoryService: TranCategoryService,
                private transactionService: AccountTransactionService,
                private bankService: BankService,
                private eventManager: JhiEventManager,
                private authServerProvider: AuthServerProvider,
                private principal: Principal,
                private dateUtils: JhiDateUtils) {

    }

    // TODO: Remove this when we're done
    get diagnostic() {
        return JSON.stringify(this.transactions);
    }

    ngOnInit() {
        this.activatedRoute.params.subscribe((params) => {
            this.accountId = params['accountId'];
            this.load();
        });
    }

    load() {
        this.logger.log('***Loading***');
        this.isSaving = false;

        this.searcher = new Searcher();
        this.searcher.onSearch = (term: string) => {
            return this.OnSearch(term.toLocaleLowerCase());
        }
        this.uploader = new FileUploader(
            {
                url: 'api/account-transactions/upload',
                authToken: 'Bearer ' + this.authServerProvider.getToken()
                /*allowedFileType: ['xls'],
                allowedMimeType: ['text/csv']*/
            });
        this.uploader.onCompleteItem = (item: FileItem, response: string, status: number, headers: ParsedResponseHeaders) => {
            this.onCompleteUpload(item, response, status, headers);
        };
        this.uploader.onBuildItemForm = (fileItem: FileItem, form: any) => {
            this.onBuildItemForm(fileItem, form);
        };

        this.principal.identity().then((user) => {
            this.currentUser = user;
        });

        this.accountService.find(this.accountId)
            .subscribe((account) => {
                this.account = account;
            }, (res: ResponseWrapper) => this.onError(res.json));

        this.tranCategoryService.query()
            .subscribe((res: ResponseWrapper) => {
                this.categories = res.json;
            }, (res: ResponseWrapper) => this.onError(res.json));

        this.bankService.query().subscribe((res: ResponseWrapper) => {
                this.banks = res.json;
                this.bank = this.banks.length > 0 ? this.banks[0] : this.bank;
            }, (res: ResponseWrapper) =>
                this.onError(res.json)
        );

    }

    private OnSearch(term: string): Observable<any[]> {
        this.logger.info('***** OnSearch ******');
        this.logger.info(term);
        this.transactionsObservables = Observable.of(this.transactions);
        if (term.length <= 0) {
            return this.transactionsObservables;
        }
        this.transactionsObservables = this.transactionsObservables.map((trans) =>
            trans.filter((tran) =>
                (<AccountTransaction>tran).description.toLocaleLowerCase().match(term) ||
                ((<AccountTransaction>tran).amount + '').toLocaleLowerCase().match(term)
            )
        );
        return this.transactionsObservables;
    }

    private onBuildItemForm(fileItem: FileItem, form: any): any {
        this.logger.info('******onBuildItemForm*****');
        form.append('bank', this.bank.id);
    }

    private onCompleteUpload(item: FileItem, response: string, status: number, headers: ParsedResponseHeaders): any {
        this.logger.info('******* Response from upload file endpoint *******');
        this.logger.info(JSON.parse(response));
        this.transactions = <AccountTransaction[]>JSON.parse(response);
        this.setCategoryValues(this.transactions);
        this.transactionsObservables = Observable.of(this.transactions);
        this.uploader.clearQueue();
        this.fileInput = null;
        return void 0;
    }

    private setCategoryValues(transactions: AccountTransaction[]) {
        this.categoryValues = [];
        for (const tran of transactions) {
            this.categoryValues.push(tran.tranCategory ? tran.tranCategory['name'] : '');
        }
    }

    upload() {
        this.logger.info('Uploading');
        this.uploader.uploadItem(<FileItem>this.uploader.getNotUploadedItems()[0]);
        /*this.uploader.component = this;*/
    }

    remove(index: number, item: AccountTransaction) {
        this.transactions.splice(index, 1);
    }

    trackBankById(index: number, item: Bank) {
        return item.id;
    }

    trackAccountById(index: number, item: FinanceAccount) {
        return item.id;
    }

    trackTranCategoryById(index: number, item: TranCategory) {
        return item.id;
    }

    trackId(index: number, item: AccountTransaction) {
        return item.tranNumber;
    }

    onChangeCategory() {
        this.logger.info(this.categoryValues);
    }

    onTypeaheadSelect(index: number, transaction: AccountTransaction, event: any) {
        /*this.logger.info('***** on select typeahead category');
        this.logger.info(index);
        this.logger.info(transaction);
        this.logger.info(event);*/
        transaction.tranCategory = event.item;
    }

    goBack() {
        this.logger.log('***Back***');
        this.clear();
        window.history.back();
    }

    clear() {
        this.logger.log('***Clear***');
        this.transactions = [];
        this.account = null;
        this.uploader.clearQueue();
        this.fileInput = null;
    }

    private onSaveSuccess(result: AccountTransaction[]) {
        this.eventManager.broadcast({name: 'accountTransactionListModification', content: 'OK'});
        this.isSaving = false;
        this.goBack();
    }

    private subscribeToSaveResponse(result: Observable<AccountTransaction[]>) {
        result.subscribe((res: AccountTransaction[]) =>
            this.onSaveSuccess(res), (res: Response) => this.onSaveError());
    }

    private prepareTransactionsForServer(): AccountTransaction[] {
        const copyTransactions: AccountTransaction[] = [];
        for (const tran of this.transactions) {
            const copy: AccountTransaction = Object.assign({}, tran);
            copy.id = null;
            copy.financeAccount = this.account;
            copy.user = this.currentUser;
            const postDate: Date = this.dateUtils.convertLocalDateFromServer(copy.postDate);
            copy.postDate = {
                year: postDate.getFullYear(),
                month: postDate.getMonth() + 1,
                day: postDate.getDate()
            };
            copyTransactions.push(copy);
        }
        return copyTransactions;
    }

    save() {
        this.isSaving = true;
        this.logger.log('***Saving***');
        this.subscribeToSaveResponse(this.transactionService.createBulk(this.prepareTransactionsForServer()));
    }

    private onSaveError() {
        this.isSaving = false;
    }

    private onError(error: any) {
        this.alertService.error(error.message, null, null);
    }

    ngOnDestroy() {

    }
}
<file_sep>/src/main/webapp/app/sf-entities/account-transaction/transaction-upload/transaction-upload.component.ts
import {Component, OnDestroy, OnInit} from '@angular/core';
import {LoggerService} from '../../../shared/logger/logger.service';
import {FileItem, FileUploader, ParsedResponseHeaders} from 'ng2-file-upload';
import {FinanceAccount} from '../../finance-account/finance-account.model';
import {AccountTransaction} from '../account-transaction.model';
import {JhiAlertService, JhiDateUtils, JhiEventManager} from 'ng-jhipster';
import {FinanceAccountService} from '../../finance-account/finance-account.service';
import {ActivatedRoute} from '@angular/router';
import {AuthServerProvider} from '../../../shared/auth/auth-jwt.service';
import {ResponseWrapper} from '../../../shared/model/response-wrapper.model';
import {AccountTransactionService} from '../account-transaction.service';
import {TranCategoryService} from '../../tran-category/tran-category.service';
import {TranCategory} from '../../tran-category/tran-category.model';
import {Observable} from 'rxjs/Observable';
import {User} from '../../../shared/user/user.model';
import {Principal} from '../../../shared/auth/principal.service';
import {Bank} from '../../bank/bank.model';
import {BankService} from '../../bank/bank.service';
import {Searcher} from '../../../shared/search/searcher';

@Component({
    selector: 'jhi-transaction-upload',
    templateUrl: './transaction-upload.component.html',
    styles: []
})
export class TransactionUploadComponent implements OnInit, OnDestroy {
    searcher: Searcher;
    /*component property*/
    hasBaseDropZoneOver = false;
    isSaving: boolean;
    uploader: FileUploader;

    /*dropdown data*/
    accounts: FinanceAccount[];
    categories: TranCategory[];

    /*model*/
    transactions: AccountTransaction[] = [];
    transactionsObservables: Observable<AccountTransaction[]> = Observable.of([]);
    account: FinanceAccount;
    bank: Bank;
    banks: Bank[] = [];
    currentUser: User;
    fileInput: any;

    constructor(private logger: LoggerService,
                private alertService: JhiAlertService,
                private accountService: FinanceAccountService,
                private tranCategoryService: TranCategoryService,
                private transactionService: AccountTransactionService,
                private bankService: BankService,
                private eventManager: JhiEventManager,
                private route: ActivatedRoute,
                private authServerProvider: AuthServerProvider,
                private principal: Principal,
                private dateUtils: JhiDateUtils) {
    }

    // TODO: Remove this when we're done
    get diagnostic() {
        return JSON.stringify(this.transactions);
    }

    ngOnInit() {
        this.load();
    }

    load() {

        this.logger.log('***Loading***');
        this.isSaving = false;

        this.searcher = new Searcher();
        this.searcher.onSearch = (term: string) => {
            return this.OnSearch(term.toLocaleLowerCase());
        };
        this.uploader = new FileUploader(
            {
                url: 'api/account-transactions/upload',
                authToken: 'Bearer ' + this.authServerProvider.getToken()
                /*allowedFileType: ['xls'],
                allowedMimeType: ['text/csv']*/
            });
        this.uploader.onCompleteItem = (item: FileItem, response: string, status: number, headers: ParsedResponseHeaders) => {
            this.onCompleteUpload(item, response, status, headers);
        };
        this.uploader.onBuildItemForm = (fileItem: FileItem, form: any) => {
            this.onBuildItemForm(fileItem, form);
        };

        this.principal.identity().then((user) => {
            this.currentUser = user;
        });

        this.accountService.query()
            .subscribe((res: ResponseWrapper) => {
                this.accounts = res.json;
                this.account = this.accounts.length > 0 ? this.accounts[0] : this.account;
            }, (res: ResponseWrapper) => this.onError(res.json));
        this.tranCategoryService.query()
            .subscribe((res: ResponseWrapper) => {
                this.categories = res.json;
            }, (res: ResponseWrapper) => this.onError(res.json));

        this.bankService.query().subscribe((res: ResponseWrapper) => {
                this.banks = res.json;
                this.bank = this.banks.length > 0 ? this.banks[0] : this.bank;
            }, (res: ResponseWrapper) =>
                this.onError(res.json)
        );

    }

    private OnSearch(term: string): Observable<any[]> {
        this.logger.info("***** OnSearch ******");
        this.logger.info(term);
        this.transactionsObservables = Observable.of(this.transactions);
        if (term.length <= 0) {
            return this.transactionsObservables;
        }
        this.transactionsObservables = this.transactionsObservables.map(trans =>
            trans.filter(tran =>
                (<AccountTransaction>tran).description.toLocaleLowerCase().match(term) ||
                ((<AccountTransaction>tran).amount + "").toLocaleLowerCase().match(term)
            )
        );
        return this.transactionsObservables;
    }

    private onBuildItemForm(fileItem: FileItem, form: any): any {
        this.logger.info("******onBuildItemForm*****");
        form.append("bank", this.bank.id);
    }

    private onCompleteUpload(item: FileItem, response: string, status: number, headers: ParsedResponseHeaders): any {
        this.logger.info("******* Response from upload file endpoint *******");
        this.logger.info(JSON.parse(response));
        this.transactions = <AccountTransaction[]>JSON.parse(response);
        this.transactionsObservables = Observable.of(this.transactions);
        this.uploader.clearQueue();
        this.fileInput = null;
        return void 0;
    }

    upload() {
        this.logger.info("Uploading");
        this.uploader.uploadItem(<FileItem>this.uploader.getNotUploadedItems()[0]);
        /*this.uploader.component = this;*/
    }

    remove(index: number, item: AccountTransaction) {
        this.transactions.splice(index, 1);
    }

    trackBankById(index: number, item: Bank) {
        return item.id;
    }

    trackAccountById(index: number, item: FinanceAccount) {
        return item.id;
    }

    trackTranCategoryById(index: number, item: TranCategory) {
        return item.id;
    }

    trackId(index: number, item: AccountTransaction) {
        return item.id;
    }

    goBack() {
        this.logger.log('***Back***');
        this.clear();
        window.history.back();
    }

    clear() {
        this.logger.log('***Clear***');
        this.transactions = [];
        this.account = null;
        this.uploader.clearQueue();
        this.fileInput = null;
    }

    private onSaveSuccess(result: AccountTransaction[]) {
        this.eventManager.broadcast({name: 'accountTransactionListModification', content: 'OK'});
        this.isSaving = false;
        this.goBack();
    }

    private subscribeToSaveResponse(result: Observable<AccountTransaction[]>) {
        result.subscribe((res: AccountTransaction[]) =>
            this.onSaveSuccess(res), (res: Response) => this.onSaveError());
    }

    private prepareTransactions(): AccountTransaction[] {
        const copyTransactions: AccountTransaction[] = [];
        for (let tran of this.transactions) {
            const copy: AccountTransaction = Object.assign({}, tran);
            copy.id = null;
            copy.financeAccount = this.account;
            copy.user = this.currentUser;
            let postDate: Date = this.dateUtils.convertLocalDateFromServer(copy.postDate);
            copy.postDate = {
                year: postDate.getFullYear(),
                month: postDate.getMonth() + 1,
                day: postDate.getDate()
            };
            copyTransactions.push(copy);
        }
        return copyTransactions;
    }

    save() {
        this.isSaving = true;
        this.logger.log('***Saving***');
        this.subscribeToSaveResponse(this.transactionService.createBulk(this.prepareTransactions()));
    }

    private onSaveError() {
        this.isSaving = false;
    }

    private onError(error: any) {
        this.alertService.error(error.message, null, null);
    }

    ngOnDestroy() {

    }

}

<file_sep>/src/main/webapp/app/sf-entities/tran-category/tran-category-delete-dialog.component.ts
import { Component, OnInit, OnDestroy } from '@angular/core';
import { ActivatedRoute } from '@angular/router';

import { NgbActiveModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
import { JhiEventManager } from 'ng-jhipster';

import { TranCategory } from './tran-category.model';
import { TranCategoryPopupService } from './tran-category-popup.service';
import { TranCategoryService } from './tran-category.service';

@Component({
    selector: 'jhi-tran-category-delete-dialog',
    templateUrl: './tran-category-delete-dialog.component.html'
})
export class TranCategoryDeleteDialogComponent {

    tranCategory: TranCategory;

    constructor(
        private tranCategoryService: TranCategoryService,
        public activeModal: NgbActiveModal,
        private eventManager: JhiEventManager
    ) {
    }

    clear() {
        this.activeModal.dismiss('cancel');
    }

    confirmDelete(id: number) {
        this.tranCategoryService.delete(id).subscribe((response) => {
            this.eventManager.broadcast({
                name: 'tranCategoryListModification',
                content: 'Deleted an tranCategory'
            });
            this.activeModal.dismiss(true);
        });
    }
}

@Component({
    selector: 'jhi-tran-category-delete-popup',
    template: ''
})
export class TranCategoryDeletePopupComponent implements OnInit, OnDestroy {

    routeSub: any;

    constructor(
        private route: ActivatedRoute,
        private tranCategoryPopupService: TranCategoryPopupService
    ) {}

    ngOnInit() {
        this.routeSub = this.route.params.subscribe((params) => {
            this.tranCategoryPopupService
                .open(TranCategoryDeleteDialogComponent as Component, params['id']);
        });
    }

    ngOnDestroy() {
        this.routeSub.unsubscribe();
    }
}
<file_sep>/src/main/webapp/app/entities/finance-account/finance-account.model.ts
import { BaseEntity, User } from './../../shared';

export const enum AccountStatus {
    'INACTIVE',
    'ACTIVE'
}

export class FinanceAccount implements BaseEntity {
    constructor(
        public id?: number,
        public accountStatus?: AccountStatus,
        public accountNumber?: string,
        public name?: string,
        public description?: string,
        public balance?: number,
        public isCreditCard?: boolean,
        public dueDate?: any,
        public closingDate?: any,
        public accountTransactions?: BaseEntity[],
        public user?: User,
    ) {
        this.isCreditCard = false;
    }
}
<file_sep>/src/main/webapp/app/sf-entities/account-transaction/account-transaction-dialog.component.ts
import { Component, OnInit, OnDestroy } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Response } from '@angular/http';

import { Observable } from 'rxjs/Rx';
import { NgbActiveModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
import { JhiEventManager, JhiAlertService } from 'ng-jhipster';

import {AccountTransaction, TranType} from './account-transaction.model';
import { AccountTransactionPopupService } from './account-transaction-popup.service';
import { AccountTransactionService } from './account-transaction.service';
import { User, UserService } from '../../shared';
import { FinanceAccount, FinanceAccountService } from '../finance-account';
import { TranCategory, TranCategoryService } from '../tran-category';
import { ResponseWrapper } from '../../shared';
import {Principal} from '../../shared/auth/principal.service';
import {LoggerService} from '../../shared/logger/logger.service';

@Component({
    selector: 'jhi-account-transaction-dialog',
    templateUrl: './account-transaction-dialog.component.html'
})
export class AccountTransactionDialogComponent implements OnInit {

    accountTransaction: AccountTransaction;
    isSaving: boolean;

    currentUser: User;
    users: User[];

    financeaccounts: FinanceAccount[] = [];

    trancategories: TranCategory[] = [];
    postDateDp: any;

    isDetailsCollapsed: boolean = true;

    constructor(
        public activeModal: NgbActiveModal,
        private alertService: JhiAlertService,
        private accountTransactionService: AccountTransactionService,
        private userService: UserService,
        private financeAccountService: FinanceAccountService,
        private tranCategoryService: TranCategoryService,
        private eventManager: JhiEventManager,
        private principal: Principal,
        private logger: LoggerService
    ) {
    }

    ngOnInit() {
        this.load();
    }

    load() {
        this.isSaving = false;
        this.userService.query().subscribe((res: ResponseWrapper) =>
            {
                this.users = res.json;
            }, (res: ResponseWrapper) => this.onError(res.json));
        this.financeAccountService.query()
            .subscribe((res: ResponseWrapper) => {
                this.financeaccounts = res.json;
                if(!this.accountTransaction.id)
                    this.accountTransaction.financeAccount = this.financeaccounts.length > 0? this.financeaccounts[0]:this.accountTransaction.financeAccount;
            }, (res: ResponseWrapper) => this.onError(res.json));
        this.tranCategoryService.query()
            .subscribe((res: ResponseWrapper) =>
            {
                this.trancategories = res.json;
                if(!this.accountTransaction.id)
                    this.accountTransaction.tranCategory = this.trancategories.length > 0? this.trancategories[0]:this.accountTransaction.tranCategory;
            }, (res: ResponseWrapper) => this.onError(res.json));

        this.loadDefaults();

    }

    loadDefaults() {

    }

    clear() {
        this.activeModal.dismiss('cancel');
    }

    save() {
        this.isSaving = true;
        /*this.accountTransaction.user = this.currentUser;*/
        if (this.accountTransaction.id !== undefined) {
            this.subscribeToSaveResponse(
                this.accountTransactionService.update(this.accountTransaction));
        } else {
            this.subscribeToSaveResponse(
                this.accountTransactionService.create(this.accountTransaction));
        }
    }

    private subscribeToSaveResponse(result: Observable<AccountTransaction>) {
        result.subscribe((res: AccountTransaction) =>
            this.onSaveSuccess(res), (res: Response) => this.onSaveError());
    }

    private onSaveSuccess(result: AccountTransaction) {
        this.eventManager.broadcast({ name: 'accountTransactionListModification', content: 'OK'});
        this.isSaving = false;
        this.activeModal.dismiss(result);
    }

    private onSaveError() {
        this.isSaving = false;
    }

    private onError(error: any) {
        this.alertService.error(error.message, null, null);
    }

    trackUserById(index: number, item: User) {
        return item.id;
    }

    trackFinanceAccountById(index: number, item: FinanceAccount) {
        return item.id;
    }

    trackTranCategoryById(index: number, item: TranCategory) {
        return item.id;
    }

    getDetailsCollapseClass() {
        return {
            'form-row': !this.isDetailsCollapsed,
            'collapse': this.isDetailsCollapsed
        };
    }

    getTranIncomeClass() {
        return {
                'btn': true,
                'btn-secondary': this.accountTransaction.tranType == <TranType><any>'EXPENSE',
                'btn-success': this.accountTransaction.tranType == <TranType><any>'INCOME'
            };
    }

    getTranExpenseClass() {
        return {
            'btn': true,
            'btn-danger': this.accountTransaction.tranType == <TranType><any>'EXPENSE',
            'btn-secondary': this.accountTransaction.tranType == <TranType><any>'INCOME'
        };
    }
}

@Component({
    selector: 'jhi-account-transaction-popup',
    template: ''
})
export class AccountTransactionPopupComponent implements OnInit, OnDestroy {

    routeSub: any;

    constructor(
        private route: ActivatedRoute,
        private accountTransactionPopupService: AccountTransactionPopupService
    ) {}

    ngOnInit() {
        this.routeSub = this.route.params.subscribe((params) => {
            if ( params['id'] ) {
                this.accountTransactionPopupService
                    .open(AccountTransactionDialogComponent as Component, params['id']);
            } else {
                this.accountTransactionPopupService
                    .open(AccountTransactionDialogComponent as Component);
            }
        });
    }

    ngOnDestroy() {
        this.routeSub.unsubscribe();
    }

}
<file_sep>/src/main/webapp/app/entities/tran-category/tran-category.module.ts
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { RouterModule } from '@angular/router';

import { SfWebClientSharedModule } from '../../shared';
import { SfWebClientAdminModule } from '../../admin/admin.module';
import {
    TranCategoryService,
    TranCategoryPopupService,
    TranCategoryComponent,
    TranCategoryDetailComponent,
    TranCategoryDialogComponent,
    TranCategoryPopupComponent,
    TranCategoryDeletePopupComponent,
    TranCategoryDeleteDialogComponent,
    tranCategoryRoute,
    tranCategoryPopupRoute,
    TranCategoryResolvePagingParams,
} from './';

const ENTITY_STATES = [
    ...tranCategoryRoute,
    ...tranCategoryPopupRoute,
];

@NgModule({
    imports: [
        SfWebClientSharedModule,
        SfWebClientAdminModule,
        RouterModule.forRoot(ENTITY_STATES, { useHash: true })
    ],
    declarations: [
        TranCategoryComponent,
        TranCategoryDetailComponent,
        TranCategoryDialogComponent,
        TranCategoryDeleteDialogComponent,
        TranCategoryPopupComponent,
        TranCategoryDeletePopupComponent,
    ],
    entryComponents: [
        TranCategoryComponent,
        TranCategoryDialogComponent,
        TranCategoryPopupComponent,
        TranCategoryDeleteDialogComponent,
        TranCategoryDeletePopupComponent,
    ],
    providers: [
        TranCategoryService,
        TranCategoryPopupService,
        TranCategoryResolvePagingParams,
    ],
    schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class SfWebClientTranCategoryModule {}
<file_sep>/src/main/webapp/app/sf-entities/finance-account/transaction/transaction-popup.service.ts
import { Injectable, Component } from '@angular/core';
import { Router } from '@angular/router';
import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
import {User} from '../../../shared/user/user.model';
import {AccountTransactionService} from '../../account-transaction/account-transaction.service';
import {Principal} from '../../../shared/auth/principal.service';
import {LoggerService} from '../../../shared/logger/logger.service';
import {DatetimeService} from '../../../shared/datetime/datetime.service';
import {AccountTransaction, PaymentMethod, TranType} from '../../account-transaction/account-transaction.model';



@Injectable()
export class TransactionPopupService {
    private ngbModalRef: NgbModalRef;
    private currentUser: User;

    constructor(
        private modalService: NgbModal,
        private router: Router,
        private accountTransactionService: AccountTransactionService,
        private principal: Principal,
        private logger: LoggerService,
        private dateTimeService: DatetimeService

    ) {
        this.ngbModalRef = null;
    }

    open(component: Component, id?: number | any): Promise<NgbModalRef> {
        return new Promise<NgbModalRef>((resolve, reject) => {
            const isOpen = this.ngbModalRef !== null;
            if (isOpen) {
                resolve(this.ngbModalRef);
            }

            if (id) {
                this.accountTransactionService.find(id).subscribe((accountTransaction) => {
                    if (accountTransaction.postDate) {
                        accountTransaction.postDate = {
                            year: accountTransaction.postDate.getFullYear(),
                            month: accountTransaction.postDate.getMonth() + 1,
                            day: accountTransaction.postDate.getDate()
                        };
                    }
                    this.logger.info(accountTransaction);
                    this.ngbModalRef = this.accountTransactionModalRef(component, accountTransaction);
                    resolve(this.ngbModalRef);
                });
            } else {
                // setTimeout used as a workaround for getting ExpressionChangedAfterItHasBeenCheckedError
                setTimeout(() => {
                    this.ngbModalRef = this.accountTransactionModalRef(component, this.newAccountTransaction());
                    resolve(this.ngbModalRef);
                }, 0);
            }
        });
    }

    newAccountTransaction() {
        const tran: AccountTransaction = new AccountTransaction();
        tran.tranType = <TranType><any>'EXPENSE';
        tran.paymentMethod = <PaymentMethod><any>'UNSPECIFIED';
        tran.postDate = this.dateTimeService.nowLocalDate();
        this.principal.identity().then((user) => {
            this.currentUser = user;
            tran.user = user;
        });
        this.logger.info(tran);
        return tran;
    }

    accountTransactionModalRef(component: Component, accountTransaction: AccountTransaction): NgbModalRef {
        const modalRef = this.modalService.open(component, { size: 'lg', backdrop: 'static'});
        modalRef.componentInstance.transaction = accountTransaction;
        modalRef.result.then((result) => {
            this.router.navigate([{ outlets: { popup: null }}], { replaceUrl: true });
            this.ngbModalRef = null;
        }, (reason) => {
            this.router.navigate([{ outlets: { popup: null }}], { replaceUrl: true });
            this.ngbModalRef = null;
        });
        return modalRef;
    }
}
<file_sep>/src/main/webapp/app/sf-entities/finance-account/transaction/transaction.module.ts
import {
    TransactionPopupService,
    TransactionComponent,
    TransactionDialogComponent,
    TransactionPopupComponent,
    TransactionDeletePopupComponent,
    TransactionDeleteDialogComponent,
    TranUploadComponent,
    transactionRoute,
    transactionPopupRoute,
    TransactionResolvePagingParams
} from './';
import {SfWebClientSharedModule} from '../../../shared/shared.module';
import {SfWebClientAdminModule} from '../../../admin/admin.module';
import {RouterModule} from '@angular/router';
import {FileUploadModule} from 'ng2-file-upload';
import {SearchModule} from '../../../shared/search/search.module';
import {AccountTransactionService} from '../../account-transaction/account-transaction.service';
import {CUSTOM_ELEMENTS_SCHEMA, NgModule} from '@angular/core';
import {TypeaheadModule} from 'ngx-bootstrap/typeahead';
import {BsDatepickerModule} from "ngx-bootstrap/datepicker";


const ENTITY_STATES = [
    ...transactionRoute,
    ...transactionPopupRoute,
];

@NgModule({
    imports: [
        SfWebClientSharedModule,
        SfWebClientAdminModule,
        RouterModule.forRoot(ENTITY_STATES, { useHash: true, enableTracing: true }),
        FileUploadModule,
        SearchModule,
        TypeaheadModule.forRoot(),
        BsDatepickerModule.forRoot()
    ],
    declarations: [
        TransactionComponent,
        TransactionDialogComponent,
        TransactionDeleteDialogComponent,
        TransactionPopupComponent,
        TransactionDeletePopupComponent,
        TranUploadComponent
    ],
    providers: [
        AccountTransactionService,
        TransactionPopupService,
        TransactionResolvePagingParams,
    ],
    entryComponents: [
        TranUploadComponent,
        TransactionDialogComponent,
        TransactionDeleteDialogComponent,
        TransactionPopupComponent,
        TransactionDeletePopupComponent
    ],
    exports: [
        TransactionComponent
    ],
    schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class SfWebClientTransactionModule {}
<file_sep>/src/main/java/com/calderon/sf/domain/package-info.java
/**
 * JPA domain objects.
 */
package com.calderon.sf.domain;
<file_sep>/src/main/webapp/app/entities/account-transaction/index.ts
export * from './account-transaction.model';
export * from './account-transaction-popup.service';
export * from './account-transaction.service';
export * from './account-transaction-dialog.component';
export * from './account-transaction-delete-dialog.component';
export * from './account-transaction-detail.component';
export * from './account-transaction.component';
export * from './account-transaction.route';
<file_sep>/src/main/webapp/app/entities/account-transaction/account-transaction-popup.service.ts
import { Injectable, Component } from '@angular/core';
import { Router } from '@angular/router';
import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
import { AccountTransaction } from './account-transaction.model';
import { AccountTransactionService } from './account-transaction.service';

@Injectable()
export class AccountTransactionPopupService {
    private ngbModalRef: NgbModalRef;

    constructor(
        private modalService: NgbModal,
        private router: Router,
        private accountTransactionService: AccountTransactionService

    ) {
        this.ngbModalRef = null;
    }

    open(component: Component, id?: number | any): Promise<NgbModalRef> {
        return new Promise<NgbModalRef>((resolve, reject) => {
            const isOpen = this.ngbModalRef !== null;
            if (isOpen) {
                resolve(this.ngbModalRef);
            }

            if (id) {
                this.accountTransactionService.find(id).subscribe((accountTransaction) => {
                    if (accountTransaction.postDate) {
                        accountTransaction.postDate = {
                            year: accountTransaction.postDate.getFullYear(),
                            month: accountTransaction.postDate.getMonth() + 1,
                            day: accountTransaction.postDate.getDate()
                        };
                    }
                    this.ngbModalRef = this.accountTransactionModalRef(component, accountTransaction);
                    resolve(this.ngbModalRef);
                });
            } else {
                // setTimeout used as a workaround for getting ExpressionChangedAfterItHasBeenCheckedError
                setTimeout(() => {
                    this.ngbModalRef = this.accountTransactionModalRef(component, new AccountTransaction());
                    resolve(this.ngbModalRef);
                }, 0);
            }
        });
    }

    accountTransactionModalRef(component: Component, accountTransaction: AccountTransaction): NgbModalRef {
        const modalRef = this.modalService.open(component, { size: 'lg', backdrop: 'static'});
        modalRef.componentInstance.accountTransaction = accountTransaction;
        modalRef.result.then((result) => {
            this.router.navigate([{ outlets: { popup: null }}], { replaceUrl: true });
            this.ngbModalRef = null;
        }, (reason) => {
            this.router.navigate([{ outlets: { popup: null }}], { replaceUrl: true });
            this.ngbModalRef = null;
        });
        return modalRef;
    }
}
<file_sep>/src/main/java/com/calderon/sf/web/rest/TranCategoryRegexResource.java
package com.calderon.sf.web.rest;

import com.calderon.sf.domain.TranCategoryRegex;
import com.calderon.sf.repository.TranCategoryRegexRepository;
import com.calderon.sf.web.rest.util.HeaderUtil;
import com.calderon.sf.web.rest.util.PaginationUtil;
import com.codahale.metrics.annotation.Timed;
import io.github.jhipster.web.util.ResponseUtil;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;

/**
 * REST controller for managing TranCategoryRegex.
 */
@RestController
@RequestMapping("/api")
public class TranCategoryRegexResource {

    private final Logger log = LoggerFactory.getLogger(TranCategoryRegexResource.class);

    private static final String ENTITY_NAME = "tranCategoryRegex";

    private final TranCategoryRegexRepository tranCategoryRegexRepository;

    public TranCategoryRegexResource(TranCategoryRegexRepository tranCategoryRegexRepository) {
        this.tranCategoryRegexRepository = tranCategoryRegexRepository;
    }

    /**
     * POST  /tran-category-regexes : Create a new tranCategoryRegex.
     *
     * @param tranCategoryRegex the tranCategoryRegex to create
     * @return the ResponseEntity with status 201 (Created) and with body the new tranCategoryRegex, or with status 400 (Bad Request) if the tranCategoryRegex has already an ID
     * @throws URISyntaxException if the Location URI syntax is incorrect
     */
    @PostMapping("/tran-category-regexes")
    @Timed
    public ResponseEntity<TranCategoryRegex> createTranCategoryRegex(@Valid @RequestBody TranCategoryRegex tranCategoryRegex) throws URISyntaxException {
        log.debug("REST request to save TranCategoryRegex : {}", tranCategoryRegex);
        if (tranCategoryRegex.getId() != null) {
            return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(ENTITY_NAME, "idexists", "A new tranCategoryRegex cannot already have an ID")).body(null);
        }
        TranCategoryRegex result = tranCategoryRegexRepository.save(tranCategoryRegex);
        return ResponseEntity.created(new URI("/api/tran-category-regexes/" + result.getId()))
            .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
            .body(result);
    }

    /**
     * PUT  /tran-category-regexes : Updates an existing tranCategoryRegex.
     *
     * @param tranCategoryRegex the tranCategoryRegex to update
     * @return the ResponseEntity with status 200 (OK) and with body the updated tranCategoryRegex,
     * or with status 400 (Bad Request) if the tranCategoryRegex is not valid,
     * or with status 500 (Internal Server Error) if the tranCategoryRegex couldn't be updated
     * @throws URISyntaxException if the Location URI syntax is incorrect
     */
    @PutMapping("/tran-category-regexes")
    @Timed
    public ResponseEntity<TranCategoryRegex> updateTranCategoryRegex(@Valid @RequestBody TranCategoryRegex tranCategoryRegex) throws URISyntaxException {
        log.debug("REST request to update TranCategoryRegex : {}", tranCategoryRegex);
        if (tranCategoryRegex.getId() == null) {
            return createTranCategoryRegex(tranCategoryRegex);
        }
        TranCategoryRegex result = tranCategoryRegexRepository.save(tranCategoryRegex);
        return ResponseEntity.ok()
            .headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, tranCategoryRegex.getId().toString()))
            .body(result);
    }

    /**
     * GET  /tran-category-regexes : get all the tranCategoryRegexes.
     *
     * @param pageable the pagination information
     * @return the ResponseEntity with status 200 (OK) and the list of tranCategoryRegexes in body
     */
    @GetMapping("/tran-category-regexes")
    @Timed
    public ResponseEntity<List<TranCategoryRegex>> getAllTranCategoryRegexes(@ApiParam Pageable pageable) {
        log.debug("REST request to get a page of TranCategoryRegexes");
        /*Page<TranCategoryRegex> page = tranCategoryRegexRepository.findAll(pageable);*/
        Page<TranCategoryRegex> page = tranCategoryRegexRepository.findByUserIsCurrentUser(pageable);
        HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/tran-category-regexes");
        return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
    }

    /**
     * GET  /tran-category-regexes/:id : get the "id" tranCategoryRegex.
     *
     * @param id the id of the tranCategoryRegex to retrieve
     * @return the ResponseEntity with status 200 (OK) and with body the tranCategoryRegex, or with status 404 (Not Found)
     */
    @GetMapping("/tran-category-regexes/{id}")
    @Timed
    public ResponseEntity<TranCategoryRegex> getTranCategoryRegex(@PathVariable Long id) {
        log.debug("REST request to get TranCategoryRegex : {}", id);
        TranCategoryRegex tranCategoryRegex = tranCategoryRegexRepository.findOne(id);
        return ResponseUtil.wrapOrNotFound(Optional.ofNullable(tranCategoryRegex));
    }

    /**
     * DELETE  /tran-category-regexes/:id : delete the "id" tranCategoryRegex.
     *
     * @param id the id of the tranCategoryRegex to delete
     * @return the ResponseEntity with status 200 (OK)
     */
    @DeleteMapping("/tran-category-regexes/{id}")
    @Timed
    public ResponseEntity<Void> deleteTranCategoryRegex(@PathVariable Long id) {
        log.debug("REST request to delete TranCategoryRegex : {}", id);
        tranCategoryRegexRepository.delete(id);
        return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
    }
}
<file_sep>/src/main/java/com/calderon/sf/domain/enumeration/AccountStatus.java
package com.calderon.sf.domain.enumeration;

/**
 * The AccountStatus enumeration.
 */
public enum AccountStatus {
    INACTIVE, ACTIVE
}
<file_sep>/src/main/java/com/calderon/sf/domain/enumeration/AccountType.java
package com.calderon.sf.domain.enumeration;

/**
 * The AccountType enumeration.
 */
public enum AccountType {
    GENERIC, CHECKING_ACCOUNT, SAVING_ACCOUNT, CREDIT_CARD
}
<file_sep>/src/main/webapp/app/shared/logger/logger.service.ts
import {Injectable} from '@angular/core';

@Injectable()
export class LoggerService {

    constructor() {
    }

    public log(msg: any) {
        console.log(msg);
    }

    info(msg: any){
        console.info(msg);
    }

    error(msg: any) {
        console.error(msg);
    }

    warn(msg: any) {
        console.warn(msg);
    }
}
<file_sep>/src/main/webapp/app/sf-entities/finance-account/finance-account-delete-dialog.component.ts
import { Component, OnInit, OnDestroy } from '@angular/core';
import { ActivatedRoute } from '@angular/router';

import { NgbActiveModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
import { JhiEventManager } from 'ng-jhipster';

import { FinanceAccount } from './finance-account.model';
import { FinanceAccountPopupService } from './finance-account-popup.service';
import { FinanceAccountService } from './finance-account.service';

@Component({
    selector: 'jhi-finance-account-delete-dialog',
    templateUrl: './finance-account-delete-dialog.component.html'
})
export class FinanceAccountDeleteDialogComponent {

    financeAccount: FinanceAccount;

    constructor(
        private financeAccountService: FinanceAccountService,
        public activeModal: NgbActiveModal,
        private eventManager: JhiEventManager
    ) {
    }

    clear() {
        this.activeModal.dismiss('cancel');
    }

    confirmDelete(id: number) {
        this.financeAccountService.delete(id).subscribe((response) => {
            this.eventManager.broadcast({
                name: 'financeAccountListModification',
                content: 'Deleted an financeAccount'
            });
            this.activeModal.dismiss(true);
        });
    }
}

@Component({
    selector: 'jhi-finance-account-delete-popup',
    template: ''
})
export class FinanceAccountDeletePopupComponent implements OnInit, OnDestroy {

    routeSub: any;

    constructor(
        private route: ActivatedRoute,
        private financeAccountPopupService: FinanceAccountPopupService
    ) {}

    ngOnInit() {
        this.routeSub = this.route.params.subscribe((params) => {
            this.financeAccountPopupService
                .open(FinanceAccountDeleteDialogComponent as Component, params['id']);
        });
    }

    ngOnDestroy() {
        this.routeSub.unsubscribe();
    }
}
<file_sep>/src/main/webapp/app/sf-entities/finance-account/finance-account.service.ts
import {Injectable} from '@angular/core';
import {Http, Response} from '@angular/http';
import {Observable} from 'rxjs/Rx';
import {SERVER_API_URL} from '../../app.constants';

import {JhiDateUtils} from 'ng-jhipster';

import {FinanceAccount} from './finance-account.model';
import {createRequestOption, ResponseWrapper} from '../../shared';
import {AccountTransaction} from '../account-transaction/account-transaction.model';
import {HttpObserve} from '@angular/common/http/src/client';
import {HttpParams} from '@angular/common/http';
import {createQueryRequestOption} from "../../shared/model/request-util";
import {DatetimeService} from "../../shared/datetime/datetime.service";

@Injectable()
export class FinanceAccountService {

    private resourceUrl = SERVER_API_URL + 'api/finance-accounts';

    constructor(private http: Http, private dateUtils: JhiDateUtils, private dateTimeService: DatetimeService) {
    }

    create(financeAccount: FinanceAccount): Observable<FinanceAccount> {
        const copy = this.convert(financeAccount);
        return this.http.post(this.resourceUrl, copy).map((res: Response) => {
            const jsonResponse = res.json();
            this.convertItemFromServer(jsonResponse);
            return jsonResponse;
        });
    }

    update(financeAccount: FinanceAccount): Observable<FinanceAccount> {
        const copy = this.convert(financeAccount);
        return this.http.put(this.resourceUrl, copy).map((res: Response) => {
            const jsonResponse = res.json();
            this.convertItemFromServer(jsonResponse);
            return jsonResponse;
        });
    }

    find(id: number): Observable<FinanceAccount> {
        return this.http.get(`${this.resourceUrl}/${id}`).map((res: Response) => {
            const jsonResponse = res.json();
            this.convertItemFromServer(jsonResponse);
            return jsonResponse;
        });
    }

    findTransactions(id: number): Observable<AccountTransaction[]> {
        return this.findTransactionsByYear(id, 0);
    }

    findTransactionsByYear(id: number, year: number): Observable<AccountTransaction[]> {
        return this.http.get(`${this.resourceUrl}/${id}/transactionsByYear`, {
            params: new HttpParams().set('year', year + '')
        }).map((res: Response) => {
            const jsonResponse = res.json();
            this.convertTransactionsFromServer(jsonResponse);
            return jsonResponse;
        });
    }

    query(req?: any): Observable<ResponseWrapper> {
        const options = createRequestOption(req);
        return this.http.get(this.resourceUrl, options)
            .map((res: Response) => this.convertResponse(res));
    }

    queryTransactions(id: number, req?: any): Observable<ResponseWrapper> {
        const options = createQueryRequestOption(req);
        return this.http.get(`${this.resourceUrl}/${id}/transactions`, options)
            .map((res: Response) => this.convertResponse(res));
    }

    queryTransactionsBy(id: number, req?: any, criteria?: any): Observable<ResponseWrapper> {
        const options = createQueryRequestOption(req, this.convertCriteria(criteria));
        return this.http.get(`${this.resourceUrl}/${id}/transactions`, options)
            .map((res: Response) => this.convertResponse(res));
    }

    delete(id: number): Observable<Response> {
        return this.http.delete(`${this.resourceUrl}/${id}`);
    }

    private convertTransactionsFromServer(accountTransactions: AccountTransaction[]) {
        for (let tran of accountTransactions) {
            this.convertTransactionFromServer(tran);
        }
    }

    private convertTransactionFromServer(entity: any) {
        entity.postDate = this.dateUtils
            .convertLocalDateFromServer(entity.postDate);
    }

    private convertResponse(res: Response): ResponseWrapper {
        const jsonResponse = res.json();
        for (let i = 0; i < jsonResponse.length; i++) {
            this.convertItemFromServer(jsonResponse[i]);
        }
        return new ResponseWrapper(res.headers, jsonResponse, res.status);
    }

    private convertTranResponse(res: Response): ResponseWrapper {
        const jsonResponse = res.json();
        for (let i = 0; i < jsonResponse.length; i++) {
            this.convertItemFromServer(jsonResponse[i]);
        }
        return new ResponseWrapper(res.headers, jsonResponse, res.status);
    }

    private convertTranFromServer(entity: any) {
        entity.postDate = this.dateUtils
            .convertLocalDateFromServer(entity.postDate);
        entity.createdDate = this.dateUtils
            .convertLocalDateFromServer(entity.createdDate);
    }

    private convertItemFromServer(entity: any) {
        entity.dueDate = this.dateUtils
            .convertLocalDateFromServer(entity.dueDate);
        entity.closingDate = this.dateUtils
            .convertLocalDateFromServer(entity.closingDate);
    }

    private convert(financeAccount: FinanceAccount): FinanceAccount {
        const copy: FinanceAccount = Object.assign({}, financeAccount);
        copy.dueDate = this.dateUtils
            .convertLocalDateToServer(financeAccount.dueDate);
        copy.closingDate = this.dateUtils
            .convertLocalDateToServer(financeAccount.closingDate);
        return copy;
    }

    private convertCriteria(criteria: any): any {
        const copy: any = Object.assign({}, criteria);
        if(copy.startDate)
            copy.startDate = this.dateUtils
            .convertLocalDateToServer(this.dateTimeService.convertToObjDate(criteria.startDate));
        if(copy.endDate)
            copy.endDate = this.dateUtils
            .convertLocalDateToServer(this.dateTimeService.convertToObjDate(criteria.endDate));
        return copy;
    }
}
<file_sep>/src/main/webapp/app/shared/search/search.component.ts
import {Component, OnInit} from "@angular/core";
import {Observable} from "rxjs/Observable";
import {Subject} from "rxjs/Subject";

@Component({
    selector: 'jhi-search',
    templateUrl: './search.component.html',
    providers: []
})
export class SearchComponent implements OnInit {
    items: Observable<any[]>;
    private searchTerms = new Subject<string>();

    constructor() {}

    // Push a search term into the observable stream.
    search(term: string): void {
        this.searchTerms.next(term);
    }

    ngOnInit(): void {
        this.items = this.searchTerms
            .debounceTime(300)        // wait 300ms after each keystroke before considering the term
            .distinctUntilChanged()   // ignore if next search term is same as previous
            .switchMap(term => term   // switch to new observable each time the term changes
                // return the http search observable
                ? this.searchAysnc(term)
                // or the observable of empty heroes if there was no search term
                : Observable.of<any[]>([]))
            .catch(error => {
                // TODO: add real error handling
                console.log(error);
                return Observable.of<any[]>([]);
            });
    }

    private searchAysnc(term: string): Observable<any[]> {
        return Observable.of<any[]>([]);
    }
}
<file_sep>/src/main/webapp/app/shared/model/request-util.ts
import { URLSearchParams, BaseRequestOptions } from '@angular/http';

export const createRequestOption = (req?: any): BaseRequestOptions => {
    const options: BaseRequestOptions = new BaseRequestOptions();
    if (req) {
        const params: URLSearchParams = new URLSearchParams();
        params.set('page', req.page);
        params.set('size', req.size);
        if (req.sort) {
            params.paramsMap.set('sort', req.sort);
        }
        params.set('query', req.query);

        options.params = params;
    }
    return options;
};

export const createQueryRequestOption = (req?: any, criteria?: any): BaseRequestOptions => {
    const options: BaseRequestOptions = new BaseRequestOptions();
    if (req) {
        const urlParams: URLSearchParams = new URLSearchParams();
        const params = {};
        params['page'] = req.page;
        params['size'] = req.size;
        if (req.sort) {
            params['sort'] = req.sort;
        }
        params['query'] = req.query;


        urlParams.set("pageable", JSON.stringify(params));
        if(criteria){
            criteria["active"]=true;
            urlParams.set("criteria", JSON.stringify(criteria));
        }
        else
            //urlParams.set("criteria", JSON.stringify({"active": false, "startDate":"", "endDate":"","desc":"","startAmount":"","endAmount":""}));
            urlParams.set("criteria", JSON.stringify({"active": false}));
        options.params = urlParams;
    }
    return options;
};
<file_sep>/src/test/javascript/e2e/entities/bank.spec.ts
import { browser, element, by, $ } from 'protractor';
import { NavBarPage } from './../page-objects/jhi-page-objects';
const path = require('path');

describe('Bank e2e test', () => {

    let navBarPage: NavBarPage;
    let bankDialogPage: BankDialogPage;
    let bankComponentsPage: BankComponentsPage;
    const fileToUpload = '../../../../main/webapp/content/images/logo-jhipster.png';
    const absolutePath = path.resolve(__dirname, fileToUpload);
    

    beforeAll(() => {
        browser.get('/');
        browser.waitForAngular();
        navBarPage = new NavBarPage();
        navBarPage.getSignInPage().autoSignInUsing('admin', 'admin');
        browser.waitForAngular();
    });

    it('should load Banks', () => {
        navBarPage.goToEntity('bank');
        bankComponentsPage = new BankComponentsPage();
        expect(bankComponentsPage.getTitle()).toMatch(/sfWebClientApp.bank.home.title/);

    });

    it('should load create Bank dialog', () => {
        bankComponentsPage.clickOnCreateButton();
        bankDialogPage = new BankDialogPage();
        expect(bankDialogPage.getModalTitle()).toMatch(/sfWebClientApp.bank.home.createOrEditLabel/);
        bankDialogPage.close();
    });

    it('should create and save Banks', () => {
        bankComponentsPage.clickOnCreateButton();
        bankDialogPage.setNameInput('name');
        expect(bankDialogPage.getNameInput()).toMatch('name');
        bankDialogPage.setDescriptionInput('description');
        expect(bankDialogPage.getDescriptionInput()).toMatch('description');
        bankDialogPage.save();
        expect(bankDialogPage.getSaveButton().isPresent()).toBeFalsy();
    }); 

    afterAll(() => {
        navBarPage.autoSignOut();
    });
});

export class BankComponentsPage {
    createButton = element(by.css('.jh-create-entity'));
    title = element.all(by.css('jhi-bank div h2 span')).first();

    clickOnCreateButton() {
        return this.createButton.click();
    }

    getTitle() {
        return this.title.getAttribute('jhiTranslate');
    }
}

export class BankDialogPage {
    modalTitle = element(by.css('h4#myBankLabel'));
    saveButton = element(by.css('.modal-footer .btn.btn-primary'));
    closeButton = element(by.css('button.close'));
    nameInput = element(by.css('input#field_name'));
    descriptionInput = element(by.css('input#field_description'));

    getModalTitle() {
        return this.modalTitle.getAttribute('jhiTranslate');
    }

    setNameInput = function (name) {
        this.nameInput.sendKeys(name);
    }

    getNameInput = function () {
        return this.nameInput.getAttribute('value');
    }

    setDescriptionInput = function (description) {
        this.descriptionInput.sendKeys(description);
    }

    getDescriptionInput = function () {
        return this.descriptionInput.getAttribute('value');
    }

    save() {
        this.saveButton.click();
    }

    close() {
        this.closeButton.click();
    }

    getSaveButton() {
        return this.saveButton;
    }
}
<file_sep>/src/main/webapp/app/sf-entities/tran-category/index.ts
export * from './tran-category.model';
export * from './tran-category-popup.service';
export * from './tran-category.service';
export * from './tran-category-dialog.component';
export * from './tran-category-delete-dialog.component';
export * from './tran-category-detail.component';
export * from './tran-category.component';
export * from './tran-category.route';
<file_sep>/src/main/webapp/app/shared/search/search.module.ts
import {NgModule} from '@angular/core';
import {SearchDirective} from './search.directive';

@NgModule({
    imports: [],
    declarations: [SearchDirective],
    exports: [
        SearchDirective
    ]
})
export class SearchModule {
}
<file_sep>/src/test/javascript/e2e/entities/tran-category-regex.spec.ts
import { browser, element, by, $ } from 'protractor';
import { NavBarPage } from './../page-objects/jhi-page-objects';
const path = require('path');

describe('TranCategoryRegex e2e test', () => {

    let navBarPage: NavBarPage;
    let tranCategoryRegexDialogPage: TranCategoryRegexDialogPage;
    let tranCategoryRegexComponentsPage: TranCategoryRegexComponentsPage;
    const fileToUpload = '../../../../main/webapp/content/images/logo-jhipster.png';
    const absolutePath = path.resolve(__dirname, fileToUpload);
    

    beforeAll(() => {
        browser.get('/');
        browser.waitForAngular();
        navBarPage = new NavBarPage();
        navBarPage.getSignInPage().autoSignInUsing('admin', 'admin');
        browser.waitForAngular();
    });

    it('should load TranCategoryRegexes', () => {
        navBarPage.goToEntity('tran-category-regex');
        tranCategoryRegexComponentsPage = new TranCategoryRegexComponentsPage();
        expect(tranCategoryRegexComponentsPage.getTitle()).toMatch(/sfWebClientApp.tranCategoryRegex.home.title/);

    });

    it('should load create TranCategoryRegex dialog', () => {
        tranCategoryRegexComponentsPage.clickOnCreateButton();
        tranCategoryRegexDialogPage = new TranCategoryRegexDialogPage();
        expect(tranCategoryRegexDialogPage.getModalTitle()).toMatch(/sfWebClientApp.tranCategoryRegex.home.createOrEditLabel/);
        tranCategoryRegexDialogPage.close();
    });

    it('should create and save TranCategoryRegexes', () => {
        tranCategoryRegexComponentsPage.clickOnCreateButton();
        tranCategoryRegexDialogPage.setNameInput('name');
        expect(tranCategoryRegexDialogPage.getNameInput()).toMatch('name');
        tranCategoryRegexDialogPage.setDescriptionInput('description');
        expect(tranCategoryRegexDialogPage.getDescriptionInput()).toMatch('description');
        tranCategoryRegexDialogPage.setRegexInput('regex');
        expect(tranCategoryRegexDialogPage.getRegexInput()).toMatch('regex');
        tranCategoryRegexDialogPage.userSelectLastOption();
        tranCategoryRegexDialogPage.save();
        expect(tranCategoryRegexDialogPage.getSaveButton().isPresent()).toBeFalsy();
    }); 

    afterAll(() => {
        navBarPage.autoSignOut();
    });
});

export class TranCategoryRegexComponentsPage {
    createButton = element(by.css('.jh-create-entity'));
    title = element.all(by.css('jhi-tran-category-regex div h2 span')).first();

    clickOnCreateButton() {
        return this.createButton.click();
    }

    getTitle() {
        return this.title.getAttribute('jhiTranslate');
    }
}

export class TranCategoryRegexDialogPage {
    modalTitle = element(by.css('h4#myTranCategoryRegexLabel'));
    saveButton = element(by.css('.modal-footer .btn.btn-primary'));
    closeButton = element(by.css('button.close'));
    nameInput = element(by.css('input#field_name'));
    descriptionInput = element(by.css('input#field_description'));
    regexInput = element(by.css('input#field_regex'));
    userSelect = element(by.css('select#field_user'));

    getModalTitle() {
        return this.modalTitle.getAttribute('jhiTranslate');
    }

    setNameInput = function (name) {
        this.nameInput.sendKeys(name);
    }

    getNameInput = function () {
        return this.nameInput.getAttribute('value');
    }

    setDescriptionInput = function (description) {
        this.descriptionInput.sendKeys(description);
    }

    getDescriptionInput = function () {
        return this.descriptionInput.getAttribute('value');
    }

    setRegexInput = function (regex) {
        this.regexInput.sendKeys(regex);
    }

    getRegexInput = function () {
        return this.regexInput.getAttribute('value');
    }

    userSelectLastOption = function () {
        this.userSelect.all(by.tagName('option')).last().click();
    }

    userSelectOption = function (option) {
        this.userSelect.sendKeys(option);
    }

    getUserSelect = function () {
        return this.userSelect;
    }

    getUserSelectedOption = function () {
        return this.userSelect.element(by.css('option:checked')).getText();
    }

    save() {
        this.saveButton.click();
    }

    close() {
        this.closeButton.click();
    }

    getSaveButton() {
        return this.saveButton;
    }
}
<file_sep>/src/test/javascript/e2e/entities/account-transaction.spec.ts
import { browser, element, by, $ } from 'protractor';
import { NavBarPage } from './../page-objects/jhi-page-objects';
const path = require('path');

describe('AccountTransaction e2e test', () => {

    let navBarPage: NavBarPage;
    let accountTransactionDialogPage: AccountTransactionDialogPage;
    let accountTransactionComponentsPage: AccountTransactionComponentsPage;
    const fileToUpload = '../../../../main/webapp/content/images/logo-jhipster.png';
    const absolutePath = path.resolve(__dirname, fileToUpload);
    

    beforeAll(() => {
        browser.get('/');
        browser.waitForAngular();
        navBarPage = new NavBarPage();
        navBarPage.getSignInPage().autoSignInUsing('admin', 'admin');
        browser.waitForAngular();
    });

    it('should load AccountTransactions', () => {
        navBarPage.goToEntity('account-transaction');
        accountTransactionComponentsPage = new AccountTransactionComponentsPage();
        expect(accountTransactionComponentsPage.getTitle()).toMatch(/sfWebClientApp.accountTransaction.home.title/);

    });

    it('should load create AccountTransaction dialog', () => {
        accountTransactionComponentsPage.clickOnCreateButton();
        accountTransactionDialogPage = new AccountTransactionDialogPage();
        expect(accountTransactionDialogPage.getModalTitle()).toMatch(/sfWebClientApp.accountTransaction.home.createOrEditLabel/);
        accountTransactionDialogPage.close();
    });

   /* it('should create and save AccountTransactions', () => {
        accountTransactionComponentsPage.clickOnCreateButton();
        accountTransactionDialogPage.tranTypeSelectLastOption();
        accountTransactionDialogPage.setTranNumberInput('tranNumber');
        expect(accountTransactionDialogPage.getTranNumberInput()).toMatch('tranNumber');
        accountTransactionDialogPage.setReferenceNumberInput('referenceNumber');
        expect(accountTransactionDialogPage.getReferenceNumberInput()).toMatch('referenceNumber');
        accountTransactionDialogPage.setPostDateInput('2000-12-31');
        expect(accountTransactionDialogPage.getPostDateInput()).toMatch('2000-12-31');
        accountTransactionDialogPage.setDescriptionInput('description');
        expect(accountTransactionDialogPage.getDescriptionInput()).toMatch('description');
        accountTransactionDialogPage.setAmountInput('5');
        expect(accountTransactionDialogPage.getAmountInput()).toMatch('5');
        accountTransactionDialogPage.paymentMethodSelectLastOption();
        accountTransactionDialogPage.userSelectLastOption();
        accountTransactionDialogPage.financeAccountSelectLastOption();
        accountTransactionDialogPage.tranCategorySelectLastOption();
        accountTransactionDialogPage.save();
        expect(accountTransactionDialogPage.getSaveButton().isPresent()).toBeFalsy();
    }); */

    afterAll(() => {
        navBarPage.autoSignOut();
    });
});

export class AccountTransactionComponentsPage {
    createButton = element(by.css('.jh-create-entity'));
    title = element.all(by.css('jhi-account-transaction div h2 span')).first();

    clickOnCreateButton() {
        return this.createButton.click();
    }

    getTitle() {
        return this.title.getAttribute('jhiTranslate');
    }
}

export class AccountTransactionDialogPage {
    modalTitle = element(by.css('h4#myAccountTransactionLabel'));
    saveButton = element(by.css('.modal-footer .btn.btn-primary'));
    closeButton = element(by.css('button.close'));
    tranTypeSelect = element(by.css('select#field_tranType'));
    tranNumberInput = element(by.css('input#field_tranNumber'));
    referenceNumberInput = element(by.css('input#field_referenceNumber'));
    postDateInput = element(by.css('input#field_postDate'));
    descriptionInput = element(by.css('input#field_description'));
    amountInput = element(by.css('input#field_amount'));
    paymentMethodSelect = element(by.css('select#field_paymentMethod'));
    userSelect = element(by.css('select#field_user'));
    financeAccountSelect = element(by.css('select#field_financeAccount'));
    tranCategorySelect = element(by.css('select#field_tranCategory'));

    getModalTitle() {
        return this.modalTitle.getAttribute('jhiTranslate');
    }

    setTranTypeSelect = function (tranType) {
        this.tranTypeSelect.sendKeys(tranType);
    }

    getTranTypeSelect = function () {
        return this.tranTypeSelect.element(by.css('option:checked')).getText();
    }

    tranTypeSelectLastOption = function () {
        this.tranTypeSelect.all(by.tagName('option')).last().click();
    }
    setTranNumberInput = function (tranNumber) {
        this.tranNumberInput.sendKeys(tranNumber);
    }

    getTranNumberInput = function () {
        return this.tranNumberInput.getAttribute('value');
    }

    setReferenceNumberInput = function (referenceNumber) {
        this.referenceNumberInput.sendKeys(referenceNumber);
    }

    getReferenceNumberInput = function () {
        return this.referenceNumberInput.getAttribute('value');
    }

    setPostDateInput = function (postDate) {
        this.postDateInput.sendKeys(postDate);
    }

    getPostDateInput = function () {
        return this.postDateInput.getAttribute('value');
    }

    setDescriptionInput = function (description) {
        this.descriptionInput.sendKeys(description);
    }

    getDescriptionInput = function () {
        return this.descriptionInput.getAttribute('value');
    }

    setAmountInput = function (amount) {
        this.amountInput.sendKeys(amount);
    }

    getAmountInput = function () {
        return this.amountInput.getAttribute('value');
    }

    setPaymentMethodSelect = function (paymentMethod) {
        this.paymentMethodSelect.sendKeys(paymentMethod);
    }

    getPaymentMethodSelect = function () {
        return this.paymentMethodSelect.element(by.css('option:checked')).getText();
    }

    paymentMethodSelectLastOption = function () {
        this.paymentMethodSelect.all(by.tagName('option')).last().click();
    }
    userSelectLastOption = function () {
        this.userSelect.all(by.tagName('option')).last().click();
    }

    userSelectOption = function (option) {
        this.userSelect.sendKeys(option);
    }

    getUserSelect = function () {
        return this.userSelect;
    }

    getUserSelectedOption = function () {
        return this.userSelect.element(by.css('option:checked')).getText();
    }

    financeAccountSelectLastOption = function () {
        this.financeAccountSelect.all(by.tagName('option')).last().click();
    }

    financeAccountSelectOption = function (option) {
        this.financeAccountSelect.sendKeys(option);
    }

    getFinanceAccountSelect = function () {
        return this.financeAccountSelect;
    }

    getFinanceAccountSelectedOption = function () {
        return this.financeAccountSelect.element(by.css('option:checked')).getText();
    }

    tranCategorySelectLastOption = function () {
        this.tranCategorySelect.all(by.tagName('option')).last().click();
    }

    tranCategorySelectOption = function (option) {
        this.tranCategorySelect.sendKeys(option);
    }

    getTranCategorySelect = function () {
        return this.tranCategorySelect;
    }

    getTranCategorySelectedOption = function () {
        return this.tranCategorySelect.element(by.css('option:checked')).getText();
    }

    save() {
        this.saveButton.click();
    }

    close() {
        this.closeButton.click();
    }

    getSaveButton() {
        return this.saveButton;
    }
}
<file_sep>/src/main/java/com/calderon/sf/domain/AccountTransaction.java
package com.calderon.sf.domain;

import com.calderon.sf.domain.enumeration.PaymentMethod;
import com.calderon.sf.domain.enumeration.TranType;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Objects;

/**
 * A AccountTransaction.
 */
@Entity
@Table(name = "account_transaction")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class AccountTransaction extends AbstractAuditingEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @NotNull
    @Enumerated(EnumType.STRING)
    @Column(name = "tran_type", nullable = false)
    private TranType tranType;

    @Column(name = "tran_number")
    private String tranNumber;

    @Column(name = "reference_number")
    private String referenceNumber;

    @NotNull
    @Column(name = "post_date", nullable = false)
    private LocalDate postDate;

    @Size(max = 256, min = 2)
    @Column(name = "description", length = 256, nullable = false)
    private String description;

    @NotNull
    @Column(name = "amount", precision=10, scale=2, nullable = false)
    private BigDecimal amount;

    @Enumerated(EnumType.STRING)
    @Column(name = "payment_method")
    private PaymentMethod paymentMethod;

    @ManyToOne
    private User user;

    @ManyToOne(optional = false)
    @NotNull
    private FinanceAccount financeAccount;

    @ManyToOne
    private TranCategory tranCategory;

    // jhipster-needle-entity-add-field - Jhipster will add fields here, do not remove
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public TranType getTranType() {
        return tranType;
    }

    public AccountTransaction tranType(TranType tranType) {
        this.tranType = tranType;
        return this;
    }

    public void setTranType(TranType tranType) {
        this.tranType = tranType;
    }

    public String getTranNumber() {
        return tranNumber;
    }

    public AccountTransaction tranNumber(String tranNumber) {
        this.tranNumber = tranNumber;
        return this;
    }

    public void setTranNumber(String tranNumber) {
        this.tranNumber = tranNumber;
    }

    public String getReferenceNumber() {
        return referenceNumber;
    }

    public AccountTransaction referenceNumber(String referenceNumber) {
        this.referenceNumber = referenceNumber;
        return this;
    }

    public void setReferenceNumber(String referenceNumber) {
        this.referenceNumber = referenceNumber;
    }

    public LocalDate getPostDate() {
        return postDate;
    }

    public AccountTransaction postDate(LocalDate postDate) {
        this.postDate = postDate;
        return this;
    }

    public void setPostDate(LocalDate postDate) {
        this.postDate = postDate;
    }

    public String getDescription() {
        return description;
    }

    public AccountTransaction description(String description) {
        this.description = description;
        return this;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public AccountTransaction amount(BigDecimal amount) {
        this.amount = amount;
        return this;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public PaymentMethod getPaymentMethod() {
        return paymentMethod;
    }

    public AccountTransaction paymentMethod(PaymentMethod paymentMethod) {
        this.paymentMethod = paymentMethod;
        return this;
    }

    public void setPaymentMethod(PaymentMethod paymentMethod) {
        this.paymentMethod = paymentMethod;
    }

    public User getUser() {
        return user;
    }

    public AccountTransaction user(User user) {
        this.user = user;
        return this;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public FinanceAccount getFinanceAccount() {
        return financeAccount;
    }

    public AccountTransaction financeAccount(FinanceAccount financeAccount) {
        this.financeAccount = financeAccount;
        return this;
    }

    public void setFinanceAccount(FinanceAccount financeAccount) {
        this.financeAccount = financeAccount;
    }

    public TranCategory getTranCategory() {
        return tranCategory;
    }

    public AccountTransaction tranCategory(TranCategory tranCategory) {
        this.tranCategory = tranCategory;
        return this;
    }

    public void setTranCategory(TranCategory tranCategory) {
        this.tranCategory = tranCategory;
    }
    // jhipster-needle-entity-add-getters-setters - Jhipster will add getters and setters here, do not remove

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        AccountTransaction accountTransaction = (AccountTransaction) o;
        if (accountTransaction.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), accountTransaction.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    @Override
    public String toString() {
        return "AccountTransaction{" +
            "id=" + getId() +
            ", tranType='" + getTranType() + "'" +
            ", tranNumber='" + getTranNumber() + "'" +
            ", referenceNumber='" + getReferenceNumber() + "'" +
            ", postDate='" + getPostDate() + "'" +
            ", description='" + getDescription() + "'" +
            ", amount='" + getAmount() + "'" +
            ", paymentMethod='" + getPaymentMethod() + "'" +
            "}";
    }
}
<file_sep>/src/test/javascript/e2e/entities/finance-account.spec.ts
import { browser, element, by, $ } from 'protractor';
import { NavBarPage } from './../page-objects/jhi-page-objects';
const path = require('path');

describe('FinanceAccount e2e test', () => {

    let navBarPage: NavBarPage;
    let financeAccountDialogPage: FinanceAccountDialogPage;
    let financeAccountComponentsPage: FinanceAccountComponentsPage;
    const fileToUpload = '../../../../main/webapp/content/images/logo-jhipster.png';
    const absolutePath = path.resolve(__dirname, fileToUpload);
    

    beforeAll(() => {
        browser.get('/');
        browser.waitForAngular();
        navBarPage = new NavBarPage();
        navBarPage.getSignInPage().autoSignInUsing('admin', 'admin');
        browser.waitForAngular();
    });

    it('should load FinanceAccounts', () => {
        navBarPage.goToEntity('finance-account');
        financeAccountComponentsPage = new FinanceAccountComponentsPage();
        expect(financeAccountComponentsPage.getTitle()).toMatch(/sfWebClientApp.financeAccount.home.title/);

    });

    it('should load create FinanceAccount dialog', () => {
        financeAccountComponentsPage.clickOnCreateButton();
        financeAccountDialogPage = new FinanceAccountDialogPage();
        expect(financeAccountDialogPage.getModalTitle()).toMatch(/sfWebClientApp.financeAccount.home.createOrEditLabel/);
        financeAccountDialogPage.close();
    });

    it('should create and save FinanceAccounts', () => {
        financeAccountComponentsPage.clickOnCreateButton();
        financeAccountDialogPage.accountStatusSelectLastOption();
        financeAccountDialogPage.setAccountNumberInput('accountNumber');
        expect(financeAccountDialogPage.getAccountNumberInput()).toMatch('accountNumber');
        financeAccountDialogPage.setNameInput('name');
        expect(financeAccountDialogPage.getNameInput()).toMatch('name');
        financeAccountDialogPage.setDescriptionInput('description');
        expect(financeAccountDialogPage.getDescriptionInput()).toMatch('description');
        financeAccountDialogPage.setBalanceInput('5');
        expect(financeAccountDialogPage.getBalanceInput()).toMatch('5');
        financeAccountDialogPage.getIsCreditCardInput().isSelected().then(function (selected) {
            if (selected) {
                financeAccountDialogPage.getIsCreditCardInput().click();
                expect(financeAccountDialogPage.getIsCreditCardInput().isSelected()).toBeFalsy();
            } else {
                financeAccountDialogPage.getIsCreditCardInput().click();
                expect(financeAccountDialogPage.getIsCreditCardInput().isSelected()).toBeTruthy();
            }
        });
        financeAccountDialogPage.setDueDateInput('2000-12-31');
        expect(financeAccountDialogPage.getDueDateInput()).toMatch('2000-12-31');
        financeAccountDialogPage.setClosingDateInput('2000-12-31');
        expect(financeAccountDialogPage.getClosingDateInput()).toMatch('2000-12-31');
        financeAccountDialogPage.userSelectLastOption();
        financeAccountDialogPage.save();
        expect(financeAccountDialogPage.getSaveButton().isPresent()).toBeFalsy();
    }); 

    afterAll(() => {
        navBarPage.autoSignOut();
    });
});

export class FinanceAccountComponentsPage {
    createButton = element(by.css('.jh-create-entity'));
    title = element.all(by.css('jhi-finance-account div h2 span')).first();

    clickOnCreateButton() {
        return this.createButton.click();
    }

    getTitle() {
        return this.title.getAttribute('jhiTranslate');
    }
}

export class FinanceAccountDialogPage {
    modalTitle = element(by.css('h4#myFinanceAccountLabel'));
    saveButton = element(by.css('.modal-footer .btn.btn-primary'));
    closeButton = element(by.css('button.close'));
    accountStatusSelect = element(by.css('select#field_accountStatus'));
    accountNumberInput = element(by.css('input#field_accountNumber'));
    nameInput = element(by.css('input#field_name'));
    descriptionInput = element(by.css('input#field_description'));
    balanceInput = element(by.css('input#field_balance'));
    isCreditCardInput = element(by.css('input#field_isCreditCard'));
    dueDateInput = element(by.css('input#field_dueDate'));
    closingDateInput = element(by.css('input#field_closingDate'));
    userSelect = element(by.css('select#field_user'));

    getModalTitle() {
        return this.modalTitle.getAttribute('jhiTranslate');
    }

    setAccountStatusSelect = function (accountStatus) {
        this.accountStatusSelect.sendKeys(accountStatus);
    }

    getAccountStatusSelect = function () {
        return this.accountStatusSelect.element(by.css('option:checked')).getText();
    }

    accountStatusSelectLastOption = function () {
        this.accountStatusSelect.all(by.tagName('option')).last().click();
    }
    setAccountNumberInput = function (accountNumber) {
        this.accountNumberInput.sendKeys(accountNumber);
    }

    getAccountNumberInput = function () {
        return this.accountNumberInput.getAttribute('value');
    }

    setNameInput = function (name) {
        this.nameInput.sendKeys(name);
    }

    getNameInput = function () {
        return this.nameInput.getAttribute('value');
    }

    setDescriptionInput = function (description) {
        this.descriptionInput.sendKeys(description);
    }

    getDescriptionInput = function () {
        return this.descriptionInput.getAttribute('value');
    }

    setBalanceInput = function (balance) {
        this.balanceInput.sendKeys(balance);
    }

    getBalanceInput = function () {
        return this.balanceInput.getAttribute('value');
    }

    getIsCreditCardInput = function () {
        return this.isCreditCardInput;
    }
    setDueDateInput = function (dueDate) {
        this.dueDateInput.sendKeys(dueDate);
    }

    getDueDateInput = function () {
        return this.dueDateInput.getAttribute('value');
    }

    setClosingDateInput = function (closingDate) {
        this.closingDateInput.sendKeys(closingDate);
    }

    getClosingDateInput = function () {
        return this.closingDateInput.getAttribute('value');
    }

    userSelectLastOption = function () {
        this.userSelect.all(by.tagName('option')).last().click();
    }

    userSelectOption = function (option) {
        this.userSelect.sendKeys(option);
    }

    getUserSelect = function () {
        return this.userSelect;
    }

    getUserSelectedOption = function () {
        return this.userSelect.element(by.css('option:checked')).getText();
    }

    save() {
        this.saveButton.click();
    }

    close() {
        this.closeButton.click();
    }

    getSaveButton() {
        return this.saveButton;
    }
}
<file_sep>/src/main/webapp/app/sf-entities/tran-category/tran-category-detail.component.ts
import { Component, OnInit, OnDestroy } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Subscription } from 'rxjs/Rx';
import { JhiEventManager } from 'ng-jhipster';

import { TranCategory } from './tran-category.model';
import { TranCategoryService } from './tran-category.service';

@Component({
    selector: 'jhi-tran-category-detail',
    templateUrl: './tran-category-detail.component.html'
})
export class TranCategoryDetailComponent implements OnInit, OnDestroy {

    tranCategory: TranCategory;
    private subscription: Subscription;
    private eventSubscriber: Subscription;

    constructor(
        private eventManager: JhiEventManager,
        private tranCategoryService: TranCategoryService,
        private route: ActivatedRoute
    ) {
    }

    ngOnInit() {
        this.subscription = this.route.params.subscribe((params) => {
            this.load(params['id']);
        });
        this.registerChangeInTranCategories();
    }

    load(id) {
        this.tranCategoryService.find(id).subscribe((tranCategory) => {
            this.tranCategory = tranCategory;
        });
    }
    previousState() {
        window.history.back();
    }

    ngOnDestroy() {
        this.subscription.unsubscribe();
        this.eventManager.destroy(this.eventSubscriber);
    }

    registerChangeInTranCategories() {
        this.eventSubscriber = this.eventManager.subscribe(
            'tranCategoryListModification',
            (response) => this.load(this.tranCategory.id)
        );
    }
}
<file_sep>/src/main/webapp/app/account/activate/activate.component.ts
import {Component, OnDestroy, OnInit} from '@angular/core';
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
import {ActivatedRoute, Router} from '@angular/router';

import { ActivateService } from './activate.service';
import { LoginModalService } from '../../shared';
import {Principal} from "../../shared/auth/principal.service";
import {Subscription} from "rxjs/Subscription";
import {JhiEventManager} from "ng-jhipster";

@Component({
    selector: 'jhi-activate',
    templateUrl: './activate.component.html'
})
export class ActivateComponent implements OnInit, OnDestroy {
    error: string;
    success: string;
    modalRef: NgbModalRef;
    eventSubscriber: Subscription;

    constructor(
        private eventManager: JhiEventManager,
        private activateService: ActivateService,
        private loginModalService: LoginModalService,
        private route: ActivatedRoute,
        private router: Router,
        private principal: Principal,
    ) {
    }

    ngOnInit() {
        this.onAuthentication();

        this.route.queryParams.subscribe((params) => {
            this.activateService.get(params['key']).subscribe(() => {
                this.error = null;
                this.success = 'OK';
            }, () => {
                this.success = null;
                this.error = 'ERROR';
            });
        });
        this.registerOnUserLogin();
    }

    login() {
        this.modalRef = this.loginModalService.open();
    }

    onAuthentication() {
        if(this.principal.isAuthenticated())
            this.router.navigate(['/']);
    }
    registerOnUserLogin() {
        this.eventSubscriber = this.eventManager.subscribe('authenticationSuccess', (content) => {
            this.onAuthentication();
        });
    }


    ngOnDestroy(): void {
        this.eventManager.destroy(this.eventSubscriber);
    }
}
<file_sep>/src/main/java/com/calderon/sf/repository/TranCategoryRegexRepository.java
package com.calderon.sf.repository;

import com.calderon.sf.domain.TranCategoryRegex;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Spring Data JPA repository for the TranCategoryRegex entity.
 */
@SuppressWarnings("unused")
@Repository
public interface TranCategoryRegexRepository extends JpaRepository<TranCategoryRegex, Long> {

    @Query("select tran_category_regex from TranCategoryRegex tran_category_regex where tran_category_regex.user.login = ?#{principal.username}")
    List<TranCategoryRegex> findByUserIsCurrentUser();

    @Query("select tran_category_regex from TranCategoryRegex tran_category_regex where tran_category_regex.user.login = ?#{principal.username}")
    Page<TranCategoryRegex> findByUserIsCurrentUser(Pageable pageable);


}
<file_sep>/src/main/webapp/app/sf-entities/tran-category/tran-category.model.ts
import { BaseEntity, User } from './../../shared';

export class TranCategory implements BaseEntity {
    constructor(
        public id?: number,
        public name?: string,
        public description?: string,
        public transactions?: BaseEntity[],
        public user?: User,
        public tranCategoryRegex?: BaseEntity,
    ) {
    }
}
<file_sep>/src/main/java/com/calderon/sf/domain/projections/Transaction.java
package com.calderon.sf.domain.projections;

import java.math.BigDecimal;
import java.time.LocalDate;

public interface Transaction {
    String getDescription();
    BigDecimal getAmount();
    LocalDate getPostDate();
}
