List of usage examples for java.lang Short valueOf
@HotSpotIntrinsicCandidate public static Short valueOf(short s)
From source file:org.logger.event.cassandra.loader.dao.RawDataUpdateDAOImpl.java
@SuppressWarnings("unchecked") public UserCo processUser(Map<String, Object> eventMap, UserCo userCo) { if (eventMap.containsKey("gooruUId") && eventMap.get("gooruUId") != null) { userCo.setUserUid(eventMap.get("gooruUId").toString()); userCo.setGooruUid(eventMap.get("gooruUId").toString()); }//from w w w. j a va2 s. co m userCo.setFirstname((eventMap.containsKey("firstName") && eventMap.get("firstName") != null) ? eventMap.get("firstName").toString() : null); userCo.setLastname((eventMap.containsKey("lastName") && eventMap.get("lastName") != null) ? eventMap.get("lastName").toString() : null); userCo.setUsername((eventMap.containsKey("username") && eventMap.get("username") != null) ? eventMap.get("username").toString() : null); userCo.setDisplayname((eventMap.containsKey("usernameDisplay") && eventMap.get("usernameDisplay") != null) ? eventMap.get("usernameDisplay").toString() : null); userCo.setEmailId((eventMap.containsKey("emailId") && eventMap.get("emailId") != null) ? eventMap.get("emailId").toString() : null); userCo.setAccountRegisterType( (eventMap.containsKey("accountCreatedType") && eventMap.get("accountCreatedType") != null) ? eventMap.get("accountCreatedType").toString() : null); userCo.setActive((eventMap.containsKey("active") && eventMap.get("active") != null) ? Short.valueOf(eventMap.get("active").toString()) : null); userCo.setConfirmStatus((eventMap.containsKey("confirmStatus") && eventMap.get("confirmStatus") != null) ? eventMap.get("confirmStatus").toString() : null); userCo.setDeleted(false); userCo.setRoleSet((eventMap.containsKey("userRoleSetString") && eventMap.get("userRoleSetString") != null) ? eventMap.get("userRoleSetString").toString() : null); userCo.setUserProfileImage( (eventMap.containsKey("profileImageUrl") && eventMap.get("profileImageUrl") != null) ? eventMap.get("profileImageUrl").toString() : null); userCo.setVersionUid(UUID.randomUUID().toString()); try { userCo.setCreatedOn((eventMap.containsKey("createdOn") && eventMap.get("createdOn") != null) ? dateFormatter.parse(eventMap.get("createdOn").toString()) : null); userCo.setLastModifiedOn( (eventMap.containsKey("lastModifiedOn") && eventMap.get("lastModifiedOn") != null) ? dateFormatter.parse(eventMap.get("lastModifiedOn").toString()) : null); userCo.setLastLogin((eventMap.containsKey("lastLogin") && eventMap.get("lastLogin") != null) ? dateFormatter.parse(eventMap.get("lastLogin").toString()) : null); } catch (ParseException e) { logger.info("Unable to parse date fields"); } String profileVisibility = "false"; if (eventMap.containsKey("customFields") && eventMap.get("customFields") != null) { List<Map<String, Object>> customFields = (List<Map<String, Object>>) eventMap.get("customFields"); if (customFields != null && customFields.size() > 0) { if (eventMap.containsKey("optionalKey") && eventMap.get("optionalKey").toString().equalsIgnoreCase("show_profile_page") && (eventMap.containsKey("optionalValue") && eventMap.get("optionalValue") != null)) { profileVisibility = (eventMap.get("optionalValue").toString()); } } } userCo.setProfileVisibility(profileVisibility); if ((eventMap.containsKey("meta") && eventMap.get("meta") != null) || (eventMap.containsKey("optionalKey") && eventMap.get("optionalKey") != null && eventMap.get("optionalKey").toString().equalsIgnoreCase("user_taxonomy_root_code"))) { Map<String, Object> metaData = new HashMap<String, Object>(); JSONSerializer metaDataSerializer = new JSONSerializer(); List<String> taxonomyCodeIdList; List<String> taxonomyCodeList; if (eventMap.containsKey("optionalKey") && eventMap.get("optionalKey") != null && eventMap.get("optionalKey").toString().equalsIgnoreCase("user_taxonomy_root_code")) { if (eventMap.containsKey("optionalValue") && eventMap.get("optionalValue") != null) { taxonomyCodeIdList = (Arrays.asList(eventMap.get("optionalValue").toString().split(","))); if (taxonomyCodeIdList.size() > 0) { metaData.put("codeId", taxonomyCodeIdList); } } } else if (eventMap.containsKey("meta") && eventMap.get("meta") != null) { Map<String, Object> metaMap = (Map<String, Object>) eventMap.get("meta"); Map<String, Object> taxonomyPreference = (Map<String, Object>) metaMap.get("taxonomyPreference"); if (taxonomyPreference != null) { if (taxonomyPreference.containsKey("codeId") && taxonomyPreference.get("codeId") != null) { taxonomyCodeIdList = (List<String>) taxonomyPreference.get("codeId"); if (taxonomyCodeIdList.size() > 0) { metaData.put("codeId", taxonomyCodeIdList); } } if (taxonomyPreference.containsKey("code") && taxonomyPreference.get("code") != null) { taxonomyCodeList = (List<String>) taxonomyPreference.get("code"); if (taxonomyCodeList.size() > 0) { metaData.put("code", taxonomyCodeList); } } } } if (!metaData.isEmpty()) { userCo.setMetaJson(metaDataSerializer.deepSerialize(metaData)); } } if ((eventMap.containsKey("parentUser") && eventMap.get("parentUser") != null) && (eventMap.containsKey("accountCreatedType") && eventMap.get("accountCreatedType") != null && eventMap.get("accountCreatedType").toString().equalsIgnoreCase("child"))) { Map<String, Object> parentUser = (Map<String, Object>) eventMap.get("parentUser"); userCo.setParentAccountUserName( (parentUser.containsKey("username") && parentUser.get("username") != null) ? parentUser.get("username").toString() : null); userCo.setParentUid((parentUser.containsKey("gooruUId") && parentUser.get("gooruUId") != null) ? parentUser.get("gooruUId").toString() : null); userCo.setEmailId((eventMap.containsKey("username") && eventMap.get("username") != null) ? eventMap.get("username").toString() : null); } else { userCo.setParentAccountUserName(""); } userCo.setLoginType((eventMap.containsKey("loginType") && eventMap.get("loginType") != null) ? eventMap.get("loginType").toString() : null); //userCo.setAccountTypeId((eventMap.containsKey("accountTypeId") && eventMap.get("accountTypeId") != null) ? Long.valueOf(eventMap.get("accountTypeId").toString()) : null); return userCo; }
From source file:org.apache.ambari.server.controller.internal.UpgradeResourceProvider.java
private void makeRestartStage(UpgradeContext context, RequestStageContainer request, UpgradeItemEntity entity, StageWrapper wrapper, boolean skippable, boolean allowRetry) throws AmbariException { Cluster cluster = context.getCluster(); List<RequestResourceFilter> filters = new ArrayList<RequestResourceFilter>(); for (TaskWrapper tw : wrapper.getTasks()) { // add each host to this stage filters.add(new RequestResourceFilter(tw.getService(), tw.getComponent(), new ArrayList<String>(tw.getHosts()))); }/*from ww w .ja v a2 s .c o m*/ Map<String, String> restartCommandParams = new HashMap<String, String>(); restartCommandParams.put(COMMAND_PARAM_RESTART_TYPE, "rolling_upgrade"); restartCommandParams.put(COMMAND_PARAM_VERSION, context.getVersion()); restartCommandParams.put(COMMAND_PARAM_DIRECTION, context.getDirection().name().toLowerCase()); ActionExecutionContext actionContext = new ActionExecutionContext(cluster.getClusterName(), "RESTART", filters, restartCommandParams); actionContext.setTimeout(Short.valueOf(s_configuration.getDefaultAgentTaskTimeout(false))); actionContext.setIgnoreMaintenance(true); ExecuteCommandJson jsons = s_commandExecutionHelper.get().getCommandJson(actionContext, cluster); Stage stage = s_stageFactory.get().createNew(request.getId().longValue(), "/tmp/ambari", cluster.getClusterName(), cluster.getClusterId(), entity.getText(), jsons.getClusterHostInfo(), jsons.getCommandParamsForStage(), jsons.getHostParamsForStage()); stage.setSkippable(skippable); long stageId = request.getLastStageId() + 1; if (0L == stageId) { stageId = 1L; } stage.setStageId(stageId); entity.setStageId(Long.valueOf(stageId)); Map<String, String> requestParams = new HashMap<String, String>(); requestParams.put("command", "RESTART"); s_commandExecutionHelper.get().addExecutionCommandsToStage(actionContext, stage, requestParams, allowRetry); request.addStages(Collections.singletonList(stage)); }
From source file:org.apache.axis2.corba.receivers.CorbaUtil.java
public static Object parseValue(DataType type, String value) { if (value == null) return null; value = value.trim();//from ww w.j a v a 2 s .c o m Object ret = null; switch (type.getTypeCode().kind().value()) { case TCKind._tk_long: ret = Integer.valueOf(value); break; case TCKind._tk_ulong: ret = Integer.valueOf(value); break; case TCKind._tk_longlong: ret = Long.valueOf(value); break; case TCKind._tk_ulonglong: ret = Long.valueOf(value); break; case TCKind._tk_short: ret = Short.valueOf(value); break; case TCKind._tk_ushort: ret = Short.valueOf(value); break; case TCKind._tk_float: ret = Float.valueOf(value); break; case TCKind._tk_double: ret = Double.valueOf(value); break; case TCKind._tk_char: ret = Character.valueOf(value.charAt(0)); break; case TCKind._tk_wchar: ret = Character.valueOf(value.charAt(0)); break; case TCKind._tk_boolean: ret = Boolean.valueOf(value); break; case TCKind._tk_octet: ret = Byte.valueOf(value); break; case TCKind._tk_string: ret = value; break; case TCKind._tk_wstring: ret = value; break; case TCKind._tk_enum: EnumType enumType = (EnumType) type; EnumValue enumValue = new EnumValue(enumType); int i = enumType.getEnumMembers().indexOf(value); enumValue.setValue(i); ret = enumValue; break; default: log.error("ERROR! Invalid dataType"); break; } return ret; }
From source file:org.apache.openjpa.kernel.StateManagerImpl.java
public Object fetchField(int field, boolean transitions) { FieldMetaData fmd = _meta.getField(field); if (fmd == null) throw new UserException(_loc.get("no-field", String.valueOf(field), getManagedInstance().getClass())) .setFailedObject(getManagedInstance()); // do normal state transitions if (!fmd.isPrimaryKey() && transitions) accessingField(field);// w ww .j a v a 2s.c om switch (fmd.getDeclaredTypeCode()) { case JavaTypes.STRING: return fetchStringField(field); case JavaTypes.OBJECT: return fetchObjectField(field); case JavaTypes.BOOLEAN: return (fetchBooleanField(field)) ? Boolean.TRUE : Boolean.FALSE; case JavaTypes.BYTE: return Byte.valueOf(fetchByteField(field)); case JavaTypes.CHAR: return Character.valueOf(fetchCharField(field)); case JavaTypes.DOUBLE: return Double.valueOf(fetchDoubleField(field)); case JavaTypes.FLOAT: return Float.valueOf(fetchFloatField(field)); case JavaTypes.INT: return fetchIntField(field); case JavaTypes.LONG: return fetchLongField(field); case JavaTypes.SHORT: return Short.valueOf(fetchShortField(field)); default: return fetchObjectField(field); } }
From source file:org.apache.ambari.server.controller.internal.UpgradeResourceProvider.java
private void makeServiceCheckStage(UpgradeContext context, RequestStageContainer request, UpgradeItemEntity entity, StageWrapper wrapper, boolean skippable, boolean allowRetry) throws AmbariException { List<RequestResourceFilter> filters = new ArrayList<RequestResourceFilter>(); for (TaskWrapper tw : wrapper.getTasks()) { filters.add(new RequestResourceFilter(tw.getService(), "", Collections.<String>emptyList())); }/* www. ja v a2s.c om*/ Cluster cluster = context.getCluster(); Map<String, String> commandParams = new HashMap<String, String>(); commandParams.put(COMMAND_PARAM_VERSION, context.getVersion()); commandParams.put(COMMAND_PARAM_DIRECTION, context.getDirection().name().toLowerCase()); ActionExecutionContext actionContext = new ActionExecutionContext(cluster.getClusterName(), "SERVICE_CHECK", filters, commandParams); actionContext.setTimeout(Short.valueOf(s_configuration.getDefaultAgentTaskTimeout(false))); actionContext.setIgnoreMaintenance(true); ExecuteCommandJson jsons = s_commandExecutionHelper.get().getCommandJson(actionContext, cluster); Stage stage = s_stageFactory.get().createNew(request.getId().longValue(), "/tmp/ambari", cluster.getClusterName(), cluster.getClusterId(), entity.getText(), jsons.getClusterHostInfo(), jsons.getCommandParamsForStage(), jsons.getHostParamsForStage()); stage.setSkippable(skippable); long stageId = request.getLastStageId() + 1; if (0L == stageId) { stageId = 1L; } stage.setStageId(stageId); entity.setStageId(Long.valueOf(stageId)); Map<String, String> requestParams = new HashMap<String, String>(); s_commandExecutionHelper.get().addExecutionCommandsToStage(actionContext, stage, requestParams, allowRetry); request.addStages(Collections.singletonList(stage)); }
From source file:org.eclipse.kapua.app.console.server.GwtDeviceManagementServiceImpl.java
private Object[] getObjectValue(GwtConfigParameter gwtConfigParam, String[] defaultValues) { List<Object> values = new ArrayList<Object>(); GwtConfigParameterType type = gwtConfigParam.getType(); switch (type) { case BOOLEAN: for (String value : defaultValues) { values.add(Boolean.valueOf(value)); }//from w w w .ja va 2 s . com return values.toArray(new Boolean[] {}); case BYTE: for (String value : defaultValues) { values.add(Byte.valueOf(value)); } return values.toArray(new Byte[] {}); case CHAR: for (String value : defaultValues) { values.add(new Character(value.charAt(0))); } return values.toArray(new Character[] {}); case DOUBLE: for (String value : defaultValues) { values.add(Double.valueOf(value)); } return values.toArray(new Double[] {}); case FLOAT: for (String value : defaultValues) { values.add(Float.valueOf(value)); } return values.toArray(new Float[] {}); case INTEGER: for (String value : defaultValues) { values.add(Integer.valueOf(value)); } return values.toArray(new Integer[] {}); case LONG: for (String value : defaultValues) { values.add(Long.valueOf(value)); } return values.toArray(new Long[] {}); case SHORT: for (String value : defaultValues) { values.add(Short.valueOf(value)); } return values.toArray(new Short[] {}); case PASSWORD: for (String value : defaultValues) { values.add(new Password(value)); } return values.toArray(new Password[] {}); case STRING: default: return defaultValues; } }
From source file:edu.ku.brc.specify.tools.ireportspecify.MainFrameSpecify.java
/** * @param repResName/*from w w w. ja v a 2s .c om*/ * @param tableId * @param spReport * @param appRes * * Allows editing of SpReport and SpAppResource properties for reports. */ protected static AppResAndProps getProps(final String repResName, final Integer tableId, final ReportSpecify spReport, final AppResourceIFace appRes) { String repType; if (appRes == null) { repType = "Report"; } else { String mime = appRes.getMimeType(); String reportType = appRes.getMetaDataMap().getProperty("reporttype", null); if (mime.equals(ReportsBaseTask.LABELS_MIME)) { repType = "Label"; } else if (mime.equals(ReportsBaseTask.SUBREPORTS_MIME)) { repType = "Subreport"; } else { if (reportType != null && reportType.equalsIgnoreCase("invoice")) { repType = "Invoice"; } else { repType = "Report"; } } } RepResourcePropsPanel propPanel = new RepResourcePropsPanel(repResName, repType, tableId == null, spReport); boolean goodProps = false; boolean overwrite = false; SpAppResource match = null; CustomDialog cd = new CustomDialog((Frame) UIRegistry.getTopWindow(), UIRegistry.getResourceString("REP_PROPS_DLG_TITLE"), true, propPanel); propPanel.setCanceller(cd.getCancelBtn()); while (!goodProps) { UIHelper.centerAndShow(cd); if (cd.isCancelled()) { return null; } String repName = propPanel.getNameTxt().getText().trim(); boolean isNameOK = repName.matches("[a-zA-Z0-9\\-. '`_]*"); if (StringUtils.isEmpty(repName)) { JOptionPane.showMessageDialog(UIRegistry.getTopWindow(), String.format(UIRegistry.getResourceString("REP_NAME_MUST_NOT_BE_BLANK"), propPanel.getNameTxt().getText())); } else if (!isNameOK) { Toolkit.getDefaultToolkit().beep(); JOptionPane.showMessageDialog(UIRegistry.getTopWindow(), UIRegistry.getResourceString("INVALID_CHARS_NAME")); } else { match = getRepResource(propPanel.getNameTxt().getText()); if (match != null) { if (appRes == null || !((SpAppResource) appRes).getId().equals(match.getId())) { int chc = JOptionPane.showConfirmDialog(UIRegistry.getTopWindow(), String.format( UIRegistry.getResourceString("REP_NAME_ALREADY_EXISTS_OVERWRITE_CONFIRM"), propPanel.getNameTxt().getText())); if (chc == JOptionPane.OK_OPTION) { goodProps = true; overwrite = true; } else if (chc != JOptionPane.NO_OPTION) { return null; } } else { goodProps = true; } } else { goodProps = true; } goodProps = goodProps && propPanel.validInputs(); } } if (goodProps /*just in case*/) { if (match != null && overwrite) { //user has chosen to overwrite an identically named report //XXX - Is it possible that another user created the matching report? //first close design frame for match if one exists. /* * Actually, never mind, too hard to do in this method. * Let the user deal with it. */ //delete match Integer matchRepId = null; DataProviderSessionIFace session = DataProviderFactory.getInstance().createSession(); try { SpReport matchRep = session.getData(SpReport.class, "appResource", match, DataProviderSessionIFace.CompareType.Equals); if (matchRep == null) { JOptionPane.showMessageDialog(null, String.format(UIRegistry.getResourceString("REP_UNABLE_TO_OVERWRITE"), match.getName()), UIRegistry.getResourceString("Error"), JOptionPane.ERROR_MESSAGE); return null; } matchRepId = matchRep.getId(); } finally { session.close(); session = null; } ReportsBaseTask.deleteReportAndResource(matchRepId, match.getId()); overwrittenReportId = matchRepId; } AppResourceIFace modifiedRes = null; if (appRes == null) { String dirName = ((RepResourcePropsPanel.ResDirItem) propPanel.getResDirCombo().getSelectedItem()) .getName(); SpAppResourceDir dir = getDirForResource(dirName); modifiedRes = ((SpecifyAppContextMgr) AppContextMgr.getInstance()).createAppResourceForDir(dir); } else { modifiedRes = appRes; String dirName = ((RepResourcePropsPanel.ResDirItem) propPanel.getResDirCombo().getSelectedItem()) .getName(); SpAppResourceDir dir = getDirForResource(dirName); ((SpAppResource) modifiedRes).setSpAppResourceDir(dir); } modifiedRes.setName(propPanel.getNameTxt().getText().trim()); modifiedRes.setDescription(propPanel.getNameTxt().getText().trim()); modifiedRes.setLevel(Short.valueOf(propPanel.getLevelTxt().getText())); propPanel.getResDirCombo().getSelectedItem(); String metaDataStr = "tableid=" + propPanel.getTableId() + ";"; if (propPanel.getTypeCombo().getSelectedIndex() == 2) { metaDataStr += "reporttype=Invoice;"; } else { metaDataStr += "reporttype=Report;"; } if (propPanel.getSubReportsTxt() != null && propPanel.getSubReportsTxt().getText() != null) { metaDataStr += "subreports=" + propPanel.getSubReportsTxt().getText() + ";"; } if (propPanel.getTypeCombo().getSelectedIndex() == 3) { modifiedRes.setMimeType("jrxml/subreport"); } else if (propPanel.getTypeCombo().getSelectedIndex() == 1) { modifiedRes.setMimeType("jrxml/label"); } else { modifiedRes.setMimeType("jrxml/report"); } if (StringUtils.isNotEmpty(modifiedRes.getMetaData())) { /* Assuming ReportResources only get edited by this class... metaDataStr = metaDataStr + ";" + modifiedRes.getMetaData();*/ log.info("overwriting existing AppResource metadata (" + modifiedRes.getMetaData() + ") with (" + metaDataStr + ")"); } modifiedRes.setMetaData(metaDataStr); AppResAndProps result = new AppResAndProps(modifiedRes, propPanel.getRepeats()); return result; } return null; }
From source file:org.mifos.accounts.servicefacade.WebTierAccountServiceFacade.java
@Override public void applyGroupCharge(Map<Integer, String> idsAndValues, Short chargeId, boolean isPenaltyType) { MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); UserContext userContext = toUserContext(user); TreeMap<Integer, String> idsAndValueAsTreeMap = new TreeMap<Integer, String>(idsAndValues); try {// w w w. jav a 2 s .c o m AccountBO parentAccount = ((LoanBO) legacyAccountDao.getAccount( new AccountBusinessService().getAccount(idsAndValueAsTreeMap.firstKey()).getAccountId())) .getParentAccount(); BigDecimal parentAmount = ((LoanBO) parentAccount).getLoanAmount().getAmount(); BigDecimal membersAmount = BigDecimal.ZERO; for (Map.Entry<Integer, String> entry : idsAndValues.entrySet()) { LoanBO individual = loanDao.findById(entry.getKey()); Double chargeAmount = Double.valueOf(entry.getValue()); if (chargeAmount.equals(0.0)) { continue; } membersAmount = membersAmount.add(individual.getLoanAmount().getAmount()); individual.updateDetails(userContext); if (isPenaltyType && !chargeId.equals(Short.valueOf(AccountConstants.MISC_PENALTY))) { PenaltyBO penalty = this.penaltyDao.findPenaltyById(chargeId.intValue()); individual.addAccountPenalty(new AccountPenaltiesEntity(individual, penalty, chargeAmount)); } else { individual.applyCharge(chargeId, chargeAmount); } } boolean isRateCharge = false; if (!chargeId.equals(Short.valueOf(AccountConstants.MISC_FEES)) && !chargeId.equals(Short.valueOf(AccountConstants.MISC_PENALTY))) { if (isPenaltyType) { PenaltyBO penalty = this.penaltyDao.findPenaltyById(chargeId.intValue()); if (penalty instanceof RatePenaltyBO) { isRateCharge = true; } } else { FeeBO fee = feeDao.findById(chargeId); if (fee.getFeeType().equals(RateAmountFlag.RATE)) { isRateCharge = true; } } } Double chargeAmount = null; if (!isRateCharge) { chargeAmount = sumCharge(idsAndValues); } else { chargeAmount = Double.valueOf(idsAndValueAsTreeMap.firstEntry().getValue()); BigDecimal chargeAmountBig = new BigDecimal(chargeAmount); membersAmount = membersAmount.multiply(chargeAmountBig); int scale = Money.getInternalPrecision(); chargeAmountBig = membersAmount.divide(parentAmount, scale, RoundingMode.HALF_EVEN); chargeAmount = chargeAmountBig.doubleValue(); } parentAccount.updateDetails(userContext); CustomerLevel customerLevel = null; if (parentAccount.isCustomerAccount()) { customerLevel = parentAccount.getCustomer().getLevel(); } if (parentAccount.getPersonnel() != null) { checkPermissionForApplyCharges(parentAccount.getType(), customerLevel, userContext, parentAccount.getOffice().getOfficeId(), parentAccount.getPersonnel().getPersonnelId()); } else { checkPermissionForApplyCharges(parentAccount.getType(), customerLevel, userContext, parentAccount.getOffice().getOfficeId(), userContext.getId()); } this.transactionHelper.startTransaction(); if (isPenaltyType && parentAccount instanceof LoanBO) { PenaltyBO penalty = this.penaltyDao.findPenaltyById(chargeId.intValue()); ((LoanBO) parentAccount) .addAccountPenalty(new AccountPenaltiesEntity(parentAccount, penalty, chargeAmount)); } else { parentAccount.applyCharge(chargeId, chargeAmount); } this.transactionHelper.commitTransaction(); } catch (ServiceException e) { this.transactionHelper.rollbackTransaction(); throw new MifosRuntimeException(e); } catch (ApplicationException e) { this.transactionHelper.rollbackTransaction(); throw new BusinessRuleException(e.getKey(), e); } }
From source file:com.mimp.controllers.main.java
@RequestMapping(value = "/inscSesGrp", method = RequestMethod.GET) public ModelAndView inscSesGrp_GET(ModelMap map, HttpSession session) { int turno = 0; String estado = ""; String nombreEl = ""; String apellidoPEl = ""; String apellidoMEl = ""; String paisNacEl = ""; String depNacEl = ""; String proNacEl = ""; String fechaNacEl = ""; String edadEl = ""; String docEl = ""; String numDocEl = ""; String profesionEl = ""; String celEl = ""; String correoEl = ""; String nombreElla = ""; String apellidoPElla = ""; String apellidoMElla = ""; String paisNacElla = ""; String depNacElla = ""; String proNacElla = ""; String fechaNacElla = ""; String edadElla = ""; String docElla = ""; String numDocElla = ""; String profesionElla = ""; String celElla = ""; String correoElla = ""; String pais = ""; String dep = ""; String prov = ""; String dist = ""; String dir = ""; String telf = ""; try {/*from w w w.j av a2 s . c o m*/ turno = Integer.parseInt(session.getAttribute("turno").toString()); estado = session.getAttribute("estado").toString(); nombreEl = session.getAttribute("nombreEl").toString(); apellidoPEl = session.getAttribute("apellidoPEl").toString(); apellidoMEl = session.getAttribute("apellidoMEl").toString(); paisNacEl = session.getAttribute("paisNacEl").toString(); depNacEl = session.getAttribute("depNacEl").toString(); proNacEl = session.getAttribute("proNacEl").toString(); fechaNacEl = session.getAttribute("fechaNacEl").toString(); edadEl = session.getAttribute("edadEl").toString(); docEl = session.getAttribute("docEl").toString(); numDocEl = session.getAttribute("numDocEl").toString(); profesionEl = session.getAttribute("profesionEl").toString(); celEl = session.getAttribute("celEl").toString(); correoEl = session.getAttribute("correoEl").toString(); nombreElla = session.getAttribute("nombreElla").toString(); apellidoPElla = session.getAttribute("apellidoPElla").toString(); apellidoMElla = session.getAttribute("apellidoMElla").toString(); paisNacElla = session.getAttribute("paisNacElla").toString(); depNacElla = session.getAttribute("depNacElla").toString(); proNacElla = session.getAttribute("proNacElla").toString(); fechaNacElla = session.getAttribute("fechaNacElla").toString(); edadElla = session.getAttribute("edadElla").toString(); docElla = session.getAttribute("docElla").toString(); numDocElla = session.getAttribute("numDocElla").toString(); profesionElla = session.getAttribute("profesionElla").toString(); celElla = session.getAttribute("celElla").toString(); correoElla = session.getAttribute("correoElla").toString(); pais = session.getAttribute("pais").toString(); dep = session.getAttribute("dep").toString(); prov = session.getAttribute("prov").toString(); dist = session.getAttribute("dist").toString(); dir = session.getAttribute("dir").toString(); telf = session.getAttribute("telf").toString(); } catch (Exception ex) { return new ModelAndView("redirect:/", map); } session.removeAttribute("estado"); session.removeAttribute("turno"); session.removeAttribute("nombreEl"); session.removeAttribute("apellidoPEl"); session.removeAttribute("apellidoMEl"); session.removeAttribute("paisNacEl"); session.removeAttribute("depNacEl"); session.removeAttribute("proNacEl"); session.removeAttribute("fechaNacEl"); session.removeAttribute("edadEl"); session.removeAttribute("docEl"); session.removeAttribute("numDocEl"); session.removeAttribute("profesionEl"); session.removeAttribute("celEl"); session.removeAttribute("correoEl"); session.removeAttribute("nombreElla"); session.removeAttribute("apellidoPElla"); session.removeAttribute("apellidoMElla"); session.removeAttribute("paisNacElla"); session.removeAttribute("depNacElla"); session.removeAttribute("proNacElla"); session.removeAttribute("fechaNacElla"); session.removeAttribute("edadElla"); session.removeAttribute("docElla"); session.removeAttribute("numDocElla"); session.removeAttribute("profesionElla"); session.removeAttribute("celElla"); session.removeAttribute("correoElla"); session.removeAttribute("pais"); session.removeAttribute("dep"); session.removeAttribute("prov"); session.removeAttribute("dist"); session.removeAttribute("dir"); session.removeAttribute("telf"); String m = "m"; String f = "f"; Turno temp = ServicioMain.getTurno(turno); FormularioSesion fs = new FormularioSesion(); Asistente asisEl = new Asistente(); Asistente asisElla = new Asistente(); AsistenciaFT aft = new AsistenciaFT(); AsistenciaFT aft2 = new AsistenciaFT(); fs.setSesion(temp.getSesion()); aft.setTurno(temp); aft2.setTurno(temp); String asistencia = "F"; char asist = asistencia.charAt(0); aft.setAsistencia(asist); aft2.setAsistencia(asist); String inajust = "1"; Short i = Short.valueOf(inajust); aft.setInasJus(i); aft2.setInasJus(i); Date today = new Date(); fs.setFechaSol(today); fs.setPaisRes(pais); fs.setDepRes(dep); fs.setProvRes(prov); fs.setDistritoRes(dist); fs.setDireccionRes(dir); fs.setTelefono(telf); fs.setEstadoCivil(estado); asisEl.setNombre(nombreEl); asisEl.setApellidoP(apellidoPEl); asisEl.setApellidoM(apellidoMEl); asisEl.setPaisNac(paisNacEl); asisEl.setDepNac(depNacEl); asisEl.setProvNac(proNacEl); short bEl = Byte.valueOf(edadEl); asisEl.setEdad(bEl); if (fechaNacEl != null && !fechaNacEl.equals("")) { asisEl.setFechaNac(df.stringToDate(fechaNacEl)); } char cEl = docEl.charAt(0); asisEl.setTipoDoc(cEl); char sexoEl = m.charAt(0); asisEl.setSexo(sexoEl); asisEl.setNDoc(numDocEl); asisEl.setProfesion(profesionEl); asisEl.setCelular(celEl); asisEl.setCorreo(correoEl); asisElla.setNombre(nombreElla); asisElla.setApellidoP(apellidoPElla); asisElla.setApellidoM(apellidoMElla); asisElla.setPaisNac(paisNacElla); asisElla.setDepNac(depNacElla); asisElla.setProvNac(proNacElla); short bElla = Byte.valueOf(edadElla); asisElla.setEdad(bElla); if (fechaNacElla != null && !fechaNacElla.equals("")) { asisElla.setFechaNac(df.stringToDate(fechaNacElla)); } char cElla = docElla.charAt(0); asisElla.setTipoDoc(cElla); char sexoElla = f.charAt(0); asisElla.setSexo(sexoElla); asisElla.setNDoc(numDocElla); asisElla.setProfesion(profesionElla); asisElla.setCelular(celElla); asisElla.setCorreo(correoElla); ArrayList<Asistente> tempList = new ArrayList(); tempList = ServicioMain.listaAsistentes(temp.getSesion().getIdsesion()); if (!tempList.isEmpty()) { for (Asistente asistente : tempList) { if (asistente.getNDoc().equals(numDocEl) || asistente.getNDoc().equals(numDocElla)) { map.put("mensaje", "inscrito"); return new ModelAndView("/Inscripcion/inscripcion_sesion1b", map); } } } if (temp.getVacantes() > temp.getAsistenciaFTs().size() + 1) { map.put("ts", ts); map.put("turno", temp); ServicioMain.InsertFormGrp(asisEl, asisElla, fs, aft, aft2); return new ModelAndView("/Inscripcion/inscripcion_sesion4", map); } return new ModelAndView("/Inscripcion/inscripcion_sesion1b", map); }
From source file:org.apache.openjpa.kernel.StateManagerImpl.java
/** * Fetch the specified field from the specified field manager, wrapping it * in an object if it's a primitive. A field should be provided to the * field manager before this call is made. */// w ww. j a v a2 s . c om private static Object fetchField(FieldManager fm, FieldMetaData fmd) { int field = fmd.getIndex(); switch (fmd.getDeclaredTypeCode()) { case JavaTypes.BOOLEAN: return (fm.fetchBooleanField(field)) ? Boolean.TRUE : Boolean.FALSE; case JavaTypes.BYTE: return Byte.valueOf(fm.fetchByteField(field)); case JavaTypes.CHAR: return Character.valueOf(fm.fetchCharField(field)); case JavaTypes.DOUBLE: return Double.valueOf(fm.fetchDoubleField(field)); case JavaTypes.FLOAT: return Float.valueOf(fm.fetchFloatField(field)); case JavaTypes.INT: return fm.fetchIntField(field); case JavaTypes.LONG: return fm.fetchLongField(field); case JavaTypes.SHORT: return Short.valueOf(fm.fetchShortField(field)); case JavaTypes.STRING: return fm.fetchStringField(field); default: return fm.fetchObjectField(field); } }