Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe

Commits:

3 changed files:

Changes:

  • common-dto/src/main/java/fr/ird/observe/dto/model/AggregateDtoModel.java deleted
    1
    -package fr.ird.observe.dto.model;
    
    2
    -
    
    3
    -/*-
    
    4
    - * #%L
    
    5
    - * ObServe Toolkit :: Common Dto
    
    6
    - * %%
    
    7
    - * Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io
    
    8
    - * %%
    
    9
    - * This program is free software: you can redistribute it and/or modify
    
    10
    - * it under the terms of the GNU General Public License as
    
    11
    - * published by the Free Software Foundation, either version 3 of the
    
    12
    - * License, or (at your option) any later version.
    
    13
    - *
    
    14
    - * This program is distributed in the hope that it will be useful,
    
    15
    - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16
    - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17
    - * GNU General Public License for more details.
    
    18
    - *
    
    19
    - * You should have received a copy of the GNU General Public
    
    20
    - * License along with this program.  If not, see
    
    21
    - * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    - * #L%
    
    23
    - */
    
    24
    -
    
    25
    -import com.google.common.collect.ImmutableSet;
    
    26
    -import fr.ird.observe.dto.data.DataDto;
    
    27
    -import fr.ird.observe.dto.referential.ReferentialDto;
    
    28
    -import io.ultreia.java4all.util.ServiceLoaders;
    
    29
    -
    
    30
    -import java.util.ServiceLoader;
    
    31
    -
    
    32
    -/**
    
    33
    - * Created by tchemit on 26/05/2018.
    
    34
    - *
    
    35
    - * @author Tony Chemit - dev@tchemit.fr
    
    36
    - */
    
    37
    -public abstract class AggregateDtoModel implements DtoModel {
    
    38
    -
    
    39
    -    private static AggregateDtoModel instance;
    
    40
    -    private final String name;
    
    41
    -    private final ImmutableSet<DtoModel> models;
    
    42
    -    private final ImmutableSet<Class<? extends ReferentialDto>> referentialTypes;
    
    43
    -    private final ImmutableSet<Class<? extends DataDto>> dataTypes;
    
    44
    -
    
    45
    -    protected AggregateDtoModel(String name) {
    
    46
    -        this.name = name;
    
    47
    -        ImmutableSet.Builder<DtoModel> modelsBuilder = ImmutableSet.builder();
    
    48
    -        ImmutableSet.Builder<Class<? extends ReferentialDto>> referentialTypes = ImmutableSet.builder();
    
    49
    -        ImmutableSet.Builder<Class<? extends DataDto>> dataTypes = ImmutableSet.builder();
    
    50
    -        for (DtoModel dtoModel : ServiceLoader.load(DtoModel.class)) {
    
    51
    -            modelsBuilder.add(dtoModel);
    
    52
    -            referentialTypes.addAll(dtoModel.getReferentialTypes());
    
    53
    -            dataTypes.addAll(dtoModel.getDataTypes());
    
    54
    -        }
    
    55
    -        this.referentialTypes = referentialTypes.build();
    
    56
    -        this.dataTypes = dataTypes.build();
    
    57
    -        this.models = modelsBuilder.build();
    
    58
    -    }
    
    59
    -
    
    60
    -    public static synchronized AggregateDtoModel get() {
    
    61
    -        return instance == null ? instance = ServiceLoaders.loadUniqueService(AggregateDtoModel.class) : instance;
    
    62
    -    }
    
    63
    -
    
    64
    -    @Override
    
    65
    -    public String getName() {
    
    66
    -        return name;
    
    67
    -    }
    
    68
    -
    
    69
    -    @Override
    
    70
    -    public ImmutableSet<Class<? extends ReferentialDto>> getReferentialTypes() {
    
    71
    -        return referentialTypes;
    
    72
    -    }
    
    73
    -
    
    74
    -    @Override
    
    75
    -    public ImmutableSet<Class<? extends DataDto>> getDataTypes() {
    
    76
    -        return dataTypes;
    
    77
    -    }
    
    78
    -
    
    79
    -    public ImmutableSet<DtoModel> getModels() {
    
    80
    -        return models;
    
    81
    -    }
    
    82
    -}

  • common-dto/src/main/java/fr/ird/observe/dto/model/DtoModel.java deleted
    1
    -package fr.ird.observe.dto.model;
    
    2
    -
    
    3
    -/*-
    
    4
    - * #%L
    
    5
    - * ObServe Toolkit :: Common Dto
    
    6
    - * %%
    
    7
    - * Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io
    
    8
    - * %%
    
    9
    - * This program is free software: you can redistribute it and/or modify
    
    10
    - * it under the terms of the GNU General Public License as
    
    11
    - * published by the Free Software Foundation, either version 3 of the
    
    12
    - * License, or (at your option) any later version.
    
    13
    - *
    
    14
    - * This program is distributed in the hope that it will be useful,
    
    15
    - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16
    - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17
    - * GNU General Public License for more details.
    
    18
    - *
    
    19
    - * You should have received a copy of the GNU General Public
    
    20
    - * License along with this program.  If not, see
    
    21
    - * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    - * #L%
    
    23
    - */
    
    24
    -
    
    25
    -import com.google.common.collect.ImmutableSet;
    
    26
    -import fr.ird.observe.dto.data.DataDto;
    
    27
    -import fr.ird.observe.dto.referential.ReferentialDto;
    
    28
    -
    
    29
    -/**
    
    30
    - * Created by tchemit on 26/05/2018.
    
    31
    - *
    
    32
    - * @author Tony Chemit - dev@tchemit.fr
    
    33
    - */
    
    34
    -public interface DtoModel {
    
    35
    -
    
    36
    -    String getName();
    
    37
    -
    
    38
    -    ImmutableSet<Class<? extends ReferentialDto>> getReferentialTypes();
    
    39
    -
    
    40
    -    ImmutableSet<Class<? extends DataDto>> getDataTypes();
    
    41
    -}

  • common-dto/src/main/java/fr/ird/observe/dto/model/DtoModelSupport.java deleted
    1
    -package fr.ird.observe.dto.model;
    
    2
    -
    
    3
    -/*-
    
    4
    - * #%L
    
    5
    - * ObServe Toolkit :: Common Dto
    
    6
    - * %%
    
    7
    - * Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io
    
    8
    - * %%
    
    9
    - * This program is free software: you can redistribute it and/or modify
    
    10
    - * it under the terms of the GNU General Public License as
    
    11
    - * published by the Free Software Foundation, either version 3 of the
    
    12
    - * License, or (at your option) any later version.
    
    13
    - *
    
    14
    - * This program is distributed in the hope that it will be useful,
    
    15
    - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16
    - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17
    - * GNU General Public License for more details.
    
    18
    - *
    
    19
    - * You should have received a copy of the GNU General Public
    
    20
    - * License along with this program.  If not, see
    
    21
    - * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    - * #L%
    
    23
    - */
    
    24
    -
    
    25
    -import com.google.common.collect.ImmutableSet;
    
    26
    -import fr.ird.observe.dto.data.DataDto;
    
    27
    -import fr.ird.observe.dto.referential.ReferentialDto;
    
    28
    -
    
    29
    -/**
    
    30
    - * Created by tchemit on 26/05/2018.
    
    31
    - *
    
    32
    - * @author Tony Chemit - dev@tchemit.fr
    
    33
    - */
    
    34
    -public class DtoModelSupport implements DtoModel {
    
    35
    -
    
    36
    -    private final String name;
    
    37
    -
    
    38
    -    private final ImmutableSet<Class<? extends ReferentialDto>> referentialTypes;
    
    39
    -    private final ImmutableSet<Class<? extends DataDto>> dataTypes;
    
    40
    -
    
    41
    -    public DtoModelSupport(String name, ImmutableSet<Class<? extends ReferentialDto>> referentialTypes, ImmutableSet<Class<? extends DataDto>> dataTypes) {
    
    42
    -        this.name = name;
    
    43
    -        this.referentialTypes = referentialTypes;
    
    44
    -        this.dataTypes = dataTypes;
    
    45
    -    }
    
    46
    -
    
    47
    -    @Override
    
    48
    -    public String getName() {
    
    49
    -        return name;
    
    50
    -    }
    
    51
    -
    
    52
    -    @Override
    
    53
    -    public ImmutableSet<Class<? extends ReferentialDto>> getReferentialTypes() {
    
    54
    -        return referentialTypes;
    
    55
    -    }
    
    56
    -
    
    57
    -    @Override
    
    58
    -    public ImmutableSet<Class<? extends DataDto>> getDataTypes() {
    
    59
    -        return dataTypes;
    
    60
    -    }
    
    61
    -}