Commit bdf3035b authored by Tifenn Guillas's avatar Tifenn Guillas

Add comments for metamodel module => DONE

parent 25e6a312
......@@ -11,6 +11,7 @@ import { Action } from '@ngrx/store';
import { Attribute, AttributesByDataset } from '../model';
export const LOAD_ATTRIBUTE_LIST = '[Attribute] Load Attribute List';
export const LOAD_ATTRIBUTE_LIST_SUCCESS = '[Attribute] Load Attribute List Success';
export const LOAD_ATTRIBUTE_LIST_FAIL = '[Attribute] Load Attribute List Fail';
......@@ -18,36 +19,66 @@ export const LOAD_MULTIPLE_ATTRIBUTE_LISTS = '[Attribute] Load Multiple Attribut
export const LOAD_MULTIPLE_ATTRIBUTE_LISTS_SUCCESS = '[Attribute] Load Multiple Attribute Lists Success';
export const LOAD_MULTIPLE_ATTRIBUTE_LISTS_FAIL = '[Attribute] Load Multiple Attribute Lists Fail';
/**
* @class
* @classdesc LoadAttributeListAction action.
* @readonly
*/
export class LoadAttributeListAction implements Action {
readonly type = LOAD_ATTRIBUTE_LIST;
constructor(public payload: string) { }
}
/**
* @class
* @classdesc LoadAttributeListSuccessAction action.
* @readonly
*/
export class LoadAttributeListSuccessAction implements Action {
readonly type = LOAD_ATTRIBUTE_LIST_SUCCESS;
constructor(public payload: { datasetName: string, attributeList: Attribute[] }) { }
}
/**
* @class
* @classdesc LoadAttributeListFailAction action.
* @readonly
*/
export class LoadAttributeListFailAction implements Action {
readonly type = LOAD_ATTRIBUTE_LIST_FAIL;
constructor(public payload: string) { }
}
/**
* @class
* @classdesc LoadMultipleAttributeListsAction action.
* @readonly
*/
export class LoadMultipleAttributeListsAction implements Action {
readonly type = LOAD_MULTIPLE_ATTRIBUTE_LISTS;
constructor(public payload: string[]) { }
}
/**
* @class
* @classdesc LoadMultipleAttributeListsSuccessAction action.
* @readonly
*/
export class LoadMultipleAttributeListsSuccessAction implements Action {
readonly type = LOAD_MULTIPLE_ATTRIBUTE_LISTS_SUCCESS;
constructor(public payload: AttributesByDataset[]) { }
}
/**
* @class
* @classdesc LoadMultipleAttributeListsFailAction action.
* @readonly
*/
export class LoadMultipleAttributeListsFailAction implements Action {
readonly type = LOAD_MULTIPLE_ATTRIBUTE_LISTS_FAIL;
......
......@@ -11,29 +11,50 @@ import { Action } from '@ngrx/store';
import { Family } from '../model';
export const LOAD_CRITERIA_SEARCH_META = '[Criteria] Load Criteria Search Meta';
export const LOAD_CRITERIA_SEARCH_META_WIP = '[Criteria] Load Criteria Search Meta WIP';
export const LOAD_CRITERIA_SEARCH_META_SUCCESS = '[Criteria] Load Criteria Search Meta Success';
export const LOAD_CRITERIA_SEARCH_META_FAIL = '[Criteria] Load Criteria Search Meta Fail';
/**
* @class
* @classdesc LoadCriteriaSearchMetaAction action.
* @readonly
*/
export class LoadCriteriaSearchMetaAction implements Action {
readonly type = LOAD_CRITERIA_SEARCH_META;
constructor(public payload: string) { }
}
/**
* @class
* @classdesc LoadCriteriaSearchMetaWipAction action.
* @readonly
*/
export class LoadCriteriaSearchMetaWipAction implements Action {
readonly type = LOAD_CRITERIA_SEARCH_META_WIP;
constructor(public payload: string) { }
}
/**
* @class
* @classdesc LoadCriteriaSearchMetaSuccessAction action.
* @readonly
*/
export class LoadCriteriaSearchMetaSuccessAction implements Action {
readonly type = LOAD_CRITERIA_SEARCH_META_SUCCESS;
constructor(public payload: Family[]) { }
}
/**
* @class
* @classdesc LoadCriteriaSearchMetaFailAction action.
* @readonly
*/
export class LoadCriteriaSearchMetaFailAction implements Action {
readonly type = LOAD_CRITERIA_SEARCH_META_FAIL;
......
......@@ -16,24 +16,44 @@ export const LOAD_DATASET_SEARCH_META_WIP = '[Dataset] Load Dataset Search Meta
export const LOAD_DATASET_SEARCH_META_SUCCESS = '[Dataset] Load Dataset Search Meta Success';
export const LOAD_DATASET_SEARCH_META_FAIL = '[Dataset] Load Dataset Search Meta Fail';
/**
* @class
* @classdesc LoadDatasetSearchMetaAction action.
* @readonly
*/
export class LoadDatasetSearchMetaAction implements Action {
readonly type = LOAD_DATASET_SEARCH_META;
constructor(public payload: {} = null) { }
}
/**
* @class
* @classdesc LoadDatasetSearchMetaWipAction action.
* @readonly
*/
export class LoadDatasetSearchMetaWipAction implements Action {
readonly type = LOAD_DATASET_SEARCH_META_WIP;
constructor(public payload: {} = null) { }
}
/**
* @class
* @classdesc LoadDatasetSearchMetaSuccessAction action.
* @readonly
*/
export class LoadDatasetSearchMetaSuccessAction implements Action {
readonly type = LOAD_DATASET_SEARCH_META_SUCCESS;
constructor(public payload: [Project[], Dataset[], Family[]]) { }
}
/**
* @class
* @classdesc LoadDatasetSearchMetaFailAction action.
* @readonly
*/
export class LoadDatasetSearchMetaFailAction implements Action {
readonly type = LOAD_DATASET_SEARCH_META_FAIL;
......
......@@ -11,22 +11,38 @@ import { Action } from '@ngrx/store';
import { Instance } from '../model';
export const LOAD_INSTANCE_META = '[Instance] Load Instance Meta';
export const LOAD_INSTANCE_META_SUCCESS = '[Instance] Load Instance Meta Success';
export const LOAD_INSTANCE_META_FAIL = '[Instance] Load Instance Meta Fail';
/**
* @class
* @classdesc LoadInstanceMetaAction action.
* @readonly
*/
export class LoadInstanceMetaAction implements Action {
readonly type = LOAD_INSTANCE_META;
constructor(public payload: {} = null) { }
}
/**
* @class
* @classdesc LoadInstanceMetaSuccessAction action.
* @readonly
*/
export class LoadInstanceMetaSuccessAction implements Action {
readonly type = LOAD_INSTANCE_META_SUCCESS;
constructor(public payload: Instance) { }
}
/**
* @class
* @classdesc LoadInstanceMetaFailAction action.
* @readonly
*/
export class LoadInstanceMetaFailAction implements Action {
readonly type = LOAD_INSTANCE_META_FAIL;
......
......@@ -11,29 +11,50 @@ import { Action } from '@ngrx/store';
import { Family, Category } from '../model';
export const LOAD_OUTPUT_SEARCH_META = '[Output] Load Output Search Meta';
export const LOAD_OUTPUT_SEARCH_META_WIP = '[Output] Load Output Search Meta WIP';
export const LOAD_OUTPUT_SEARCH_META_SUCCESS = '[Output] Load Output Search Meta Success';
export const LOAD_OUTPUT_SEARCH_META_FAIL = '[Output] Load Output Search Meta Fail';
/**
* @class
* @classdesc LoadOutputSearchMetaAction action.
* @readonly
*/
export class LoadOutputSearchMetaAction implements Action {
readonly type = LOAD_OUTPUT_SEARCH_META;
constructor(public payload: string) { }
}
/**
* @class
* @classdesc LoadOutputSearchMetaWipAction action.
* @readonly
*/
export class LoadOutputSearchMetaWipAction implements Action {
readonly type = LOAD_OUTPUT_SEARCH_META_WIP;
constructor(public payload: string) { }
}
/**
* @class
* @classdesc LoadOutputSearchMetaSuccessAction action.
* @readonly
*/
export class LoadOutputSearchMetaSuccessAction implements Action {
readonly type = LOAD_OUTPUT_SEARCH_META_SUCCESS;
constructor(public payload: [Family[], Category[]]) { }
}
/**
* @class
* @classdesc LoadOutputSearchMetaFailAction action.
* @readonly
*/
export class LoadOutputSearchMetaFailAction implements Action {
readonly type = LOAD_OUTPUT_SEARCH_META_FAIL;
......
......@@ -19,6 +19,10 @@ import { AttributeService } from '../services/attribute.service';
import { Attribute, AttributesByDataset } from '../model';
@Injectable()
/**
* @class
* @classdesc Attribute effects.
*/
export class AttributeEffects {
constructor(
private actions$: Actions,
......@@ -26,6 +30,9 @@ export class AttributeEffects {
private toastr: ToastrService
) { }
/**
* Retrieves attribute list for a given dataset name.
*/
@Effect()
loadAttributeListAction$ = this.actions$.pipe(
ofType(attributeActions.LOAD_ATTRIBUTE_LIST),
......@@ -40,12 +47,18 @@ export class AttributeEffects {
)
);
/**
* Displays retrieve attribute list error notification.
*/
@Effect({ dispatch: false })
loadAttributeListFailAction$ = this.actions$.pipe(
ofType(attributeActions.LOAD_ATTRIBUTE_LIST_FAIL),
tap(_ => this.toastr.error('Loading Failed!', 'Attribute list loading failed'))
);
/**
* Retrieves attribute lists for a given datasets name.
*/
@Effect()
loadMultipleAttributeListsAction$ = this.actions$.pipe(
ofType(attributeActions.LOAD_MULTIPLE_ATTRIBUTE_LISTS),
......@@ -74,6 +87,9 @@ export class AttributeEffects {
})
);
/**
* Displays retrieve attribute lists error notification.
*/
@Effect({ dispatch: false })
loadAttributeListsFailedAction$ = this.actions$.pipe(
ofType(attributeActions.LOAD_MULTIPLE_ATTRIBUTE_LISTS_FAIL),
......
......@@ -19,6 +19,10 @@ import * as criteriaActions from '../action/criteria.action';
import { CriteriaService } from '../services/criteria.service';
@Injectable()
/**
* @class
* @classdesc Criteria effects.
*/
export class CriteriaEffects {
constructor(
private actions$: Actions,
......@@ -26,6 +30,9 @@ export class CriteriaEffects {
private toastr: ToastrService
) { }
/**
* Calls action to retrieve criteria metadata.
*/
@Effect()
loadCriteriaSearchMetaAction$ = this.actions$.pipe(
ofType(criteriaActions.LOAD_CRITERIA_SEARCH_META),
......@@ -34,6 +41,9 @@ export class CriteriaEffects {
})
);
/**
* Retrieves criteria metadata.
*/
@Effect()
loadCriteriaSearchMetaWipAction$ = this.actions$.pipe(
ofType(criteriaActions.LOAD_CRITERIA_SEARCH_META_WIP),
......@@ -46,6 +56,9 @@ export class CriteriaEffects {
})
);
/**
* Displays retrieve criteria metadata error notification.
*/
@Effect({ dispatch: false })
loadCriteriaSearchMetaFailedAction$ = this.actions$.pipe(
ofType(criteriaActions.LOAD_CRITERIA_SEARCH_META_FAIL),
......
......@@ -21,6 +21,10 @@ import * as fromMetamodel from '../reducers';
import { DatasetService } from '../services/dataset.service';
@Injectable()
/**
* @class
* @classdesc Dataset effects.
*/
export class DatasetEffects {
constructor(
private actions$: Actions,
......@@ -29,6 +33,9 @@ export class DatasetEffects {
private store$: Store<{ metamodel: fromMetamodel.State }>
) { }
/**
* Calls action to retrieve datasets metadata.
*/
@Effect()
loadDatasetSearchMetaAction$ = this.actions$.pipe(
ofType(datasetActions.LOAD_DATASET_SEARCH_META),
......@@ -42,6 +49,9 @@ export class DatasetEffects {
})
);
/**
* Retrieves datasets metadata.
*/
@Effect()
loadDatasetSearchMetaWipAction$ = this.actions$.pipe(
ofType(datasetActions.LOAD_DATASET_SEARCH_META_WIP),
......@@ -54,6 +64,9 @@ export class DatasetEffects {
)
);
/**
* Displays retrieve datasets metadata error notification.
*/
@Effect({ dispatch: false })
loadDatasetSearchMetaFailedAction$ = this.actions$.pipe(
ofType(datasetActions.LOAD_DATASET_SEARCH_META_FAIL),
......
......@@ -19,6 +19,10 @@ import * as instanceActions from '../action/instance.action';
import { InstanceService } from '../services/instance.service';
@Injectable()
/**
* @class
* @classdesc Instance effects.
*/
export class InstanceEffects {
constructor(
private actions$: Actions,
......@@ -26,6 +30,9 @@ export class InstanceEffects {
private toastr: ToastrService
) { }
/**
* Retrieves instance metadata.
*/
@Effect()
loadInstanceMetaAction$ = this.actions$.pipe(
ofType(instanceActions.LOAD_INSTANCE_META),
......@@ -38,6 +45,9 @@ export class InstanceEffects {
)
);
/**
* Displays retrieve instance metadata error notification.
*/
@Effect({ dispatch: false })
loadInstanceMetaFailedAction$ = this.actions$.pipe(
ofType(instanceActions.LOAD_INSTANCE_META_FAIL),
......
......@@ -9,16 +9,20 @@
import { Injectable } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs';
import { switchMap, map, catchError, tap } from 'rxjs/operators';
import { ToastrService } from 'ngx-toastr';
import { Family, Category } from '../model';
import * as outputActions from '../action/output.action';
import { OutputService } from '../services/output.service';
@Injectable()
/**
* @class
* @classdesc Output effects.
*/
export class OutputEffects {
constructor(
private actions$: Actions,
......@@ -26,6 +30,9 @@ export class OutputEffects {
private toastr: ToastrService
) { }
/**
* Calls action to retrieve output metadata.
*/
@Effect()
loadOutputSearchMetaAction$ = this.actions$.pipe(
ofType(outputActions.LOAD_OUTPUT_SEARCH_META),
......@@ -34,6 +41,9 @@ export class OutputEffects {
})
);
/**
* Retrieves output metadata.
*/
@Effect()
loadOutputSearchMetaWipAction$ = this.actions$.pipe(
ofType(outputActions.LOAD_OUTPUT_SEARCH_META_WIP),
......@@ -46,6 +56,9 @@ export class OutputEffects {
})
);
/**
* Displays retrieve output metadata error notification.
*/
@Effect({ dispatch: false })
loadOutputSearchMetaFailedAction$ = this.actions$.pipe(
ofType(outputActions.LOAD_OUTPUT_SEARCH_META_FAIL),
......
......@@ -25,4 +25,8 @@ import { reducer } from './reducers';
services
]
})
/**
* @class
* @classdesc Metamodel module.
*/
export class MetamodelModule { }
......@@ -10,6 +10,11 @@
import { Option } from './option.model';
import { RendererConfig } from './renderer-config.model';
/**
* Interface for attribute.
*
* @interface Attribute
*/
export interface Attribute {
id: number;
name: string;
......@@ -44,5 +49,4 @@ export interface Attribute {
vo_size: number;
id_criteria_family: number;
id_output_category: number;
}
......@@ -9,6 +9,11 @@
import { Attribute } from './attribute.model';
/**
* Interface for attributes by dataset.
*
* @interface AttributesByDataset
*/
export interface AttributesByDataset {
datasetName: string;
isLoading: boolean;
......
......@@ -7,6 +7,11 @@
* file that was distributed with this source code.
*/
/**
* Interface for category.
*
* @interface Category
*/
export interface Category {
id: number;
label: string;
......
......@@ -7,6 +7,11 @@
* file that was distributed with this source code.
*/
/**
* Interface for dataset.
*
* @interface Dataset
*/
export interface Dataset {
name: string;
table_ref: string;
......
......@@ -7,6 +7,11 @@
* file that was distributed with this source code.
*/
/**
* Interface for family.
*
* @interface Family
*/
export interface Family {
id: number;
type: string;
......
......@@ -7,6 +7,11 @@
* file that was distributed with this source code.
*/
/**
* Interface for instance.
*
* @interface Instance
*/
export interface Instance {
name: string;
label: string;
......
......@@ -7,6 +7,10 @@
* file that was distributed with this source code.
*/
/**
* @class
* @classdesc Option class.
*/
export class Option {
label: string;
value: string;
......
......@@ -7,6 +7,11 @@
* file that was distributed with this source code.
*/
/**
* Interface for project.
*
* @interface Project
*/
export interface Project {
name: string;
label: string;
......
......@@ -7,4 +7,9 @@
* file that was distributed with this source code.
*/
/**
* Interface for renderer configuration.
*
* @interface RendererConfig
*/
export interface RendererConfig { }
\ No newline at end of file
......@@ -12,8 +12,21 @@ import { createEntityAdapter, EntityAdapter, EntityState, Update } from '@ngrx/e
import * as actions from '../action/attribute.action';
import { AttributesByDataset } from '../model';
/**
* Interface for attribute state.
*
* @interface State
* @extends EntityState<AttributesByDataset>
*/