/**
   * @see org.apromore.filestore.client.FileStoreService#resetUserPassword(String, String)
   *     {@inheritDoc}
   */
  @Override
  @SuppressWarnings("unchecked")
  public boolean resetUserPassword(String username, String password) {
    LOGGER.debug("Preparing Reset the Users Password.....");

    ResetUserPasswordInputMsgType msg = new ResetUserPasswordInputMsgType();
    msg.setUsername(username);
    msg.setPassword(password);

    JAXBElement<ResetUserPasswordInputMsgType> request =
        WS_CLIENT_FACTORY.createResetUserPasswordRequest(msg);

    JAXBElement<ResetUserPasswordOutputMsgType> response =
        (JAXBElement<ResetUserPasswordOutputMsgType>)
            webServiceTemplate.marshalSendAndReceive(request);
    return response.getValue().isSuccess();
  }
  /**
   * @see org.apromore.filestore.client.FileStoreService#writeUser(org.apromore.model.UserType)
   *     {@inheritDoc}
   */
  @Override
  @SuppressWarnings("unchecked")
  public UserType writeUser(UserType user) throws Exception {
    LOGGER.debug("Preparing WriteUserRequest.....");

    WriteUserInputMsgType msg = new WriteUserInputMsgType();
    msg.setUser(user);

    JAXBElement<WriteUserInputMsgType> request = WS_CLIENT_FACTORY.createWriteUserRequest(msg);

    JAXBElement<WriteUserOutputMsgType> response =
        (JAXBElement<WriteUserOutputMsgType>) webServiceTemplate.marshalSendAndReceive(request);
    if (response.getValue().getResult().getCode() == -1) {
      throw new Exception(response.getValue().getResult().getMessage());
    }

    return response.getValue().getUser();
  }
  /** @see org.apromore.filestore.client.FileStoreService#readUserByEmail(String) {@inheritDoc} */
  @Override
  @SuppressWarnings("unchecked")
  public UserType readUserByEmail(String email) throws Exception {
    LOGGER.debug("Preparing ResetUserRequest.....");

    ReadUserByEmailInputMsgType msg = new ReadUserByEmailInputMsgType();
    msg.setEmail(email);

    JAXBElement<ReadUserByEmailInputMsgType> request =
        WS_CLIENT_FACTORY.createReadUserByEmailRequest(msg);

    JAXBElement<ReadUserByEmailOutputMsgType> response =
        (JAXBElement<ReadUserByEmailOutputMsgType>)
            webServiceTemplate.marshalSendAndReceive(request);
    if (response.getValue().getResult().getCode() == -1) {
      throw new Exception(response.getValue().getResult().getMessage());
    } else {
      return response.getValue().getUser();
    }
  }