List of usage examples for java.text DateFormat MEDIUM
int MEDIUM
To view the source code for java.text DateFormat MEDIUM.
Click Source Link
From source file:org.hoteia.qalingo.core.web.mvc.factory.impl.ViewBeanFactoryImpl.java
/** * *//*from w ww . ja v a 2 s .co m*/ public CurrencyReferentialViewBean buildCurrencyReferentialViewBean(final RequestData requestData, final CurrencyReferential currencyReferential) throws Exception { final CurrencyReferentialViewBean currencyReferentialViewBean = new CurrencyReferentialViewBean(); if (currencyReferential != null) { currencyReferentialViewBean.setName(currencyReferential.getName()); currencyReferentialViewBean.setDescription(currencyReferential.getDescription()); currencyReferentialViewBean.setCode(currencyReferential.getCode()); currencyReferentialViewBean.setSign(currencyReferential.getSign()); currencyReferentialViewBean.setAbbreviated(currencyReferential.getAbbreviated()); DateFormat dateFormat = requestUtil.getFormatDate(requestData, DateFormat.MEDIUM, DateFormat.MEDIUM); Date dateCreate = currencyReferential.getDateCreate(); if (dateCreate != null) { currencyReferentialViewBean.setDateCreate(dateFormat.format(dateCreate)); } else { currencyReferentialViewBean.setDateCreate("NA"); } Date dateUpdate = currencyReferential.getDateUpdate(); if (dateUpdate != null) { currencyReferentialViewBean.setDateUpdate(dateFormat.format(dateUpdate)); } else { currencyReferentialViewBean.setDateUpdate("NA"); } // CLONE THE CURRENT REQUEST DATE TO BUILD THE CHANGE CONTEXT URL (MENU) RequestData requestDataChangecontext = new RequestData(); BeanUtils.copyProperties(requestData, requestDataChangecontext); requestDataChangecontext.setMarketAreaCurrency(currencyReferential); currencyReferentialViewBean .setChangeContextUrl(urlService.buildChangeContextUrl(requestDataChangecontext)); currencyReferentialViewBean.setHomeUrl(urlService.generateUrl(FoUrls.HOME, requestDataChangecontext)); } return currencyReferentialViewBean; }
From source file:org.hoteia.qalingo.core.web.mvc.factory.BackofficeViewBeanFactory.java
/** * @throws Exception//from w w w . j a va 2 s .c o m * */ @Override public AssetViewBean buildViewBeanAsset(final RequestData requestData, final Asset asset) throws Exception { AssetViewBean assetViewBean = super.buildViewBeanAsset(requestData, asset); assetViewBean.setAbsoluteWebPath(engineSettingService.getProductMarketingImageWebPath(asset)); DateFormat dateFormat = requestUtil.getCommonFormatDate(requestData, DateFormat.MEDIUM, DateFormat.MEDIUM); Date createdDate = asset.getDateCreate(); if (createdDate != null) { assetViewBean.setDateCreate(dateFormat.format(createdDate)); } else { assetViewBean.setDateCreate(Constants.NOT_AVAILABLE); } Date updatedDate = asset.getDateUpdate(); if (updatedDate != null) { assetViewBean.setDateUpdate(dateFormat.format(updatedDate)); } else { assetViewBean.setDateUpdate(Constants.NOT_AVAILABLE); } if (!Asset.ASSET_TYPE_DEFAULT.equals(asset.getType())) { assetViewBean.setDetailsUrl(backofficeUrlService.generateUrl(BoUrls.ASSET_DETAILS, requestData, asset)); assetViewBean.setEditUrl(backofficeUrlService.generateUrl(BoUrls.ASSET_EDIT, requestData, asset)); } return assetViewBean; }
From source file:org.hoteia.qalingo.core.service.WebManagementService.java
/** * //from w ww . ja va 2 s . c om */ public void buildAndSaveNewOrderConfirmationMail(final RequestData requestData, final Customer customer, final OrderPurchase order) throws Exception { final MarketArea marketArea = requestData.getMarketArea(); final String contextNameValue = requestData.getContextNameValue(); final String velocityPath = requestData.getVelocityEmailPrefix(); final Locale locale = requestData.getLocale(); final String localizationCode = requestData.getMarketAreaLocalization().getCode(); final OrderConfirmationEmailBean orderConfirmationEmailBean = new OrderConfirmationEmailBean(); orderConfirmationEmailBean.setFromAddress(getEmailFromAddress(requestData, marketArea, contextNameValue, Email.EMAIl_TYPE_ORDER_CONFIRMATION)); orderConfirmationEmailBean .setFromName(marketArea.getEmailFromName(contextNameValue, Email.EMAIl_TYPE_ORDER_CONFIRMATION)); orderConfirmationEmailBean.setReplyToEmail(getEmailFromAddress(requestData, marketArea, contextNameValue, Email.EMAIl_TYPE_ORDER_CONFIRMATION)); orderConfirmationEmailBean.setToEmail(customer.getEmail()); if (order != null) { orderConfirmationEmailBean.setOrderNumber(order.getOrderNum()); DateFormat dateFormat = requestUtil.getCommonFormatDate(requestData, DateFormat.MEDIUM, DateFormat.MEDIUM); if (order.getExpectedDeliveryDate() != null) { orderConfirmationEmailBean .setExpectedDeliveryDate(dateFormat.format(order.getExpectedDeliveryDate())); } else { orderConfirmationEmailBean.setExpectedDeliveryDate("NA"); } if (Hibernate.isInitialized(order.getShippingAddress()) && order.getShippingAddress() != null) { orderConfirmationEmailBean.setCompanyName(order.getShippingAddress().getCompanyName()); orderConfirmationEmailBean.setTitleCode(order.getShippingAddress().getTitle()); String titleLabel = referentialDataService.getTitleByLocale(order.getShippingAddress().getTitle(), locale); orderConfirmationEmailBean.setTitleLabel(titleLabel); orderConfirmationEmailBean.setLastname(order.getShippingAddress().getLastname()); orderConfirmationEmailBean.setFirstname(order.getShippingAddress().getFirstname()); orderConfirmationEmailBean.setAddress1(order.getShippingAddress().getAddress1()); orderConfirmationEmailBean.setAddress2(order.getShippingAddress().getAddress2()); orderConfirmationEmailBean.setAddressAdditionalInformation( order.getShippingAddress().getAddressAdditionalInformation()); orderConfirmationEmailBean.setPostalCode(order.getShippingAddress().getPostalCode()); orderConfirmationEmailBean.setCity(order.getShippingAddress().getCity()); orderConfirmationEmailBean.setStateCode(order.getShippingAddress().getStateCode()); orderConfirmationEmailBean.setAreaCode(order.getShippingAddress().getAreaCode()); orderConfirmationEmailBean.setCountryCode(order.getShippingAddress().getCountryCode()); String coutryLabel = referentialDataService .getCountryByLocale(order.getShippingAddress().getCountryCode(), locale); orderConfirmationEmailBean.setCountry(coutryLabel); } if (Hibernate.isInitialized(order.getOrderItems()) && order.getOrderItems() != null) { for (OrderItem orderItem : order.getOrderItems()) { OrderItemEmailBean orderItemEmailBean = new OrderItemEmailBean(); orderItemEmailBean.setSkuCode(orderItem.getProductSkuCode()); if (StringUtils.isNotEmpty(orderItem.getProductSkuCode())) { ProductSku productSku = productService.getProductSkuByCode(orderItem.getProductSkuCode()); orderItemEmailBean.setEan(productSku.getEan()); orderItemEmailBean.setI18nName(productSku.getI18nName(localizationCode)); orderItemEmailBean.setI18nDescription(productSku.getI18nDescription(localizationCode)); if (Hibernate.isInitialized(productSku.getAssets()) && productSku.getAssets() != null) { for (Asset asset : productSku.getAssets()) { final String path = engineSettingService .getProductSkuImageWebPath(productSku.getCode(), asset); orderItemEmailBean .setDefaultAssetFullPath(urlService.buildAbsoluteUrl(requestData, path)); } } } if (orderItem.getStoreId() != null) { Store store = retailerService.getStoreById(orderItem.getStoreId()); orderItemEmailBean.setStoreCode(store.getCode()); orderItemEmailBean.setStoreName(store.getName()); } orderItemEmailBean.setPrice(orderItem.getOrderItemPriceWithStandardCurrencySign()); orderItemEmailBean .setPriceWithTaxes(orderItem.getOrderItemPriceWithTaxesWithStandardCurrencySign()); orderItemEmailBean.setQuantity(orderItem.getQuantity()); orderItemEmailBean .setAmount(orderItem.getOrderItemTotalPriceWithTaxesWithStandardCurrencySign()); orderConfirmationEmailBean.getOrderItems().add(orderItemEmailBean); } } orderConfirmationEmailBean .setOrderItemsTotalWithCurrencySign(order.getOrderItemTotalWithTaxesWithStandardCurrencySign()); orderConfirmationEmailBean .setOrderShippingTotalWithCurrencySign(order.getDeliveryMethodTotalWithStandardCurrencySign()); if (BigDecimal.ZERO.compareTo(order.getDeliveryMethodTotal()) == 0) { orderConfirmationEmailBean.setOrderShippingTotalWithCurrencySign(coreMessageSource .getCommonMessage(ScopeWebMessage.LABEL.getPropertyKey(), "free", requestData.getLocale())); } orderConfirmationEmailBean .setOrderTaxesTotalWithCurrencySign(order.getTaxTotalWithStandardCurrencySign()); orderConfirmationEmailBean.setOrderTotalWithCurrencySign(order.getOrderTotalWithStandardCurrencySign()); } emailService.buildAndSaveNewOrderB2CConfirmationMail(requestData, customer, velocityPath, orderConfirmationEmailBean); }
From source file:org.hoteia.qalingo.core.web.mvc.factory.impl.BackofficeViewBeanFactoryImpl.java
/** * @throws Exception/*ww w.ja va 2 s . c om*/ * */ public RuleViewBean buildRuleViewBean(final RequestData requestData, final AbstractRuleReferential rule) throws Exception { RuleViewBean ruleViewBean = new RuleViewBean(); ruleViewBean.setId(rule.getId()); ruleViewBean.setVersion(rule.getVersion()); ruleViewBean.setName(rule.getName()); ruleViewBean.setDescription(rule.getDescription()); ruleViewBean.setSalience(rule.getSalience()); DateFormat dateFormat = requestUtil.getFormatDate(requestData, DateFormat.MEDIUM, DateFormat.MEDIUM); if (rule.getDateCreate() != null) { ruleViewBean.setDateCreate(dateFormat.format(rule.getDateCreate())); } else { ruleViewBean.setDateCreate(Constants.NOT_AVAILABLE); } if (rule.getDateUpdate() != null) { ruleViewBean.setDateUpdate(dateFormat.format(rule.getDateUpdate())); } else { ruleViewBean.setDateUpdate(Constants.NOT_AVAILABLE); } ruleViewBean.setDetailsUrl(backofficeUrlService.generateUrl(BoUrls.RULE_DETAILS, requestData, rule)); ruleViewBean.setEditUrl(backofficeUrlService.generateUrl(BoUrls.RULE_EDIT, requestData, rule)); return ruleViewBean; }
From source file:tvbrowser.TVBrowser.java
/** * Creates a very simple Formatter for log formatting * * @return a very simple Formatter for log formatting. */// w w w . ja va 2 s. co m private static Formatter createFormatter() { return new Formatter() { public synchronized String format(LogRecord record) { StringBuilder sb = new StringBuilder(); DateFormat mTimeFormat = DateFormat.getTimeInstance(DateFormat.MEDIUM); String message = formatMessage(record); sb.append(mTimeFormat.format(new java.util.Date(System.currentTimeMillis()))); sb.append(' '); sb.append(record.getLevel().getLocalizedName()); sb.append(": "); sb.append(message); sb.append('\n'); if (record.getThrown() != null) { try { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); record.getThrown().printStackTrace(pw); pw.close(); sb.append(sw.toString()); } catch (Exception ex) { // ignore } } return sb.toString(); } }; }
From source file:mitm.common.security.certificate.GenerateTestCertificates.java
/** * Generate a certificate with email in AltNames but not in subject * //ww w. ja va2s .c o m * @throws Exception */ private void generateCertificateEmailInAltNamesNotInSubject() throws Exception { X509CertificateBuilder certificateBuilder = securityFactory.createX509CertificateBuilder(); String encodedPublicKey = "30819f300d06092a864886f70d010101050003818d003081890281810088" + "350aa5de312b8d6d2bcb1845ae426b52f53bed933d05c1914753651911dd" + "2f2e449e5ebf0a9708d16bbf7ad3ff7e56bf149e26eb37112e1d92989884" + "ec3f9c27d4a37efe804a55e97e3ec62aa30610952b3f60f8a3f7516cf00b" + "1bc1d3a75f5d4f5834962d091c5676f5ecd6a12ac4e4fbb6069048684696" + "bfbf72483feb210203010001"; String encodedPrivateKey = "30820275020100300d06092a864886f70d01010105000482025f3082025b" + "0201000281810088350aa5de312b8d6d2bcb1845ae426b52f53bed933d05" + "c1914753651911dd2f2e449e5ebf0a9708d16bbf7ad3ff7e56bf149e26eb" + "37112e1d92989884ec3f9c27d4a37efe804a55e97e3ec62aa30610952b3f" + "60f8a3f7516cf00b1bc1d3a75f5d4f5834962d091c5676f5ecd6a12ac4e4" + "fbb6069048684696bfbf72483feb2102030100010281802a20257be93d51" + "d7fab4b9aa771a8f063c710628d309e376db64b0e12aa0c0c4afcd9f2174" + "7a64fde02f2fd8602abbbb3e7bb4f21a7b3c8003bb6c2077b3cd741b4b83" + "37c1330742875962dc56a91ecd9b6ccbc54d9c86ac7533dae9d3b792844a" + "2135e35b7ce2720f4d2fc25e2013aaadecd35a93d74a08921f1d4991023b" + "05024100e5b57d7eeeef447c9ca66643f8b38d743a2e1247e0b2bbe6925f" + "1a6166c580d10d87dff02a15ffc963e0f192ea060862e4ad3d1a6afbd280" + "3e5b409ea283119b02410097cbef487d4309e5646303b1c75e88db469c8a" + "653f93eac9713d570fad45b85f583c2c0314f3a290e6cc8a5cce2ca60ad5" + "4ea549779c829429f1645530dc6ff302402daac0314d052a636fad312590" + "3afa034251c8769bb84cdcd0fab13eedf493e07bc52883118ae018449002" + "d6c749bdbf136151858001625ef686a3b925ebd2c30240698a333e55494d" + "121eeff0dba460880add576da9e3c07657c4d1ff3c391ee687f413320e9a" + "7ca2a4d8b391e7e0b98e60adda567574226f6f9091f34e8000641d024031" + "7135e36f1533cffe338cbd103f44cc8ca257a27682c41b50f5458f7d0fde" + "7fe60171fc6718614fca2a756648fe87c9b2551d54cf4162035d59e7730f" + "a0783d"; PrivateKey privateKey = decodePrivateKey(encodedPrivateKey); PublicKey publicKey = decodePublicKey(encodedPublicKey); X500PrincipalBuilder subjectBuilder = new X500PrincipalBuilder(); String email = "test@example.com"; subjectBuilder.setCommonName("Email in DN not in AltNames"); subjectBuilder.setCountryCode("NL"); subjectBuilder.setLocality("Amsterdam"); subjectBuilder.setState("NH"); AltNamesBuilder altNamesBuider = new AltNamesBuilder(); altNamesBuider.setRFC822Names(email); X500Principal subject = subjectBuilder.buildPrincipal(); GeneralNames altNames = altNamesBuider.buildAltNames(); Set<KeyUsageType> keyUsage = new TreeSet<KeyUsageType>(); keyUsage.add(KeyUsageType.DIGITALSIGNATURE); keyUsage.add(KeyUsageType.KEYENCIPHERMENT); keyUsage.add(KeyUsageType.NONREPUDIATION); Set<ExtendedKeyUsageType> extendedKeyUsage = new TreeSet<ExtendedKeyUsageType>(); extendedKeyUsage.add(ExtendedKeyUsageType.CLIENTAUTH); extendedKeyUsage.add(ExtendedKeyUsageType.EMAILPROTECTION); BigInteger serialNumber = new BigInteger("115fceeccd07fe8929f68cc6b359a5a", 16); Date now = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, Locale.UK) .parse("21-Nov-2007 11:41:35"); certificateBuilder.setSubject(subject); certificateBuilder.setAltNames(altNames, true); certificateBuilder.setKeyUsage(keyUsage, true); certificateBuilder.setExtendedKeyUsage(extendedKeyUsage, false); certificateBuilder.setNotBefore(DateUtils.addDays(now, -20)); certificateBuilder.setNotAfter(DateUtils.addYears(new Date(), 20)); certificateBuilder.setPublicKey(publicKey); certificateBuilder.setSerialNumber(serialNumber); certificateBuilder.setSignatureAlgorithm("SHA1WithRSAEncryption"); certificateBuilder.addSubjectKeyIdentifier(true); X509Certificate certificate = certificateBuilder.generateCertificate(caPrivateKey, caCertificate); assertNotNull(certificate); certificates.add(certificate); Certificate[] chain = new Certificate[] { certificate, caCertificate, rootCertificate }; keyStore.setKeyEntry("emailInAltNamesNotInSubject", privateKey, null, chain); }
From source file:org.sakaiproject.util.foorm.Foorm.java
/** * Generates a secured search clause+values based on the given search clause * /*from ww w . j av a 2 s . c o m*/ * We assume a valid search clause like : * * SEARCH_FIELD_1:SEARCH_VALUE_1[#&#|#\\|#]SEARCH_FIELD_2:SEARCH_VALUE_2[#&#|#\\|#]...[#&#|#\\|#]SEARCH_FIELD_N:SEARCH_VALUE_N * * Secured search (LTISearchData.search) will be something like : * * SEARCH_FIELD_1 LIKE ? AND SEARCH_FIELD_2 LIKE ? AND ... AND SEARCH_FIELD_N LIKE ? * * Also returns a list with all values (LTISearchData.values) * * Also accepts a search clause like [TABLENAME.]SEARCH_FIELD=SEARCH_VALUE * * @param search * @return secured search */ public LTISearchData secureSearch(String search, String vendor) { LTISearchData ret = new LTISearchData(); //check if is a direct search if (StringUtils.isNotEmpty(search) && search.matches("(\\w+\\.)?\\w+\\s*=.+")) { ret.setSearch(search); return ret; } //split into tokens StringBuilder sb = new StringBuilder(); List<String> tokens = getSearchTokens(search); List<String> separators = getSearchSeparators(search); for (int i = 0; i < tokens.size(); i++) { String token = tokens.get(i); String searchField = getSearchField(token); String searchValue = getSearchValue(token); if (StringUtils.isNotEmpty(searchField) && StringUtils.isNotEmpty(searchValue)) { if (sb.length() > 0) { String separator = separators.get(i - 1); if (separator.equals(LTIService.LTI_SEARCH_TOKEN_SEPARATOR_AND)) sb.append(" AND "); if (separator.equals(LTIService.LTI_SEARCH_TOKEN_SEPARATOR_OR)) sb.append(" OR "); } if (LTIService.LTI_SEARCH_TOKEN_NULL.equals(searchValue)) { sb.append(searchField + " IS NULL"); } else if (searchValue.startsWith(LTIService.LTI_SEARCH_TOKEN_DATE)) { searchValue = searchValue.replace(LTIService.LTI_SEARCH_TOKEN_DATE, ""); if (StringUtils.isNotEmpty(searchValue)) { try { DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, rb.getLocale()); Date d = df.parse(searchValue); DateFormat sql_df = new SimpleDateFormat(LTIService.LTI_SEARCH_INTERNAL_DATE_FORMAT); if ("oracle".equals(vendor)) { sb.append(searchField + " = TO_DATE('" + sql_df.format(d) + "', 'DD/MM/YYYY HH24:MI:SS')"); } else if ("mysql".equals(vendor)) { sb.append(searchField + " = STR_TO_DATE('" + sql_df.format(d) + "', '%d/%m/%Y %H:%i:%s')"); } } catch (Exception ignore) { } } } else { sb.append(searchField + " LIKE ?"); searchValue = searchValue.replace(LTIService.ESCAPED_LTI_SEARCH_TOKEN_SEPARATOR_AND, LTIService.LTI_SEARCH_TOKEN_SEPARATOR_AND); searchValue = searchValue.replace(LTIService.ESCAPED_LTI_SEARCH_TOKEN_SEPARATOR_OR, LTIService.LTI_SEARCH_TOKEN_SEPARATOR_OR); ret.addSearchValue((Object) ("%" + searchValue + "%")); } } } ret.setSearch((sb.length() > 0) ? sb.toString() : null); return ret; }
From source file:com.apptentive.android.sdk.module.engagement.interaction.fragment.MessageCenterFragment.java
protected String createDatestamp(Double seconds) { if (seconds != null && seconds > Double.MIN_VALUE) { Date date = new Date(Math.round(seconds * 1000)); DateFormat mediumDateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM); return mediumDateFormat.format(date); }//from w w w.j a va 2s. c om return null; }
From source file:com.clustercontrol.jobmanagement.factory.SelectJob.java
/** * ???????/*from w ww .j a v a 2 s. c o m*/ * * @param sessionId ID * @param jobId ID * @param jobunitId ID * @param destFacilityId ?ID * @param destFacilityName ??? * @param checksum ? * @param locale * @return * @throws JobInfoNotFound */ private String getFileJobDetailMessage(String sessionId, String jobunitId, String jobId, String destFacilityId, String destFacilityName, boolean checksum, Locale locale) throws JobInfoNotFound { final String START = "_START"; final String END = "_END"; final String FILE = "_FILE"; final String RTN = "\n"; StringBuilder message = new StringBuilder(); if (sessionId == null || sessionId.length() == 0 || jobId == null || jobId.length() == 0) { return message.toString(); } // UTILIUPDT_S?? if (CreateHulftJob.isHulftMode()) { try { JobSessionJobEntity job = QueryUtil.getJobSessionJobPK(sessionId, jobunitId, jobId); JobSessionJobEntity jobUtliupdtS = QueryUtil.getJobSessionJobPK(sessionId, jobunitId, job.getParentJobId() + CreateHulftJob.UTILIUPDT_S); if (jobUtliupdtS.getEndDate() != null) { if (jobUtliupdtS.getEndStatus() == null || jobUtliupdtS.getEndStatus() != EndStatusConstant.TYPE_NORMAL) { for (JobSessionNodeEntity node : jobUtliupdtS.getJobSessionNodeEntities()) { String nodeMessage = node.getMessage(); if (nodeMessage != null && nodeMessage.length() > 0) { message.append(nodeMessage); message.append(RTN); } } } } } catch (JobInfoNotFound e) { m_log.debug("getFileJobDetailMessage() : " + e.getMessage()); } catch (InvalidRole e) { m_log.info("getFileJobDetailMessage() : " + e.getMessage()); } } //ID? Collection<JobSessionJobEntity> collection = QueryUtil.getChildJobSessionJobOrderByStartDate(sessionId, jobunitId, jobId); if (collection == null) { JobInfoNotFound je = new JobInfoNotFound("JobSessionJobEntity.findByStartDate" + ", [sessionId, parentJobId] = " + "[" + sessionId + ", " + jobId + "]"); m_log.info("getFileJobDetailMessage() : " + je.getClass().getSimpleName() + ", " + je.getMessage()); je.setSessionId(sessionId); je.setParentJobId(jobId); throw je; } DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.MEDIUM, locale); dateFormat.setTimeZone(HinemosTime.getTimeZone()); HashMap<String, String> jobIdMap = new HashMap<String, String>(); for (JobSessionJobEntity childSessionJob : collection) { JobInfoEntity childJob = childSessionJob.getJobInfoEntity(); String childJobId = childSessionJob.getId().getJobId(); if (childJobId.indexOf(CreateFileJob.GET_KEY) != -1) { //"_GET_CHECKSUM"??ID? String fileJobId = childJobId.replaceAll(CreateFileJob.GET_KEY, ""); //???? if (childSessionJob.getStartDate() != null && childSessionJob.getEndDate() != null && (childSessionJob.getEndStatus() == null || childSessionJob.getEndStatus() != EndStatusConstant.TYPE_NORMAL)) { for (JobSessionNodeEntity node : childSessionJob.getJobSessionNodeEntities()) { String nodeMessage = node.getMessage(); if (nodeMessage != null && nodeMessage.length() > 0) { message.append(nodeMessage); message.append(RTN); } } jobIdMap.put(fileJobId, END); } } else if (childJobId.indexOf(CreateFileJob.ADD_KEY) != -1) { //"_GET_CHECKSUM"??ID? String fileJobId = childJobId.replaceAll(CreateFileJob.ADD_KEY, ""); //???? if (childSessionJob.getStartDate() != null && childSessionJob.getEndDate() != null && (jobIdMap.get(fileJobId) == null || !jobIdMap.get(fileJobId).equals(END))) { if (childSessionJob.getEndStatus() == null || childSessionJob.getEndStatus() != EndStatusConstant.TYPE_NORMAL) { for (JobSessionNodeEntity node : childSessionJob.getJobSessionNodeEntities()) { String nodeMessage = node.getMessage(); if (nodeMessage != null && nodeMessage.length() > 0) { message.append(nodeMessage); message.append(RTN); } } jobIdMap.put(fileJobId, END); } } } else if (childJobId.indexOf(CreateFileJob.GET_CHECKSUM) != -1) { //"_GET_CHECKSUM"??ID? String fileJobId = childJobId.replaceAll(CreateFileJob.GET_CHECKSUM, ""); jobIdMap.put(fileJobId + FILE, childJob.getArgument()); //???? if (childSessionJob.getStartDate() != null) { String dateString = dateFormat.format(childSessionJob.getStartDate()); String file = childJob.getArgument(); String[] args = { dateString, file, destFacilityName }; message.append(MessageConstant.MESSAGE_STARTED_TO_TRANSFER_FILE.getMessage(args)); message.append(RTN); jobIdMap.put(fileJobId, START); } //???? if (childSessionJob.getStartDate() != null && childSessionJob.getEndDate() != null && (jobIdMap.get(fileJobId) == null || !jobIdMap.get(fileJobId).equals(END))) { if (childSessionJob.getEndStatus() == null || childSessionJob.getEndStatus() != EndStatusConstant.TYPE_NORMAL) { String dateString = dateFormat.format(childSessionJob.getEndDate()); String file = childJob.getArgument(); String[] args = { dateString, file, destFacilityName }; message.append(MessageConstant.MESSAGE_FAILED_TO_TRANSFER_FILE.getMessage(args)); message.append(RTN); for (JobSessionNodeEntity node : childSessionJob.getJobSessionNodeEntities()) { String nodeMessage = node.getMessage(); if (nodeMessage != null && nodeMessage.length() > 0) { message.append(nodeMessage); message.append(RTN); } } jobIdMap.put(fileJobId, END); } } } else if (childJobId.indexOf(CreateFileJob.FORWARD) != -1) { //"_FORWARD"??ID? String fileJobId = childJobId.replaceAll(CreateFileJob.FORWARD, ""); //???? if (childSessionJob.getStartDate() != null && !checksum) { String dateString = dateFormat.format(childSessionJob.getStartDate()); String file = childJob.getArgument(); String[] args = { dateString, file, destFacilityName }; message.append(MessageConstant.MESSAGE_STARTED_TO_TRANSFER_FILE.getMessage(args)); message.append(RTN); jobIdMap.put(fileJobId, START); } //???? if (childSessionJob.getStartDate() != null && childSessionJob.getEndDate() != null && (jobIdMap.get(fileJobId) == null || !jobIdMap.get(fileJobId).equals(END))) { String dateString = dateFormat.format(childSessionJob.getEndDate()); String file = childJob.getArgument(); String[] args = { dateString, file, destFacilityName }; if (childSessionJob.getEndStatus() != null && childSessionJob.getEndStatus() == EndStatusConstant.TYPE_NORMAL) { if (!checksum) { message.append(MessageConstant.MESSAGE_FINISHED_TRANSFERRING_FILE.getMessage(args)); message.append(RTN); jobIdMap.put(fileJobId, END); } } else { message.append(MessageConstant.MESSAGE_FAILED_TO_TRANSFER_FILE.getMessage(args)); message.append(RTN); for (JobSessionNodeEntity node : childSessionJob.getJobSessionNodeEntities()) { m_log.debug(node.getId().getJobId()); String nodeMessage = node.getMessage(); if (nodeMessage != null && nodeMessage.length() > 0) { message.append(nodeMessage); message.append(RTN); } } jobIdMap.put(fileJobId, END); } } if (!checksum) { jobIdMap.remove(fileJobId); jobIdMap.remove(fileJobId + FILE); } } else if (childJobId.indexOf(CreateFileJob.CHECK_CHECKSUM) != -1) { //"_CHECK_CHECKSUM"??ID? String fileJobId = childJobId.replaceAll(CreateFileJob.CHECK_CHECKSUM, ""); //???? if (childSessionJob.getStartDate() != null && childSessionJob.getEndDate() != null && (jobIdMap.get(fileJobId) == null || !jobIdMap.get(fileJobId).equals(END))) { String dateString = dateFormat.format(childSessionJob.getEndDate()); String file = jobIdMap.get(fileJobId + FILE); String[] args = { dateString, file, destFacilityName }; if (childSessionJob.getEndStatus() != null && childSessionJob.getEndStatus() == EndStatusConstant.TYPE_NORMAL) { message.append(MessageConstant.MESSAGE_FINISHED_TRANSFERRING_FILE.getMessage(args)); message.append(RTN); } else { message.append(MessageConstant.MESSAGE_FAILED_TO_TRANSFER_FILE.getMessage(args)); message.append(RTN); for (JobSessionNodeEntity node : childSessionJob.getJobSessionNodeEntities()) { m_log.debug(node.getId().getJobId()); String nodeMessage = node.getMessage(); if (nodeMessage != null && nodeMessage.length() > 0) { message.append(nodeMessage); message.append(RTN); } } jobIdMap.put(fileJobId, END); } } jobIdMap.remove(fileJobId); jobIdMap.remove(fileJobId + FILE); } else if (childJobId.indexOf(CreateFileJob.DEL_KEY) != -1) { //"_DEL_KEY"??ID? String fileJobId = childJobId.replaceAll(CreateFileJob.DEL_KEY, ""); //???? if (childSessionJob.getStartDate() != null && childSessionJob.getEndDate() != null && (jobIdMap.get(fileJobId) == null || !jobIdMap.get(fileJobId).equals(END))) { if (childSessionJob.getEndStatus() == null || childSessionJob.getEndStatus() != EndStatusConstant.TYPE_NORMAL) { for (JobSessionNodeEntity node : childSessionJob.getJobSessionNodeEntities()) { String nodeMessage = node.getMessage(); if (nodeMessage != null && nodeMessage.length() > 0) { message.append(nodeMessage); message.append(RTN); } } jobIdMap.put(fileJobId, END); } } } else if (childJobId.indexOf(CreateHulftJob.UTILIUPDT_R) != -1) { //"_UTILIUPDT_R"??ID? String fileJobId = childJobId.replaceAll(CreateHulftJob.UTILIUPDT_R, ""); //???? if (childSessionJob.getStartDate() != null && childSessionJob.getEndDate() != null && (jobIdMap.get(fileJobId) == null || !jobIdMap.get(fileJobId).equals(END))) { if (childSessionJob.getEndStatus() == null || childSessionJob.getEndStatus() != EndStatusConstant.TYPE_NORMAL) { for (JobSessionNodeEntity node : childSessionJob.getJobSessionNodeEntities()) { String nodeMessage = node.getMessage(); if (nodeMessage != null && nodeMessage.length() > 0) { message.append(nodeMessage); message.append(RTN); } } jobIdMap.put(fileJobId, END); } } } else if (childJobId.indexOf(CreateHulftJob.UTILIUPDT_H_SND) != -1) { //"_UTLSEND"??ID? String fileJobId = childJobId.replaceAll(CreateHulftJob.UTILIUPDT_H_SND, ""); //???? if (childSessionJob.getStartDate() != null && childSessionJob.getEndDate() != null && (jobIdMap.get(fileJobId) == null || !jobIdMap.get(fileJobId).equals(END))) { if (childSessionJob.getEndStatus() == null || childSessionJob.getEndStatus() != EndStatusConstant.TYPE_NORMAL) { for (JobSessionNodeEntity node : childSessionJob.getJobSessionNodeEntities()) { String nodeMessage = node.getMessage(); if (nodeMessage != null && nodeMessage.length() > 0) { message.append(nodeMessage); message.append(RTN); } } jobIdMap.put(fileJobId, END); } } } else if (childJobId.indexOf(CreateHulftJob.UTILIUPDT_H_RCV) != -1) { //"_UTLSEND"??ID? String fileJobId = childJobId.replaceAll(CreateHulftJob.UTILIUPDT_H_RCV, ""); //???? if (childSessionJob.getStartDate() != null && childSessionJob.getEndDate() != null && (jobIdMap.get(fileJobId) == null || !jobIdMap.get(fileJobId).equals(END))) { if (childSessionJob.getEndStatus() == null || childSessionJob.getEndStatus() != EndStatusConstant.TYPE_NORMAL) { for (JobSessionNodeEntity node : childSessionJob.getJobSessionNodeEntities()) { String nodeMessage = node.getMessage(); if (nodeMessage != null && nodeMessage.length() > 0) { message.append(nodeMessage); message.append(RTN); } } jobIdMap.put(fileJobId, END); } } } else if (childJobId.indexOf(CreateHulftJob.UTLSEND) != -1) { //"_UTLSEND"??ID? String fileJobId = childJobId.replaceAll(CreateHulftJob.UTLSEND, ""); //???? if (childSessionJob.getStartDate() != null && childSessionJob.getEndDate() != null && (jobIdMap.get(fileJobId) == null || !jobIdMap.get(fileJobId).equals(END))) { if (childSessionJob.getEndStatus() == null || childSessionJob.getEndStatus() != EndStatusConstant.TYPE_NORMAL) { for (JobSessionNodeEntity node : childSessionJob.getJobSessionNodeEntities()) { String nodeMessage = node.getMessage(); if (nodeMessage != null && nodeMessage.length() > 0) { message.append(nodeMessage); message.append(RTN); } } jobIdMap.put(fileJobId, END); } } } else if (childJobId.indexOf(CreateHulftJob.HULOPLCMD) != -1) { //"_HULOPLCMD"??ID? String fileJobId = childJobId.replaceAll(CreateHulftJob.HULOPLCMD, ""); //???? if (childSessionJob.getStartDate() != null && childSessionJob.getEndDate() != null && (jobIdMap.get(fileJobId) == null || !jobIdMap.get(fileJobId).equals(END))) { // HULOPLCMD?????????????? for (JobSessionNodeEntity node : childSessionJob.getJobSessionNodeEntities()) { String nodeMessage = node.getMessage(); if (nodeMessage != null && nodeMessage.length() > 0) { message.append(nodeMessage); message.append(RTN); } } jobIdMap.put(fileJobId, END); } } m_log.debug("getFileJobDetailMessage() : jobid=" + childJobId + ", message=" + message); } if (message.length() > 0) { message.setLength(message.length() - 1); } return message.toString(); }
From source file:org.hoteia.qalingo.core.web.mvc.factory.impl.ViewBeanFactoryImpl.java
/** * //from ww w.java2 s. c om */ public CustomerViewBean buildCustomerViewBean(final RequestData requestData, final Customer customer) throws Exception { final HttpServletRequest request = requestData.getRequest(); final Locale locale = requestData.getLocale(); final CustomerViewBean customerViewBean = new CustomerViewBean(); if (customer != null) { customerViewBean.setAvatarImg(requestUtil.getCustomerAvatar(request, customer)); customerViewBean.setFirstname(customer.getFirstname()); customerViewBean.setLastname(customer.getLastname()); customerViewBean.setEmail(customer.getEmail()); DateFormat dateFormat = requestUtil.getFormatDate(requestData, DateFormat.MEDIUM, DateFormat.MEDIUM); if (customer.getDateCreate() != null) { customerViewBean.setDateCreate(dateFormat.format(customer.getDateCreate())); } else { customerViewBean.setDateCreate(Constants.NOT_AVAILABLE); } if (customer.getDateUpdate() != null) { customerViewBean.setDateUpdate(dateFormat.format(customer.getDateUpdate())); } else { customerViewBean.setDateUpdate(Constants.NOT_AVAILABLE); } if (customer.getConnectionLogs() != null && customer.getConnectionLogs().size() > 0) { CustomerConnectionLog customerConnectionLog = customer.getConnectionLogs().iterator().next(); if (customerConnectionLog.getLoginDate() != null) { customerViewBean.setLastConnectionDate(dateFormat.format(customerConnectionLog.getLoginDate())); } else { customerViewBean.setLastConnectionDate(Constants.NOT_AVAILABLE); } } final ValueBean customerScreenNameValueBean = new ValueBean(); customerScreenNameValueBean .setKey(getSpecificMessage(ScopeWebMessage.CUSTOMER, "screenname.label", locale)); customerScreenNameValueBean.setValue(customer.getScreenName()); customerViewBean.getCustomerAttributes().put(CustomerViewBean.SCREEN_NAME, customerScreenNameValueBean); } return customerViewBean; }