230 likes | 256 Views
Business Components. Alejandro Silva ARTech silva@artech.com.uy. Business components. Develop applications faster and more easily. What are Business Components ?. Transaction. What?. Encapsulates logics Provides viewing User interaction DB Updating Rule validation. Transaction.
E N D
Business Components Alejandro Silva ARTech silva@artech.com.uy
Business components Develop applications faster and more easily.
Transaction What? • Encapsulates logics • Provides viewing • User interaction • DB Updating • Rule validation
Transaction What? Presentation Business Logics DB Access
Business Component What? O-O Interface Business Logics DB Access
Interface How? O-O Interface Business Logics DB Access
Interface How? (Properties) Load(key) Save() Check() O-O Interface GetMessages() NoErrors() Mode()
Interface Como? (Properties) Load(key) Save() Check() O-O Interface GetMessages() NoErrors() Mode()
Interface – Properties How? Assigns value to modifiable object attributes • Obtains value of attributes • Example • &total = &factura.FacTotal • For &facLinea in &factura.Factura1 &cantidadItems = &cantidadItems + &facLinea.PrdCant EndFor (Properties)
Interface How? (Properties) Load(key) Save() Check() O-O Interface GetMessages() NoErrors() Mode()
Interface - Methods How? • Load(key) • Loads information related to the key given. • Check() • Processes the component without updating the DB. • Save() • Processes the component and updates the DB. • Delete() • Deletes the set. Load(key) Save() Check()
Interface How? (Properties dades) Load(key) Save() Check() O-O Interface GetMessages() NoErrors() Mode()
Interface - Methods How? • NoErrors() • Component status. • GetMessages() • Messages of last operation results. • Mode() • Mode of the component. GetMessages() NoErrors() Mode()
Interface How? • Example &factura.FacFecha = today() &factura.CliCod = 1 &facLinea.PrdId = 1 &facLinea.PrdCantidad = 10 &factura.Factura1.Add( &facLinea) &factura.Save() If NoErrors() return Else &messages = GetMessages() EndIf
Advantages Why? • Reuse transaction logics • Delete cascade • Validation • Integrity check • Encapsulate business rules • Not necessary to check rules in all places.
Case I Why? • Delete in procedures • Implementation • Integrity references check • Subordinate tables delete • Problems • Duplicates logics • Maintenance • Lack of functionality
Case II Why ? • Updating in Work Panel • Implementation • Create process – to update DB. • Validate business logics in events • Problems • Duplicates logics • Maintenance • Lack of functionality • Optimistic lock
Case III Why? • Web services • Implementation • Create SOAP procedures – to update DB. • Problems • Duplicates Transaction logics.
Web Services Why? • Present the Business Component as a Web Service • “SOAP” Methods • Load( in:key, out:component, out: messages) • Check( inout: component, out: messages) • Save( inout: component, out: messages)