void updateInterface( final String foreignId, final String ipAddress, final MultivaluedMapImpl params) { final String foreignSource = m_foreignSource; LOG.debug( "updateInterface: Updating interface {} on node {}/{}", ipAddress, foreignSource, foreignId); if (params.isEmpty()) return; final Requisition req = getActiveRequisition(false); if (req != null) { final RequisitionNode node = req.getNode(foreignId); if (node != null) { final RequisitionInterface iface = node.getInterface(ipAddress); if (iface != null) { req.updateDateStamp(); RestUtils.setBeanProperties(iface, params); save(req); LOG.debug( "updateInterface: Interface {} on node {}/{} updated", ipAddress, foreignSource, foreignId); } } } }
@Override public String toString() { MultivaluedMap<String, String> matrixParameters = getMatrixParameters(); String parameters = MultivaluedMapImpl.toString(matrixParameters, ";"); // $NON-NLS-1$ String delim = (matrixParameters.isEmpty() ? "" : ";"); // $NON-NLS-1$ //$NON-NLS-2$ String result = getPath() + delim + parameters; return result; }
void updateRequisition(final MultivaluedMapImpl params) { final String foreignSource = m_foreignSource; LOG.debug("updateRequisition: Updating requisition with foreign source {}", foreignSource); if (params.isEmpty()) return; final Requisition req = getActiveRequisition(false); if (req != null) { req.updateDateStamp(); RestUtils.setBeanProperties(req, params); save(req); LOG.debug("updateRequisition: Requisition with foreign source {} updated", foreignSource); } }
@PUT @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Path("{userCriteria}") public Response updateUser( @PathParam("userCriteria") final String userCriteria, final MultivaluedMapImpl params) { OnmsUser user = null; writeLock(); try { try { user = m_userManager.getOnmsUser(userCriteria); } catch (final Throwable t) { throw getException(Status.BAD_REQUEST, t); } if (user == null) throw getException(Status.BAD_REQUEST, "updateUser: User does not exist: " + userCriteria); log().debug("updateUser: updating user " + user); final BeanWrapper wrapper = PropertyAccessorFactory.forBeanPropertyAccess(user); for (final String key : params.keySet()) { if (wrapper.isWritableProperty(key)) { final String stringValue = params.getFirst(key); @SuppressWarnings("unchecked") final Object value = wrapper.convertIfNecessary(stringValue, wrapper.getPropertyType(key)); wrapper.setPropertyValue(key, value); } } log().debug("updateUser: user " + user + " updated"); try { m_userManager.save(user); } catch (final Throwable t) { throw getException(Status.INTERNAL_SERVER_ERROR, t); } return Response.seeOther(getRedirectUri(m_uriInfo)).build(); } finally { writeUnlock(); } }
void updateNode(final String foreignId, final MultivaluedMapImpl params) { final String foreignSource = m_foreignSource; LOG.debug( "updateNode: Updating node with foreign source {} and foreign id {}", foreignSource, foreignId); if (params.isEmpty()) return; final Requisition req = getActiveRequisition(false); if (req != null) { final RequisitionNode node = req.getNode(foreignId); if (node != null) { req.updateDateStamp(); RestUtils.setBeanProperties(node, params); save(req); LOG.debug( "updateNode: Node with foreign source {} and foreign id {} updated", foreignSource, foreignId); } } }