generated from com-pas/compas-template-service
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from com-pas/Fetch_IED_Data
Fetch ied data
- Loading branch information
Showing
44 changed files
with
1,824 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,5 +48,4 @@ public Uni<BayTypicalResponse> getAssignedBayTypicals() { | |
return Uni.createFrom().item(response); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
app/src/main/java/org/lfenergy/compas/sitipe/rest/v2/BTComponentResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// SPDX-FileCopyrightText: 2023 Alliander N.V. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.lfenergy.compas.sitipe.rest.v2; | ||
|
||
import io.quarkus.security.Authenticated; | ||
import io.smallrye.common.annotation.Blocking; | ||
import io.smallrye.mutiny.Uni; | ||
import org.lfenergy.compas.sitipe.dto.ImportedComponentDTO; | ||
import org.lfenergy.compas.sitipe.service.ImportedComponentService; | ||
import org.lfenergy.compas.sitipe.dto.ImportedDataDTO; | ||
|
||
import javax.enterprise.context.RequestScoped; | ||
import javax.inject.Inject; | ||
import javax.ws.rs.*; | ||
import javax.ws.rs.core.MediaType; | ||
import java.util.List; | ||
|
||
@Authenticated | ||
@RequestScoped | ||
@Path("/v2/btcomponents") | ||
public class BTComponentResource { | ||
|
||
private final ImportedComponentService importedComponentService; | ||
|
||
@Inject | ||
public BTComponentResource( | ||
final ImportedComponentService importedComponentService | ||
) { | ||
this.importedComponentService = importedComponentService; | ||
} | ||
|
||
@GET | ||
@Path("/{accessId}/imported") | ||
@Consumes(MediaType.APPLICATION_JSON) | ||
@Produces(MediaType.APPLICATION_JSON) | ||
@Blocking | ||
public Uni<List<ImportedComponentDTO>> getImportedComponents( | ||
@PathParam("accessId") final String accessId | ||
) { | ||
return Uni.createFrom().item(this.importedComponentService.getByAccessId(accessId)); | ||
} | ||
|
||
@GET | ||
@Path("/imported/{id}") | ||
@Consumes(MediaType.APPLICATION_JSON) | ||
@Produces(MediaType.APPLICATION_JSON) | ||
@Blocking | ||
public Uni<ImportedDataDTO> getImportedComponentData( | ||
@PathParam("id") final Integer id | ||
) { | ||
final ImportedDataDTO data = this.importedComponentService.getImportedComponentData(id); | ||
|
||
return Uni.createFrom().item(data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
app/src/test/java/org/lfenergy/compas/sitipe/helper/CompressionUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// SPDX-FileCopyrightText: 2023 Alliander N.V. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.lfenergy.compas.sitipe.helper; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
import java.io.ByteArrayOutputStream; | ||
import java.io.IOException; | ||
import java.util.zip.DeflaterOutputStream; | ||
|
||
@ApplicationScoped | ||
public class CompressionUtils { | ||
|
||
public byte[] compress(byte[] bArray) throws IOException { | ||
ByteArrayOutputStream baos = new ByteArrayOutputStream(); | ||
try (DeflaterOutputStream dos = new DeflaterOutputStream(baos)) { | ||
dos.write(bArray); | ||
} | ||
return baos.toByteArray(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.