use of net.geoprism.registry.DataNotFoundException in project geoprism-registry by terraframe.
the class ServerGeoObjectService method getGeoObjectByCode.
public ServerGeoObjectIF getGeoObjectByCode(String code, ServerGeoObjectType type, boolean throwException) {
this.permissionService.enforceCanRead(type.getOrganization().getCode(), type);
ServerGeoObjectStrategyIF strategy = this.getStrategy(type);
ServerGeoObjectIF geoObject = strategy.getGeoObjectByCode(code);
if (geoObject == null && throwException) {
DataNotFoundException ex = new DataNotFoundException();
ex.setTypeLabel(GeoObjectMetadata.get().getClassDisplayLabel());
ex.setDataIdentifier(code);
ex.setAttributeLabel(GeoObjectMetadata.get().getAttributeDisplayLabel(DefaultAttribute.CODE.getName()));
throw ex;
}
return geoObject;
}
Aggregations