
nl.tno.bim.nmd.controller.ElementController Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bimnmdservice Show documentation
Show all versions of bimnmdservice Show documentation
provides a REST api for retrieving nmd data from various data sources
The newest version!
package nl.tno.bim.nmd.controller;
import java.util.List;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.ApiOperation;
import nl.tno.bim.nmd.domain.NmdElement;
@CrossOrigin()
@RestController()
@RequestMapping(value = "/api")
public class ElementController extends BaseNMDController {
public ElementController() {
super();
}
@ApiOperation(value = "Get All Elements")
@RequestMapping(method = RequestMethod.GET, value = "{versionId}/elements")
public ResponseEntity> getAllElements(@PathVariable Integer versionId) {
logMessage("triggering method getAllElements ");
try {
List els = getService(versionId).getAllElements();
if (els == null || els.isEmpty()) {
logMessage("returning 404 no data found ");
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null);
}
logMessage("returning all Elements 200 object");
return ResponseEntity.status(HttpStatus.OK).body(els);
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy