List of usage examples for java.util Calendar before
public boolean before(Object when)
Calendar
represents a time before the time represented by the specified Object
. From source file:nl.strohalm.cyclos.services.transactions.InvoiceServiceImpl.java
private Validator getValidator(final Invoice invoice) { final Validator validator = new Validator("invoice"); validator.property("from").required(); validator.property("to").add(new PropertyValidation() { private static final long serialVersionUID = -5222363482447066104L; @Override/*from w w w . j av a2 s. c o m*/ public ValidationError validate(final Object object, final Object name, final Object value) { final Invoice invoice = (Invoice) object; // Can't be the same from / to if (invoice.getFrom() != null && invoice.getTo() != null && invoice.getFrom().equals(invoice.getTo())) { return new InvalidError(); } return null; } }); validator.property("description").required().maxLength(1000); validator.property("amount").required().positiveNonZero(); if (LoggedUser.hasUser()) { final boolean asMember = !LoggedUser.accountOwner().equals(invoice.getFrom()); if (asMember || LoggedUser.isMember() || LoggedUser.isOperator()) { validator.property("destinationAccountType").required(); } else { validator.property("transferType").required(); } } validator.general(new GeneralValidation() { private static final long serialVersionUID = 4085922259108191939L; @Override public ValidationError validate(final Object object) { // Validate the scheduled payments final Invoice invoice = (Invoice) object; final List<InvoicePayment> payments = invoice.getPayments(); if (CollectionUtils.isEmpty(payments)) { return null; } // Validate the from member Member fromMember = invoice.getFromMember(); if (fromMember == null && LoggedUser.isMember()) { fromMember = LoggedUser.element(); } Calendar maxPaymentDate = null; if (fromMember != null) { fromMember = fetchService.fetch(fromMember, RelationshipHelper.nested(Element.Relationships.GROUP)); final MemberGroup group = fromMember.getMemberGroup(); // Validate the max payments final int maxSchedulingPayments = group.getMemberSettings().getMaxSchedulingPayments(); if (payments.size() > maxSchedulingPayments) { return new ValidationError("errors.greaterEquals", messageResolver.message("transfer.paymentCount"), maxSchedulingPayments); } // Get the maximum payment date final TimePeriod maxSchedulingPeriod = group.getMemberSettings().getMaxSchedulingPeriod(); if (maxSchedulingPeriod != null) { maxPaymentDate = maxSchedulingPeriod.add(DateHelper.truncate(Calendar.getInstance())); } } final BigDecimal invoiceAmount = invoice.getAmount(); final BigDecimal minimumPayment = paymentService.getMinimumPayment(); BigDecimal totalAmount = BigDecimal.ZERO; Calendar lastDate = DateHelper.truncate(Calendar.getInstance()); for (final InvoicePayment payment : payments) { final Calendar date = payment.getDate(); // Validate the max payment date if (maxPaymentDate != null && date.after(maxPaymentDate)) { final LocalSettings localSettings = settingsService.getLocalSettings(); final CalendarConverter dateConverter = localSettings.getRawDateConverter(); return new ValidationError("payment.invalid.schedulingDate", dateConverter.toString(maxPaymentDate)); } final BigDecimal amount = payment.getAmount(); if (amount == null || amount.compareTo(minimumPayment) < 0) { return new RequiredError(messageResolver.message("transfer.amount")); } if (date == null) { return new RequiredError(messageResolver.message("transfer.date")); } else if (date.before(lastDate)) { return new ValidationError("invoice.invalid.paymentDates"); } totalAmount = totalAmount.add(amount); lastDate = date; } if (invoiceAmount != null && totalAmount.compareTo(invoiceAmount) != 0) { return new ValidationError("invoice.invalid.paymentAmount"); } return null; } }); // Custom fields final List<TransferType> possibleTransferTypes = getPossibleTransferTypes(invoice); if (possibleTransferTypes.size() == 1) { validator.chained(new DelegatingValidator(new DelegatingValidator.DelegateSource() { @Override public Validator getValidator() { final TransferType transferType = possibleTransferTypes.iterator().next(); return paymentCustomFieldService.getValueValidator(transferType); } })); } return validator; }
From source file:org.artificer.server.mvn.services.MavenFacadeServlet.java
/** * Generates the maven-metadata.xml file dynamically for a given groupId/artifactId/snapshot-version. * This will list all of the snapshot versions available. * @param gavInfo/* w ww . ja v a 2 s . c o m*/ * @throws Exception */ private String doGenerateSnapshotMavenMetaData(MavenGavInfo gavInfo) throws Exception { PagedResult<ArtifactSummary> artifacts = queryService.query( "/s-ramp[@maven.groupId = '" + gavInfo.getGroupId() + "'" + " and @maven.artifactId = '" + gavInfo.getArtifactId() + "'" + " and @maven.version = '" + gavInfo.getVersion() + "']", "createdTimestamp", true); if (artifacts.getTotalSize() == 0) { return null; } SimpleDateFormat timestampFormat = new SimpleDateFormat("yyyyMMdd.HHmmss"); SimpleDateFormat updatedFormat = new SimpleDateFormat("yyyyMMddHHmmss"); StringBuilder snapshotVersions = new StringBuilder(); snapshotVersions.append(" <snapshotVersions>\n"); Set<String> processed = new HashSet<String>(); Calendar latestDate = null; for (ArtifactSummary artifactSummary : artifacts.getResults()) { BaseArtifactType artifact = artifactService.getMetaData(artifactSummary.getModel(), artifactSummary.getType(), artifactSummary.getUuid()); String extension = ArtificerModelUtils.getCustomProperty(artifact, "maven.type"); String classifier = ArtificerModelUtils.getCustomProperty(artifact, "maven.classifier"); String value = gavInfo.getVersion(); Calendar updatedDate = artifact.getLastModifiedTimestamp().toGregorianCalendar(); String updated = updatedFormat.format(updatedDate.getTime()); String pkey = classifier + "::" + extension; if (processed.add(pkey)) { snapshotVersions.append(" <snapshotVersion>\n"); if (classifier != null) snapshotVersions.append(" <classifier>").append(classifier).append("</classifier>\n"); snapshotVersions.append(" <extension>").append(extension).append("</extension>\n"); snapshotVersions.append(" <value>").append(value).append("</value>\n"); snapshotVersions.append(" <updated>").append(updated).append("</updated>\n"); snapshotVersions.append(" </snapshotVersion>\n"); if (latestDate == null || latestDate.before(updatedDate)) { latestDate = updatedDate; } } } snapshotVersions.append(" </snapshotVersions>\n"); String groupId = gavInfo.getGroupId(); String artifactId = gavInfo.getArtifactId(); String version = gavInfo.getVersion(); String lastUpdated = updatedFormat.format(latestDate.getTime()); StringBuilder mavenMetadata = new StringBuilder(); mavenMetadata.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); mavenMetadata.append("<metadata>\n"); mavenMetadata.append(" <groupId>").append(groupId).append("</groupId>\n"); mavenMetadata.append(" <artifactId>").append(artifactId).append("</artifactId>\n"); mavenMetadata.append(" <version>").append(version).append("</version>\n"); mavenMetadata.append(" <versioning>\n"); mavenMetadata.append(" <snapshot>\n"); mavenMetadata.append(" <timestamp>").append(timestampFormat.format(latestDate.getTime())) .append("</timestamp>\n"); mavenMetadata.append(" <buildNumber>1</buildNumber>\n"); mavenMetadata.append(" </snapshot>\n"); mavenMetadata.append(" <lastUpdated>").append(lastUpdated).append("</lastUpdated>\n"); mavenMetadata.append(snapshotVersions.toString()); mavenMetadata.append(" </versioning>\n"); mavenMetadata.append("</metadata>\n"); if (!gavInfo.isHash()) { return mavenMetadata.toString(); } else { return generateHash(mavenMetadata.toString(), gavInfo.getHashAlgorithm()); } }
From source file:com.square.core.service.implementations.ActionServiceImplementation.java
/** * Mthode prive qui vrifie si les champs obligatoires sont renseigns. * @param actionDto les donnes sources//from www. j a va2 s. c om * @param rapport le rapport remplir au fur et mesure */ private void verificationAction(ActionCreationDto actionDto, RapportDto rapport) { if (actionDto == null) { throw new BusinessException(messageSourceUtil.get(ActionKeyUtil.MESSAGE_ERREUR_ACTION_DTO_NULL)); } final ValidationExpressionProp[] propsAction = new ValidationExpressionProp[] { new ValidationExpressionProp("dateAction", null, messageSourceUtil.get(ActionKeyUtil.MESSAGE_ERREUR_ACTION_DATE_ACTION_NULL)), new ValidationExpressionProp("idPersonne", null, messageSourceUtil.get(ActionKeyUtil.MESSAGE_ERREUR_ACTION_IDPERSONNE_NULL)), new ValidationExpressionProp("idNatureAction", null, messageSourceUtil.get(ActionKeyUtil.MESSAGE_ERREUR_ACTION_NATURE_ACTION_NULL)), new ValidationExpressionProp("idType", null, messageSourceUtil.get(ActionKeyUtil.MESSAGE_ERREUR_ACTION_TYPE_ACTION_NULL)), new ValidationExpressionProp("idObjet", null, messageSourceUtil.get(ActionKeyUtil.MESSAGE_ERREUR_ACTION_OBJET_NULL)), new ValidationExpressionProp("idAgence", null, messageSourceUtil.get(ActionKeyUtil.MESSAGE_ERREUR_ACTION_AGENCE_NULL)) }; validationExpressionUtil.verifierSiVide(rapport, actionDto, propsAction); if (actionDto.getDateAction() != null) { // On vrifie que la date d'action est postrieure la date courante final Calendar dateCourante = DateUtils.truncate(Calendar.getInstance(), Calendar.DAY_OF_MONTH); final Calendar dateAction = DateUtils.truncate((Calendar) actionDto.getDateAction().clone(), Calendar.DAY_OF_MONTH); if (dateAction.before(dateCourante)) { rapport.ajoutRapport(actionDto.getClass().getSimpleName() + ".dateAction", messageSourceUtil.get(ActionKeyUtil.MESSAGE_ERREUR_ACTION_DATE_ACTION_INVALIDE), true); } } // On ne peut rendre visible une action dans l'agenda que si elle a une date de dbut, une dure if (actionDto.getVisibleAgenda() != null && actionDto.getVisibleAgenda().booleanValue() && (actionDto.getDateAction() == null || actionDto.getIdDuree() == null)) { rapport.ajoutRapport(actionDto.getClass().getSimpleName() + ".isVisibleAgenda", messageSourceUtil.get(ActionKeyUtil.MESSAGE_ERREUR_ACTION_IMPOSSIBLE_VISIBLE_AGENDA), true); } }
From source file:org.kuali.kfs.coa.businessobject.PriorYearAccount.java
/** * This method determines whether the account is expired or not. Note that if Expiration Date is the same date as testDate, then * this will return false. It will only return true if the account expiration date is one day earlier than testDate or earlier. * Note that this logic ignores all time components when doing the comparison. It only does the before/after comparison based on * date values, not time-values./* w w w.java 2 s . co m*/ * * @param testDate - Calendar instance with the date to test the Account's Expiration Date against. This is most commonly set to * today's date. * @return true or false based on the logic outlined above */ @Override public boolean isExpired(Calendar testDate) { if (LOG.isDebugEnabled()) { LOG.debug("entering isExpired(" + testDate + ")"); } // dont even bother trying to test if the accountExpirationDate is null if (this.accountExpirationDate == null) { return false; } // remove any time-components from the testDate testDate = DateUtils.truncate(testDate, Calendar.DAY_OF_MONTH); // get a calendar reference to the Account Expiration // date, and remove any time components Calendar acctDate = Calendar.getInstance(); acctDate.setTime(this.accountExpirationDate); acctDate = DateUtils.truncate(acctDate, Calendar.DAY_OF_MONTH); // if the Account Expiration Date is before the testDate if (acctDate.before(testDate)) { return true; } else { return false; } }
From source file:com.ecofactor.qa.automation.newapp.service.MockDataServiceImpl.java
/** * Checks if is sPO block active./*from w w w . ja va 2 s. com*/ * * @param thermostatId * the thermostat id * @param algoId * the algo id * @return true, if is sPO block active * @see com.ecofactor.qa.automation.algorithm.service.DataService#isSPOBlockActive(java.lang.Integer, * int) */ @Override public boolean isSPOBlockActive(Integer thermostatId, int algoId) { log("Check if SPO is active for thermostat :" + thermostatId, true); boolean spoActive = false; Thermostat thermostat = findBythermostatId(thermostatId); Calendar currentTime = (Calendar) Calendar.getInstance(TimeZone.getTimeZone(thermostat.getTimezone())) .clone(); JSONArray jsonArray = getJobData(thermostatId); for (int i = 0; i < jsonArray.length(); i++) { try { JSONObject jsonObj = jsonArray.getJSONObject(i); Calendar startCal = DateUtil.getTimeZoneCalendar((String) jsonObj.get("start"), thermostat.getTimezone()); Calendar endcal = DateUtil.getTimeZoneCalendar((String) jsonObj.get("end"), thermostat.getTimezone()); if (currentTime.after(startCal) && currentTime.before(endcal)) { spoActive = true; break; } } catch (JSONException e) { e.printStackTrace(); } } return spoActive; }
From source file:xyz.lebalex.lockscreen.MainActivity.java
private void startBackgroundService(int interval, int startTime) { try {//from w ww . j a v a2s. co m Intent alarmIntent = new Intent(this, LockScreenServiceReceiver.class); alarmIntent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND); PendingIntent pendingIntent; pendingIntent = PendingIntent.getBroadcast(this, 1001, alarmIntent, PendingIntent.FLAG_CANCEL_CURRENT); AlarmManager manager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); if (interval > 0) { Calendar curentTime = Calendar.getInstance(); Calendar startCalen = Calendar.getInstance(); startCalen.set(Calendar.HOUR_OF_DAY, startTime); startCalen.set(Calendar.MINUTE, 5); startCalen.set(Calendar.SECOND, 0); startCalen.set(Calendar.MILLISECOND, 0); boolean find = false; while (!find) { if (curentTime.before(startCalen)) find = true; else startCalen.add(Calendar.MILLISECOND, interval); } //manager.setRepeating(AlarmManager.RTC_WAKEUP, startCalen.getTimeInMillis(), interval, pendingIntent); manager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, startCalen.getTimeInMillis(), pendingIntent); SharedPreferences.Editor editor = sp.edit(); editor.putBoolean("start_service", true); editor.commit(); LogWrite.Log(this, "start Alarm " + startCalen.get(Calendar.YEAR) + "-" + startCalen.get(Calendar.MONTH) + "-" + startCalen.get(Calendar.DATE) + " " + startCalen.get(Calendar.HOUR_OF_DAY) + ":" + startCalen.get(Calendar.MINUTE) + ":" + startCalen.get(Calendar.SECOND)); } else { LogWrite.Log(this, "stop Alarm"); } } catch (Exception e) { LogWrite.LogError(this, e.getMessage()); } }
From source file:com.baidu.rigel.biplatform.tesseract.meta.impl.TimeDimensionMemberServiceImpl.java
/** * ??// w w w.ja v a2 s .co m * * @param level * @param parentMember * @return */ private List<MiniCubeMember> genMembersWithQuarterParentForAll(Level level, Member parentMember) { List<MiniCubeMember> members = Lists.newArrayList(); Calendar cal = Calendar.getInstance(); // ? cal.set(Calendar.DAY_OF_MONTH, 1); // 1? int nowMonth = cal.get(Calendar.MONTH) + 1; // ? int quarterIndex = nowMonth / 3; // SimpleDateFormat sf = new SimpleDateFormat("yyyyMMdd"); for (int i = 0; i <= quarterIndex; i++) { cal.set(Calendar.MONTH, i * 3);// cal.set(Calendar.DATE, 1); Calendar calEnd = Calendar.getInstance(); calEnd.setTime(cal.getTime()); calEnd.add(Calendar.MONTH, 2); calEnd.add(Calendar.DATE, calEnd.getActualMaximum(Calendar.DATE) - 1); // String day = sf.format(cal.getTime()); String year = day.substring(0, 4); String caption = year + "" + (i + 1) + ""; MiniCubeMember firstDayOfQuarter = new MiniCubeMember(day); firstDayOfQuarter.setCaption(caption); firstDayOfQuarter.setLevel(level); firstDayOfQuarter.setParent(parentMember); firstDayOfQuarter.setName(day); firstDayOfQuarter.setVisible(true); while (cal.before(calEnd) || (cal.compareTo(calEnd) == 0)) { firstDayOfQuarter.getQueryNodes().add(sf.format(cal.getTime())); cal.add(Calendar.DATE, 1); } members.add(firstDayOfQuarter); } return members; }
From source file:ch.dbs.actions.user.UserAction.java
/** * Data privacy: checks if the allowed range is exceeded. <p></p> * /*w ww.j a v a2 s . co m*/ * @param Strinf date_from * @return true/false */ private boolean checkAnonymize(final String date_from, final String timezone) { boolean check = false; if (date_from != null && ReadSystemConfigurations.isAnonymizationActivated()) { final Bestellungen b = new Bestellungen(); final Calendar cal = b.stringFromMysqlToCal(date_from); final Calendar limit = Calendar.getInstance(); limit.setTimeZone(TimeZone.getTimeZone(timezone)); limit.add(Calendar.MONTH, -ReadSystemConfigurations.getAnonymizationAfterMonths()); limit.add(Calendar.DAY_OF_MONTH, -1); if (cal.before(limit)) { check = true; } } return check; }
From source file:com.ecofactor.qa.automation.newapp.service.DataServiceImpl.java
/** * Checks if is sPO block active./*from w ww . ja v a2 s . c o m*/ * * @param thermostatId * the thermostat id * @param algoId * the algo id * @return true, if is sPO block active * @see com.ecofactor.qa.automation.algorithm.service.SPODataService#isSPOBlockActive(java.lang.Integer, * int) */ @Override public boolean isSPOBlockActive(Integer thermostatId, int algoId) { DriverConfig.setLogString("Check SPO is Active Now for Thermostat Id :" + thermostatId, true); boolean isSPOActive = false; Calendar currentTime = DateUtil.getUTCCalendar(); JSONArray jsonArray = getJobData(thermostatId); boolean isDataChanged = false; for (int i = 0; i < jsonArray.length(); i++) { try { JSONObject jsonObj = jsonArray.getJSONObject(i); Calendar startCal = DateUtil.getUTCTimeZoneCalendar((String) jsonObj.get("start")); Calendar endcal = DateUtil.getUTCTimeZoneCalendar((String) jsonObj.get("end")); int endHour = endcal.get(Calendar.HOUR_OF_DAY); int startHour = startCal.get(Calendar.HOUR_OF_DAY); if (isDataChanged) { startCal.set(Calendar.DATE, startCal.get(Calendar.DATE) + 1); endcal.set(Calendar.DATE, endcal.get(Calendar.DATE) + 1); } if (startHour > endHour) { endcal.set(Calendar.DATE, endcal.get(Calendar.DATE) + 1); isDataChanged = true; } DriverConfig.setLogString("startCal :" + DateUtil.format(startCal, DateUtil.DATE_FMT_FULL_TZ), true); DriverConfig.setLogString("endcal :" + DateUtil.format(endcal, DateUtil.DATE_FMT_FULL_TZ), true); if (currentTime.after(startCal) && currentTime.before(endcal)) { isSPOActive = true; break; } } catch (JSONException e) { e.printStackTrace(); } } return isSPOActive; }
From source file:br.gov.jfrj.siga.vraptor.ExDocumentoController.java
@Post("/app/expediente/doc/gravar") public void gravar(final ExDocumentoDTO exDocumentoDTO, final String[] vars, final String[] campos) { final Ex ex = Ex.getInstance(); final ExBL exBL = ex.getBL(); try {// w w w . j a va 2 s . c o m buscarDocumentoOuNovo(true, exDocumentoDTO); if (exDocumentoDTO.getDoc() == null) { exDocumentoDTO.setDoc(new ExDocumento()); } long tempoIni = System.currentTimeMillis(); if (!validar()) { edita(exDocumentoDTO, null, vars, exDocumentoDTO.getMobilPaiSel(), exDocumentoDTO.isCriandoAnexo()); getPar().put("alerta", new String[] { "Sim" }); exDocumentoDTO.setAlerta("Sim"); String url = null; if (exDocumentoDTO.getMobilPaiSel().getSigla() != null) { url = MessageFormat.format("editar?mobilPaiSel.sigla={0}&criandoAnexo={1}", exDocumentoDTO.getMobilPaiSel().getSigla(), exDocumentoDTO.isCriandoAnexo()); } else { url = MessageFormat.format("editar?sigla={0}&criandoAnexo={1}", exDocumentoDTO.getSigla(), exDocumentoDTO.isCriandoAnexo()); } result.redirectTo(url); return; } lerForm(exDocumentoDTO, vars); if (!ex.getConf().podePorConfiguracao(getTitular(), getLotaTitular(), exDocumentoDTO.getDoc().getExTipoDocumento(), exDocumentoDTO.getDoc().getExFormaDocumento(), exDocumentoDTO.getDoc().getExModelo(), exDocumentoDTO.getDoc().getExClassificacaoAtual(), exDocumentoDTO.getDoc().getExNivelAcesso(), CpTipoConfiguracao.TIPO_CONFIG_CRIAR)) { if (!ex.getConf().podePorConfiguracao(getTitular(), getLotaTitular(), null, null, null, exDocumentoDTO.getDoc().getExClassificacao(), null, CpTipoConfiguracao.TIPO_CONFIG_CRIAR)) { throw new AplicacaoException("Usurio no possui permisso de criar documento da classificao " + exDocumentoDTO.getDoc().getExClassificacao().getCodificacao()); } throw new AplicacaoException("Operao no permitida"); } System.out.println("monitorando gravacao IDDoc " + exDocumentoDTO.getDoc().getIdDoc() + ", PESSOA " + exDocumentoDTO.getDoc().getCadastrante().getIdPessoa() + ". Terminou verificacao de config PodeCriarModelo: " + (System.currentTimeMillis() - tempoIni)); tempoIni = System.currentTimeMillis(); exDocumentoDTO.getDoc().setOrgaoUsuario(getLotaTitular().getOrgaoUsuario()); if (exDocumentoDTO.isClassificacaoIntermediaria() && (exDocumentoDTO.getDescrClassifNovo() == null || exDocumentoDTO.getDescrClassifNovo().trim().length() == 0)) { throw new AplicacaoException( "Quando a classificao selecionada no traz informao para criao de vias, o " + "sistema exige que, antes de gravar o documento, seja informada uma sugesto de " + "classificao para ser includa na prxima reviso da tabela de classificaes."); } if (exDocumentoDTO.getDoc().getDescrDocumento().length() > exDocumentoDTO.getTamanhoMaximoDescricao()) { throw new AplicacaoException("O campo descrio possui mais do que " + exDocumentoDTO.getTamanhoMaximoDescricao() + " caracteres."); } if (exDocumentoDTO.getDoc().isFinalizado()) { final Date dt = dao().dt(); final Calendar c = Calendar.getInstance(); c.setTime(dt); final Calendar dtDocCalendar = Calendar.getInstance(); if (exDocumentoDTO.getDoc().getDtDoc() == null) { throw new Exception("A data do documento deve ser informada."); } dtDocCalendar.setTime(exDocumentoDTO.getDoc().getDtDoc()); if (c.before(dtDocCalendar)) { throw new Exception("No permitido criar documento com data futura"); } verificaDocumento(exDocumentoDTO.getDoc()); } ExMobil mobilAutuado = null; if (exDocumentoDTO.getIdMobilAutuado() != null) { mobilAutuado = dao().consultar(exDocumentoDTO.getIdMobilAutuado(), ExMobil.class, false); exDocumentoDTO.getDoc().setExMobilAutuado(mobilAutuado); } final String realPath = getContext().getRealPath(""); exBL.gravar(getCadastrante(), getLotaTitular(), exDocumentoDTO.getDoc(), realPath); lerEntrevista(exDocumentoDTO); if (exDocumentoDTO.getDesativarDocPai().equals("sim")) { exDocumentoDTO.setDesativ("&exDocumentoDTO.desativarDocPai=sim"); } try { exBL.incluirCosignatariosAutomaticamente(getCadastrante(), getLotaTitular(), exDocumentoDTO.getDoc()); } catch (Exception e) { throw new AplicacaoException("Erro ao tentar incluir os cosignatrios deste documento", 0, e); } } catch (final Exception e) { throw new AplicacaoException("Erro na gravao", 0, e); } if (param("ajax") != null && param("ajax").equals("true")) { final String body = MessageFormat.format("OK_{0}_{1}", exDocumentoDTO.getDoc().getSigla(), exDocumentoDTO.getDoc().getDtRegDocDDMMYY()); result.use(Results.http()).body(body); } else { final String url = MessageFormat.format("exibir?sigla={0}{1}", exDocumentoDTO.getDoc().getSigla(), exDocumentoDTO.getDesativ()); result.redirectTo(url); } }