Java tutorial
/* Copyright (C) 2016 NTT DATA Corporation This program is free software; you can redistribute it and/or Modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ package com.clustercontrol.hub.action; import org.eclipse.jface.dialogs.MessageDialog; import com.clustercontrol.hub.util.HubEndpointWrapper; import com.clustercontrol.util.HinemosMessage; import com.clustercontrol.util.Messages; import com.clustercontrol.ws.hub.InvalidRole_Exception; import com.clustercontrol.ws.hub.InvalidSetting_Exception; import com.clustercontrol.ws.hub.LogFormat; import com.clustercontrol.ws.hub.TransferInfo; /** * ?????<BR> * */ public class ModifyLog { /** * ???<BR> * ??SessionBean???? * * @param format ?[] * @return ??????<code> true </code> */ public boolean modifyLogFormat(String managerName, LogFormat format) { boolean result = false; try { HubEndpointWrapper wrapper = HubEndpointWrapper.getWrapper(managerName); wrapper.modifyLogFormat(format); result = true; MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString( "message.hub.log.format.modify.finish", new Object[] { format.getLogFormatId(), managerName })); } catch (Exception e) { String errMessage = ""; if (e instanceof InvalidRole_Exception) { MessageDialog.openInformation(null, Messages.getString("failed"), Messages.getString("message.accesscontrol.16")); } else if (e instanceof InvalidSetting_Exception) { MessageDialog.openError(null, Messages.getString("failed"), Messages.getString(HinemosMessage.replace(e.getMessage()))); } else { errMessage = ", " + e.getMessage(); } MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.hub.log.format.modify.failed") + errMessage); } return result; } /** * ??[?]???<BR> * ??SessionBean???? * * @param transfer ???[?] * @return ??????<code> true </code> */ public boolean modifyLogTransfer(String managerName, TransferInfo transfer) { boolean result = false; try { HubEndpointWrapper wrapper = HubEndpointWrapper.getWrapper(managerName); wrapper.modifyTransferInfo(transfer); result = true; MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString("message.hub.log.transfer.modify.finish", new Object[] { transfer.getTransferId(), managerName })); } catch (Exception e) { String errMessage = ""; if (e instanceof InvalidRole_Exception) { MessageDialog.openInformation(null, Messages.getString("failed"), Messages.getString("message.accesscontrol.16")); } else if (e instanceof InvalidSetting_Exception) { MessageDialog.openError(null, Messages.getString("failed"), Messages.getString(HinemosMessage.replace(e.getMessage()))); } else { errMessage = ", " + e.getMessage(); } MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.hub.log.transfer.modify.failed") + errMessage); } return result; } }