How to set duplicates at EList - eclipse

I have been trying to set duplicates,Strings,at EList.
The issue that the following method bans to add duplicates:
elist.set(index, value);
I have been searching on a way that fixes that and I have found that I need to disable Uniqueness but this would may affect the rest of framework.
Any ideas would be appreciated.
Thanks.

Disable the uniqueness setting has been how I have handled this. What are the effects to the rest of the framework?

Related

How to ignore NDepend issue?

What is the recommended approach to ignore a NDepend issue or rule violation? Modify the query in the NDepend config file, or is there a better approach?
Just wondering that starting to add ORs in the CQLinq query isn't maybe the nicest thing to do?
In 2018 we plan to support SuppressWarning attribute.
For now you can either modify the rule as you wrote, or also use the JustMyCode/notmycode approach to avoid issues on particular code elements.

Getting Spring Data MongoDB to recreate indexes

I'd like to be able to purge the database of all data between Integration test executions. My first thought was to use an org.springframework.test.context.support.AbstractTestExecutionListener
registered using the #TestExecutionListeners annotation to perform the necessary cleanup between tests.
In the afterTestMethod(TestContext testContext) method I tried getting the database from the test context and using the com.mongodb.DB.drop() method. This worked ok, apart from the fact that it also destroys the indexes that were automatically created by Spring Data when it first bound my managed #Document objects.
For now I have fixed this by resorting to iterating through the collection names and calling remove as follows:
for (String collectionName : database.getCollectionNames()) {
if (collectionIsNotASystemCollection(collectionName)
database.getCollection(collectionName).remove(new BasicDBObject());
}
This works and achieves the desired result - but it'd be nice if there was a way I could simply drop the database and just ask Spring Data to "rebind" and perform the same initialisation that it did when it started up to create all of the necessary indexes. That feels a bit cleaner and safer...
I tried playing around with the org.springframework.data.mongodb.core.mapping.MongoMappingContext but haven't yet managed to work out if there is a way to do what I want.
Can anyone offer any guidance?
See this ticket for an explanation why it currently works as it works and why working around this issue creates more problems than it solves.
Supposed you're working with Hibernate and then trigger a call to delete the database, would you even dream to assume that the tables and all indexes reappear magically? If you drop a MongoDB database/collection you remove all metadata associated with it. Thus, you need to set it up the way you'd like it to work.
P.S.: I am not sure we did ourselves a favor to add automatic indexing support as this of course triggers the expectations that you now have :). Feel free to comment on the ticket if you have suggestions how this could be achieved without the downsides I outlined in my initial comment.

Using RegeX in Adobe CQ query builder

Is there any way to use Regular expressions in Query builder.
Is JCR supports this?
Any pointers on this would be helpful for us.
Thanks in advance.
San
If this QueryBuilder API documentation where to believed as being definitive, then no I would not say there is regex support. However there does seem to be some wildcard support that may be useful. What I would do in this case is try to craft a query around all the properties that you know of about your nodes that can identify them. For example using the debug tool at http://x.x.x.x:4502/libs/cq/search/content/querydebug.html a query like may give you some ideas
type=cq:Page
path=/content/myapp
nodename=*s
1_relativedaterange.property=jcr:content/cq:lastModified
1_relativedaterange.lowerBound=-48h
Where I'm looking for pages in my app content, that end is 's', that have been modified in the last 48 hours. You can even filter by resourceType, template, and any other property that can help you find those nodes. You may even consider adding your own just for this query.
Maybe you can have a sling job, where in Java you could iterate the node names (or whatever) and you do have regex, and tag nodes with a meaningful property that you can then use to query using the query builder.

sapui5 binding callbacks, update vs. insert vs. add

Looking through sap.ui.base.ManagedObject has helped make the data binding in sapui5 more clear, but it's still not quite tangible yet.
A fundamental question that isn't clear to me is which callbacks get fired on a control when it's model is updated.
For example, if a control had an aggregation called items, in which situations does "updateItems" get fired? And which situations does "addItem" get fired? Also, "insertItem"?
I see that addAggregation and insertAggregation have a parameter to suppress invalidation. But I don't see that option for updateAggregation. Is there a reason for that?
Does the "bindable" metadata property alter this behavior at all?
Thanks for any insight!

Guava BloomFilter how to expire once a day

I am using guava bloom filter to remove duplicate message in the service for receiving log.
Is there a way for bloom filter to expire like guava cache does?
No, a BloomFilter does not have any remove functionality. This is also impossible, since a BloomFilter keeps track of what may possibly be in a set of objects.
Removing an entry from a BloomFilter for one entry would result into false negatives for other entries. A BloomFilter must be 100% accurate about what is not in the set.
You can't even remove from Guava's BloomFilter, let alone automatically expire entries.
If you need remove functionality consider using a Counting Bloom Filter.
As suggested by Tavian Barnes, one solution here might be to create a class that wraps a BloomFilter and (once a day, or however often you want) atomically replaces that BloomFilter with a new one and repopulates it.
Consider using Sliding Bloom Filters
Check this, This can solve your problem
https://programming.guide/sliding-bloom-filter.html