Fix formatting issues

revert-70aa11f8
lasanthaDLPDS 5 years ago
parent e42950dd76
commit 9d9f420c83

@ -108,15 +108,15 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (InvalidDeviceException e) {
String msg = "Invalid device identifiers are found with the request.";
log.error(msg);
log.error(msg, e);
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
} catch (DeviceManagementException e) {
String msg = "Error occurred when updating device owners.";
log.error(msg);
log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (UserNotFoundException e) {
String msg = "Couldn't found the owner in user store to update the owner of devices.";
log.error(msg);
log.error(msg, e);
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
}
}

@ -498,7 +498,8 @@ public interface DeviceDAO {
* @throws DeviceManagementDAOException throws {@link DeviceManagementDAOException} if connections establishment
* fails.
*/
List<Device> getDevicesByIdentifiers(List<String> deviceIdentifiers, int tenantId) throws DeviceManagementDAOException;
List<Device> getDevicesByIdentifiers(List<String> deviceIdentifiers, int tenantId)
throws DeviceManagementDAOException;
/**
* This method is used to permanently delete the device and its related details
@ -508,4 +509,3 @@ public interface DeviceDAO {
*/
void deleteDevice(DeviceIdentifier deviceIdentifier, int tenantId) throws DeviceManagementDAOException;
}

@ -1507,8 +1507,8 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
}
return devices;
} catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while obtaining the DB connection when adding tags",
e);
throw new DeviceManagementDAOException("Error occurred while obtaining the DB connection to get devices for"
+ " given device identifiers.", e);
}
}

@ -369,7 +369,11 @@ public class EnrollmentDAOImpl implements EnrollmentDAO {
try {
Connection conn = this.getConnection();
boolean updateStatus = true;
String sql = "UPDATE DM_ENROLMENT SET OWNER = ? WHERE ID = ? AND TENANT_ID = ?";
String sql = "UPDATE "
+ "DM_ENROLMENT "
+ "SET OWNER = ? "
+ "WHERE ID = ? AND "
+ "TENANT_ID = ?";
try (PreparedStatement ps = conn.prepareStatement(sql)) {
if (conn.getMetaData().supportsBatchUpdates()) {
for (Device device : devices) {
@ -381,6 +385,7 @@ public class EnrollmentDAOImpl implements EnrollmentDAO {
for (int i : ps.executeBatch()) {
if (i == 0 || i == Statement.SUCCESS_NO_INFO || i == Statement.EXECUTE_FAILED) {
updateStatus = false;
break;
}
}
} else {
@ -390,14 +395,15 @@ public class EnrollmentDAOImpl implements EnrollmentDAO {
ps.setInt(3, tenantId);
if (ps.executeUpdate() == 0) {
updateStatus = false;
break;
}
}
}
}
return updateStatus;
} catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while obtaining the DB connection when adding tags",
e);
throw new DeviceManagementDAOException("Error occurred while obtaining the DB connection to update the "
+ "owner of the device enrollment.", e);
}
}

@ -3086,12 +3086,12 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
DeviceManagementDAOFactory.rollbackTransaction();
return false;
} catch (TransactionManagementException e) {
String msg = "Error occurred while initiating transaction";
String msg = "Error occurred while initiating the transaction.";
log.error(msg, e);
throw new DeviceManagementException(msg, e);
} catch (DeviceManagementDAOException e) {
String msg = "Error occurred either verifying existence of device ids or updating owner of the device.";
log.error(msg);
log.error(msg, e);
throw new DeviceManagementException(msg, e);
} finally {
DeviceManagementDAOFactory.closeConnection();
@ -3114,7 +3114,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
return owner;
} catch (UserStoreException e) {
String msg = "Error occurred when checking whether owner is exist or not. Owner: " + owner;
log.error(msg);
log.error(msg, e);
throw new DeviceManagementException(msg, e);
}
}

@ -147,6 +147,7 @@ import java.util.List;
key = "perm:get-activity",
permissions = {"/device-mgt/devices/owning-device/view"}
)
}
)
@Path("/users")

@ -106,15 +106,15 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (InvalidDeviceException e) {
String msg = "Invalid device identifiers are found with the request.";
log.error(msg);
log.error(msg, e);
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
} catch (DeviceManagementException e) {
String msg = "Error occurred when updating the device owner.";
log.error(msg);
log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (UserNotFoundException e) {
String msg = "Couldn't found the owner in user store to update the owner of devices.";
log.error(msg);
log.error(msg, e);
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
}
}

Loading…
Cancel
Save