/** * This method returns the timestamp type of the given timestamp * * @param timestampId * the timestamp id * @return the related timestamp type */ public String getTimestampType(String timestampId) { TimestampWrapper timestamp = getTimestampByIdNullSafe(timestampId); return timestamp.getType(); }
public List<TimestampWrapper> getTimestampListByType(final TimestampType timestampType) { List<TimestampWrapper> result = new ArrayList<TimestampWrapper>(); List<TimestampWrapper> all = getTimestampList(); for (TimestampWrapper tsp : all) { if (timestampType.name().equals(tsp.getType())) { result.add(tsp); } } return result; }
@Override protected boolean process() { List<TimestampWrapper> timestampsBySignature = diagnosticData.getTimestampList(signature.getId()); for (TimestampWrapper timestampWrapper : timestampsBySignature) { if (TimestampType.CONTENT_TIMESTAMP.name().equals(timestampWrapper.getType()) || TimestampType.ALL_DATA_OBJECTS_TIMESTAMP.name().equals(timestampWrapper.getType()) || TimestampType.INDIVIDUAL_DATA_OBJECTS_TIMESTAMP.name().equals(timestampWrapper.getType())) { return true; } } return false; }
private Date getEarliestTimestampProductionTime(List<TimestampWrapper> timestamps, TimestampType... selectedTimestampTypes) { Date earliestProductionTime = null; for (TimestampWrapper timestamp : timestamps) { if (isInSelectedTypes(selectedTimestampTypes, timestamp.getType())) { Date productionTime = timestamp.getProductionTime(); if ((earliestProductionTime == null) || earliestProductionTime.after(productionTime)) { earliestProductionTime = productionTime; } } } return earliestProductionTime; }
private Date getLatestTimestampProductionDate(List<TimestampWrapper> timestamps, TimestampType... selectedTimestampTypes) { Date latestProductionTime = null; for (TimestampWrapper timestamp : timestamps) { if (isInSelectedTypes(selectedTimestampTypes, timestamp.getType())) { Date productionTime = timestamp.getProductionTime(); if ((latestProductionTime == null) || latestProductionTime.before(productionTime)) { latestProductionTime = productionTime; } } } return latestProductionTime; }
private Set<TimestampWrapper> filterValidSignatureTimestamps(List<TimestampWrapper> allTimestamps) { Set<TimestampWrapper> result = new HashSet<TimestampWrapper>(); for (TimestampWrapper timestampWrapper : allTimestamps) { if (!TimestampType.SIGNATURE_TIMESTAMP.name().equals(timestampWrapper.getType())) { break; } boolean foundValidationTSP = false; for (XmlValidationProcessTimestamps timestampValidation : timestampValidations) { List<XmlConstraint> constraints = timestampValidation.getConstraint(); for (XmlConstraint tspValidation : constraints) { if (Utils.areStringsEqual(timestampWrapper.getId(), tspValidation.getId())) { foundValidationTSP = true; // PVA : if OK message imprint is validated in SVA of timestamp (depending of constraint.xml) if (XmlStatus.OK.equals(tspValidation.getStatus())) { result.add(timestampWrapper); break; } } } } if (!foundValidationTSP) { LOG.warn("Cannot find tsp validation info for tsp {}", timestampWrapper.getId()); } } return result; }
@Override protected void addAdditionalInfo() { result.setId(timestamp.getId()); result.setType(timestamp.getType()); result.setProductionTime(timestamp.getProductionTime()); }