Many of my spans are more useful if they inherit many attributes from the parent. Performing queries using Honeycomb for example, it's not possible to query spans based on properties that parent or child spans might have, and many of the attributes of the parents are relevant to the specific span for querying it in isolation. Other than recording them manually (if they're in scope when the child span is created), or perhaps pushing attributes that are intended to be inherited into baggage, and pulling them out on a per-span basis, what are my options here?
How do I propagate attributes to child spans?
Related
If you want to implement a hierarchical model in DDD, will your referrals be to parents only or will you also refer to a list of children?
Consider a simple ticketing system in which we are supposed to have a maximum of two answers per ticket. In fact, the answer goes to only two levels.
Post: Aggregate Root
Comment: Entity
Given the above condition, I think I should also refer to the list of comments because it has limitations. On the other hand, for Aggregate Root itself, it will have only two response levels when fetched, which returns, and this has no effect on performance.
What is your opinion and what factors do you think should be considered in this design? Thanks
If I understood you correctly, I don't think it matters if the children reference its parent or if the parent reference its children for it to be a hierarchical model with a specific AR. But if you need the children to be an ordered list I would go with first alternative with the parent referencing its children. But if all you need is an unordered collection I would use the other variant. I this specific case with comments I guess each Comment would have a Posted:DateTime, and could then be sorted on this property instead of being ordered. If it instead would have been for instance a list of steps to take to complete a task, then the ordering would have been more important of course.
I'm interested in creating a graph of parent nodes each containing 1 or more child nodes to be placed via co-ordinates. Child nodes will have edges to other child nodes in the graph.
I would then like to perform a breadthfirst layout on the parents, without disturbing the local position of the child nodes.
Is this possible in Cytoscape.js? Will I need to write a custom layout module?
Compound nodes don't really have independent positions and dimensions: A parent is wholly dependent on children for to fit its position and dimensions.
To do what you suggest, you'd need to move all the descendants of a parent to effectively move the parent. For that, you'd need unique layout logic.
You could probably just use the scaffolder and copy the breadthfirst code as a basis -- modifying it for what you need. If you want to have it public, it could be a nice layout extension in the listing.
I have two subgrids
Parent
Children
Now I will be adding entries to it from the contact entity
What I want to achieve is, I want to create parent-child relationship among the data that are there in these two subgrids so that I can use it for querying in future
Usage scenario:
I have a entity form for a entity called as MedicalCase
MedicalCase form will have two subgrids for "Children" and "Parent"
Now I will be able to add children and parent records to subgrid from the Contact entity
For these records in the parent and children subgrid, I want to specify, which parent is the father/mother of which child
I don't have the luxury of editing the Contact records, is there any other means that you can think of?
Someway in which I can record the relationship between child and parent in the subgrids
Hope I am clear enough, feel free to ask me if you need any clarifications
I'm having a hard time understanding the situation exactly, but after several re-reads it sounds like you need a custom many-to-many relationship entity. Create an entity called ChildParentRelationship (CPR) which should have a lookup to Child and a lookup to Parent. Your Medical Case form should have a sub-grid for CPR entity. When a user creates a new CPR record, they will specify the Child and Parent. Does that get you what you need?
We currently have some parent child relationships between Orchard content items built using the Container/Containable structure.
The parent item is a manufacturer, the child item is a range, the child of a range is a product. We have this kind of parent child relationship 4 levels deep.
This is all working but on a page where we have a list of products from different manufacturers and want to display some information about the manufacturer with each product performance is terrible due to select n+1 issues.
This is because we are bringing in all the products in a single query, but then for each product a query is executed for the common part to find the container ID and then a separate query is executed for each manufacturer content item.
I've added query hints to get the common part eagerly, but we still have the select n+1 issue to get the actual parent content item, obviously at lower levels in the hierarchy this problem is magnified.
I think this is because of the lazy field for the Container on the CommonPart - I can't see a way of avoiding this with that structure, or telling the content manager to fetch it eagerly.
I then looked at defining the structure ourselves using http://docs.orchardproject.net/Documentation/Creating-1-n-and-n-n-relations#BuildingaRelationBetweenContentItems but the example there for relationships between content types again uses lazy fields to load in the parent.
What I want is to execute a single query to get me every product with its parent range and its parent manufacturer, but I can't see how to do this. Are there any examples of this?
I've got a simple pojo named "Parent" which contains a collection of object "Child".
In hibernate/jpa, it's simply a one-to-many association, children do not know their parent: these Child objects can have different type of Parent so it easier to not know the parent (think of Child which represents Tags and parents can be different object types which have tags).
Now, I send my Parent object to the client view of my web site to allow user to modify it.
For it, I use Hibernate/GWT/Gilead.
My user mades some changes and click the save button (ajax) which sends my Parent object to the server. fields of my parent has been modified but more important, some Child objects has been added or deleted in the collection.
To summary, when Parent object comes back to server, it now has in its collection:
- new "Child" objects where id is null and need to be persist
- modified "Child" objects where id is not null and need to be merge
- potentially hacked "Child" objects where id is not null but are not originally owned by the Parent
- Child objects missing (deleted): need to be deleted
How do you save the parent object (and its collection) ? do you load the parent collection from database to compare each objects of the modified collection to see if there is no hacked item ?
Do you clear the old collection (to remove orphan) and re add new child (but there is some Child that has not been modified) ?
thanks
PS: sorry for my english, I hope you have understand the concept ;)
Something in your stack has to supply the logic you are talking about, and given your circumstances it is probably you. You will have to get the current persisted state of the object by reading from your datasource so you can do the comparison. Bear in mind that, if several legitimate actions can update your parent object and its collection simultaneously you will have to take great care over defining your transaction grain and the thread-safe nature of your code.
This is not a simple problem by any means and there may well be framework features that can assist, but I am yet to find something which has solved this for any real world implementation I have encountered, especially where I have logic which tried to distinguish between legitimate and "hacked" data.
You may consider altering your architecture such that the parent and children are persisted in separate actions. It may not be appropriate in your case but you might be able to have a finer grain of transaction by splitting up the persistence actions and provide child-oriented security which makes your problem of hacking a little more manageable.
Good luck. I recommend you draw a detailed flow chart of your logic before you do too much coding.
The best solution I've found is to manage a DTO, manually created. The DTO sends only needed datas to the client. For each fields I want to set in ReadOnly mode, I calculate a signature based on a secret key that I send to client with my dto.
When my DTO comes back to server, I check the signature to be sure that my read only fields have not changed (recalculate the signature with coming back fields and compare it to the signature coming back with dto)
It allows me to specify read only fields and be sure that my objects are not hacked.