List of usage examples for java.util Date equals
public boolean equals(Object obj)
From source file:net.sourceforge.subsonic.service.MediaScannerService.java
private void updateArtist(MediaFile file, Date lastScanned, Map<String, Integer> albumCount) { if (file.getArtist() == null || !file.isAudio()) { return;/* w w w .j av a 2s. com*/ } Artist artist = artistDao.getArtist(file.getArtist()); if (artist == null) { artist = new Artist(); artist.setName(file.getArtist()); } if (artist.getCoverArtPath() == null) { MediaFile parent = mediaFileService.getParentOf(file); if (parent != null) { artist.setCoverArtPath(parent.getCoverArtPath()); } } boolean firstEncounter = !lastScanned.equals(artist.getLastScanned()); Integer n = albumCount.get(artist.getName()); artist.setAlbumCount(n == null ? 0 : n); artist.setLastScanned(lastScanned); artist.setPresent(true); artistDao.createOrUpdateArtist(artist); if (firstEncounter) { searchService.index(artist); } }
From source file:st.jigasoft.dbutil.view.DUReport.java
private boolean hasAltered(Date oldDate, Date newDate) { return oldDate == null && newDate != null || oldDate != null && newDate == null || (oldDate != null && newDate != null && !oldDate.equals(newDate)); }
From source file:com.virtusa.akura.reporting.controller.GenerateTeacherEarlyLateAttendiesReportController.java
/** * Perform the logic of the controller to generate Teacher Wise Attendance Report . * * @param attendeesWrapperTemplate of type AttendeesWrapperTemplate * @param request of type HttpServletRequest * @param response of type HttpServletResponse * @param errors of type BindingResult/*from w ww. j a v a 2s . c o m*/ * @return java.lang.String * @param map of type ModelMap * @throws AkuraAppException AkuraAppException */ @SuppressWarnings("unchecked") @RequestMapping(value = REQUEST_PARA_TEACHER_LATE, method = RequestMethod.POST) public String onSubmit(HttpServletRequest request, HttpServletResponse response, @ModelAttribute(MODEL_ATT_ATTENDANCE_WRAPPER_TEMPLATE) AttendeesWrapperTemplate attendeesWrapperTemplate, BindingResult errors, ModelMap map) throws AkuraAppException { String returnString = STRING_EMPTY; lateComersValidator.validate(attendeesWrapperTemplate, errors); if (errors.hasErrors()) { return VIEW_PAGE; } Map<String, Object> params = new HashMap<String, Object>(); params.put(REPORT_PARA_TITLE, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_VALUE_TEACHER_LATE_ATTEND_REPORT)); params.put(REPORT_PARA_TEACHERID, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_VALUE_TEACHER_ID)); params.put(REPORT_PARA_TEACHERNAME, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_VALUE_TEACHER_NAME)); params.put(REPORT_PARA_DATE, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_VALUE_DATE_CONSIDERED)); params.put(REPORT_PARA_TIMEIN, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_VALUE_TIME_IN)); params.put(REPORT_PARA_TIMEOUT, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_VALUE_TIME_OUT)); params.put(REPORT_PARA_DATEFROM, attendeesWrapperTemplate.getTeacherLateAttendiesTemplate().getDateFrom()); params.put(REPORT_PARA_DATETO, attendeesWrapperTemplate.getTeacherLateAttendiesTemplate().getDateTo()); params.put(REPORT_PARA_TIMEINFROM, attendeesWrapperTemplate.getTeacherLateAttendiesTemplate().getTimeInFrom() + VARIABLE_HOURS_HR); params.put(REPORT_PARA_TIMEINTO, attendeesWrapperTemplate.getTeacherLateAttendiesTemplate().getTimeInTo() + VARIABLE_HOURS_HR); params.put(REPORT_PARA_LOGO_PATH, ReportUtil.getReportLogo()); params.put(STYLE_TEMPLATE, PropertyReader.getPropertyValue(SYSTEM_CONFIG, APPSERVER_HOME) + PropertyReader.getPropertyValue(SYSTEM_CONFIG, STYLE_PATH)); params.put(DATE_FROM, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, STAFF_WISE_ATTENDEES_DATE_FROM)); params.put(DATE_TO, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, STAFF_WISE_ATTENDEES_DATE_TO)); params.put(TIME_IN_FROM, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, STAFF_WISE_ATTENDEES_TIME_IN_FROM)); params.put(TIME_IN_TO, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, STAFF_WISE_ATTENDEES_TIME_IN_TO)); params.put(REPORT_GENERATED_ON, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_GENERATED_ON_TEXT)); params.put(REPORT_KEY_DATE_TYPE, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_DATE_TYPE_ON_TEXT)); params.put(GENERATED_DATE, DateUtil.getReportGeneratedDate( PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_GENERATED_DATE_LOCALE))); params.put(PAGE, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_PAGE)); params.put(GPL, AkuraWebConstant.REPORT_GPL); JRBeanCollectionDataSource jrBeanDataSource = attendanceReportingService .getTeacherLateAttendies(attendeesWrapperTemplate.getTeacherLateAttendiesTemplate()); List<TeacherAttendance> objList = null; if (jrBeanDataSource.getRecordCount() != 0) { objList = (List<TeacherAttendance>) jrBeanDataSource.getData(); } Date fromDate = DateUtil .getParseDate(attendeesWrapperTemplate.getTeacherLateAttendiesTemplate().getDateFrom()); Date toDate = DateUtil.getParseDate(attendeesWrapperTemplate.getTeacherLateAttendiesTemplate().getDateTo()); if (objList != null) { for (TeacherAttendance obj : objList) { int staffId = obj.getStaffId(); Date attDate = DateUtil.getParseDate(obj.getDate()); List<StaffLeave> staffLeaveList = staffService.getStaffLeaveListByDatePeriodAndStaffId(fromDate, toDate, staffId); if (!staffLeaveList.isEmpty()) { for (StaffLeave sl : staffLeaveList) { Date getFromDate = DateUtil.getParseDate(sl.getFromDate().toString()); Date getToDate = DateUtil.getParseDate(sl.getToDate().toString()); if ((sl.getStaffLeaveStatusId() == 1) && (getFromDate.before(attDate) && getToDate.after(attDate))) { setDayType(obj, sl); } else if ((sl.getStaffLeaveStatusId() == 1) && (getFromDate.equals(attDate) || getToDate.equals(attDate))) { setDayType(obj, sl); } } } } } if (jrBeanDataSource.getRecordCount() != 0) { displayReportForm(response, jrBeanDataSource, params, REPORT_NAME); } else { returnString = VIEW_PAGE; setErrorMessage(map); } return returnString; }
From source file:controller.CommercialController.java
@RequestMapping(value = "regub/commercial/contrats/annulercontratcom", method = RequestMethod.POST) public String annulercontratAction(HttpServletRequest request, HttpSession session, Model model) throws ParseException { //ClientConnecte cli = new ClientConnecte((Client) session.getAttribute("UserConnected")); //session.removeAttribute("UserConnected"); int idContrat = Integer.parseInt(request.getParameter("idvideo")); DateFormat dateformat = new SimpleDateFormat("dd-MM-yyyy"); Video vid = VidBDD.modifcontrat(idContrat); String datedebut = ConvertToDate(vid.getDateDebut()); Date ddebut = dateformat.parse(datedebut); //System.out.println(""+datedebut); //System.out.println("Con De type Date:"+ddebut); Date currentDate = new Date(); String datecourante = dateformat.format(currentDate); Date dcourante = dateformat.parse(datecourante); //System.out.println(""+datecourante); //System.out.println("Cu De type Date:"+dcourante); //Raccourci la date de validation du contrat la date courante if (dcourante.after(ddebut) || dcourante.equals(ddebut)) { //System.out.println("Date courant sup ou egale celle du cntrat"); vid.setDateFin(ConvertToSqlDate(datecourante)); VidBDD.updComContrat(vid, "annuler"); } else {/*from w ww . j a va 2 s .c o m*/ //supprime le contrat si il n'est pas commenc //System.out.println("Date courant inf celle du cntrat"); VidBDD.deleteComContrat(idContrat); } //return listClientAction(request, session, model); //return "redirect:/regub/commercial"; return "redirect:/regub/commercial/contrats/" + vid.getClient().getIdClient(); }
From source file:org.nuxeo.ecm.platform.auth.saml.AbstractSAMLProfile.java
protected void validateAssertion(Assertion assertion, SAMLMessageContext context) throws SAMLException, org.opensaml.xml.security.SecurityException, ValidationException, DecryptionException { validateIssuer(assertion.getIssuer(), context); Conditions conditions = assertion.getConditions(); // validate conditions timestamps: notBefore, notOnOrAfter Date now = new DateTime().toDate(); Date condition_notBefore = null; Date condition_NotOnOrAfter = null; if (conditions.getNotBefore() != null) { condition_notBefore = conditions.getNotBefore().toDate(); }/*from w ww . ja va 2 s.com*/ if (conditions.getNotOnOrAfter() != null) { condition_NotOnOrAfter = conditions.getNotOnOrAfter().toDate(); } if (condition_notBefore != null && now.before(condition_notBefore)) { log.debug("Current time: [" + now + "] NotBefore: [" + condition_notBefore + "]"); throw new SAMLException("Conditions are not yet active"); } else if (condition_NotOnOrAfter != null && (now.after(condition_NotOnOrAfter) || now.equals(condition_NotOnOrAfter))) { log.debug("Current time: [" + now + "] NotOnOrAfter: [" + condition_NotOnOrAfter + "]"); throw new SAMLException("Conditions have expired"); } Signature signature = assertion.getSignature(); if (signature != null) { validateSignature(signature, context.getPeerEntityMetadata().getEntityID()); } // TODO(nfgs) : Check subject }
From source file:io.jsonwebtoken.impl.DefaultJwtParser.java
@Override public Jwt parse(String jwt) throws ExpiredJwtException, MalformedJwtException, SignatureException { Assert.hasText(jwt, "JWT String argument cannot be null or empty."); String base64UrlEncodedHeader = null; String base64UrlEncodedPayload = null; String base64UrlEncodedDigest = null; int delimiterCount = 0; StringBuilder sb = new StringBuilder(128); for (char c : jwt.toCharArray()) { if (c == SEPARATOR_CHAR) { String token = Strings.clean(sb.toString()); if (delimiterCount == 0) { base64UrlEncodedHeader = token; } else if (delimiterCount == 1) { base64UrlEncodedPayload = token; }// w w w .j a va2s . co m delimiterCount++; sb = new StringBuilder(128); } else { sb.append(c); } } if (delimiterCount != 2) { String msg = "JWT strings must contain exactly 2 period characters. Found: " + delimiterCount; throw new MalformedJwtException(msg); } if (sb.length() > 0) { base64UrlEncodedDigest = sb.toString(); } if (base64UrlEncodedPayload == null) { throw new MalformedJwtException("JWT string '" + jwt + "' is missing a body/payload."); } // =============== Header ================= Header header = null; CompressionCodec compressionCodec = null; if (base64UrlEncodedHeader != null) { String origValue = TextCodec.BASE64URL.decodeToString(base64UrlEncodedHeader); Map<String, Object> m = readValue(origValue); if (base64UrlEncodedDigest != null) { header = new DefaultJwsHeader(m); } else { header = new DefaultHeader(m); } compressionCodec = compressionCodecResolver.resolveCompressionCodec(header); } // =============== Body ================= String payload; if (compressionCodec != null) { byte[] decompressed = compressionCodec.decompress(TextCodec.BASE64URL.decode(base64UrlEncodedPayload)); payload = new String(decompressed, Strings.UTF_8); } else { payload = TextCodec.BASE64URL.decodeToString(base64UrlEncodedPayload); } Claims claims = null; if (payload.charAt(0) == '{' && payload.charAt(payload.length() - 1) == '}') { //likely to be json, parse it: Map<String, Object> claimsMap = readValue(payload); claims = new DefaultClaims(claimsMap); } // =============== Signature ================= if (base64UrlEncodedDigest != null) { //it is signed - validate the signature JwsHeader jwsHeader = (JwsHeader) header; SignatureAlgorithm algorithm = null; if (header != null) { String alg = jwsHeader.getAlgorithm(); if (Strings.hasText(alg)) { algorithm = SignatureAlgorithm.forName(alg); } } if (algorithm == null || algorithm == SignatureAlgorithm.NONE) { //it is plaintext, but it has a signature. This is invalid: String msg = "JWT string has a digest/signature, but the header does not reference a valid signature " + "algorithm."; throw new MalformedJwtException(msg); } if (key != null && keyBytes != null) { throw new IllegalStateException( "A key object and key bytes cannot both be specified. Choose either."); } else if ((key != null || keyBytes != null) && signingKeyResolver != null) { String object = key != null ? "a key object" : "key bytes"; throw new IllegalStateException( "A signing key resolver and " + object + " cannot both be specified. Choose either."); } //digitally signed, let's assert the signature: Key key = this.key; if (key == null) { //fall back to keyBytes byte[] keyBytes = this.keyBytes; if (Objects.isEmpty(keyBytes) && signingKeyResolver != null) { //use the signingKeyResolver if (claims != null) { key = signingKeyResolver.resolveSigningKey(jwsHeader, claims); } else { key = signingKeyResolver.resolveSigningKey(jwsHeader, payload); } } if (!Objects.isEmpty(keyBytes)) { Assert.isTrue(!algorithm.isRsa(), "Key bytes cannot be specified for RSA signatures. Please specify a PublicKey or PrivateKey instance."); key = new SecretKeySpec(keyBytes, algorithm.getJcaName()); } } Assert.notNull(key, "A signing key must be specified if the specified JWT is digitally signed."); //re-create the jwt part without the signature. This is what needs to be signed for verification: String jwtWithoutSignature = base64UrlEncodedHeader + SEPARATOR_CHAR + base64UrlEncodedPayload; JwtSignatureValidator validator; try { validator = createSignatureValidator(algorithm, key); } catch (IllegalArgumentException e) { String algName = algorithm.getValue(); String msg = "The parsed JWT indicates it was signed with the " + algName + " signature " + "algorithm, but the specified signing key of type " + key.getClass().getName() + " may not be used to validate " + algName + " signatures. Because the specified " + "signing key reflects a specific and expected algorithm, and the JWT does not reflect " + "this algorithm, it is likely that the JWT was not expected and therefore should not be " + "trusted. Another possibility is that the parser was configured with the incorrect " + "signing key, but this cannot be assumed for security reasons."; throw new UnsupportedJwtException(msg, e); } if (!validator.isValid(jwtWithoutSignature, base64UrlEncodedDigest)) { String msg = "JWT signature does not match locally computed signature. JWT validity cannot be " + "asserted and should not be trusted."; throw new SignatureException(msg); } } //since 0.3: if (claims != null) { SimpleDateFormat sdf; final Date now = this.clock.now(); //https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-30#section-4.1.4 //token MUST NOT be accepted on or after any specified exp time: Date exp = claims.getExpiration(); if (exp != null) { if (now.equals(exp) || now.after(exp)) { sdf = new SimpleDateFormat(ISO_8601_FORMAT); String expVal = sdf.format(exp); String nowVal = sdf.format(now); String msg = "JWT expired at " + expVal + ". Current time: " + nowVal; throw new ExpiredJwtException(header, claims, msg); } } //https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-30#section-4.1.5 //token MUST NOT be accepted before any specified nbf time: Date nbf = claims.getNotBefore(); if (nbf != null) { if (now.before(nbf)) { sdf = new SimpleDateFormat(ISO_8601_FORMAT); String nbfVal = sdf.format(nbf); String nowVal = sdf.format(now); String msg = "JWT must not be accepted before " + nbfVal + ". Current time: " + nowVal; throw new PrematureJwtException(header, claims, msg); } } validateExpectedClaims(header, claims); } Object body = claims != null ? claims : payload; if (base64UrlEncodedDigest != null) { return new DefaultJws<Object>((JwsHeader) header, body, base64UrlEncodedDigest); } else { return new DefaultJwt<Object>(header, body); } }
From source file:org.richfaces.component.UICalendar.java
public void broadcast(FacesEvent event) throws AbortProcessingException { // TODO Auto-generated method stub if (event instanceof AjaxEvent) { FacesContext facesContext = FacesContext.getCurrentInstance(); AjaxContext ajaxContext = AjaxContext.getCurrentInstance(facesContext); ajaxContext.addRegionsFromComponent(this); if (getPreload() != null) { ajaxContext.setResponseData(getPreload()); }/*w w w . j a v a 2 s. c o m*/ } else { if (event instanceof CurrentDateChangeEvent) { FacesContext facesContext = getFacesContext(); CurrentDateChangeEvent dateChangeEvent = (CurrentDateChangeEvent) event; String currentDateString = dateChangeEvent.getCurrentDateString(); // if currentDateString is not null then event cames from // apply request phase try { // XXX nick - kaa - we should use datePattern // attribute-based converter only for selectedDate // current date string always has predefined format: m/y // review // org.richfaces.renderkit.CalendarRendererBase.convertCurrentDate(String) // method // for more // XX nick - kaa - throw exception and review resulting // message :) Date currentDate = getAsDate(getCurrentDate()); Date submittedCurrentDate = convertCurrentDate(currentDateString); dateChangeEvent.setCurrentDate(submittedCurrentDate); if (!submittedCurrentDate.equals(currentDate)) { updateCurrentDate(facesContext, submittedCurrentDate); MethodExpression methodExpression = getCurrentDateChangeListener(); if (methodExpression != null) { methodExpression.invoke(facesContext.getELContext(), new Object[] { dateChangeEvent }); } } } catch (Exception e) { // XXX nick - kaa - add log.debug(...) // XXX nick - kaa - we should stop processing on exc. // setValid(false) and then call // FacesContext.renderResponse(...) // update model phase shouldn't start if (log.isDebugEnabled()) { log.debug(" currentDate convertion fails with following exception: " + e.toString(), e); } setValid(false); String messageString = e.toString(); e.printStackTrace(); FacesMessage message = new FacesMessage(messageString); message.setSeverity(FacesMessage.SEVERITY_ERROR); facesContext.addMessage(getClientId(facesContext), message); facesContext.renderResponse(); } } else { super.broadcast(event); } } }
From source file:com.emc.ecs.sync.target.EcsS3Target.java
@Override public void filter(SyncObject obj) { try {/*from ww w . j a v a 2s. co m*/ // skip the root of the bucket since it obviously exists if ("".equals(rootKey + obj.getRelativePath())) { log.debug("Target is bucket root; skipping"); return; } // some sync objects lazy-load their metadata (i.e. AtmosSyncObject) // since this may be a timed operation, ensure it loads outside of other timed operations if (!(obj instanceof EcsS3ObjectVersion) || !((EcsS3ObjectVersion) obj).isDeleteMarker()) obj.getMetadata(); // Compute target key final String targetKey = getTargetKey(obj); obj.setTargetIdentifier(AwsS3Util.fullPath(bucketName, targetKey)); if (includeVersions) { ListIterator<EcsS3ObjectVersion> sourceVersions = s3Source.versionIterator((EcsS3SyncObject) obj); ListIterator<EcsS3ObjectVersion> targetVersions = versionIterator(obj); boolean newVersions = false, replaceVersions = false; if (force) { replaceVersions = true; } else { // special workaround for bug where objects are listed, but they have no versions if (sourceVersions.hasNext()) { // check count and etag/delete-marker to compare version chain while (sourceVersions.hasNext()) { EcsS3ObjectVersion sourceVersion = sourceVersions.next(); if (targetVersions.hasNext()) { EcsS3ObjectVersion targetVersion = targetVersions.next(); if (sourceVersion.isDeleteMarker()) { if (!targetVersion.isDeleteMarker()) replaceVersions = true; } else { if (targetVersion.isDeleteMarker()) replaceVersions = true; else if (!sourceVersion.getETag().equals(targetVersion.getETag())) replaceVersions = true; // different checksum } } else if (!replaceVersions) { // source has new versions, but existing target versions are ok newVersions = true; sourceVersions.previous(); // back up one putIntermediateVersions(sourceVersions, targetKey); // add any new intermediary versions (current is added below) } } if (targetVersions.hasNext()) replaceVersions = true; // target has more versions if (!newVersions && !replaceVersions) { log.info("Source and target versions are the same. Skipping {}", obj.getRelativePath()); return; } } } // something's off; must delete all versions of the object if (replaceVersions) { log.info( "[{}]: version history differs between source and target; re-placing target version history with that from source.", obj.getRelativePath()); // collect versions in target final List<ObjectKey> deleteVersions = new ArrayList<>(); while (targetVersions.hasNext()) targetVersions.next(); // move cursor to end while (targetVersions.hasPrevious()) { // go in reverse order EcsS3ObjectVersion version = targetVersions.previous(); deleteVersions.add(new ObjectKey(targetKey, version.getVersionId())); } // batch delete all versions in target log.debug("[{}]: deleting all versions in target", obj.getRelativePath()); time(new Function<Void>() { @Override public Void call() { s3.deleteObjects(new DeleteObjectsRequest(bucketName).withKeys(deleteVersions)); return null; } }, OPERATION_DELETE_VERSIONS); // replay version history in target while (sourceVersions.hasPrevious()) sourceVersions.previous(); // move cursor to beginning putIntermediateVersions(sourceVersions, targetKey); } } else { // normal sync (no versions) Date sourceLastModified = obj.getMetadata().getModificationTime(); long sourceSize = obj.getMetadata().getContentLength(); // Get target metadata. S3ObjectMetadata destMeta = null; try { destMeta = time(new Function<S3ObjectMetadata>() { @Override public S3ObjectMetadata call() { return s3.getObjectMetadata(bucketName, targetKey); } }, OPERATION_GET_METADATA); } catch (S3Exception e) { if (e.getHttpCode() != 404) { throw new RuntimeException("Failed to check target key '" + targetKey + "' : " + e, e); } } if (!force && obj.getFailureCount() == 0 && destMeta != null) { // Check overwrite Date destLastModified = destMeta.getLastModified(); long destSize = destMeta.getContentLength(); if (destLastModified.equals(sourceLastModified) && sourceSize == destSize) { log.info("Source and target the same. Skipping {}", obj.getRelativePath()); return; } if (destLastModified.after(sourceLastModified)) { log.info("Target newer than source. Skipping {}", obj.getRelativePath()); return; } } } // at this point we know we are going to write the object // Put [current object version] if (obj instanceof S3ObjectVersion && ((S3ObjectVersion) obj).isDeleteMarker()) { // object has version history, but is currently deleted log.debug("[{}]: deleting object in target to replicate delete marker in source.", obj.getRelativePath()); time(new Function<Void>() { @Override public Void call() { s3.deleteObject(bucketName, targetKey); return null; } }, OPERATION_DELETE_OBJECT); } else { putObject(obj, targetKey); // if object has new metadata after the stream (i.e. encryption checksum), we must update S3 again if (obj.requiresPostStreamMetadataUpdate()) { log.debug("[{}]: updating metadata after sync as required", obj.getRelativePath()); final CopyObjectRequest cReq = new CopyObjectRequest(bucketName, targetKey, bucketName, targetKey); cReq.setObjectMetadata(EcsS3Util.s3MetaFromSyncMeta(obj.getMetadata())); time(new Function<Void>() { @Override public Void call() { s3.copyObject(cReq); return null; } }, OPERATION_UPDATE_METADATA); } } } catch (Exception e) { throw new RuntimeException("Failed to store object: " + e, e); } }
From source file:dao.ExportacaoParaExcel.java
private void BuscaContas(Date dataInicial, Date dataFinal) { List<FlxcxEspecificacoes> especificacoes = BuscarEspecificoes(); boolean carregar = false; for (FlxcxEspecificacoes especificacao : especificacoes) { this.valor = new Excel(); this.valor.setEspecificacao(especificacao); List<FlxcxOperacoes> operacoes = BuscarOperacoes(especificacao.getEspCodigo()); for (FlxcxOperacoes operacao : operacoes) { Operacao op = new Operacao(); op.setOperacoes(operacao);/*from w w w .j a v a2s .c o m*/ boolean mostrar = true; boolean primeiroRegistro = true; List<CarCapContas> contas = BuscaContas(operacao.getOpCodigo(), dataInicial, dataFinal); Contas cont = new Contas(); Calendar c = Calendar.getInstance(); c.set(1, 1, 1800); Date dataAnterior = c.getTime(); for (CarCapContas conta : contas) { if (!conta.getContaDataEmissao().equals(dataAnterior)) { if (!dataAnterior.equals(c.getTime())) { cont.setDataColuna(dataAnterior); op.getContas().add(cont); cont = new Contas(); } dataAnterior = conta.getContaDataEmissao(); } if (conta.getContaTipo() == TipoConta.Entrada) { cont.getValoresEntrada().add(conta); } else { cont.getValoresSaida().add(conta); } } if (!dataAnterior.equals(c.getTime())) { cont.setDataColuna(dataAnterior); op.getContas().add(cont); cont = new Contas(); this.valor.getOperacao().add(op); carregar = true; } } if (carregar) { this.colunas.add(this.valor); } } }
From source file:org.sakaiproject.signup.tool.jsf.organizer.action.EditMeeting.java
private boolean checkAttachmentsChanges(SignupMeeting latestOne) { //TODO excluding attendee's attachment??? List<SignupAttachment> latestList = getEventMainAttachments(latestOne.getSignupAttachments()); List<SignupAttachment> orignalAttachList = getEventMainAttachments( this.originalMeetingCopy.getSignupAttachments()); if (latestList.isEmpty() != orignalAttachList.isEmpty()) { return true; }//ww w . j av a2s. c om if (latestList.size() != orignalAttachList.size()) { return true; } for (int i = 0; i < latestList.size(); i++) { Date latest = latestList.get(i).getLastModifiedDate(); Date orignal = orignalAttachList.get(i).getLastModifiedDate(); if (!latest.equals(orignal)) return true; } return false; }