Let’s start off with a quick quiz. Look at the image and answer the following questions:
Are the file and the folder in the same category?
Are the file and the folder in the same lifecycle state?
Answers: No, they are in different categories, and yes, they are in the same lifecycle state.
It can be a bit confusing when you have concepts that span multiple objects types. Sometimes you can share behavior across different types and sometimes you can’t. In this article, I’ll attempt to explain what the scope of each feature.
Custom entities make things more tricky. In case you don’t know already, all custom entities are part of the same entity class (CUSTENT). When you create your own custom entity definition, it’s actually a sub-type of CUSTENT. So that adds another level of complexity when defining scope.
Let me go down feature-by-feature and explain the scope...
Categories - A category is specific to an entity class. It cannot be shared across different entity classes. So a File and a Folder can never have the same category. You can give set the display names the same on a File and Folder categories, like in my quiz, but they are still different underlying objects.
Categories are applied at the entity class level. So, CUSTENT categories can be used by any of the custom entity sub-types. So it is possible for a Foo object and a Bar object to have the same category.
Property Definitions - A property definition can span multiple entity classes. If you go to the admin settings, you will see that it’s common for Files and Folders to share a property definition. Categories can provide additional behavior, but it’s not required. If a Property Definition is associated to the FILE entity class, then any file object can have that property, regardless of category.
If a property definition is associated to the CUSTENT entity class, then it’s available to all sub-types. There is no way to have a property definition specifically for Foo objects.
Searching - A search is specific to an entity class. This is pretty obvious at the API level since the functions are named FindXBySearchConditions, where the X is the entity class.
For custom entities, a search will span all CUSTENT objects, regardless of sub-types. So it’s possible for a single search to return both Foo and Bar objects. Most of the time, you don’t want this, so you need to add a search condition that narrows the search to a specific sub-type.
Lifecycle Definitions - Files, folders and custom entities all share the same lifecycle engine. Any lifecycle definition can be used across these 3 entity types and any custom object sub-types. The only restriction is that the entity must be in a category that is associated with the lifecycle definition.
Revision Schemes - They work similar to lifecycle definitions. You can share them across different entity classes, but the entity must be in a category that is associated with the lifecycle definition.
Roles and Permissions - The role usually mentions the entity class directly, such as Item Editor (Level 1). So it’s pretty clear that roles are specific to an entity class.
For custom entities, a role applies to all custom entity sub types. So somebody with Custom Object Editor (Level 1), can edit both “foo” and “bar” objects. If you want the user to be able to edit “foo” but not “bar”, you need to give that user the edit role, then use ACL security to restrict edit on “bar” objects.
Custom Commands - These can be bound to a specific entity type. In the case of custom entities, they can be bound to specific to a sub-type. A command can work with to different types/sub-types by binding the command to multiple command sites. Another option is to specify null for the NavigationTypes property, which has the effect of making the command always available.
Custom Tab Views - These are always bound to a specific entity type or custom entity sub-type. You can’t share a file tab with an item tab or a “foo” tab with a “bar” tab.
Speaking of bar tabs, it’s payday and my shift is over. I’ll leave you with this this handy chart, summarizing everything.
|
Entity class scope |
Custom entity sub-type scope |
Categories |
Specific to a single entity class |
Always shared across all sub-types |
Property Definitions |
May be shared with multiple entity classes |
Always shared across all sub-types |
Searching |
Specific to a single entity class |
Always shared across all sub-types |
Lifecycle Definitions |
May be shared with multiple entity classes (dependent on category) |
May be shared with multiple sub-types (dependent on category) |
Revision Schemes |
May be shared with multiple entity classes (dependent on category) |
N/A |
Roles and Permissions |
Specific to a single entity class |
Always shared across all sub-types |
Custom Commands |
May be shared with multiple entity classes |
May be shared with multiple sub-types |
Custom Tab Views |
Specific to a single entity class |
Specific to a single sub-type |