boolean isExpirationLifecycleConfigurationPresent(BucketLifecycleConfiguration lifecycleConfiguration) { return lifecycleConfiguration != null && lifecycleConfiguration.getRules() != null && lifecycleConfiguration.getRules().stream() .filter(r -> r.getExpirationInDays() == getConfiguredExpirationInDays()) .filter(r -> { LifecycleFilterPredicate predicate = r.getFilter().getPredicate(); if (predicate instanceof LifecycleTagPredicate) { LifecycleTagPredicate tagPredicate = (LifecycleTagPredicate) predicate; return DELETED_TAG.equals(tagPredicate.getTag()); } return false; }) .findAny().isPresent(); }
@Override public void visit(LifecycleAndOperator lifecycleAndOperator) { xml.start("And"); for (LifecycleFilterPredicate predicate : lifecycleAndOperator.getOperands()) { predicate.accept(this); } xml.end(); // </And> }
@Override protected void doStartElement( String uri, String name, String qName, Attributes attrs) { if (in("LifecycleConfiguration")) { if (name.equals("Rule")) { currentRule = new Rule(); } } else if (in("LifecycleConfiguration", "Rule")) { if (name.equals("Transition")) { currentTransition = new Transition(); } else if (name.equals("NoncurrentVersionTransition")) { currentNcvTransition = new NoncurrentVersionTransition(); } else if (name.equals("AbortIncompleteMultipartUpload")) { abortIncompleteMultipartUpload = new AbortIncompleteMultipartUpload(); } else if (name.equals("Filter")) { currentFilter = new LifecycleFilter(); } } else if (in("LifecycleConfiguration", "Rule", "Filter")) { if (name.equals("And")) { andOperandsList = new ArrayList<LifecycleFilterPredicate>(); } } }
boolean isExpirationLifecycleConfigurationPresent(BucketLifecycleConfiguration lifecycleConfiguration) { return lifecycleConfiguration != null && lifecycleConfiguration.getRules() != null && lifecycleConfiguration.getRules().stream() .filter(r -> r.getExpirationInDays() == getConfiguredExpirationInDays()) .anyMatch(r -> { LifecycleFilterPredicate predicate = r.getFilter().getPredicate(); if (predicate instanceof LifecycleTagPredicate) { LifecycleTagPredicate tagPredicate = (LifecycleTagPredicate) predicate; return DELETED_TAG.equals(tagPredicate.getTag()); } return false; }); }
private void writeLifecycleFilterPredicate(XmlWriter xml, LifecycleFilterPredicate predicate) { if (predicate == null) { return; } predicate.accept(new LifecyclePredicateVisitorImpl(xml)); }