Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Cines Vitamui
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dad
Cines Vitamui
Commits
acabb88f
Commit
acabb88f
authored
4 years ago
by
bbenarbia
Browse files
Options
Downloads
Patches
Plain Diff
remove wrong commited files that should be ignored
remove wrong commited files that should be ignored
parent
89f62aad
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitignore
+1
-1
1 addition, 1 deletion
.gitignore
api/api-archive/archive-internal/src/main/java/fr/gouv/vitamui/archive/internal/server/service/ArchiveInternalService.java
+0
-128
0 additions, 128 deletions
...chive/internal/server/service/ArchiveInternalService.java
with
1 addition
and
129 deletions
.gitignore
+
1
−
1
View file @
acabb88f
...
...
@@ -232,7 +232,7 @@ deployment/playbooks/templates/vitamui/conf/*/*.p12
###################################
# Vitam development configuration #
###################################
api/api-archive/archive-search-internal/src/main/config/dev-vitam/*
api/api-archive
-search
/archive-search-internal/src/main/config/dev-vitam/*
api/api-ingest/ingest-internal/src/main/config/dev-vitam/*
api/api-referential/referential-internal/src/main/config/dev-vitam/*
api/api-ingest/ingest-internal/src/main/config/dev-vitam/*
...
...
This diff is collapsed.
Click to expand it.
api/api-archive/archive-internal/src/main/java/fr/gouv/vitamui/archive/internal/server/service/ArchiveInternalService.java
deleted
100644 → 0
+
0
−
128
View file @
89f62aad
/*
* Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2020)
* contact.vitam@culture.gouv.fr
*
* This software is a computer program whose purpose is to implement a digital archiving back-office system managing
* high volumetry securely and efficiently.
*
* This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free
* software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as
* circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license,
* users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the
* successive licensors have only limited liability.
*
* In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or
* developing or reproducing the software by the user in light of its specific status of free software, that may mean
* that it is complicated to manipulate, and that also therefore means that it is reserved for developers and
* experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the
* software's suitability as regards their requirements in conditions enabling the security of their systems and/or data
* to be ensured and, more generally, to use and operate it in the same conditions as regards security.
*
* The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you
* accept its terms.
*/
package
fr.gouv.vitamui.archive.internal.server.service
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
fr.gouv.vitam.common.client.VitamContext
;
import
fr.gouv.vitam.common.database.builder.request.exception.InvalidCreateOperationException
;
import
fr.gouv.vitam.common.exception.InvalidParseOperationException
;
import
fr.gouv.vitam.common.exception.VitamClientException
;
import
fr.gouv.vitam.common.model.RequestResponse
;
import
fr.gouv.vitamui.archives.search.common.dsl.VitamQueryHelper
;
import
fr.gouv.vitamui.archives.search.common.dto.ArchiveUnitsDto
;
import
fr.gouv.vitamui.archives.search.common.dto.SearchCriteriaDto
;
import
fr.gouv.vitamui.commons.api.domain.DirectionDto
;
import
fr.gouv.vitamui.commons.api.exception.BadRequestException
;
import
fr.gouv.vitamui.commons.api.logger.VitamUILogger
;
import
fr.gouv.vitamui.commons.api.logger.VitamUILoggerFactory
;
import
fr.gouv.vitamui.commons.vitam.api.access.UnitService
;
import
fr.gouv.vitamui.commons.vitam.api.dto.VitamUISearchResponseDto
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.io.IOException
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
/**
* Archive Internal service communication with VITAM.
*/
@Service
public
class
ArchiveInternalService
{
private
static
final
VitamUILogger
LOGGER
=
VitamUILoggerFactory
.
getInstance
(
ArchiveInternalService
.
class
);
public
static
final
String
INGEST_ARCHIVE_TYPE
=
"INGEST"
;
private
final
ObjectMapper
objectMapper
;
final
private
UnitService
unitService
;
@Autowired
public
ArchiveInternalService
(
final
ObjectMapper
objectMapper
,
final
UnitService
unitService
)
{
this
.
unitService
=
unitService
;
this
.
objectMapper
=
objectMapper
;
}
public
ArchiveUnitsDto
searchArchiveUnitsByCriteria
(
final
SearchCriteriaDto
searchQuery
,
final
VitamContext
vitamContext
)
throws
VitamClientException
,
IOException
{
LOGGER
.
info
(
"calling find archive units by criteria {} "
,
searchQuery
.
toString
());
LOGGER
.
info
(
"searchArchiveUnitsByCriteria EvIdAppSession : {} "
,
vitamContext
.
getApplicationSessionId
());
List
<
String
>
archiveUnits
=
Arrays
.
asList
(
INGEST_ARCHIVE_TYPE
);
JsonNode
response
=
searchUnits
(
mapRequestToDslQuery
(
archiveUnits
,
searchQuery
),
vitamContext
);
return
new
ArchiveUnitsDto
(
objectMapper
.
treeToValue
(
response
,
VitamUISearchResponseDto
.
class
));
}
/**
* Map search query to DSl Query Json node
*
* @param searchQuery
* @return
*/
private
JsonNode
mapRequestToDslQuery
(
List
<
String
>
archiveUnits
,
SearchCriteriaDto
searchQuery
)
{
Optional
<
String
>
orderBy
=
Optional
.
empty
();
Optional
<
DirectionDto
>
direction
=
Optional
.
empty
();
Map
<
String
,
List
<
String
>>
vitamCriteria
=
new
HashMap
<>();
JsonNode
query
;
try
{
if
(
searchQuery
!=
null
&&
searchQuery
.
getCriteriaList
()
!=
null
&&
!
searchQuery
.
getCriteriaList
().
isEmpty
())
{
searchQuery
.
getCriteriaList
().
stream
()
.
filter
(
criteria
->
criteria
.
getValues
()
!=
null
&&
!
criteria
.
getValues
().
isEmpty
())
.
forEach
(
criteria
->
vitamCriteria
.
put
(
criteria
.
getCriteria
(),
criteria
.
getValues
()));
}
if
(
searchQuery
.
getSortingCriteria
()
!=
null
)
{
direction
=
Optional
.
of
(
searchQuery
.
getSortingCriteria
().
getSorting
());
orderBy
=
Optional
.
of
(
searchQuery
.
getSortingCriteria
().
getCriteria
());
}
query
=
VitamQueryHelper
.
createQueryDSL
(
archiveUnits
,
searchQuery
.
getNodes
(),
vitamCriteria
,
searchQuery
.
getPageNumber
(),
searchQuery
.
getSize
(),
orderBy
,
direction
);
}
catch
(
InvalidParseOperationException
ioe
)
{
LOGGER
.
error
(
"Unable to find archive units with pagination "
+
ioe
.
getMessage
());
throw
new
BadRequestException
(
"Unable to find archive units with pagination"
,
ioe
);
}
catch
(
InvalidCreateOperationException
e
)
{
LOGGER
.
error
(
"Can't parse criteria as Vitam query"
+
e
.
getMessage
());
throw
new
BadRequestException
(
"Can't parse criteria as Vitam query"
,
e
);
}
return
query
;
}
public
JsonNode
searchUnits
(
final
JsonNode
dslQuery
,
final
VitamContext
vitamContext
)
throws
VitamClientException
{
RequestResponse
<
JsonNode
>
response
=
unitService
.
searchUnits
(
dslQuery
,
vitamContext
);
return
response
.
toJsonNode
();
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment