Skip to content
Snippets Groups Projects
Commit 41f5fb41 authored by helayoty's avatar helayoty
Browse files

Indexer new structure

parent f7f9c98a
No related branches found
No related tags found
1 merge request!6Trusted ibm
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>dps-indexer-boot-mvn</artifactId>
<groupId>com.slb</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>dps-indexer-queue</artifactId>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>dps-indexer-boot-mvn</artifactId>
<groupId>com.slb</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>dps-indexer</artifactId>
</project>
\ No newline at end of file
// Copyright 2017-2019, Schlumberger
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.slb.indexer.api;
import com.slb.core.SwaggerDoc;
import com.slb.core.model.SearchServiceRole;
import com.slb.core.util.AppError;
import com.slb.de.core.api.DpsHeaders;
import com.slb.dps.multitenancy.TenantInfo;
import com.slb.indexer.logging.AuditLogger;
import com.slb.indexer.model.RecordReindexRequest;
import com.slb.indexer.service.ReindexService;
import io.swagger.annotations.*;
import org.apache.http.HttpStatus;
import javax.annotation.security.RolesAllowed;
import javax.inject.Inject;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import static java.util.Collections.singletonList;
@Api(
value = SwaggerDoc.INDEXER_TAG,
authorizations = {@Authorization(value = SwaggerDoc.BEARER_AUTH),
@Authorization(value = SwaggerDoc.GOOGLE_ID_AUTH),
@Authorization(value = SwaggerDoc.SAUTH_ID_AUTH)})
@Path("/reindex")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiImplicitParams({
@ApiImplicitParam(name = DpsHeaders.ACCOUNT_ID, value = SwaggerDoc.PARAMETER_ACCOUNT_ID, required = true, defaultValue = TenantInfo.COMMON, dataType = "string", paramType = "header"),
@ApiImplicitParam(name = DpsHeaders.ON_BEHALF_OF, value = SwaggerDoc.PARAMETER_ONBEHALF_ACCOUNT_ID, dataType = "string", paramType = "header")})
public class ReindexApi {
@Inject
private ReindexService reIndexService;
@Inject
private AuditLogger auditLogger;
@POST
@RolesAllowed({SearchServiceRole.ADMIN})
@ApiOperation(
value = SwaggerDoc.REINDEX_POST_TITLE,
nickname = SwaggerDoc.REINDEX_OPERATION_ID,
notes = SwaggerDoc.REINDEX_POST_NOTES)
@ApiResponses({
@ApiResponse(
code = HttpStatus.SC_OK,
message = SwaggerDoc.REINDEX_POST_RESPONSE_OK,
response = String.class),
@ApiResponse(
code = HttpStatus.SC_BAD_REQUEST,
message = SwaggerDoc.REINDEX_POST_RESPONSE_BAD_REQUEST,
response = AppError.class),
@ApiResponse(
code = HttpStatus.SC_NOT_FOUND,
message = SwaggerDoc.REINDEX_POST_RESPONSE_NOT_FOUND,
response = AppError.class)})
public Response reindex(@NotNull(message = SwaggerDoc.REQUEST_VALIDATION_NOT_NULL_BODY) @Valid RecordReindexRequest recordReindexRequest) {
this.reIndexService.reindexRecords(recordReindexRequest);
this.auditLogger.getReindex(singletonList(recordReindexRequest.getKind()));
return Response.status(HttpStatus.SC_OK).type(MediaType.APPLICATION_JSON).build();
}
}
\ No newline at end of file
pom.xml 0 → 100644
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.slb</groupId>
<artifactId>dps-indexer-boot-mvn</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
<module>dps-indexer</module>
<module>dps-indexer-queue</module>
</modules>
</project>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment