How to combine fields from modules? - sugarcrm

The scenario is that there are 3 modules.
an abstract address module.
a 1:1 relationship between addresses and objects + a role (like opportunities_contacts described here)
an object module
In objects there should be address fields showing up dependent on a dropdown.
If the object is of type Museum -> one address with role 'main', is it of type X -> 3 addresses with roles 'a','b','c'...
The addresses should appear as if they were belonging to the module itself (for reproting, campaigns...). Addresses entered in the object module should create a role dependent on the dropdown (for example: 'main' and 'alternative').
Besides that there should always be a Subpanel for addresses with additional roles.
What needs to be done to integrate fields from addresses module into this objects module?
Could one also use this to override the default accounts/contacts/leads structure without breaking campaigns module...?

You can leverage Sugar Logic or use a technique like this...
http://developers.sugarcrm.com/wordpress/2012/03/13/howto-grab-fields-from-a-related-record-without-sugar-logic/

Related

Mapping between AssetTypes and DomainTypes in Collibra

From Collibra Documentation (https://university.collibra.com/knowledge/collibra-body-of-knowledge/data-governance-operating-model/organizational-concepts/domain-types/)
A Domain Type formally defines which types of Assets can be created in the Domain. In other words it serves as a template. By assigning asset types to a domain type, you can specify which asset types can be created within which domain type.
Is there any such strict mapping in place? Can a user create a mapping between domain type and asset type? Is there any way, through REST APIs / Java Connectors, that these mappings can be createt or retrived?
In Collibra certain domain type has a certain asset type under it. This means from one domain is a physical dictionary then you can have Column Asset, Code and code number asset and etc. To create a separate mapping, you need to have System admin rights. If you do then the first step is to go to setting —> Domain type -> Select the domain type you want to map —> go to characteristics in that domain —> then check Mark on whichever asset type you want to map.
The second step is to create a relationship between that domain and assets if you want to retrieve any data or hierarchy. You can create relationships from setting only where you also need system admin's rights.
Let me know if you have any follow up on this.
(Share a screenshot or details if still has query)

How to set attribute value to instance of class at runtime

I'm on Enterprise Architect 14. I have a component diagram containing an interface User and two classes Employee and Customer, which both realize interface User.
Furthermore I created two instances, one of each class and specified the values of the attributes via Features & Properties > Set Run State....
Next I created a component with 2 attributes, one of type Employee and one of type Customer. Then I created an instance of the component.
Now I would like to set run state of the component instance by assigning ArbitraryUser to the Employee attribute and ArbitraryCustomer to the Customer attribute of the component instance. According documentation this should be possible (see here).
At run-time, an Object instance can have specific values for its attributes, or exist in a particular state. To model the varying behavior of Objects at run-time, use instance values selected from the 'Select ' dialog and run-time states or run-states.
However I could not figure out how to do so. Can someone help me?
AFAIK that is not possible.
I'm not sure what the quote from the help really means, but I've only ever been able to type a value for the run state.
An partial alternative would be to use associations rather than attributes to model such relations. Then you can create a link as an instance of the association to relate instances of Employee or Customer with instances of a ArbitraryComponent.
This solution doesn't work for datatypes, but it seems a bit far fetched to start modelling instances of datatypes.

DDD: Concrete Type per user ROLE on Bounded Context. Identity and Access

Im stuck with designing the Identity and Access of my project against DDD.
I have Roles like Marketer, Coordinator, Planner in the system.
What I did was created concrete type for each role with their information save on table name people(name, email). and for the credentials I have users table (username, password) and table roles. Basically people and users table have the same id. (when I create user, I will also create person(people) and assign the id=user_account_id.
My problem is it seems like its not natural to check the role of the user to determine which concrete type I should instantiate. And I also have discriminator column in my people for each type. And I dont even know if creating concrete type per Role is a good idea.
I was thinking its better when I have concrete type so I can do something like
$inquiry = $marketer->makeInquiry($client, $subject);
instead of
$inquiry = new Inquiry($client, $subject, $marketer);
I also came out with idea of just using the id instead of the concrete type instance, but having problem when I need to display information about the person(people) like his name because I only have the id.
So, what is the best approach for this problem?
I am using Symfony2 and Doctrine (if it matters) but I think it is also applicable even with other technologies like ASP MVC and EF.
It's probably not a good idea to have subclasses for either Role or People (it's not entirely clear to me whether you refer to both).
For Role it isn't because the "type" of role (Planner, etc.) is just an attribute of Role, not a subtype. A role subtype would be something like a PersonRole or CompanyRole.
For People it doesn't seem a good idea because
Roles can change. Subtypes are meant to be (practically) immutable, like a Bike will always be a Vehicle of type "bike" and never turn into a Car.
It would block the possibility to assign two roles to a person by architecture. Architectural constraints are the hardest ones to change. Maybe presently it's not a question whether a person can have multiple roles, but in the future it may.
When it comes to differences of behavior based on a person's role you should consider other behavioral patterns than inheritance. Also look at composition over inheritance.

Restrict access to database resources in Entity Framework + UoW + Generic Repositories

I'm using ASP.NET MVC3 with Entity Framework 4.
I am using the Unit Of Work + Generic Repository pattern.
I searched for similar question everywhere, I see that many people have my problem, but still can't find a good and practical solution.
We have a multi-tenant database.
Imagine a database with a similar structure:
customers
groups, associated to a customer
users, associated to one or many groups
And then, for each customer we have
resources, associated to one or many groups, and linked between each other with foreign keys, many-to-many relationships and so on
So, when a user logs in, he is associated to one or many groups, and he needs to have access to the parent and child resources associated to that groups.
Now the problem is:
I implemented a sort of pre-filtering with a .Where() clause into the unit of work, in the repositories, based on the id of the logged in user.
And this is working.
The pre-filtering I did on the repositories is working fine, but of course it works only if you access directly the repository of the sources of TYPE A or TYPE B or TYPE C and so on.
But a resource is linked to other resources with many-to-many tables and foreign keys.
So, it happens that sometimes a resource belongs to a group to which the user has access, but sometimes the resources linked to this resource belong to a group to which the user does not have access.
If I traverse the navigation properties of the "parent" resource, the user can access all the linked resources, even the one belonging to other groups.
So, if you are starting from a TYPE A resource, and traverse the navigation properties to reach the TYPE B and TYPE C resources, they are not filtered.
If you access the TYPE B and TYPE C repositories, they are filtered.
Now my filters, as I said before, are in the Unit Of Work class, but I tried to move them into a custom DBContext, applying the filters directly into the DBSet, but nothing changes:
It seems that EF is accessing directly the database to build the navigation properties, thus not using the other repositories or the other DBSet, avoiding the prefilter.
What can we do?
I see that NHibernate has Global Filters that could accomplish my task, so I'm evaluating a migration from EF to NH.
I see that many other people is asking for .Include() filters, thus disabling lazy loading.
Thank you.
I can provide some piece of code if needed, but I hope I explained my problem correctly.
Thank you i.a.
Best Regards,
Marco
I saw a solution with mapping to views and stored procedures, but I'm not sure how hard it was in development and maintanace. In short, it is possible to map EF model to views, where data will be filtered; in this solution each user have own database credentials.

Entity Framework - table naming conflicts Application, User, Role

We are in the database design phase of a project using EF4/5 (and RIA Services to Silverlight).
Our current schema has tables like: Applications, Users and Accounts
In .NET I get naming conflicts to existing objects , and have to specify my own object eg: System.Windows.Application
EntityQuery<Customer.Web.Application> queryApplicationT32 = custDomainContext.GetApplicationsQuery();
Question: Is it best practice to do this, or to map in EF to something else eg CustApplication?
If Application, User and Account are real meaningful names in your domain, you should use them.
You will only have a name conflict when you have using statements for both classes:
using Customer.Web;
using System.Windows;
If you only use one of them you won't have a conflict. If you use both, you will have to fully specify your class name.
You can also use an alias: using myAlias = Customer.Web; That way you can specify which class to use by using a shorthand alias.