Step 1: Entry Types
Start a new Kickstarter project
umkickstarter -n de.pinuts.tutorial
cd umkickstarter
# Copy your partner license file to env/devel/cmsbs-conf/cmsbs.license
gradle setup runEntry Types
The data model is to contain at least four different domain objects or Entry Types:
employees
customers
partnering shipping companies
trucks of that shipping companies
Custom attributes
Employees, customers and shipping companies can be represented by UM entries utilizing only standard attributes. Only trucks seem to stand out; here we need to create a few extra attributes to adequately represent them:
cmsbs-conf/conf.d/truck.attributes:
registration_number.type = STRING
registration_number.title = Registration number
additional.attributes[] = registration_number
max_payload.type = INTEGER
max_payload.title = Max. payload in kg
additional.attributes[] = max_payload
attribute.groups[] = truck
grp.truck.members = registration_number max_payload
grp.truck.title = TruckEntry Types
Now we can setup a magic attribute named entrytype.
cmsbs-conf/conf.d/entrytype.attributes:
entrytype.values[] = employee
entrytype.values[] = shipping_company
entrytype.values[] = customer
entrytype.values[] = truck
entrytype.value.employee = Employee
entrytype.value.shipping_company = Shipping Company
entrytype.value.customer = Customer
entrytype.value.truck = TruckCustomize Entry views
Now, we’ll customize the Entry views for our four different Entry Types.
cmsbs-conf/entryTypes/type_shipping_company.properties:
# Show only certain attribute groups:
attribute.groups = *std_personal *std_contact *std_address
# Show these attributes in attribute group 'std_personal':
grp.std_personal.members = login_name company lang cmsbs.isadmin admin_role password
# Show these attributes in attribute group 'std_contact':
grp.std_contact.members = phone mobile fax emailcmsbs-conf/entryTypes/type_employee.properties:
attribute.groups = *std_personal *std_contact *std_address
grp.std_personal.members = login_name salut title firstname lastname lang cmsbs.isadmin admin_role password
grp.std_contact.members = phone mobile fax emailcmsbs-conf/entryTypes/type_customer.properties:
attribute.groups = *std_personal *std_contact
grp.std_personal.members = salut title firstname lastname company street zip city country
grp.std_contact.members = phone mobile fax emailcmsbs-conf/entryTypes/type_truck.properties:
# Show only one attribute groups:
attribute.groups = *truckBefore we can use our new Entry Types we have to comment in one line in build.gradleso the builder knows where to put our entryTypes
fileTree('cmsbs-conf/entryTypes').each {target ->
ln(target, new File(pinuts.um.cmsbsConfDir, 'entryTypes'))
}
// fileTree('cmsbs-conf/adminRoles').each {target ->
// ln(target, new File(pinuts.um.cmsbsConfDir, 'adminRoles'))
// }After dropping the database and restarting we should be able to create an Entry of each of these four Entry Types and see the customized view and edit pages in action:
gradle destroy
gradle setup run