Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-maraval committed Nov 10, 2023
2 parents 9187e7e + d84ad32 commit 11c9663
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 2 deletions.
2 changes: 1 addition & 1 deletion kbart-webservices/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>fr.abes.convergence</groupId>
<artifactId>kbart-webservices</artifactId>
<version>0.0.5-SNAPSHOT</version>
<version>0.0.6-SNAPSHOT</version>

<packaging>jar</packaging>
<properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package fr.abes.convergence.kbartws.component;

import fr.abes.convergence.kbartws.utils.ExecutionTime;
import org.hibernate.annotations.ColumnTransformer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.query.EscapeCharacter;
Expand All @@ -14,6 +15,7 @@ public class BaseXmlFunctionsCaller {
@Autowired
private JdbcTemplate baseXmlJdbcTemplate;

@ExecutionTime
@ColumnTransformer(read = "XMLSERIALIZE (CONTENT data_xml as CLOB)", write = "NULLSAFE_XMLTYPE(?)")
public String issnToPpn(String issn) throws SQLRecoverableException, UncategorizedSQLException {
StringBuilder request = new StringBuilder("SELECT AUTORITES.ISSN2PPNJSON('");
Expand All @@ -22,6 +24,7 @@ public String issnToPpn(String issn) throws SQLRecoverableException, Uncategoriz
return baseXmlJdbcTemplate.queryForObject(request.toString(), String.class);
}

@ExecutionTime
@ColumnTransformer(read = "XMLSERIALIZE (CONTENT data_xml as CLOB)", write = "NULLSAFE_XMLTYPE(?)")
public String isbnToPpn(String isbn) throws SQLRecoverableException, UncategorizedSQLException {
StringBuilder request = new StringBuilder("SELECT AUTORITES.ISBN2PPNJSON('");
Expand All @@ -30,6 +33,7 @@ public String isbnToPpn(String isbn) throws SQLRecoverableException, Uncategoriz
return baseXmlJdbcTemplate.queryForObject(request.toString(), String.class);
}

@ExecutionTime
@ColumnTransformer(read = "XMLSERIALIZE (CONTENT data_xml as CLOB)", write = "NULLSAFE_XMLTYPE(?)")
public String baconProvider035(Integer provider) throws SQLRecoverableException, UncategorizedSQLException {
StringBuilder request = new StringBuilder("SELECT AUTORITES.BACON_PROVIDER_035_JSON(");
Expand All @@ -38,6 +42,7 @@ public String baconProvider035(Integer provider) throws SQLRecoverableException,
return baseXmlJdbcTemplate.queryForObject(request.toString(), String.class);
}

@ExecutionTime
@ColumnTransformer(read = "XMLSERIALIZE (CONTENT data_xml as CLOB)", write = "NULLSAFE_XMLTYPE(?)")
public String doiToPpn(String doi) throws SQLRecoverableException, UncategorizedSQLException {
StringBuilder request = new StringBuilder("select XMLTRANSFORM(XMLROOT(XMLElement(\"sudoc\",AUTORITES.DOI2PNN('");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package fr.abes.convergence.kbartws.repository;

import fr.abes.convergence.kbartws.entity.BiblioTableFrbr4XX;
import fr.abes.convergence.kbartws.utils.ExecutionTime;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

public interface BiblioTableFrbr4XXRepository extends JpaRepository<BiblioTableFrbr4XX, Integer> {
@ExecutionTime
List<BiblioTableFrbr4XX> findAllByTagAndDatas(String tag, String datas);
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package fr.abes.convergence.kbartws.repository;

import fr.abes.convergence.kbartws.entity.NoticesBibio;
import fr.abes.convergence.kbartws.utils.ExecutionTime;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.Optional;

@Repository
public interface NoticesBibioRepository extends JpaRepository<NoticesBibio, Integer> {
@ExecutionTime
Optional<NoticesBibio> findByPpn(String ppn);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import fr.abes.convergence.kbartws.exception.IllegalPpnException;
import fr.abes.convergence.kbartws.repository.BiblioTableFrbr4XXRepository;
import fr.abes.convergence.kbartws.repository.NoticesBibioRepository;
import fr.abes.convergence.kbartws.utils.ExecutionTime;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

Expand All @@ -17,6 +18,7 @@
import java.util.Optional;

@Service
@Slf4j
public class NoticeService {
private final NoticesBibioRepository noticesBibioRepository;

Expand Down Expand Up @@ -44,7 +46,9 @@ public NoticeXml getNoticeByPpn(String ppn) throws IllegalPpnException, IOExcept
return null;
}

@ExecutionTime
public List<String> getEquivalentElectronique(NoticeXml notice) throws IOException, IllegalPpnException {
log.debug("entrée dans getEquivalentElectronique");
List<String> ppnlies;

//on cherche une 452$0 dans la notice
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package fr.abes.convergence.kbartws.utils;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface ExecutionTime {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package fr.abes.convergence.kbartws.utils;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;

@Aspect
@Slf4j
public class ExecutionTimeAspect {

@Around("@annotation(ExecutionTime)")
public Object measureExecutionTime(ProceedingJoinPoint joinPoint) throws Throwable {
long startTime = System.currentTimeMillis();

Object result = joinPoint.proceed();

long endTime = System.currentTimeMillis();
double executionTime = (endTime - startTime) / 1000;

log.debug("Temps d'exécution : " + executionTime + " secondes");
return result;
}
}
2 changes: 1 addition & 1 deletion sudoc-webservices/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>fr.abes.convergence</groupId>
<artifactId>sudoc-webservices</artifactId>
<version>0.0.5-SNAPSHOT</version>
<version>0.0.6-SNAPSHOT</version>
<properties>
<warName>sudoc-webservices</warName>
<webBaseDir>./target/</webBaseDir>
Expand Down

0 comments on commit 11c9663

Please sign in to comment.