public void handleSubmitRequest(RequestInvocationEvent event) throws ServletException, IOException, ModelControlException { TraceUtil.trace3("Entering"); TraceUtil.trace3("Entering handleSubmitRequest()"); int pageMode = Integer.parseInt( (String) getParentViewBean().getDisplayFieldValue(FileDetailsPopupViewBean.PAGE_MODE)); TraceUtil.trace3("pageMode is " + pageMode); String successMsg = null, errorMsg = null; String[] existingAttArray = getFileAttributes().split("###"); boolean recursive = false; TraceUtil.trace3("fileAttributes: " + getFileAttributes()); SamQFSSystemFSManager fsManager = null; String radioValue = (String) ((CCRadioButton) getChild(RADIO)).getValue(); TraceUtil.trace3("radioValue: " + radioValue); // If entry is a directory, check if RECURSIVE is checked if (directory) { CCCheckBox checkBox = (CCCheckBox) getChild(RECURSIVE); recursive = "true".equals((String) checkBox.getValue()); } int newOption = -1, existingOption = -1, partialSize = -1; try { // Check Permission (IE7) if (!SecurityManagerFactory.getSecurityManager() .hasAuthorization(Authorization.FILE_OPERATOR)) { throw new SamFSException("common.nopermission"); } try { existingOption = Integer.parseInt(existingAttArray[pageMode]); } catch (NumberFormatException numEx) { throw new SamFSException("Developer's bug found, incorrect existingOption!"); } fsManager = SamUtil.getModel(serverName).getSamQFSSystemFSManager(); switch (pageMode) { case MODE_ARCHIVE: successMsg = "fs.filedetails.archiving.success"; errorMsg = "fs.filedetails.archiving.failed"; try { newOption = Integer.parseInt(radioValue); } catch (NumberFormatException numEx) { // Developer's bug throw new SamFSException("Invalid radioValue detected!"); } break; case MODE_RELEASE: successMsg = "fs.filedetails.releasing.success"; errorMsg = "fs.filedetails.releasing.failed"; if ("release".equals(radioValue)) { String subRadioValue = (String) ((CCRadioButton) getChild(SUB_RADIO)).getValue(); try { newOption = Integer.parseInt(subRadioValue); } catch (NumberFormatException numEx) { // Developer's bug throw new SamFSException("Invalid subRadioValue detected!", numEx); } } else { newOption = Releaser.NEVER; } CCCheckBox check = (CCCheckBox) getChild(PARTIAL_RELEASE); if ("true".equals(check.getValue())) { String sizeText = (String) ((CCTextField) getChild(PARTIAL_RELEASE_SIZE)).getValue(); try { partialSize = Integer.parseInt(sizeText); } catch (NumberFormatException numEx) { // let partialSize be -1 and generate error // in isValidPartialSize } if (!isValidPartialSize(partialSize)) { ((CCLabel) getChild(LABEL)).setShowError(true); throw new SamFSException( SamUtil.getResourceString("fs.filedetails.releasing.invalidReleaseSize")); } else { newOption = newOption | Releaser.PARTIAL; } } break; case MODE_STAGE: successMsg = "fs.filedetails.staging.success"; errorMsg = "fs.filedetails.staging.failed"; if ("stage".equals(radioValue)) { String subRadioValue = (String) ((CCRadioButton) getChild(SUB_RADIO)).getValue(); try { newOption = Integer.parseInt(subRadioValue); } catch (NumberFormatException numEx) { // Developer's bug throw new SamFSException("Invalid subRadioValue detected!", numEx); } } else { newOption = Stager.NEVER; } break; } fsManager.changeFileAttributes( pageMode, getFileName(), newOption, existingOption, recursive, partialSize); SamUtil.setInfoAlert(this, ALERT, "success.summary", successMsg, serverName); } catch (SamFSException samEx) { TraceUtil.trace1("Failed to set file attributes! Reason: " + samEx.getMessage()); SamUtil.processException( samEx, this.getClass(), "handleSubmitRequest()", "Failed to set file attributes!", serverName); // Suppress the following two error codes because the detailed // error message makes no sense in this case // SE_RELEASE_FILES_FAILED = 30180, // SE_ARCHIVE_FILES_FAILED = 30629, SamUtil.setErrorAlert( this, ALERT, errorMsg, samEx.getSAMerrno(), samEx.getSAMerrno() == 30180 || samEx.getSAMerrno() == 30629 ? "" : samEx.getMessage(), serverName); } getParentViewBean().forwardTo(getRequestContext()); TraceUtil.trace3("Exiting"); }
private boolean isChecked(String childName) { CCCheckBox cb = (CCCheckBox) getChild(childName); return cb.isChecked(); }