Skip to content

Commit

Permalink
Merge branch 'release/2.0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
blavenie committed Mar 2, 2023
2 parents 55e3b4b + 73522d2 commit 0bb7ae6
Show file tree
Hide file tree
Showing 20 changed files with 66 additions and 31 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>net.sumaris</groupId>
<artifactId>sumaris-pod</artifactId>
<version>2.0.2</version>
<version>2.0.4</version>
<packaging>pom</packaging>
<name>SUMARiS</name>
<description>SUMARiS :: Maven parent</description>
Expand Down
2 changes: 1 addition & 1 deletion sumaris-core-shared/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>net.sumaris</groupId>
<artifactId>sumaris-pod</artifactId>
<version>2.0.2</version>
<version>2.0.4</version>
</parent>

<artifactId>sumaris-core-shared</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion sumaris-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>net.sumaris</groupId>
<artifactId>sumaris-pod</artifactId>
<version>2.0.2</version>
<version>2.0.4</version>
</parent>

<artifactId>sumaris-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
import net.sumaris.core.model.referential.taxon.TaxonName;
import net.sumaris.core.model.referential.taxon.TaxonomicLevel;
import net.sumaris.core.model.referential.transcribing.TranscribingItem;
import net.sumaris.core.model.referential.transcribing.TranscribingItemType;
import net.sumaris.core.model.referential.transcribing.TranscribingSystem;
import net.sumaris.core.model.technical.configuration.Software;
import net.sumaris.core.model.technical.extraction.ExtractionProduct;
import net.sumaris.core.model.technical.extraction.ExtractionProductTable;
Expand Down Expand Up @@ -94,7 +96,6 @@ public class ReferentialEntities {
I18n.n("sumaris.persistence.table.qualitativeValue");
I18n.n("sumaris.persistence.table.program");
I18n.n("sumaris.persistence.table.acquisitionLevel");
I18n.n("sumaris.persistence.table.transcribingItem");
I18n.n("sumaris.persistence.table.groupingClassification");
I18n.n("sumaris.persistence.table.groupingLevel");
I18n.n("sumaris.persistence.table.grouping");
Expand All @@ -114,6 +115,11 @@ public class ReferentialEntities {
// Job
I18n.n("sumaris.persistence.table.processingType");
I18n.n("sumaris.persistence.table.processingStatus");
// Transcribing
I18n.n("sumaris.persistence.table.transcribingSystem");
I18n.n("sumaris.persistence.table.transcribingItem");
I18n.n("sumaris.persistence.table.transcribingItemType");

}

public static final List<Class<? extends IReferentialEntity>> ROOT_CLASSES = ImmutableList.of(
Expand Down Expand Up @@ -151,6 +157,8 @@ public class ReferentialEntities {
Strategy.class,
AcquisitionLevel.class,
// Transcribing
TranscribingSystem.class,
TranscribingItemType.class,
TranscribingItem.class,
// Grouping
GroupingClassification.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@

import javax.persistence.EntityManager;
import java.sql.Timestamp;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -83,7 +82,9 @@ public List<UserEventVO> findAllVO(@NonNull UserEventFilterVO filter, @Nullable

@Override
public void toEntity(UserEventVO source, UserEvent target, boolean copyIfNull) {
super.toEntity(source, target, copyIfNull);
Beans.copyProperties(source, target,
// Exclude computed field
UserEventVO.Fields.HAS_CONTENT);

target.setLevel(source.getLevel().name());
target.setType(source.getType().name());
Expand Down Expand Up @@ -118,17 +119,20 @@ protected void onAfterSaveEntity(UserEventVO vo, UserEvent savedEntity, boolean
if (isNew) {
vo.setCreationDate(savedEntity.getCreationDate());
}
// Update computed property
vo.setHasContent(savedEntity.getContent() != null);
}


protected UserEventVO toVO(UserEvent source, UserEventFetchOptions fetchOptions) {
UserEventVO target = new UserEventVO();
this.toVO(source, target, fetchOptions, true);
return target;
}

protected void toVO(UserEvent source, UserEventVO target, UserEventFetchOptions fetchOptions, boolean copyIfNull) {
Beans.copyProperties(source, target, UserEventVO.Fields.CONTENT /*skip content here*/);
Beans.copyProperties(source, target,
// Do not fetch 'content' (should be lazy loaded, only if fetched)
UserEventVO.Fields.CONTENT);

target.setLevel(EventLevelEnum.valueOfOrNull(source.getLevel()));
target.setType(EventTypeEnum.valueOfOrNull(source.getType()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public class TranscribingItem implements IItemReferentialEntity<Integer> {
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator = "TRANSCRIBING_ITEM_SEQ")
@SequenceGenerator(name = "TRANSCRIBING_ITEM_SEQ", sequenceName="TRANSCRIBING_ITEM_SEQ", allocationSize = SEQUENCE_ALLOCATION_SIZE)

@EqualsAndHashCode.Include
private Integer id;

Expand All @@ -63,7 +62,6 @@ public class TranscribingItem implements IItemReferentialEntity<Integer> {
private Date updateDate;

@Column(name = "object_id")

private Integer objectId;

@Column(nullable = false, length = LENGTH_LABEL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import net.sumaris.core.model.annotation.Comment;
import net.sumaris.core.model.data.IDataEntity;
import net.sumaris.core.model.referential.IItemReferentialEntity;
import org.hibernate.annotations.Formula;

import javax.persistence.*;
import java.util.Date;
Expand Down Expand Up @@ -79,8 +80,12 @@ public class UserEvent implements ISignedEntity<Integer, Date>, IUpdateDateEntit
@Lob
@Column(length=20971520)
@Basic(fetch = FetchType.LAZY)
// TODO: find a way to avoid selection of this field
private String content;

@Formula("CASE WHEN CONTENT IS NOT NULL THEN 1 ELSE 0 END")
private Boolean hasContent;

@Column(name = "hash", length = CRYPTO_HASH_LENGTH)
private String hash;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class UserEventVO implements IValueObject<Integer>, IUpdateDateEntity<Int

private String hash;
private String content;
private Boolean hasContent;
private String signature;
private Date readDate;
private String readSignature;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ sumaris.persistence.table.taxonGroupType=TAXON_GROUP_TYPE
sumaris.persistence.table.taxonName=TAXON_NAME
sumaris.persistence.table.taxonomicLevel=TAXONOMIC_LEVEL
sumaris.persistence.table.transcribingItem=TRANSCRIBING_ITEM
sumaris.persistence.table.transcribingItemType=
sumaris.persistence.table.transcribingSystem=
sumaris.persistence.table.trip=TRIP
sumaris.persistence.table.unit=UNIT
sumaris.persistence.table.unitConversion=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ sumaris.persistence.table.taxonGroupType=TAXON_GROUP_TYPE
sumaris.persistence.table.taxonName=TAXON_NAME
sumaris.persistence.table.taxonomicLevel=TAXONOMIC_LEVEL
sumaris.persistence.table.transcribingItem=TRANSCRIBING_ITEM
sumaris.persistence.table.transcribingItemType=
sumaris.persistence.table.transcribingSystem=
sumaris.persistence.table.trip=TRIP
sumaris.persistence.table.unit=UNIT
sumaris.persistence.table.unitConversion=
Expand Down
2 changes: 1 addition & 1 deletion sumaris-extraction/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>net.sumaris</groupId>
<artifactId>sumaris-pod</artifactId>
<version>2.0.2</version>
<version>2.0.4</version>
</parent>

<artifactId>sumaris-extraction</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion sumaris-importation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>sumaris-pod</artifactId>
<groupId>net.sumaris</groupId>
<version>2.0.2</version>
<version>2.0.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion sumaris-rdf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>sumaris-pod</artifactId>
<groupId>net.sumaris</groupId>
<version>2.0.2</version>
<version>2.0.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion sumaris-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>net.sumaris</groupId>
<artifactId>sumaris-pod</artifactId>
<version>2.0.2</version>
<version>2.0.4</version>
</parent>

<artifactId>sumaris-server</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,13 +457,13 @@ public List<MetierVO> getTripMetiers(@GraphQLContext TripVO trip) {
@GraphQLQuery(name = "observedLocations", description = "Search in observed locations")
@Transactional(readOnly = true)
@IsUser
public List<ObservedLocationVO> findObservedLocationsByFilter(@GraphQLArgument(name = "filter") ObservedLocationFilterVO filter,
@GraphQLArgument(name = "offset", defaultValue = "0") Integer offset,
@GraphQLArgument(name = "size", defaultValue = "1000") Integer size,
@GraphQLArgument(name = "sortBy", defaultValue = ObservedLocationVO.Fields.START_DATE_TIME) String sort,
@GraphQLArgument(name = "sortDirection", defaultValue = "asc") String direction,
@GraphQLArgument(name = "trash", defaultValue = "false") Boolean trash,
@GraphQLEnvironment ResolutionEnvironment env
public List<ObservedLocationVO> findAllObservedLocations(@GraphQLArgument(name = "filter") ObservedLocationFilterVO filter,
@GraphQLArgument(name = "offset", defaultValue = "0") Integer offset,
@GraphQLArgument(name = "size", defaultValue = "1000") Integer size,
@GraphQLArgument(name = "sortBy", defaultValue = ObservedLocationVO.Fields.START_DATE_TIME) String sort,
@GraphQLArgument(name = "sortDirection", defaultValue = "asc") String direction,
@GraphQLArgument(name = "trash", defaultValue = "false") Boolean trash,
@GraphQLEnvironment ResolutionEnvironment env
) {
SortDirection sortDirection = SortDirection.fromString(direction, SortDirection.DESC);

Expand All @@ -482,8 +482,9 @@ public List<ObservedLocationVO> findObservedLocationsByFilter(@GraphQLArgument(n
}

filter = fillRootDataFilter(filter, ObservedLocationFilterVO.class);

Set<String> fields = GraphQLUtils.fields(env);

long now = TimeLog.getTime();
final List<ObservedLocationVO> result = observedLocationService.findAll(
filter,
offset, size, sort,
Expand All @@ -493,6 +494,8 @@ public List<ObservedLocationVO> findObservedLocationsByFilter(@GraphQLArgument(n
// Add additional properties if needed
fillObservedLocationsFields(result, fields);

timeLog.log(now, "findAllObservedLocations");

return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,13 @@
import net.sumaris.core.vo.social.UserEventFetchOptions;
import net.sumaris.core.vo.social.UserEventFilterVO;
import net.sumaris.core.vo.social.UserEventVO;
import net.sumaris.core.vo.technical.extraction.ExtractionProductFetchOptions;
import net.sumaris.core.vo.technical.extraction.ExtractionProductVO;
import net.sumaris.server.http.graphql.GraphQLApi;
import net.sumaris.server.http.graphql.GraphQLUtils;
import net.sumaris.server.http.security.AuthService;
import net.sumaris.server.http.security.IsAdmin;
import net.sumaris.server.http.security.IsUser;
import net.sumaris.server.service.technical.EntityWatchService;
import org.nuiton.util.TimeLog;
import org.reactivestreams.Publisher;
import org.springframework.stereotype.Service;

Expand All @@ -72,6 +71,8 @@ public class UserEventGraphQLService {

private final AuthService authService;

private final TimeLog timeLog = new TimeLog(UserEventGraphQLService.class);


@GraphQLQuery(name = "userEvents", description = "Search in user events")
@IsUser
Expand Down Expand Up @@ -99,7 +100,13 @@ public List<UserEventVO> findUserEvents(

UserEventFetchOptions fetchOptions = getFetchOptions(GraphQLUtils.fields(env));

return userEventService.findAll(filter, page, fetchOptions);
long now = TimeLog.getTime();

final List<UserEventVO> result = userEventService.findAll(filter, page, fetchOptions);

timeLog.log(now, "findUserEvents");

return result;
}


Expand Down
2 changes: 1 addition & 1 deletion sumaris-test-shared/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>net.sumaris</groupId>
<artifactId>sumaris-pod</artifactId>
<version>2.0.2</version>
<version>2.0.4</version>
</parent>

<artifactId>sumaris-test-shared</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<PROGRAM_PROPERTY ID="23" STATUS_FK="1" PROGRAM_FK="10" CREATION_DATE="2019-02-11" LABEL="sumaris.trip.observers.enable" NAME="false"/>
<PROGRAM_PROPERTY ID="24" STATUS_FK="1" PROGRAM_FK="10" CREATION_DATE="2019-02-11" LABEL="sumaris.trip.metiers.enable" NAME="false"/>
<PROGRAM_PROPERTY ID="25" STATUS_FK="1" PROGRAM_FK="10" CREATION_DATE="2019-02-11" LABEL="sumaris.trip.gear.rankOrder.enable" NAME="true"/>
<PROGRAM_PROPERTY ID="26" STATUS_FK="1" PROGRAM_FK="10" CREATION_DATE="2019-02-11" LABEL="sumaris.trip.minDurationInHours" NAME="24"/><!-- 24 hours -->
<PROGRAM_PROPERTY ID="26" STATUS_FK="1" PROGRAM_FK="10" CREATION_DATE="2019-02-11" LABEL="sumaris.trip.minDurationInHours" NAME="12"/><!-- 24 hours -->
<PROGRAM_PROPERTY ID="27" STATUS_FK="1" PROGRAM_FK="10" CREATION_DATE="2019-02-11" LABEL="sumaris.trip.maxDurationInHours" NAME="400"/>
<PROGRAM_PROPERTY ID="28" STATUS_FK="1" PROGRAM_FK="10" CREATION_DATE="2019-02-11" LABEL="sumaris.trip.operation.batch.autoFill" NAME="true"/>
<PROGRAM_PROPERTY ID="29" STATUS_FK="1" PROGRAM_FK="10" CREATION_DATE="2019-02-11" LABEL="sumaris.trip.operation.batch.taxonGroups.noWeight" NAME="RJB_1,RJB_2"/>
Expand All @@ -61,6 +61,8 @@
<PROGRAM_PROPERTY ID="36" STATUS_FK="1" PROGRAM_FK="10" CREATION_DATE="2019-02-11" LABEL="sumaris.trip.operation.batch.roundWeightConversion.country.id" NAME="1"/>
<PROGRAM_PROPERTY ID="37" STATUS_FK="1" PROGRAM_FK="10" CREATION_DATE="2019-02-11" LABEL="sumaris.trip.operation.batch.lengthWeightConversion.enable" NAME="true"/>
<PROGRAM_PROPERTY ID="38" STATUS_FK="1" PROGRAM_FK="10" CREATION_DATE="2019-02-11" LABEL="sumaris.trip.operation.batch.taxonGroups.noLanding" NAME="RJB_1,RJB_2"/>
<PROGRAM_PROPERTY ID="39" STATUS_FK="1" PROGRAM_FK="10" CREATION_DATE="2023-02-24" LABEL="sumaris.trip.extraction.sampling.method" NAME="true"/>
<PROGRAM_PROPERTY ID="40" STATUS_FK="1" PROGRAM_FK="10" CREATION_DATE="2023-02-24" LABEL="sumaris.trip.gears.columns.pmfmIds" NAME="4"/>

<PROGRAM_PROPERTY ID="14" STATUS_FK="1" PROGRAM_FK="11" CREATION_DATE="2019-02-11" LABEL="sumaris.landing.samples.weightUnit" NAME="g"/>
<PROGRAM_PROPERTY ID="15" STATUS_FK="1" PROGRAM_FK="11" CREATION_DATE="2019-02-11" LABEL="sumaris.i18nSuffix" NAME="AUCTION_CONTROL."/>
Expand All @@ -69,6 +71,7 @@
<PROGRAM_PROPERTY ID="18" STATUS_FK="1" PROGRAM_FK="11" CREATION_DATE="2019-02-11" LABEL="sumaris.landing.editor" NAME="control"/>
<PROGRAM_PROPERTY ID="19" STATUS_FK="1" PROGRAM_FK="11" CREATION_DATE="2020-09-29" LABEL="sumaris.report.enable" NAME="true"/>


<PROGRAM2LOCATION_CLASSIF PROGRAM_FK="10" LOCATION_CLASSIFICATION_FK="2"/>
<PROGRAM2LOCATION_CLASSIF PROGRAM_FK="11" LOCATION_CLASSIFICATION_FK="1"/>

Expand Down Expand Up @@ -105,7 +108,7 @@
<!-- Has selective device ?
<PMFM_STRATEGY ID="226" STRATEGY_FK="10" ACQUISITION_LEVEL_FK="2" PMFM_FK="27" RANK_ORDER="7" ACQUISITION_NUMBER="1" IS_MANDATORY="1"></PMFM_STRATEGY>-->
<!-- Selective device -->
<PMFM_STRATEGY ID="227" STRATEGY_FK="10" ACQUISITION_LEVEL_FK="2" PMFM_FK="4" RANK_ORDER="8" ACQUISITION_NUMBER="1" IS_MANDATORY="0"/>
<PMFM_STRATEGY ID="227" STRATEGY_FK="10" ACQUISITION_LEVEL_FK="2" PMFM_FK="4" RANK_ORDER="8" ACQUISITION_NUMBER="3" IS_MANDATORY="0"/>


<!-- PmfmStrategy / Operation -->
Expand All @@ -119,8 +122,8 @@
<!--<PMFM_STRATEGY ID="233" STRATEGY_FK="10" ACQUISITION_LEVEL_FK="3" PMFM_FK="30" RANK_ORDER="4" ACQUISITION_NUMBER="1" IS_MANDATORY="0" MAX_VALUE="2000"></PMFM_STRATEGY>-->
<!-- Sea state -->
<PMFM_STRATEGY ID="234" STRATEGY_FK="10" ACQUISITION_LEVEL_FK="3" PMFM_FK="33" RANK_ORDER="5" ACQUISITION_NUMBER="1" IS_MANDATORY="1"/>
<!-- Has individual measures ? -->
<PMFM_STRATEGY ID="235" STRATEGY_FK="10" ACQUISITION_LEVEL_FK="3" PMFM_FK="121" RANK_ORDER="6" ACQUISITION_NUMBER="1" IS_MANDATORY="1"></PMFM_STRATEGY>
<!-- Has individual measures ?
<PMFM_STRATEGY ID="235" STRATEGY_FK="10" ACQUISITION_LEVEL_FK="3" PMFM_FK="121" RANK_ORDER="6" ACQUISITION_NUMBER="1" IS_MANDATORY="1"></PMFM_STRATEGY>-->

<!-- PmfmStrategy / Catch batch -->
<!-- <PMFM_STRATEGY ID="240" STRATEGY_FK="10" ACQUISITION_LEVEL_FK="4" PMFM_FK="50" RANK_ORDER="4" ACQUISITION_NUMBER="1" IS_MANDATORY="0"></PMFM_STRATEGY>-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
<PROGRAM_PROPERTY ID="224" STATUS_FK="1" PROGRAM_FK="70" CREATION_DATE="2022-04-15" LABEL="sumaris.operation.editor" NAME="selectivity"/>
<PROGRAM_PROPERTY ID="225" STATUS_FK="1" PROGRAM_FK="70" CREATION_DATE="2022-04-15" LABEL="sumaris.trip.gear.help.message" NAME="Pour les maillages, saisir uniquement les &lt;b&gt;maillages à la jauge&lt;/b&gt;."/>
<PROGRAM_PROPERTY ID="226" STATUS_FK="1" PROGRAM_FK="70" CREATION_DATE="2022-10-18" LABEL="sumaris.report.enable" NAME="true"/>
<PROGRAM_PROPERTY ID="227" STATUS_FK="1" PROGRAM_FK="70" CREATION_DATE="2022-10-18" LABEL="sumaris.trip.gear.minChildrenCount" NAME="2"/>


<PROGRAM2LOCATION_CLASSIF PROGRAM_FK="70" LOCATION_CLASSIFICATION_FK="1"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<SOFTWARE_PROPERTY ID="51" STATUS_FK="1" SOFTWARE_FK="2" CREATION_DATE="2019-02-11" LABEL="sumaris.referential.vessel.import.enable" NAME="true"/>
<SOFTWARE_PROPERTY ID="52" STATUS_FK="1" SOFTWARE_FK="2" CREATION_DATE="2022-11-11" LABEL="sumaris.data.images.enable" NAME="true"/>
<SOFTWARE_PROPERTY ID="53" STATUS_FK="1" SOFTWARE_FK="2" CREATION_DATE="2023-01-16" LABEL="sumaris.persistence.vessel.registrationCode.searchAsPrefix" NAME="false"/>
<SOFTWARE_PROPERTY ID="54" STATUS_FK="1" SOFTWARE_FK="1" CREATION_DATE="2023-02-03" LABEL="sumaris.social.notification.icons.enable" NAME="true"/>
<SOFTWARE_PROPERTY ID="54" STATUS_FK="1" SOFTWARE_FK="2" CREATION_DATE="2023-02-03" LABEL="sumaris.social.notification.icons.enable" NAME="true"/>

<!-- ****** OBSDEB properties ****** -->
<SOFTWARE_PROPERTY ID="70" STATUS_FK="1" SOFTWARE_FK="4" CREATION_DATE="2019-02-11" LABEL="sumaris.logo" NAME="image:22"/>
Expand Down

0 comments on commit 0bb7ae6

Please sign in to comment.