List of usage examples for org.apache.commons.lang WordUtils capitalizeFully
public static String capitalizeFully(String str, char[] delimiters)
Converts all the delimiter separated words in a String into capitalized words, that is each word is made up of a titlecase character and then a series of lowercase characters.
From source file:com.square.client.gwt.server.util.PersonnePhysiqueFormatAop.java
/** * Interception des methodes qui retournent un objet de type PersonneModel. * @param retVal l'objet retourn.// w w w . j av a 2 s . c o m */ @SuppressWarnings("unchecked") public void formatPp(Object retVal) { final char[] delimiters = { ' ', '-', '_' }; if (retVal instanceof PersonneModel) { final PersonneModel personne = (PersonneModel) retVal; if (personne.getNom() != null && !"".equals(personne.getNom())) { personne.setNom(personne.getNom().toUpperCase()); } if (personne.getPrenom() != null && !"".equals(personne.getPrenom())) { final String prenomMisEnForme = WordUtils.capitalizeFully(personne.getPrenom(), delimiters); personne.setPrenom(prenomMisEnForme); } } else if (retVal instanceof PersonneSimpleModel) { final PersonneSimpleModel personne = (PersonneSimpleModel) retVal; if (personne.getNom() != null && !"".equals(personne.getNom())) { personne.setNom(personne.getNom().toUpperCase()); } if (personne.getPrenom() != null && !"".equals(personne.getPrenom())) { final String prenomMisEnForme = WordUtils.capitalizeFully(personne.getPrenom(), delimiters); personne.setPrenom(prenomMisEnForme); } } else if (retVal instanceof RemotePagingResultsGwt<?>) { if (((RemotePagingResultsGwt<?>) retVal).getListResults().size() > 0 && ((RemotePagingResultsGwt<?>) retVal).getListResults() .get(0) instanceof PersonneSimpleModel) { final RemotePagingResultsGwt<PersonneSimpleModel> result = (RemotePagingResultsGwt<PersonneSimpleModel>) retVal; for (PersonneSimpleModel personne : result.getListResults()) { if (personne.getNom() != null && !"".equals(personne.getNom())) { personne.setNom(personne.getNom().toUpperCase()); } if (personne.getPrenom() != null && !"".equals(personne.getPrenom())) { final String prenomMisEnForme = WordUtils.capitalizeFully(personne.getPrenom(), delimiters); personne.setPrenom(prenomMisEnForme); } } } } else if (retVal instanceof ArrayList<?> && ((ArrayList<?>) retVal).size() > 0 && ((ArrayList<?>) retVal).get(0) instanceof RelationInfosModel<?>) { final List<RelationInfosModel<? extends PersonneRelationModel>> relations = (ArrayList<RelationInfosModel<? extends PersonneRelationModel>>) retVal; for (RelationInfosModel<? extends PersonneRelationModel> relation : relations) { if (relation.getPersonne() instanceof PersonnePhysiqueRelationModel) { final PersonnePhysiqueRelationModel personne = (PersonnePhysiqueRelationModel) relation .getPersonne(); if (personne.getNom() != null && !"".equals(personne.getNom())) { personne.setNom(personne.getNom().toUpperCase()); } if (personne.getPrenom() != null && !"".equals(personne.getPrenom())) { final String prenomMisEnForme = WordUtils.capitalizeFully(personne.getPrenom(), delimiters); personne.setPrenom(prenomMisEnForme); } } } } else if (retVal instanceof InfosAdhesionModel) { final InfosAdhesionModel infosAdhesion = (InfosAdhesionModel) retVal; if (infosAdhesion.getInfosPersonnes() != null && infosAdhesion.getInfosPersonnes().size() > 0) { for (InfosPersonneModel infosPersonne : infosAdhesion.getInfosPersonnes()) { if (infosPersonne.getNom() != null && !"".equals(infosPersonne.getNom())) { infosPersonne.setNom(infosPersonne.getNom().toUpperCase()); } if (infosPersonne.getPrenom() != null && !"".equals(infosPersonne.getPrenom())) { final String prenomMisEnForme = WordUtils.capitalizeFully(infosPersonne.getPrenom(), delimiters); infosPersonne.setPrenom(prenomMisEnForme); } } } } }
From source file:nc.noumea.mairie.appock.core.utility.AppockUtil.java
public static String capitalizeFullyFrench(String str) { if (StringUtils.isBlank(str)) { return null; }/*from w w w . ja v a 2 s . c o m*/ return WordUtils.capitalizeFully(str, new char[] { '-', ' ' }); }
From source file:com.square.adherent.noyau.util.PersonneUtil.java
/** * Formatte les champs textuels du DTO pass en paramtre. * @param personne la personne formatter * @return la personne formatte//from ww w .j a v a 2 s. c om */ public PersonneSimpleDto formatterPersonneSimple(PersonneSimpleDto personne) { personne.setNom(personne.getNom().toUpperCase()); personne.setPrenom(WordUtils.capitalizeFully(personne.getPrenom().trim(), DELIMITERS)); return personne; }
From source file:net.sf.firemox.ui.component.task.TaskAction.java
/** * Return a getter method : <br>//from w ww .j a v a 2 s . c o m * getGetter("") = "get"<br> * getGetter(*) = "get*"<br> * getGetter("i-aM-fine") = "getIAmFine"<br> * * @param property * @return return a getter method */ private static String getGetter(String property) { return "get" + WordUtils.capitalizeFully(property, new char[] { '-' }).replace("-", ""); }
From source file:com.jroossien.boxx.aliases.items.Items.java
/** * Get the {@link ItemData} for the specified material and data. * If there is no item registered with the provided material and data it will return the item with data value 0. * If the material is not registered at all it will return a new blank item data without aliases and just the material as name. * * @param material The material to look up. * @param data The material data to look up. (damage/durability/data value) * @return The {@link ItemData} for the given material and data containing display name, aliases etc. */// w ww . java 2 s .c o m public static ItemData getItem(Material material, short data) { String key = material.toString().toLowerCase() + "-" + ((short) Math.max(data, 0)); if (itemLookup.containsKey(key)) { return itemLookup.get(key); } key = material.toString().toLowerCase() + "-0"; if (itemLookup.containsKey(key)) { ItemData itemData = itemLookup.get(key); return new ItemData(itemData.getName(), material, data); } return new ItemData(WordUtils.capitalizeFully(material.toString(), new char[] { '_' }).replace("_", " "), material, data); }
From source file:com.square.core.agent.AgentMessagePublisher.java
@Override protected void executeInternal(JobExecutionContext arg0) throws JobExecutionException { logger.debug(messageSourceUtil.get(AgentJmxKeyUtil.MESSAGE_LANCEMENT_AGENT_QUARTS)); final int pagination = 100; final char[] delimiters = { ' ', '-', '_' }; if (notificateurSquarePlugin == null) { logger.error(messageSourceUtil.get(AgentJmxKeyUtil.MESSAGE_ERROR_NOTIFICATION_SQUARE_PLUGIN)); } else {//from w w w. jav a 2s . c o m final ActionCritereRechercheDto criteres = new ActionCritereRechercheDto(); criteres.setDateNotification(Calendar.getInstance()); try { RemotePagingCriteriasDto<ActionCritereRechercheDto> criterias = new RemotePagingCriteriasDto<ActionCritereRechercheDto>( criteres, 0, pagination); RemotePagingResultsDto<ActionRechercheDto> resultPagination = actionService .rechercherActionParCritere(criterias); List<ActionRechercheDto> result = resultPagination.getListResults(); logger.debug(messageSourceUtil.get(AgentJmxKeyUtil.MESSAGE_NOMBRE_MESSAGE_TROUVES) + " = " + result.size()); final String titre = messageSourceUtil.get(MESSAGE_PUBLISHER_TITRE); while (result.size() > 0) { for (ActionRechercheDto action : result) { final StringBuffer urlMessage = new StringBuffer(url); if (StringUtils.isNotBlank(action.getRaisonSociale())) { urlMessage.append(OPEN_PERSON_MORALE_EVENT_NAME); } else { urlMessage.append(OPEN_PERSON_EVENT_NAME); } urlMessage.append("&").append(PARAM_ID_PERSON).append("=") .append(action.getIdpersonne()); urlMessage.append("&").append(PARAM_ID_ACTION).append("=").append(action.getId()); final StringBuffer nomAffichage = new StringBuffer(); if (StringUtils.isNotBlank(action.getPrenomPersonne())) { final String prenomMisEnForme = WordUtils.capitalizeFully(action.getPrenomPersonne(), delimiters); nomAffichage.append(prenomMisEnForme); } if (StringUtils.isNotBlank(action.getPrenomPersonne()) && StringUtils.isNotBlank(action.getNomPersonne())) { nomAffichage.append(" "); } if (StringUtils.isNotBlank(action.getNomPersonne())) { nomAffichage.append(action.getNomPersonne().toUpperCase()); } if (StringUtils.isNotBlank(action.getRaisonSociale())) { nomAffichage.append(action.getRaisonSociale().toUpperCase()); } final String contenu = messageSourceUtil.get(MESSAGE_PUBLISHER_CONTENU, new String[] { urlMessage.toString(), nomAffichage.toString() }); final MessagePublishDto message = new MessagePublishDto(); message.setTitre(titre); message.setTexte(contenu); message.setIdUtilisateur(action.getCommercial().getIdentifiant()); logger.debug(messageSourceUtil.get(AgentJmxKeyUtil.MESSAGE_APPEL_PLUGIN_NOTIFICATEUR)); notificateurSquarePlugin.publierMessage(message); actionService.notifier(action.getId()); } criterias = new RemotePagingCriteriasDto<ActionCritereRechercheDto>(criteres, 0, pagination); resultPagination = actionService.rechercherActionParCritere(criterias); result = resultPagination.getListResults(); logger.debug(messageSourceUtil.get(AgentJmxKeyUtil.MESSAGE_NOMBRE_MESSAGE_TROUVES) + " = " + result.size()); } } catch (Exception e) { logger.error( messageSourceUtil.get(AgentJmxKeyUtil.MESSAGE_ERROR_EXCEPTION_SURVENUE_DURANT_TRAITEMENT) + " : " + e.getMessage(), e); } } logger.debug(messageSourceUtil.get(AgentJmxKeyUtil.MESSAGE_FIN_AGENT_QUART)); }
From source file:com.migo.utils.GenUtils.java
/** * ????Java??//from w w w. j a v a2 s .com */ public static String columnToJava(String columnName) { return WordUtils.capitalizeFully(columnName, new char[] { '_' }).replace("_", ""); }
From source file:com.jroossien.boxx.util.Str.java
/** * Formats a string with underscores to CamelCase. * This can be used for displaying enum keys and such. * * @param str The string to format to camel case. * @return CamelCased string//from w ww . jav a 2 s. co m */ public static String camelCase(String str) { return WordUtils.capitalizeFully(str, new char[] { '_' }).replaceAll("_", ""); }
From source file:fr.ign.datalift.RDFBuilder.java
protected String cleanUpString(String str) { if (str.contains(":")) str = str.substring(str.lastIndexOf(':') + 1); return WordUtils.capitalizeFully(str, new char[] { ' ' }).replaceAll(" ", "").trim(); }
From source file:com.square.client.gwt.server.service.PersonneServiceGwtImpl.java
@Override public String[][] relationOrgChartDataStore(final Long idPersonne, final List<Long> filtreGroupement, final List<Long> filtrePasDansGroupement) { final PersonneBaseDto personne = personneService.rechercherPersonneParId(idPersonne); String nom = ""; Integer age = 0;/* w ww . j a va 2 s. c o m*/ Boolean relationPersonnePhysique = Boolean.TRUE; if (personne instanceof PersonneMoraleDto) { final PersonneMoraleDto personneMorale = (PersonneMoraleDto) personne; nom += personneMorale.getRaisonSociale().toUpperCase(); relationPersonnePhysique = Boolean.FALSE; } else { final PersonneDto personnePhysique = (PersonneDto) personne; final char[] delimiters = { ' ', '-', '_' }; final String prenomMisEnForme = WordUtils.capitalizeFully(personnePhysique.getPrenom(), delimiters); nom += personnePhysique.getNom().toUpperCase() + " " + prenomMisEnForme; final PersonneSimpleDto personneSimpleDto = personnePhysiqueService .rechercherPersonneSimpleParIdentifiant(personnePhysique.getIdentifiant()); final String[] ageString = personneSimpleDto.getAge().split(" "); if (ageString.length > 0) { age = Integer.parseInt(ageString[0]); } relationPersonnePhysique = Boolean.TRUE; } final List<String[]> datas = new ArrayList<String[]>(); final String[] data = new String[] { idPersonne.toString(), idPersonne.toString(), "Personne source", nom, "Source", age.toString() }; datas.add(data); ajouterRelations(datas, idPersonne, true, filtreGroupement, filtrePasDansGroupement); final String[][] datasRelation = new String[datas.size()][6]; for (int index = 0; index < datas.size(); index++) { datasRelation[index] = datas.get(index); } // On effectue le tri s'il s'agit de relation entre personne physique. // if (relationPersonnePhysique) { // trieDatasRelationSelonAge(datasRelation); // } if (!relationPersonnePhysique) { for (int rowi = 0; rowi < datasRelation.length; rowi++) { datasRelation[rowi][1] = datasRelation[0][0]; } } return datasRelation; }