Skip to content

Commit

Permalink
Documentation updated and Idm Integration
Browse files Browse the repository at this point in the history
  • Loading branch information
emastrosimone committed Sep 26, 2018
2 parents 5ab835a + 11c1798 commit 61e2282
Show file tree
Hide file tree
Showing 28 changed files with 1,166 additions and 310 deletions.
113 changes: 113 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@

# Created by https://www.gitignore.io/api/git,java,maven,bower,eclipse,java-web

### Bower ###
bower_components
.bower-cache
.bower-registry
.bower-tmp

### Eclipse ###

.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# PyDev specific (Python IDE for Eclipse)
*.pydevproject

# CDT-specific (C/C++ Development Tooling)
.cproject

# Java annotation processor (APT)
.factorypath

# PDT-specific (PHP Development Tools)
.buildpath

# sbteclipse plugin
.target

# Tern plugin
.tern-project

# TeXlipse plugin
.texlipse

# STS (Spring Tool Suite)
.springBeans

# Code Recommenders
.recommenders/

# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet

### Eclipse Patch ###
# Eclipse Core
.project

# JDT-specific (Eclipse Java Development Tools)
.classpath

### Git ###
*.orig

### Java ###
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

### Java-Web ###
## ignoring target file
target/

### Maven ###
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties

# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
!/.mvn/wrapper/maven-wrapper.jar

