List of usage examples for java.util Locale GERMAN
Locale GERMAN
To view the source code for java.util Locale GERMAN.
Click Source Link
From source file:com.seajas.search.codex.service.social.SocialProfileServiceTest.java
@Test public void testGetFacebookPagesSuggestions() throws Exception { List<Reference> pageReferences = Lists.newArrayList(new Reference("id3", "testPerson"), new Reference("id4", "testPerson"), new Reference("id5", "testPerson")); FacebookProfile fbp3 = new FacebookProfile("id", "username", "testPerson", "first", "last", "gender", Locale.GERMAN); FacebookProfile fbp4 = new FacebookProfile("id", "username", "testPerson", "first", "last", "gender", Locale.GERMAN);/* w ww . j a v a2 s .com*/ FacebookProfile fbp5 = new FacebookProfile("id", "username", "testPerson", "first", "last", "gender", Locale.GERMAN); when(socialFacadeMock.searchFacebookPages("testPerson")).thenReturn(pageReferences); when(socialFacadeMock.getFacebookPages(Lists.newArrayList("id3", "id4", "id5"))) .thenReturn(Lists.newArrayList(fbp3, fbp4, fbp5)); List<SocialProfileDto> dtos = socialProfileService.searchFacebookPages("testPerson", true); verify(mediaServiceMock, times(2)).storeUrl(anyString(), (String) isNull(), eq("image")); List profiles = Lists.newArrayList(SocialProfileDto.translate(fbp3), SocialProfileDto.translate(fbp4)); Assert.assertEquals(profiles, dtos); }
From source file:com.link_intersystems.lang.reflect.Class2Test.java
@Test public void applicableVarargsMethod() throws Exception { Class2<String> forClass = Class2.get(String.class); Method2 applicableMethod = forClass.getApplicableMethod("format", Locale.GERMAN, "Hello %s", "World"); Invokable invokable = applicableMethod.getInvokable(String.class); String formatted = invokable.invoke(Locale.GERMAN, "Hello %s", "World"); assertEquals("Hello World", formatted); }
From source file:de.fau.amos4.util.Lodas.java
private String sectionStammdaten() { final int personnelNumber = this.employee.getPersonnelNumber(); StringBuilder sb = new StringBuilder(); DateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy"); // Section 100 sb.append(indent()).append("100; ").append(field(personnelNumber)).append(field(employee.getFamilyName())) .append(field(employee.getFirstName())).append(field(employee.getMaidenName())) .append(field(employee.getStreet())).append(field(employee.getHouseNumber())) .append(field(employee.getPostcode())).append(field(employee.getCity())) .append(field(employee.getAdditionToAddress())).append("\n"); // Section 101 sb.append(indent()).append("101; ").append(field(personnelNumber)) .append(field(dateFormat.format(employee.getBirthDate()))).append(field(employee.getPlaceOfBirth())) .append(field(employee.getCountryOfBirth())).append(field(employee.getSex().getLodas())) .append(field(employee.getSocialInsuranceNumber())) .append(field(employee.getMaritalStatus().getLodas())).append(field(employee.getCitizenship())) .append("\n"); // Section 102 sb.append(indent()).append("102; ").append(field(personnelNumber)).append(field(employee.getIban())) .append(field(employee.getBic())).append("\n"); // Section 103 sb.append(indent()).append("103; ").append(field(personnelNumber)) .append(field(employee.getDisabled().getLodas())).append("\n"); //FIXME what to do if field is empty? // Section 200 sb.append(indent()).append("200; ").append(field(personnelNumber)) .append(field(dateFormat.format(employee.getEntryDate()))).append("\n"); // Section 201 sb.append(indent()).append("201; ").append(field(personnelNumber)) .append(field(dateFormat.format(employee.getFirstDay()))).append("\n"); // Section 300 sb.append(indent()).append("300; ").append(field(personnelNumber)) .append(field(employee.getPersonGroup().getLodas())).append("\n"); // Section 301 sb.append(indent()).append("301; ").append(field(personnelNumber)) .append(field(dateFormat.format(employee.getDateApprenticeshipBegins()))) .append(field(dateFormat.format(employee.getPlanedDateApprenticeshipEnds()))).append("\n"); // Section 400 sb.append(indent()).append("400; ").append(field(personnelNumber)) .append(field(employee.getDescriptionOfProfession())).append(field(employee.getJobPerformed())) .append(field(employee.getLevelOfEducation().getLodas())) .append(field(employee.getProfessionalTraining().getLodas())).append(field(0)) //TODO find out what really goes here .append(field(employee.getTypeOfContract().getLodas())).append("\n"); // Section 502 sb.append(indent()).append("502; ").append(field(personnelNumber)) .append(field(employee.getDepartmentNumber())).append("\n"); // Section 503 sb.append(indent()).append("503; ").append(field(personnelNumber)).append(field(employee.getCostCentre())) .append("\n"); // Section 800 sb.append(indent()).append("800; ").append(field(personnelNumber)) .append(field(String.format(Locale.GERMAN, "%.2f", employee.getWeeklyWorkingHours()))) .append(field(String.format(Locale.GERMAN, "%.2f", employee.getMon()))) .append(field(String.format(Locale.GERMAN, "%.2f", employee.getTue()))) .append(field(String.format(Locale.GERMAN, "%.2f", employee.getWed()))) .append(field(String.format(Locale.GERMAN, "%.2f", employee.getThu()))) .append(field(String.format(Locale.GERMAN, "%.2f", employee.getFri()))) .append(field(String.format(Locale.GERMAN, "%.2f", employee.getSat()))).append("\n"); // Section 801 sb.append(indent()).append("801; ").append(field(personnelNumber)) .append(field(String.format(Locale.GERMAN, "%.1f", employee.getHolidayEntitlement()))); return sb.toString(); }
From source file:de.geeksfactory.opacclient.apis.Pica.java
protected SearchRequestResult parse_search(String html, int page) throws OpacErrorException { Document doc = Jsoup.parse(html); updateSearchSetValue(doc);/*from www . ja v a2s.c o m*/ if (doc.select(".error").size() > 0) { String error = doc.select(".error").first().text().trim(); if (error.equals("Es wurde nichts gefunden.") || error.equals("Nothing has been found") || error.equals("Er is niets gevonden.") || error.equals("Rien n'a t trouv.")) { // nothing found return new SearchRequestResult(new ArrayList<SearchResult>(), 0, 1, 1); } else { // error throw new OpacErrorException(error); } } reusehtml = html; int results_total; String resultnumstr = doc.select(".pages").first().text(); Pattern p = Pattern.compile("[0-9]+$"); Matcher m = p.matcher(resultnumstr); if (m.find()) { resultnumstr = m.group(); } if (resultnumstr.contains("(")) { results_total = Integer.parseInt(resultnumstr.replaceAll(".*\\(([0-9]+)\\).*", "$1")); } else if (resultnumstr.contains(": ")) { results_total = Integer.parseInt(resultnumstr.replaceAll(".*: ([0-9]+)$", "$1")); } else { results_total = Integer.parseInt(resultnumstr); } List<SearchResult> results = new ArrayList<>(); if (results_total == 1) { // Only one result DetailledItem singleResult = parse_result(html); SearchResult sr = new SearchResult(); sr.setType(getMediaTypeInSingleResult(html)); sr.setInnerhtml( "<b>" + singleResult.getTitle() + "</b><br>" + singleResult.getDetails().get(0).getContent()); results.add(sr); } Elements table = doc.select("table[summary=hitlist] tbody tr[valign=top]"); // identifier = null; Elements links = doc.select("table[summary=hitlist] a"); boolean haslink = false; for (int i = 0; i < links.size(); i++) { Element node = links.get(i); if (node.hasAttr("href") & node.attr("href").contains("SHW?") && !haslink) { haslink = true; try { List<NameValuePair> anyurl = URLEncodedUtils.parse(new URI(node.attr("href")), getDefaultEncoding()); for (NameValuePair nv : anyurl) { if (nv.getName().equals("identifier")) { // identifier = nv.getValue(); break; } } } catch (Exception e) { e.printStackTrace(); } } } for (int i = 0; i < table.size(); i++) { Element tr = table.get(i); SearchResult sr = new SearchResult(); if (tr.select("td.hit img").size() > 0) { String[] fparts = tr.select("td img").get(0).attr("src").split("/"); String fname = fparts[fparts.length - 1]; if (data.has("mediatypes")) { try { sr.setType(MediaType.valueOf(data.getJSONObject("mediatypes").getString(fname))); } catch (JSONException | IllegalArgumentException e) { sr.setType(defaulttypes.get(fname.toLowerCase(Locale.GERMAN).replace(".jpg", "") .replace(".gif", "").replace(".png", ""))); } } else { sr.setType(defaulttypes.get(fname.toLowerCase(Locale.GERMAN).replace(".jpg", "") .replace(".gif", "").replace(".png", ""))); } } Element middlething = tr.child(2); List<Node> children = middlething.childNodes(); int childrennum = children.size(); List<String[]> strings = new ArrayList<>(); for (int ch = 0; ch < childrennum; ch++) { Node node = children.get(ch); if (node instanceof TextNode) { String text = ((TextNode) node).text().trim(); if (text.length() > 3) { strings.add(new String[] { "text", "", text }); } } else if (node instanceof Element) { List<Node> subchildren = node.childNodes(); for (int j = 0; j < subchildren.size(); j++) { Node subnode = subchildren.get(j); if (subnode instanceof TextNode) { String text = ((TextNode) subnode).text().trim(); if (text.length() > 3) { strings.add(new String[] { ((Element) node).tag().getName(), "text", text, ((Element) node).className(), node.attr("style") }); } } else if (subnode instanceof Element) { String text = ((Element) subnode).text().trim(); if (text.length() > 3) { strings.add(new String[] { ((Element) node).tag().getName(), ((Element) subnode).tag().getName(), text, ((Element) node).className(), node.attr("style") }); } } } } } StringBuilder description = new StringBuilder(); int k = 0; for (String[] part : strings) { if (part[0].equals("a") && k == 0) { description.append("<b>").append(part[2]).append("</b>"); } else if (k < 3) { description.append("<br />").append(part[2]); } k++; } sr.setInnerhtml(description.toString()); sr.setNr(10 * (page - 1) + i); sr.setId(null); results.add(sr); } resultcount = results.size(); return new SearchRequestResult(results, results_total, page); }
From source file:org.openmrs.util.OpenmrsUtilTest.java
/** * @see OpenmrsUtil#getDateFormat(Locale) *//*ww w .j av a 2 s . co m*/ @Test public void getDateFormat_shouldReturnAPatternWithFourYCharactersInIt() { Assert.assertEquals("MM/dd/yyyy", OpenmrsUtil.getDateFormat(Locale.US).toLocalizedPattern()); Assert.assertEquals("dd/MM/yyyy", OpenmrsUtil.getDateFormat(Locale.UK).toLocalizedPattern()); Assert.assertEquals("tt.MM.uuuu", OpenmrsUtil.getDateFormat(Locale.GERMAN).toLocalizedPattern()); Assert.assertEquals("dd-MM-yyyy", OpenmrsUtil.getDateFormat(new Locale("pt", "pt")).toLocalizedPattern()); }
From source file:org.nightlabs.jfire.store.StoreManagerBean.java
@TransactionAttribute(TransactionAttributeType.REQUIRED) @RolesAllowed("_System_") @Override//from w w w . ja va2 s .com public void initialise() throws Exception { PersistenceManager pm = createPersistenceManager(); try { initRegisterConfigModules(pm); initTimerTaskCalculateProductTypeAvailabilityPercentage(pm); pm.getExtent(ModeOfDelivery.class); try { pm.getObjectById(ModeOfDeliveryConst.MODE_OF_DELIVERY_ID_MANUAL); // it already exists, hence initialization is already done return; } catch (JDOObjectNotFoundException x) { // not yet initialized } pm.getExtent(ProductTypePermissionFlagSet.class); // We must already initialize the meta data here, because otherwise we run into deadlocks. SecurityChangeListenerProductTypePermission.register(pm); DefaultLocalStorekeeperDelegate.getDefaultLocalStorekeeperDelegate(pm); // Initalise standard property set structures for articleContainers DeliveryNoteStruct.getDeliveryNoteStructLocal(pm); ReceptionNoteStruct.getReceptionNoteStructLocal(pm); // create & persist instances of RepositoryType RepositoryType repositoryType; repositoryType = pm.makePersistent(new RepositoryType(RepositoryType.REPOSITORY_TYPE_ID_HOME, false)); repositoryType.getName().setText(Locale.ENGLISH.getLanguage(), "Home"); repositoryType.getName().setText(Locale.GERMAN.getLanguage(), "Heim"); repositoryType = pm.makePersistent(new RepositoryType(RepositoryType.REPOSITORY_TYPE_ID_OUTSIDE, true)); repositoryType.getName().setText(Locale.ENGLISH.getLanguage(), "Outside"); repositoryType.getName().setText(Locale.GERMAN.getLanguage(), "Auerhalb"); repositoryType = pm .makePersistent(new RepositoryType(RepositoryType.REPOSITORY_TYPE_ID_PARTNER, false)); repositoryType.getName().setText(Locale.ENGLISH.getLanguage(), "Business partner"); repositoryType.getName().setText(Locale.GERMAN.getLanguage(), "Geschftspartner"); Store store = Store.getStore(pm); Trader trader = Trader.getTrader(pm); LegalEntity anonymousCustomer = LegalEntity.getAnonymousLegalEntity(pm); CustomerGroup anonymousCustomerGroup = anonymousCustomer.getDefaultCustomerGroup(); // create fundamental set of ModeOfDelivery/ModeOfDeliveryFlavour // manual ModeOfDelivery modeOfDelivery = new ModeOfDelivery(ModeOfDeliveryConst.MODE_OF_DELIVERY_ID_MANUAL); modeOfDelivery.getName().setText(Locale.ENGLISH.getLanguage(), "Personal Delivery (manually from hand to hand)"); modeOfDelivery.getName().setText(Locale.GERMAN.getLanguage(), "Persnliche Lieferung (manuell von Hand zu Hand)"); ModeOfDeliveryFlavour modeOfDeliveryFlavour = modeOfDelivery .createFlavour(Organisation.DEV_ORGANISATION_ID, "manual"); modeOfDeliveryFlavour.loadIconFromResource(); modeOfDeliveryFlavour.getName().setText(Locale.ENGLISH.getLanguage(), "Personal Delivery (manually from hand to hand)"); modeOfDeliveryFlavour.getName().setText(Locale.GERMAN.getLanguage(), "Persnliche Lieferung (manuell von Hand zu Hand)"); modeOfDelivery = pm.makePersistent(modeOfDelivery); trader.getDefaultCustomerGroupForKnownCustomer().addModeOfDelivery(modeOfDelivery); anonymousCustomerGroup.addModeOfDelivery(modeOfDelivery); ModeOfDelivery modeOfDeliveryManual = modeOfDelivery; // nonDelivery modeOfDelivery = new ModeOfDelivery(ModeOfDeliveryConst.MODE_OF_DELIVERY_ID_NON_DELIVERY); modeOfDelivery.getName().setText(Locale.ENGLISH.getLanguage(), "Non-Delivery"); modeOfDelivery.getName().setText(Locale.GERMAN.getLanguage(), "Nichtlieferung"); modeOfDeliveryFlavour = modeOfDelivery.createFlavour(Organisation.DEV_ORGANISATION_ID, "nonDelivery"); modeOfDeliveryFlavour.getName().setText(Locale.ENGLISH.getLanguage(), "Non-Delivery"); modeOfDeliveryFlavour.getName().setText(Locale.GERMAN.getLanguage(), "Nichtlieferung"); modeOfDelivery = pm.makePersistent(modeOfDelivery); trader.getDefaultCustomerGroupForKnownCustomer().addModeOfDelivery(modeOfDelivery); ModeOfDelivery modeOfDeliveryNonDelivery = modeOfDelivery; // mailing.physical modeOfDelivery = new ModeOfDelivery(ModeOfDeliveryConst.MODE_OF_DELIVERY_ID_MAILING_PHYSICAL); modeOfDelivery.getName().setText(Locale.ENGLISH.getLanguage(), "Mailing delivery (physical)"); modeOfDelivery.getName().setText(Locale.GERMAN.getLanguage(), "Postversand (physisch)"); modeOfDeliveryFlavour = modeOfDelivery.createFlavour(Organisation.DEV_ORGANISATION_ID, "mailing.physical.default"); modeOfDeliveryFlavour.getName().setText(Locale.ENGLISH.getLanguage(), "Mailing delivery via default service provider"); modeOfDeliveryFlavour.getName().setText(Locale.GERMAN.getLanguage(), "Postversand via Standard-Dienstleister"); ModeOfDeliveryFlavour modeOfDeliveryFlavourMailingPhysicalDefault = modeOfDeliveryFlavour; // modeOfDeliveryFlavour = modeOfDelivery.createFlavour(Organisation.DEV_ORGANISATION_ID, "mailing.physical.DHL"); // modeOfDeliveryFlavour.getName().setText(Locale.ENGLISH.getLanguage(), "Mailing delivery via DHL"); // modeOfDeliveryFlavour.getName().setText(Locale.GERMAN.getLanguage(), "Postversand via DHL"); // modeOfDeliveryFlavour = modeOfDelivery.createFlavour(Organisation.DEV_ORGANISATION_ID, "mailing.physical.UPS"); // modeOfDeliveryFlavour.getName().setText(Locale.ENGLISH.getLanguage(), "Mailing delivery via UPS"); // modeOfDeliveryFlavour.getName().setText(Locale.GERMAN.getLanguage(), "Postversand via UPS"); modeOfDelivery = pm.makePersistent(modeOfDelivery); trader.getDefaultCustomerGroupForKnownCustomer().addModeOfDelivery(modeOfDelivery); anonymousCustomerGroup.addModeOfDelivery(modeOfDelivery); // mailing.virtual modeOfDelivery = new ModeOfDelivery(ModeOfDeliveryConst.MODE_OF_DELIVERY_ID_MAILING_VIRTUAL); modeOfDelivery.getName().setText(Locale.ENGLISH.getLanguage(), "Virtual Delivery (online)"); modeOfDelivery.getName().setText(Locale.GERMAN.getLanguage(), "Virtuelle Lieferung (online)"); // modeOfDeliveryFlavour = modeOfDelivery.createFlavour(Organisation.DEV_ORGANISATION_ID, "mailing.virtual.email"); // modeOfDeliveryFlavour.getName().setText(Locale.ENGLISH.getLanguage(), "Delivery by eMail"); // modeOfDeliveryFlavour.getName().setText(Locale.GERMAN.getLanguage(), "Zustellung via eMail"); // pm.makePersistent(modeOfDelivery); // trader.getDefaultCustomerGroupForKnownCustomer().addModeOfDelivery(modeOfDelivery); // anonymousCustomerGroup.addModeOfDelivery(modeOfDelivery); modeOfDelivery = new ModeOfDelivery(ModeOfDeliveryConst.MODE_OF_DELIVERY_ID_JFIRE); modeOfDelivery.getName().setText(Locale.ENGLISH.getLanguage(), "JFire Internal Delivery"); modeOfDelivery.getName().setText(Locale.GERMAN.getLanguage(), "JFire-interne Lieferung"); modeOfDeliveryFlavour = modeOfDelivery .createFlavour(ModeOfDeliveryConst.MODE_OF_DELIVERY_FLAVOUR_ID_JFIRE); ModeOfDeliveryFlavour modeOfDeliveryFlavourJFire = modeOfDeliveryFlavour; modeOfDeliveryFlavour.getName().setText(Locale.ENGLISH.getLanguage(), "JFire Internal Delivery"); modeOfDeliveryFlavour.getName().setText(Locale.GERMAN.getLanguage(), "JFire-interne Lieferung"); modeOfDelivery = pm.makePersistent(modeOfDelivery); // trader.getDefaultCustomerGroupForKnownCustomer().addModeOfDelivery(modeOfDelivery); // anonymousCustomerGroup.addModeOfDelivery(modeOfDelivery); // deliveryQueue modeOfDelivery = new ModeOfDelivery(ModeOfDeliveryConst.MODE_OF_DELIVERY_ID_DELIVER_TO_DELIVERY_QUEUE); modeOfDelivery.getName().setText(Locale.ENGLISH.getLanguage(), "Deliver to Delivery Queue"); modeOfDelivery.getName().setText(Locale.GERMAN.getLanguage(), "Lieferung in Lieferwarteschlange"); modeOfDeliveryFlavour = modeOfDelivery.createFlavour(Organisation.DEV_ORGANISATION_ID, "deliverToDeliveryQueue"); modeOfDeliveryFlavour.getName().setText(Locale.ENGLISH.getLanguage(), "Deliver to Delivery Queue"); modeOfDeliveryFlavour.getName().setText(Locale.GERMAN.getLanguage(), "Lieferung in Lieferwarteschlange"); modeOfDelivery = pm.makePersistent(modeOfDelivery); ModeOfDelivery modeOfDeliveryDeliveryQueue = modeOfDelivery; trader.getDefaultCustomerGroupForKnownCustomer().addModeOfDelivery(modeOfDelivery); anonymousCustomerGroup.addModeOfDelivery(modeOfDeliveryDeliveryQueue); // create some ServerDeliveryProcessor s ServerDeliveryProcessorManual serverDeliveryProcessorManual = ServerDeliveryProcessorManual .getServerDeliveryProcessorManual(pm); serverDeliveryProcessorManual.addModeOfDelivery(modeOfDeliveryManual); serverDeliveryProcessorManual.getName().setText(Locale.ENGLISH.getLanguage(), "Manual Delivery (no digital action)"); serverDeliveryProcessorManual.getName().setText(Locale.GERMAN.getLanguage(), "Manuelle Lieferung (nicht-digitale Aktion)"); ServerDeliveryProcessorNonDelivery serverDeliveryProcessorNonDelivery = ServerDeliveryProcessorNonDelivery .getServerDeliveryProcessorNonDelivery(pm); serverDeliveryProcessorNonDelivery.addModeOfDelivery(modeOfDeliveryNonDelivery); serverDeliveryProcessorNonDelivery.getName().setText(Locale.ENGLISH.getLanguage(), "Non-Delivery (delivery will be postponed)"); serverDeliveryProcessorNonDelivery.getName().setText(Locale.GERMAN.getLanguage(), "Nichtlieferung (Lieferung wird verschoben)"); ServerDeliveryProcessorMailingPhysicalDefault serverDeliveryProcessorMailingPhysicalDefault = ServerDeliveryProcessorMailingPhysicalDefault .getServerDeliveryProcessorMailingPhysicalDefault(pm); serverDeliveryProcessorMailingPhysicalDefault .addModeOfDeliveryFlavour(modeOfDeliveryFlavourMailingPhysicalDefault); serverDeliveryProcessorMailingPhysicalDefault.getName().setText(Locale.ENGLISH.getLanguage(), "Physical mail via default service provider"); serverDeliveryProcessorMailingPhysicalDefault.getName().setText(Locale.GERMAN.getLanguage(), "Postversand via Standard-Dienstleister"); ServerDeliveryProcessorDeliveryQueue serverDeliveryProcessorDeliveryQueue = ServerDeliveryProcessorDeliveryQueue .getServerDeliveryProcessorDeliveryQueue(pm); serverDeliveryProcessorDeliveryQueue.addModeOfDelivery(modeOfDeliveryDeliveryQueue); ServerDeliveryProcessorJFire serverDeliveryProcessorJFire = ServerDeliveryProcessorJFire .getServerDeliveryProcessorJFire(pm); serverDeliveryProcessorJFire.addModeOfDeliveryFlavour(modeOfDeliveryFlavourJFire); serverDeliveryProcessorJFire.getName().setText(Locale.ENGLISH.getLanguage(), "JFire Internal Delivery"); // persist process definitions ProcessDefinition processDefinitionDeliveryNoteCustomerLocal; processDefinitionDeliveryNoteCustomerLocal = store.storeProcessDefinitionDeliveryNote( TradeSide.customerLocal, ProcessDefinitionAssignment.class.getResource("deliverynote/customer/local/")); pm.makePersistent(new ProcessDefinitionAssignment(DeliveryNote.class, TradeSide.customerLocal, processDefinitionDeliveryNoteCustomerLocal)); ProcessDefinition processDefinitionDeliveryNoteCustomerCrossOrg; processDefinitionDeliveryNoteCustomerCrossOrg = store.storeProcessDefinitionDeliveryNote( TradeSide.customerCrossOrganisation, ProcessDefinitionAssignment.class.getResource("deliverynote/customer/crossorganisation/")); pm.makePersistent(new ProcessDefinitionAssignment(DeliveryNote.class, TradeSide.customerCrossOrganisation, processDefinitionDeliveryNoteCustomerCrossOrg)); ProcessDefinition processDefinitionDeliveryNoteVendor; processDefinitionDeliveryNoteVendor = store.storeProcessDefinitionDeliveryNote(TradeSide.vendor, ProcessDefinitionAssignment.class.getResource("deliverynote/vendor/")); pm.makePersistent(new ProcessDefinitionAssignment(DeliveryNote.class, TradeSide.vendor, processDefinitionDeliveryNoteVendor)); ProcessDefinition processDefinitionReceptionNoteCustomer; processDefinitionReceptionNoteCustomer = store.storeProcessDefinitionReceptionNote( TradeSide.customerCrossOrganisation, ProcessDefinitionAssignment.class.getResource("receptionnote/customer/crossorganisation/")); pm.makePersistent(new ProcessDefinitionAssignment(ReceptionNote.class, TradeSide.customerCrossOrganisation, processDefinitionReceptionNoteCustomer)); // TODO create and persist ProcessDefinition for ReceptionNote.Vendor // TODO and for customerLocal IDNamespaceDefault idNamespaceDefault = IDNamespaceDefault.createIDNamespaceDefault(pm, getOrganisationID(), DeliveryNote.class); idNamespaceDefault.setCacheSizeServer(0); idNamespaceDefault.setCacheSizeClient(0); pm.makePersistent(new EditLockTypeDeliveryNote(EditLockTypeDeliveryNote.EDIT_LOCK_TYPE_ID)); Unit unit = new Unit(Organisation.DEV_ORGANISATION_ID, "h", 2); unit.getSymbol().setText(Locale.ENGLISH.getLanguage(), "h"); unit.getName().setText(Locale.ENGLISH.getLanguage(), "hour"); unit.getName().setText(Locale.GERMAN.getLanguage(), "Stunde"); pm.makePersistent(unit); unit = new Unit(Organisation.DEV_ORGANISATION_ID, "piece", 3); unit.getSymbol().setText(Locale.ENGLISH.getLanguage(), "pcs."); unit.getName().setText(Locale.ENGLISH.getLanguage(), "pieces"); unit.getSymbol().setText(Locale.GERMAN.getLanguage(), "Stk."); unit.getName().setText(Locale.GERMAN.getLanguage(), "Stck"); pm.makePersistent(unit); unit = new Unit(Organisation.DEV_ORGANISATION_ID, "flatRate", 0); unit.getSymbol().setText(Locale.ENGLISH.getLanguage(), "()"); unit.getName().setText(Locale.ENGLISH.getLanguage(), "(flat-rate)"); unit.getSymbol().setText(Locale.GERMAN.getLanguage(), "()"); unit.getName().setText(Locale.GERMAN.getLanguage(), "(pauschal)"); pm.makePersistent(unit); } finally { pm.close(); } }
From source file:net.cloudfree.apps.shop.internal.app.ListingServlet.java
private void writeListing(final SolrDocument listing, final PrintWriter writer, final HttpServletRequest req) { writer.println("<div style=\"float:left;\">"); final Object uripath = listing.getFirstValue("uripath"); if (null != uripath) { writer.print("<a href=\""); writer.print(getBaseUrl(req).append(uripath)); writer.print("\">"); }/*from ww w .j a v a 2s. com*/ writer.print("<img border=\"0\" src=\""); Object thumb = listing.getFirstValue("img48"); if (null == thumb) { thumb = listing.getFirstValue("img480"); } writer.print(thumb); writer.print("\">"); if (null != uripath) { writer.print("</a>"); } writer.println("</div>"); writer.println("<br/>"); writer.print("<strong>"); writer.print(listing.getFirstValue("title")); writer.print("</strong>"); writer.println("<br/>"); writer.print("<small>"); writer.print(listing.getFirstValue("score")); writer.println("<br/>"); final Object size = listing.getFirstValue("size"); if (null != size) { writer.print("Size: "); writer.print(size); writer.println("<br/>"); } final Object color = listing.getFirstValue("color"); if (null != color) { writer.print("Color: "); writer.print(color); writer.println("<br/>"); } writer.print("</small>"); writer.print("<span style=\"font-size: 2em;\">"); NumberFormat.getCurrencyInstance(Locale.GERMAN).format((Double) listing.getFirstValue("price")); writer.print("</span><br/>"); final Object desc = listing.getFirstValue("description"); if (null != desc) { writer.println("<br/>"); writer.println("<blockquote>"); writer.print(desc); writer.println("</blockquote>"); } // writer.print("<pre>"); // writer.println(listing.toString()); // writer.print("</pre>"); writer.println("<div style=\"clear:both;\"> </div>"); }
From source file:org.nightlabs.jfire.accounting.AccountingManagerBean.java
@TransactionAttribute(TransactionAttributeType.REQUIRED) @RolesAllowed("_System_") @Override// w w w . java 2s . c om public void initialise() throws IOException { final PersistenceManager pm = createPersistenceManager(); try { // SecurityChangeListenerTariffUserSet.register(pm); pm.getExtent(PFMoneyFlowMapping.class); pm.getExtent(OwnerDimension.class); pm.getExtent(PriceFragmentDimension.class); MoneyFlowDimension priceFragmentDimension = MoneyFlowDimension.getMoneyFlowDimension(pm, PriceFragmentDimension.MONEY_FLOW_DIMENSION_ID); if (priceFragmentDimension == null) { priceFragmentDimension = new PriceFragmentDimension(); priceFragmentDimension = pm.makePersistent(priceFragmentDimension); } MoneyFlowDimension ownerDimension = MoneyFlowDimension.getMoneyFlowDimension(pm, OwnerDimension.MONEY_FLOW_DIMENSION_ID); if (ownerDimension == null) { ownerDimension = new OwnerDimension(); ownerDimension = pm.makePersistent(ownerDimension); } MoneyFlowDimension sourceOrgDimension = MoneyFlowDimension.getMoneyFlowDimension(pm, SourceOrganisationDimension.MONEY_FLOW_DIMENSION_ID); if (sourceOrgDimension == null) { sourceOrgDimension = new SourceOrganisationDimension(); sourceOrgDimension = pm.makePersistent(sourceOrgDimension); } PayableObjectMoneyTransferFactory invoiceTransferFactory = PayableObjectMoneyTransferFactoryJDO .getFactory(pm, null, PartnerPayPayableObjectAccountantDelegate.PAYABLE_OBJECT_FACTORY_SCOPE, Invoice.class); if (invoiceTransferFactory == null) { invoiceTransferFactory = new InvoiceMoneyTransferFactoryJDO( PartnerPayPayableObjectAccountantDelegate.PAYABLE_OBJECT_FACTORY_SCOPE); pm.makePersistent(invoiceTransferFactory); } pm.getExtent(AccountType.class); try { pm.getObjectById(AccountType.ACCOUNT_TYPE_ID_UNCOLLECTABLE); } catch (final JDOObjectNotFoundException x) { final AccountType accountType = pm .makePersistent(new AccountType(AccountType.ACCOUNT_TYPE_ID_UNCOLLECTABLE, false)); accountType.getName().setText(Locale.ENGLISH.getLanguage(), "Uncollectable"); accountType.getName().setText(Locale.GERMAN.getLanguage(), "Uneinbringlich"); } pm.getFetchPlan().addGroup(FetchPlan.DEFAULT); Price.setDefaultTotalPriceFragmentType(pm.detachCopy(PriceFragmentType.getTotalPriceFragmentType(pm))); initRegisterConfigModules(pm); BugfixWrongOutstandingFlag.fix(pm); UpdateTo12AccountantStructure.update(pm); // check, whether the datastore is already initialized try { pm.getObjectById(AccountType.ACCOUNT_TYPE_ID_OUTSIDE); return; // already initialized } catch (final JDOObjectNotFoundException x) { // datastore not yet initialized } // Initalise standard property set structures for articleContainers InvoiceStruct.getInvoiceStructLocal(pm); pm.makePersistent(new ResellerTariffUserSetFactory(Organisation.DEV_ORGANISATION_ID, ResellerTariffUserSetFactory.class.getName(), Tariff.class)); pm.makePersistent(new EntityUserSetNotificationFilterEntry(Organisation.DEV_ORGANISATION_ID, Tariff.class.getName(), Tariff.class)); // create and persist the AccountTypes AccountType accountType; accountType = pm.makePersistent(new AccountType(AccountType.ACCOUNT_TYPE_ID_OUTSIDE, true)); accountType.getName().setText(Locale.ENGLISH.getLanguage(), "Outside"); accountType.getName().setText(Locale.GERMAN.getLanguage(), "Auerhalb"); accountType = pm.makePersistent(new AccountType(AccountType.ACCOUNT_TYPE_ID_LOCAL_EXPENSE, false)); accountType.getName().setText(Locale.ENGLISH.getLanguage(), "Expense"); accountType.getName().setText(Locale.GERMAN.getLanguage(), "Aufwand"); accountType = pm.makePersistent(new AccountType(AccountType.ACCOUNT_TYPE_ID_LOCAL_REVENUE, false)); accountType.getName().setText(Locale.ENGLISH.getLanguage(), "Revenue"); accountType.getName().setText(Locale.GERMAN.getLanguage(), "Einnahme"); accountType = pm.makePersistent(new AccountType(AccountType.ACCOUNT_TYPE_ID_PARTNER_CUSTOMER, false)); accountType.getName().setText(Locale.ENGLISH.getLanguage(), "Customer"); accountType.getName().setText(Locale.GERMAN.getLanguage(), "Kunde"); accountType = pm.makePersistent(new AccountType(AccountType.ACCOUNT_TYPE_ID_PARTNER_NEUTRAL, false)); accountType.getName().setText(Locale.ENGLISH.getLanguage(), "Business partner"); accountType.getName().setText(Locale.GERMAN.getLanguage(), "Geschftspartner"); accountType = pm.makePersistent(new AccountType(AccountType.ACCOUNT_TYPE_ID_PARTNER_VENDOR, false)); accountType.getName().setText(Locale.ENGLISH.getLanguage(), "Vendor"); accountType.getName().setText(Locale.GERMAN.getLanguage(), "Lieferant"); accountType = pm.makePersistent(new AccountType(AccountType.ACCOUNT_TYPE_ID_SUMMARY, false)); accountType.getName().setText(Locale.ENGLISH.getLanguage(), "Summary"); accountType.getName().setText(Locale.GERMAN.getLanguage(), "Summenkonto"); final Accounting accounting = Accounting.getAccounting(pm); final Trader trader = Trader.getTrader(pm); final LegalEntity anonymousCustomer = LegalEntity.getAnonymousLegalEntity(pm); final CustomerGroup anonymousCustomerGroup = anonymousCustomer.getDefaultCustomerGroup(); // create some ModeOfPayments // Cash ModeOfPayment modeOfPayment = new ModeOfPayment(ModeOfPaymentConst.MODE_OF_PAYMENT_ID_CASH); modeOfPayment.getName().setText(Locale.ENGLISH.getLanguage(), "Cash"); modeOfPayment.getName().setText(Locale.GERMAN.getLanguage(), "Bargeld"); modeOfPayment.getName().setText(Locale.FRENCH.getLanguage(), "Argent Liquide"); ModeOfPaymentFlavour modeOfPaymentFlavour = modeOfPayment .createFlavour(ModeOfPaymentConst.MODE_OF_PAYMENT_FLAVOUR_ID_CASH); modeOfPaymentFlavour.getName().setText(Locale.ENGLISH.getLanguage(), "Cash"); modeOfPaymentFlavour.getName().setText(Locale.GERMAN.getLanguage(), "Bargeld"); modeOfPaymentFlavour.getName().setText(Locale.FRENCH.getLanguage(), "Argent Liquide"); modeOfPaymentFlavour.loadIconFromResource(); pm.makePersistent(modeOfPayment); trader.getDefaultCustomerGroupForKnownCustomer().addModeOfPayment(modeOfPayment); anonymousCustomerGroup.addModeOfPayment(modeOfPayment); // we need this later for payment processor registration final ModeOfPayment modeOfPaymentCash = modeOfPayment; // No payment - this is a dummy MOP which means, the payment is postponed without // specifying a certain real MOP modeOfPayment = new ModeOfPayment(ModeOfPaymentConst.MODE_OF_PAYMENT_ID_NON_PAYMENT); modeOfPayment.getName().setText(Locale.ENGLISH.getLanguage(), "Non-Payment"); modeOfPayment.getName().setText(Locale.GERMAN.getLanguage(), "Nichtzahlung"); modeOfPaymentFlavour = modeOfPayment .createFlavour(ModeOfPaymentConst.MODE_OF_PAYMENT_FLAVOUR_ID_NON_PAYMENT); modeOfPaymentFlavour.getName().setText(Locale.ENGLISH.getLanguage(), "Non-Payment"); modeOfPaymentFlavour.getName().setText(Locale.GERMAN.getLanguage(), "Nichtzahlung"); modeOfPaymentFlavour.loadIconFromResource(); pm.makePersistent(modeOfPayment); trader.getDefaultCustomerGroupForKnownCustomer().addModeOfPayment(modeOfPayment); // we need this later for payment processor registration final ModeOfPayment modeOfPaymentNonPayment = modeOfPayment; // Credit Card - VISA, Master, AmEx, Diners modeOfPayment = new ModeOfPayment(ModeOfPaymentConst.MODE_OF_PAYMENT_ID_CREDIT_CARD); modeOfPayment.getName().setText(Locale.ENGLISH.getLanguage(), "Credit Card"); modeOfPayment.getName().setText(Locale.GERMAN.getLanguage(), "Kreditkarte"); modeOfPayment.getName().setText(Locale.FRENCH.getLanguage(), "Carte de Crdit"); modeOfPaymentFlavour = modeOfPayment.createFlavour(ModeOfPaymentConst.MODE_OF_PAYMENT_FLAVOUR_ID_VISA); modeOfPaymentFlavour.getName().setText(Locale.ENGLISH.getLanguage(), "VISA"); modeOfPaymentFlavour.loadIconFromResource(); modeOfPaymentFlavour = modeOfPayment .createFlavour(ModeOfPaymentConst.MODE_OF_PAYMENT_FLAVOUR_ID_MASTER_CARD); modeOfPaymentFlavour.getName().setText(Locale.ENGLISH.getLanguage(), "MasterCard"); modeOfPaymentFlavour.loadIconFromResource(); modeOfPaymentFlavour = modeOfPayment .createFlavour(ModeOfPaymentConst.MODE_OF_PAYMENT_FLAVOUR_ID_AMERICAN_EXPRESS); modeOfPaymentFlavour.getName().setText(Locale.ENGLISH.getLanguage(), "American Express"); modeOfPaymentFlavour.loadIconFromResource(); modeOfPaymentFlavour = modeOfPayment .createFlavour(ModeOfPaymentConst.MODE_OF_PAYMENT_FLAVOUR_ID_DINERS_CLUB); modeOfPaymentFlavour.getName().setText(Locale.ENGLISH.getLanguage(), "Diners Club"); modeOfPaymentFlavour.loadIconFromResource(); pm.makePersistent(modeOfPayment); trader.getDefaultCustomerGroupForKnownCustomer().addModeOfPayment(modeOfPayment); anonymousCustomerGroup.addModeOfPayment(modeOfPayment); // we need this later for payment processor registration final ModeOfPayment modeOfPaymentCreditCard = modeOfPayment; // Bank Transfer modeOfPayment = new ModeOfPayment(ModeOfPaymentConst.MODE_OF_PAYMENT_ID_BANK_TRANSFER); modeOfPayment.getName().setText(Locale.ENGLISH.getLanguage(), "Bank Transfer"); modeOfPayment.getName().setText(Locale.GERMAN.getLanguage(), "berweisung"); modeOfPayment.getName().setText(Locale.FRENCH.getLanguage(), "Virement"); modeOfPaymentFlavour = modeOfPayment .createFlavour(ModeOfPaymentConst.MODE_OF_PAYMENT_FLAVOUR_ID_BANK_TRANSFER); modeOfPaymentFlavour.getName().setText(Locale.ENGLISH.getLanguage(), "Bank Transfer"); modeOfPaymentFlavour.getName().setText(Locale.GERMAN.getLanguage(), "berweisung"); modeOfPaymentFlavour.getName().setText(Locale.FRENCH.getLanguage(), "Virement"); modeOfPaymentFlavour.loadIconFromResource(); pm.makePersistent(modeOfPayment); trader.getDefaultCustomerGroupForKnownCustomer().addModeOfPayment(modeOfPayment); // we need this later for payment processor registration final ModeOfPayment modeOfPaymentBankTransfer = modeOfPayment; // Debit Note modeOfPayment = new ModeOfPayment(ModeOfPaymentConst.MODE_OF_PAYMENT_ID_DEBIT_NOTE); modeOfPayment.getName().setText(Locale.ENGLISH.getLanguage(), "Debit Note"); modeOfPayment.getName().setText(Locale.GERMAN.getLanguage(), "Lastschrift"); modeOfPayment.getName().setText(Locale.FRENCH.getLanguage(), "Note de Dbit"); modeOfPaymentFlavour = modeOfPayment .createFlavour(ModeOfPaymentConst.MODE_OF_PAYMENT_FLAVOUR_ID_DEBIT_NOTE); modeOfPaymentFlavour.getName().setText(Locale.ENGLISH.getLanguage(), "Debit Note"); modeOfPaymentFlavour.getName().setText(Locale.GERMAN.getLanguage(), "Lastschrift"); modeOfPaymentFlavour.getName().setText(Locale.FRENCH.getLanguage(), "Note de Dbit"); modeOfPaymentFlavour.loadIconFromResource(); pm.makePersistent(modeOfPayment); trader.getDefaultCustomerGroupForKnownCustomer().addModeOfPayment(modeOfPayment); // we need this later for payment processor registration final ModeOfPayment modeOfPaymentDebitNote = modeOfPayment; // create some ServerPaymentProcessors final ServerPaymentProcessorCash serverPaymentProcessorCash = ServerPaymentProcessorCash .getServerPaymentProcessorCash(pm); serverPaymentProcessorCash.getName().setText(Locale.ENGLISH.getLanguage(), "Cash Payment"); serverPaymentProcessorCash.getName().setText(Locale.GERMAN.getLanguage(), "Barzahlung"); serverPaymentProcessorCash.getName().setText(Locale.FRENCH.getLanguage(), "Paiement Argent Liquide"); serverPaymentProcessorCash.addModeOfPayment(modeOfPaymentCash); final ServerPaymentProcessorNonPayment serverPaymentProcessorNonPayment = ServerPaymentProcessorNonPayment .getServerPaymentProcessorNonPayment(pm); serverPaymentProcessorNonPayment.getName().setText(Locale.ENGLISH.getLanguage(), "Non-Payment (payment will be postponed)"); serverPaymentProcessorNonPayment.getName().setText(Locale.GERMAN.getLanguage(), "Nichtzahlung (Zahlung wird verschoben)"); serverPaymentProcessorNonPayment.addModeOfPayment(modeOfPaymentNonPayment); final ServerPaymentProcessorCreditCardDummyForClientPayment serverPaymentProcessorCreditCardDummyForClientPayment = ServerPaymentProcessorCreditCardDummyForClientPayment .getServerPaymentProcessorCreditCardDummyForClientPayment(pm); serverPaymentProcessorCreditCardDummyForClientPayment.getName().setText(Locale.ENGLISH.getLanguage(), "Dummy for client-sided Credit Card Payment"); serverPaymentProcessorCreditCardDummyForClientPayment.getName().setText(Locale.GERMAN.getLanguage(), "Pseudo-Modul fr client-seitige Kreditkarten-Zahlungen"); serverPaymentProcessorCreditCardDummyForClientPayment.addModeOfPayment(modeOfPaymentCreditCard); final ServerPaymentProcessorBankTransferGermany serverPaymentProcessorBankTransferGermany = ServerPaymentProcessorBankTransferGermany .getServerPaymentProcessorBankTransferGermany(pm); serverPaymentProcessorBankTransferGermany.getName().setText(Locale.ENGLISH.getLanguage(), "Bank transfer within Germany"); serverPaymentProcessorBankTransferGermany.getName().setText(Locale.GERMAN.getLanguage(), "berweisung innerhalb Deutschlands"); serverPaymentProcessorBankTransferGermany.addModeOfPayment(modeOfPaymentBankTransfer); final ServerPaymentProcessorDebitNoteGermany serverPaymentProcessorDebitNoteGermany = ServerPaymentProcessorDebitNoteGermany .getServerPaymentProcessorDebitNoteGermany(pm); serverPaymentProcessorDebitNoteGermany.getName().setText(Locale.ENGLISH.getLanguage(), "Debit Note within Germany"); serverPaymentProcessorDebitNoteGermany.getName().setText(Locale.GERMAN.getLanguage(), "Lastschrift innerhalb Deutschlands"); serverPaymentProcessorDebitNoteGermany.addModeOfPayment(modeOfPaymentDebitNote); // persist process definitions ProcessDefinition processDefinitionInvoiceCustomerLocal; processDefinitionInvoiceCustomerLocal = accounting.storeProcessDefinitionInvoice( TradeSide.customerLocal, ProcessDefinitionAssignment.class.getResource("invoice/customer/local/")); pm.makePersistent(new ProcessDefinitionAssignment(Invoice.class, TradeSide.customerLocal, processDefinitionInvoiceCustomerLocal)); ProcessDefinition processDefinitionInvoiceCustomerCrossOrg; processDefinitionInvoiceCustomerCrossOrg = accounting.storeProcessDefinitionInvoice( TradeSide.customerCrossOrganisation, ProcessDefinitionAssignment.class.getResource("invoice/customer/crossorganisation/")); pm.makePersistent(new ProcessDefinitionAssignment(Invoice.class, TradeSide.customerCrossOrganisation, processDefinitionInvoiceCustomerCrossOrg)); ProcessDefinition processDefinitionInvoiceVendor; processDefinitionInvoiceVendor = accounting.storeProcessDefinitionInvoice(TradeSide.vendor, ProcessDefinitionAssignment.class.getResource("invoice/vendor/")); pm.makePersistent(new ProcessDefinitionAssignment(Invoice.class, TradeSide.vendor, processDefinitionInvoiceVendor)); // deactive IDGenerator's cache for invoice final IDNamespaceDefault idNamespaceDefault = IDNamespaceDefault.createIDNamespaceDefault(pm, getOrganisationID(), Invoice.class); idNamespaceDefault.setCacheSizeServer(0); idNamespaceDefault.setCacheSizeClient(0); pm.makePersistent(new EditLockTypeInvoice(EditLockTypeInvoice.EDIT_LOCK_TYPE_ID)); } finally { pm.close(); } }
From source file:test.be.fedict.eid.applet.PcscTest.java
@Test public void testLocale() throws Exception { Locale locale = Locale.GERMAN; LOG.debug("locale: " + locale.getLanguage()); }
From source file:de.hybris.platform.servicelayer.internal.model.extractor.impl.DefaultCascaderTest.java
/** * Test method for/*from w w w . j a va 2s . com*/ * {@link de.hybris.platform.servicelayer.internal.model.extractor.impl.DefaultCascader#getNewModels(ModelWrapper, InterceptorContextSnapshot, WrapperRegistry)} * given argument: one unsaved Model - Category, holding 4 localized references (English and German Keywords) <br/> * expected result: 4 Keywords (2 EN, 2DE), recognized as new Models by the Cascader */ @Test public void testGetNewModelsForUnsavedModelWithLocalizedMany2ManyRelation() { //given cat<->keyword relation final WrapperRegistry wrapperReg = getWrapperRegistry(); final ModelWrapper cat1ModelWrapper = wrapperReg.createWrapper(cat1, PersistenceOperation.SAVE); assertTrue(cat1ModelWrapper.isNew()); final ModelValueHistory history = ((ItemModelContextImpl) ModelContextUtils .getItemModelContext((AbstractItemModel) cat1ModelWrapper.getModel())).getValueHistory(); assertNotNull(history); final Set<String> dirtyUnlocalizedAttr = history.getDirtyAttributes(); assertThat(dirtyUnlocalizedAttr).isEmpty(); //changes in localized reference attributes expected final Map<Locale, Set<String>> dirtyLocAttrMap = history.getDirtyLocalizedAttributes(); assertThat(dirtyLocAttrMap).isNotEmpty(); assertTrue(dirtyLocAttrMap.size() == 2); assertTrue(dirtyLocAttrMap.containsKey(Locale.ENGLISH)); assertTrue(dirtyLocAttrMap.containsKey(Locale.GERMAN)); assertThat(dirtyLocAttrMap.get(Locale.ENGLISH)).containsOnly(KEYWORDS); assertThat(dirtyLocAttrMap.get(Locale.GERMAN)).containsOnly(KEYWORDS); final Collection<ModelWrapper> newModels = cascader.getNewModels(cat1ModelWrapper, new InterceptorContextSnapshot(), wrapperReg); assertNotNull(newModels); assertTrue(newModels.size() == 4); checkNewModels(newModels, keywEN1, keywEN2, keywDE1, keywDE2); }