Build by Design for Plone - LMU
Transcript of Build by Design for Plone - LMU
![Page 1: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/1.jpg)
ArchGenXMLBuild by Design
for Plone
Richard Amerman7 Tech NW
www.7technw.com
![Page 2: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/2.jpg)
Who am I?
● Open Source Advocate● Plone, Asterisk, LEAF
● Plone/Asterisk Developer/Integrator● Owner of 7 Tech Northwest● Plone Trainer● Idealist
![Page 3: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/3.jpg)
Overview
● What is this all about?● What are the pieces?
– Archetypes– UML– ArchGenXML
● Why would I use this?● How do I use this?● Where are things going in the future?
![Page 4: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/4.jpg)
What is this all about?
● RAD (Rapid Application Development)
● For the un-initiated– Generating a new product for Plone from a drawing
● For the converted– Generating an Archetypes based Plone product
from a UML diagram
![Page 5: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/5.jpg)
What are the Pieces?
● Archetypes● UML (Universal Modeling Language)● ArchGenXML
![Page 6: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/6.jpg)
What is Archetypes?
● Framework for developing Plone products– Automatically creates view and edit pages– Maintains unique object IDs– Creates references between objects
![Page 7: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/7.jpg)
Archetypes framework● Field validation● Standard security setup● Alternate storage options● Data transformation capabilities
![Page 8: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/8.jpg)
Archetypes Architecture● Class
– Schema● Field
–Widget● Field
–Widget● ...
– Method– Method
![Page 9: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/9.jpg)
Archetypes Example: rogue
schema=Schema(( StringField('first_name'), StringField('last_name'), ImageField('photo'),))
class Rogue(BaseContent) schema = BaseSchema + schema
registerType(Rogue,PROJECTNAME)
![Page 10: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/10.jpg)
Archetypes: Widgets
schema=Schema(( StringField('first_name', widget=StringWidget( label='First Name', size=15) ), StringField('last_name', widget=StringWidget( label='Last Name', size=15) ), ImageField('photo', widget=ImageWidget( label='Headshot', show_content_type=True) ),))
![Page 11: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/11.jpg)
What is UML?
● UML = Uniform Modeling Language● Standard widely-adopted graphical language● Describes the artifacts of software systems● Focus on conceptual representations
![Page 12: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/12.jpg)
Rogue defined in UML
![Page 13: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/13.jpg)
Poseidon for UML
![Page 14: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/14.jpg)
More Complex UML Model
![Page 15: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/15.jpg)
UML Editors
● Recomended– Poseidon (Commercial) (by Gentleware)– ArgoUML (Open Source)
● Others– ObjectDomain (Commercial) – Powerdesigner (Commercial) (by Sybase)– Umbrello (Open Source) (KDE)
![Page 16: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/16.jpg)
What is ArchGenXML?
● Command line utility● Auto-generates code from a UML model● Produces well formed Archetypes based Plone
products ready to install● No round-trip support yet● Custom code is preserved upon regeneration
![Page 17: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/17.jpg)
Why Would I Use This?
● Your cool● You like pictures● You want to save time● You are a lazy programmer● You don’t like to reinvent the wheel● You don’t like copying and pasting code● You make heavy use of references and interfaces
![Page 18: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/18.jpg)
Why Would I Use This?Continued
● You have big projects with many different content types
● You want or need a well-documented interface to your product
● You like structured model- and patterndriven software development
● You want to maintain your project in the future without getting a headache
● You want to have productive discussions with your clients about a product without creating extra documentation
![Page 19: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/19.jpg)
How Would I Use This?
● Design and maintain product as model● Generate product using ArchGenXML● Add additional code to safe areas of generated
items● Use model as the center of discussion about
the product
![Page 20: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/20.jpg)
UML to Archetypesusing ArchGenXML
schema=Schema(( StringField('first_name', widget=StringWidget( label='First Name', size=15) ), StringField('last_name', widget=StringWidget( label='Last Name', size=15) ), ImageField('photo', widget=ImageWidget( label='Headshot', show_content_type=True) ),))
![Page 21: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/21.jpg)
UML speak to AT speak
● package● class● operation● attribute● tagged value
● product● content type● Method● field● property
![Page 22: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/22.jpg)
In practice1)Create UML model to describe your type
2)Export your model as XMI
3)Run the ArchGenXML script
4)Restart Zope to install product in Zope
5)Install the newly generated product in Plone site
![Page 23: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/23.jpg)
Generated Files/Folders
![Page 24: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/24.jpg)
[mytype].py
● Inserts documentation● Placeholders for custom code● i18n message ids● Using generate_source.sh
– Inserts author information– Creates i18n msg catalog .pot file– strips HTML from doc strings
![Page 25: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/25.jpg)
Tagged Values
● Set properties on object– Widget– Required– Default– Vocabulary– Searchable– Accessor– allowed_types– multiValued
![Page 26: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/26.jpg)
Tagged Values: Example
![Page 27: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/27.jpg)
Variants of Content Types
● Simple Classes● Folderish Classes● Portal Tools● Packages● Advanced
– Abstract mixin classes– Stub classes– Interfaces
![Page 28: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/28.jpg)
Workflow Generation
● Created using UML state diagram● Attached to a single class● Consists of the following:
– Initial State– States– Transitions (an arrow connecting two states)
![Page 29: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/29.jpg)
Workflow: Additional Items
● Transition guards● Permissions● Workflow actions● Worklists
![Page 30: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/30.jpg)
Workflow: Example State Diagram
![Page 31: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/31.jpg)
Custom Template Generation
● Custom Templates– Add method with 'view' stereotype
● Should follow [mytype]_view naming convention● Example: <<view>>+rogue_view{}:● Produces sparse template
● Portlet Generation– Add method with 'portlet' stereotype
● Should follow portlet_[myportlet] naming convention● Example: <<portlet>>+rogue_view{}:● Produces nice template
![Page 32: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/32.jpg)
Other Items
● Methods– Added as methods to a class in the model– Should not have a return
● Actions– Added as methods to a class in the model
● Forms– Added as methods to a class in the model– Generates empty form-controller template
![Page 33: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/33.jpg)
Third Party Product Integration
● ATVocabularyManager– Dynamic Vocabularies
● Relations– Support for Relations Product (complex references)
● CMFMember– Custom member types– Replace existing Plone member
![Page 34: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/34.jpg)
CMFMember Integration
![Page 35: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/35.jpg)
uml.joelburton.com● http://uml.joelburton.com/● An experimental web service for converting UML diagrams to Archetypes products.
![Page 36: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/36.jpg)
PloneMall● Example of a sophisticated e-commerce● framework built using UML● See the UML model here:● http://www.plonemall.com/uml/UML-beta2.png/image_view_fullscreen
![Page 37: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/37.jpg)
![Page 38: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/38.jpg)
Where are Things Going in the Future?
● ArchGenXML– Still actively developed (more than Genesis)– Will be updated for Plone 2.5
● Genesis– New replacement for ArchGenXML– Still being developed
![Page 39: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/39.jpg)
Summary
● What is this all about?● What are the pieces?
– Archetypes– UML– ArchGenXML
● Why would I use this?● How do I use this?● Where are things going in the future?
![Page 40: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/40.jpg)
Missing Pieces
● Deriving/Subclassing● Command Line Switches● Custom Validation● Custom Widgets● Imports● Methods and Actions● Unit testing
![Page 41: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/41.jpg)
Resources● ArchGenXML product page
– http://plone.org/products/archgenxml
● ArchGenXML getting started tutorial by Jens Klein
– http://plone.org/documentation/tutorial/archgenxml-getting-started
● Archetypes: Customizing Plone in 60 seconds (PDF) by Andy McKay
– http://www.enfoldsystems.com/About/Talks/archetypes.pdf
● Archetypes Quick Reference Manual by Maik Röder
– http://plone.org/products/archetypes/documentation/manual/quickref
![Page 42: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/42.jpg)
ArchGenXML Acknowledgements
● Philipp Auersperg (Blue Dynamics)● Jens Klein (jensens)● Martin Aspeli (optilude)● Reinout van Rees (reinout)● Joel Burton● ArchGenXML Dev Team● Plone community
![Page 43: Build by Design for Plone - LMU](https://reader033.fdocuments.us/reader033/viewer/2022041802/62542521b84f7440095ba40a/html5/thumbnails/43.jpg)
Special Acknowledgement
Special Thanks!This presentation was inspired by and barowed from a
great presentation by Nate Aune:● http://www.jazkarta.com/presentations/ArchGenXML-UML-talk.pdf
● Nate Aune (natea)– www.jazkarta.com