# End of https://www.gitignore.io/api/git,java,maven,bower,eclipse,java-web
4 changes: 4 additions & 0 deletions CHANGES_NEXT_RELEASE.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
- Fix: Feature request: add link in images categories (#1)
- Fix: DUMP federation/synchronization bugs for TURTLE format
- Fix: Theme/Subject deserialization when prefLabel is not present.
- New Feature: add a different permalink for every dataset (#2).
- Fix: RDF bug fixed.
- Fix: The list of federated catalogues, shown on the portal, is wrong. (#6).
- New Feature: Integration of the Keyrock Fiware IdM as authentication method (#5)
2 changes: 1 addition & 1 deletion Idra/src/main/java/it/eng/idra/api/AdministrationAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,7 @@ public Response deleteDataletFromDistribution(@Context HttpServletRequest httpRe

List<Datalet> remainingDatalet = jpa.jpaGetDataletByDistributionID(distributionID);
if (remainingDatalet.size() == 0) {
DCATDataset dataset = MetadataCacheManager.getDataset(Integer.parseInt(nodeID), datasetID);
DCATDataset dataset = MetadataCacheManager.getDatasetByID(datasetID);
dataset.getDistributions().stream().filter(x -> x.getId().equals(distributionID)).findFirst().get()
.setHasDatalets(false);
MetadataCacheManager.updateDatasetInsertDatalet(Integer.parseInt(nodeID), dataset);
Expand Down
67 changes: 59 additions & 8 deletions Idra/src/main/java/it/eng/idra/api/ClientAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ public Response createDataletFromDistribution(@Context HttpServletRequest httpRe

List<Datalet> existingDatalets = null;

DCATDataset dataset = MetadataCacheManager.getDataset(Integer.parseInt(nodeID), datasetID);
DCATDataset dataset = MetadataCacheManager.getDatasetByID(datasetID);
boolean updateSolr = false;
for (DCATDistribution d : dataset.getDistributions()) {
if (d.getId().equals(distributionID)) {
Expand Down Expand Up @@ -750,8 +750,7 @@ public Response getODMSCatalogues(
@QueryParam("country") String country) {
try {
List<ODMSCatalogue> nodes = new ArrayList<ODMSCatalogue>(FederationCore.getODMSCatalogues().stream().filter(x -> x.isActive()).collect(Collectors.toList()));
// List<ODMSCatalogue> nodes = new ArrayList<ODMSCatalogue>(FederationCore.getODMSNodes(withImage));
List<ODMSCatalogue> nodes = new ArrayList<ODMSCatalogue>(FederationCore.getODMSCatalogues(withImage).stream().filter(x -> x.isActive()).collect(Collectors.toList()));
if(StringUtils.isNotBlank(name) && StringUtils.isBlank(country)) {
nodes=nodes.stream().filter(x -> x.getName().toLowerCase().contains(name.toLowerCase())).collect(Collectors.toList());
Expand Down Expand Up @@ -859,7 +858,12 @@ public Response getSingleCatalogue(@Context HttpServletRequest httpRequest,@Path
try {
ODMSCatalogue result = FederationCore.getODMSCatalogue(Integer.parseInt(nodeID));
return Response.status(Response.Status.OK).entity(GsonUtil.obj2Json(result, GsonUtil.nodeType)).build();
if(result.isActive())
return Response.status(Response.Status.OK).entity(GsonUtil.obj2Json(result, GsonUtil.nodeType)).build();
else {
ErrorResponse err = new ErrorResponse(String.valueOf(Response.Status.NOT_FOUND.getStatusCode()), "Catalogues with id: "+nodeID+" not found", String.valueOf(Response.Status.NOT_FOUND.getStatusCode()), "Catalogues with id: "+nodeID+" not found");
return Response.status(Response.Status.NOT_FOUND).entity(GsonUtil.obj2Json(err, GsonUtil.errorResponseSetType)).build();
}
} catch (NumberFormatException e) {
// TODO Auto-generated catch block
Expand All @@ -880,8 +884,14 @@ public Response getSingleCatalogue(@Context HttpServletRequest httpRequest,@Path
public Response getCatalogueDatasets(@Context HttpServletRequest httpRequest,@PathParam("nodeID") String nodeID) {
try {
List<DCATDataset> result = MetadataCacheManager.getAllDatasetsByODMSNode(Integer.parseInt(nodeID));
return Response.status(Response.Status.OK).entity(GsonUtil.obj2Json(result, GsonUtil.datasetListType)).build();
ODMSCatalogue cat= FederationCore.getODMSCatalogue(Integer.parseInt(nodeID));
if(cat.isActive()) {
List<DCATDataset> result = MetadataCacheManager.getAllDatasetsByODMSCatalogue(Integer.parseInt(nodeID));
return Response.status(Response.Status.OK).entity(GsonUtil.obj2Json(result, GsonUtil.datasetListType)).build();
}else {
ErrorResponse err = new ErrorResponse(String.valueOf(Response.Status.NOT_FOUND.getStatusCode()), "Catalogues with id: "+nodeID+" not found", String.valueOf(Response.Status.NOT_FOUND.getStatusCode()), "Catalogues with id: "+nodeID+" not found");
return Response.status(Response.Status.NOT_FOUND).entity(GsonUtil.obj2Json(err, GsonUtil.errorResponseSetType)).build();
}
} catch (NumberFormatException e) {
// TODO Auto-generated catch block
Expand All @@ -898,6 +908,9 @@ public Response getCatalogueDatasets(@Context HttpServletRequest httpRequest,@Pa
} catch (GsonUtilException e) {
// TODO Auto-generated catch block
return handleErrorResponse500(e);
} catch (ODMSCatalogueNotFoundException e) {
// TODO Auto-generated catch block
return handleBadRequestErrorResponse(e);
}
}
Expand All @@ -909,7 +922,45 @@ public Response getCatalogueDatasets(@Context HttpServletRequest httpRequest,@Pa
public Response getSingleDataset(@Context HttpServletRequest httpRequest,@PathParam("nodeID") String nodeID,@PathParam("datasetID") String datasetID) {
try {
DCATDataset result = MetadataCacheManager.getDataset(Integer.parseInt(nodeID), datasetID);
ODMSCatalogue cat= FederationCore.getODMSCatalogue(Integer.parseInt(nodeID));
if(cat.isActive()) {
DCATDataset result = MetadataCacheManager.getDataset(Integer.parseInt(nodeID), datasetID);
return Response.status(Response.Status.OK).entity(GsonUtil.obj2Json(result, GsonUtil.datasetType)).build();
}else {
ErrorResponse err = new ErrorResponse(String.valueOf(Response.Status.NOT_FOUND.getStatusCode()), "Catalogues with id: "+nodeID+" not found", String.valueOf(Response.Status.NOT_FOUND.getStatusCode()), "Catalogues with id: "+nodeID+" not found");
return Response.status(Response.Status.NOT_FOUND).entity(GsonUtil.obj2Json(err, GsonUtil.errorResponseSetType)).build();
}
} catch (NumberFormatException e) {
// TODO Auto-generated catch block
return handleErrorResponse500(e);
} catch (DatasetNotFoundException e) {
// TODO Auto-generated catch block
return handleErrorResponse500(e);
} catch (IOException e) {
// TODO Auto-generated catch block
return handleErrorResponse500(e);
} catch (SolrServerException e) {
// TODO Auto-generated catch block
return handleErrorResponse500(e);
} catch (GsonUtilException e) {
// TODO Auto-generated catch block
return handleErrorResponse500(e);
}catch (ODMSCatalogueNotFoundException e) {
// TODO Auto-generated catch block
return handleBadRequestErrorResponse(e);
}
}
*/
@GET
@Path("/datasets/{id}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces("application/json")
public Response getDatasetByID(@Context HttpServletRequest httpRequest,@PathParam("id") String id) {

try {
DCATDataset result = MetadataCacheManager.getDatasetByID(id);
return Response.status(Response.Status.OK).entity(GsonUtil.obj2Json(result, GsonUtil.datasetType)).build();

} catch (NumberFormatException e) {
Expand All @@ -929,7 +980,7 @@ public Response getSingleDataset(@Context HttpServletRequest httpRequest,@PathPa
return handleErrorResponse500(e);
}
}
*/

private static Response handleErrorResponse500(Exception e) {

e.printStackTrace();
Expand Down

0 comments on commit 61e2282

Please sign in to comment.