use of com.axelor.apps.fleet.db.Vehicle in project axelor-open-suite by axelor.
the class VehicleController method setVehicleName.
public void setVehicleName(ActionRequest request, ActionResponse response) {
Vehicle vehicle = request.getContext().asType(Vehicle.class);
String actualName = Beans.get(VehicleService.class).setVehicleName(vehicle);
response.setValue("name", actualName);
}
use of com.axelor.apps.fleet.db.Vehicle in project axelor-open-suite by axelor.
the class ImportVehicle method importVehicle.
public Object importVehicle(Object bean, Map<String, Object> values) {
assert bean instanceof Vehicle;
Vehicle vehicle = (Vehicle) bean;
final Path path = (Path) values.get("__path__");
String fileName = (String) values.get("image_fileName");
if (Strings.isNullOrEmpty(fileName)) {
return bean;
}
final File image = path.resolve(fileName).toFile();
try {
final MetaFile metaFile = metaFiles.upload(image);
vehicle.setImage(metaFile);
} catch (IOException e) {
e.printStackTrace();
}
return bean;
}
Aggregations