WWDC2001 Session 612
Transcript
Kind: captions
Language: en
good afternoon everybody welcome back to
director web I'd like to introduce our
next presenter Miguel Sanchez good
afternoon everyone can you hear me okay
thank you for coming to hear our session
on director web I know you probably sick
of this polls at the beginning of the
sessions but I really need to get a read
of how many of you are with objects
developers here in the audience now how
many of you have used director web okay
so there's this is this a good number of
people there they're using directory of
rules we'll say something like 5% or so
so you probably feel a little lonely
being the only users of director web
right but you know
by now we've all been indoctrinated
about the relevance of BMW and are you
so let's see we can bend some statistics
here so we all know that BMW has 3% of
the market but for anybody that's been
out here in California for more than a
week realizes that locally it looks more
like this right so it's when you're
doing this statistics thing it's very
important to have a good grip of your of
your universe that you're you're getting
your sample from you can't just make up
numbers right so we take this thing very
seriously in webobjects so over the
lunch break I stood over in the corner
and I try to count cars and I didn't
really find any data that substantiates
this but I'm just guessing that but 6%
of the remaining people use 76 Ford
pintos right and you can't compare
apples and oranges but out of those
people that use Ford pintos about 90
percent prefer pinto beans in their
burritos when they go have Mexican food
right so what does this have to do with
direct to web not really not nothing not
much okay
director web is not a technology it's
not a technology you can explain with
pie charts so you'll have to sit through
my presentation of one hour and
hopefully you'll get a little more
excited this just as a point of
reference this is classified as an
advanced web object session so I'm
assuming some web objects knowledge here
this is sort of like if you're already a
director web user how I'm sorry a web
objects use or how can you take real
advantage of director web so you've
probably seen in the past it's been
demoed in other sessions and we've shown
you how director web jump-starts your
application in this session I'm going to
focus more on how much you can customize
your application once once you've
started what will we learn I'm going to
talk about the architecture of there are
two web so you become familiar with
what's going on behind this
one of these one of the most important
things in the architecture of director
web is the rule system so I'm going to
spend some time explaining to you what
the rule system does and of course the
recurring theme of the talk is how you
can customize director web applications
at all kinds of levels brief overview of
what director web is director whether
it's infrastructure for making your
development of web objects applications
easier much easier how do we achieve
this we achieve this by giving you a lot
of pre-built functionality we give you a
head start so you don't have to you
don't have to start from zero from
basically doing nothing other than
giving us your database model we give
you a full full running application
director web is not really an
application don't don't expect to find a
director web app anywhere in your system
rather it's a set of frameworks and
tools although I will be referring to
director web applications I mean your
applications that use director web and
director web introduces something new to
web objects which is rule-based
programming to say to say it one way
I'll talk about that what is it director
web application most importantly it's a
it's a normal web objects application
with an HTML front-end and that uses GOF
in the back like I said before you
probably started with a lot of the
pre-built components you we give you and
you customize the application we give
you either from zero you actually have a
running database application without
doing anything to quite extensively as
I'm going to show you and you know with
objects gives you a lot of great runtime
flexibility director web adds to that it
gives you yet another level in which you
can change your application so now we're
going to go to a brief demo to show just
to to show director web to those that
have that have never seen your director
level application we get the demo
machine up on screen could we get the
demo machine up on screen thank you
so the starting point for a direct web
application is always a database model
that we ask from you in addition to the
price of web objects so the example
we're going to be using throughout our
application is a simple bug tracking
tool you're all developers you probably
all have a need for something like this
within your projects we have a very
small simple database that has two main
tables the bugs which problems you have
but on your software the users users can
either have created the bugs or be the
engineers assigned to fix the bugs and
you have look-up tables like the state
of the bug and which project it belongs
to so that's that's what we start out
with once once you have the project and
you create a director web project in
project builder he uses it oh let me let
me stop here for a moment
I know I've noticed that a lot of web
objects developers out there have been
paying very very close attention to our
demos and whether we click something or
not let me let me come clean on there
before to save some time I pre-compile
we pre compile some of the applications
and we've set some defaults so we're not
showing every single step here okay so
don't don't spend too much time trying
to figure out why why we skip that we
just were just trying to save some time
here so this is the project having that
was created using direct web all you get
is a basic template for for a web
objects application it has an
application classes session and basic
very basic components and it knows about
the model oh oh you gave us was the
model so now let's look at the project
in the browser remember you haven't done
anything other than prepared your
database and giving us your model what
do you get for free you get a full
fledged
database application with a fake login
page that's just a starting point for
your app it doesn't have any login logic
we're just going to log in right now but
the application automatically knows
about every entity in your model about
all the attributes in your model and
creates the most generic database access
application for it so if we look at the
pop up on the left
you'll see that this application already
knows about bugs and projects and and UN
states and users and it gives you the
basic pages you would need in any
database application to query on them to
see that to list the results to edit to
edit data so for example let's go to the
search page for the bug director web
gear gives us this page it knows about
all the fields in the bug table in our
database
we're let's query on it we won't specify
any search criteria for the demo here we
have a list page here we get all the
results from the from the database we
can we can go down to a particular page
click on the first one please we can
look at the Edit we can look at the edit
page for to analyze the attributes of
the bug so I'm not going to go into much
detail here the point is you get this
for free so any web object developers
out there should at least use direct web
as your sort of your database
administration until you get this
application for free why not use it now
of course we can't guess everything
you're going to want in your application
so you're you're going to want to
customize certain things for that we
have an applet written in Java running
alongside your application which Ernest
is going to maximize now which it hung
actually we have to restart the app I
promised myself that every time this
thing crashed I was going to give out a
t-shirt I hope it doesn't crash more
than twice
did you realize the applet or D happens
okay so by now you've probably all heard
that have if you've been coming to our
talks how we're using we're not using
the final bits of the Java of the VM RJ
drop that's going to be released
tomorrow so we the things didn't just
didn't come together at the same time so
we relaunch we that's also why we're
launching it from the command line
because we didn't have Java embedding
embedded embedded Java running in the
browser so anyway we have the applet
running alongside our application which
allows certain levels of basic
customization for example if we go back
to the Edit Page you'll see that the
title is at the bottom of the page let's
say we want to rearrange them so we want
to rearrange think of the applet sort of
as an inspector into your application
and you rearrange the title to be the
first thing and then you do your project
and then you put the state of the bug as
your second thing and here's where the
power comes in you save and without
restarting your application you refresh
and you get the change okay you can do
other kinds of things see the project
line and the state line those are
relationships we want to use another
other kinds of components to display
them we want to use a little browser to
display the available projects that the
bug can be assigned to and a little list
of radio buttons to display them the
list of states that the bug can be
assigned to so you have those kinds of
components available to you with
directive web again he's doing those
changes he saves we do a refresh and we
see things like that so I'm not going to
spend a lot of time actually any more
time than this explaining all the little
things you can configure with direct web
the point is you get an application for
free you gave us your model and you can
configure it at least that this is the
first level you can configure it at now
let's go to the project just to briefly
show the project the point is the point
here is all
what you just saw on the screen has for
now no code in your project we're not a
code generation wizard here okay we
didn't just dump out of all these pages
for you all of this is being generated
dynamically behind the scenes by the
director web infrastructure
okay so there's really there's no code
in your project yet for any of this now
could we go back to the slides please
can we go back to the slides oh thank
you so let's look at the architecture of
the apps in a little more detail like I
said these are basic web objects
application these are normal web blog
objects applications using HTML with the
app server in the back if we look inside
you probably have your code interacting
with the uof framework and the web
objects framework you would use AOF to
access your database giving us get
having given us the definition of your
database throw in your model and you
probably defined a bunch of wall
components that give the look of your
pages so those are the applications you
should all be familiar with being web
objects developers director web ivory
reiated here as d2w
is just another framework you including
your project or another framework
already included in your project when
you have when you create a direct web
project like you saw this framework must
have a whole bunch of pre-built
components to do this to display lists
and edits and queries of the of the
entities you have in your database
now these components are built using
normal web objects component there isn't
too much trickery here but they have to
be configured at runtime by something
which we call the rule system the rule
system uses information from your ear
model to find out about your entities
obviously we don't know what they are
until you give us one and also from
another file we introduced which has the
extension d2w model file for now I'll
call it a rule file think of it as a
text file with a bunch of rules so the
rules
uses the yo model the rule file and then
the components to to to display and
configure the application the pages at
runtime now let's talk about the rule
system in more detail the rule system
consists of a set of rules and classes
to derive values from those rules it
answers questions at runtime we might
want to know as developers we might want
to know well what background color
should I be using to display this string
what are the how should I display the
property name in case I'm localizing my
application which component should I use
now so we use the rule system to get an
answer to all these things how do we
interact with the rule system the first
thing the rule system needs to know is
that is where our application currently
is what is it doing we have to tell at
this we have to tell it which task we're
trying to perform which entity we're
dealing with and more specifically at
the entity level which property or
attribute were we're handling so that's
what the rule system asks from us tell
us where you are
once you I'm sorry I forgot something in
this slide we know we tell the rule
system there's something using an
instance of a class which we call the
d2w context for now think of it as
nothing more than a dictionary of key
value pairs where you tell it how where
your application is once you've
initialized one of these contexts and
you've told the rule system this is
where I am you can now ask it to derive
more values you can now say okay so what
is the background color I should be
using at this point in time what is the
display name for property notice that
I've shortened the full English
questions into into into variable names
here the context uses the rules who is a
process which we call firing to get
information back to us let's give an
example here we have a very simple rule
set with three rules what kind of
information is is specified in this rule
in the first rule we say if the task is
is edit and the Edit and the entity that
we're handling is a bug and somebody
asks us what the page name should be the
result should be my edit page the second
rule says if the property is named and
the entity is user and somebody wants to
know what the localized name is assuming
we're localizing to Spanish we return
nombre the third one says if we're
listing users and somebody wants to know
what table color we should be using we
use red ok this is a very simple rule
system a very simple rule set but it
just hopefully you get to see how the
rules look how would this be used by a
context let's say we initialize a
context with the following two values we
say the entity is user and the property
is named and we want to know what the
localized name is so we initialize the
context and we ask the context now
derive this value for me the context
goes off and says and finds a rule that
resolves something about the localized
name then it checks on its left-hand
side and says does the context I was
given bind in with the conditions that
this rule specifies and he will find it
and it will return us localized name so
from a developer's point of view
anywhere in our code where we see d2w
context dot localized name that will be
resolved at runtime to numbering
assuming we have initialized the context
to these values now this is a very
simple example but the rule system is
recursive so the end question you might
be asking might require several other
intermediate steps for the rule system
to you to get yet more values to the
context so it will ask more questions
and initialize itself with yet more
values and then in the end it will give
you the answer you want
so it's recursive now that I've talked a
little bit about the rule system let me
show you like pull the curtain on
director web and show you what the
essence of this how do we all the pages
that we provide for you really work
like I said we use standard web objects
components to build our pages the only
difference is that these components use
the rule system to configure themselves
at runtime this is a normal web object
component that doesn't use direct to web
as ice you should all be familiar with
you have an HTML part and a WOD
definition let's say that you have your
generating some sort of edit page so
this is your solution so you even hard
code something like name : and the only
runtime information you want is the
actual value of that name so you
introduce a web objects tag and then you
resolve that tag using a wool string
messaging the current objects name
attribute or one thing this is normal
web objects programing the pages we
provide for you look very similar we
have HTML and we have a wad definition
but our pages have to be more general
than yours
because let me go back one page yours
says name : there because you know it's
your solution we don't know really which
attribute we're displaying and until run
time so there has to be another dynamic
thing that we resolve and in our
definite in our bindings file notice the
use of d2w context dot display name for
property so we we tie into the rule
system to find out okay what is internet
what is the name of the property I
should be displaying now and we do that
so components like that is what the
direct web framework provides you those
are called direct web templates and as
you saw in the first demo we give you
some basic things we give you pages to
do queries we give you pages to edit and
to do listing these templates
automatically configure themselves to
the database model you're using in your
particular situation and we use the rule
system to get information at one time of
course what you're all here for is these
can be customized how do you customize
them you can customize them at the very
basic level like we showed you in the
first demo by using the web application
web the web assistant applet running
alongside your applet you also have full
access to the HTML so that's a very high
level you can really just redraw the
HTML as you as you see fit
you also have low level access into into
certain components we plug into the page
so you might like our HTML but you just
want to display your strengths a certain
way so you can do that you can plug in
your own components so I'm going to show
you these two things in the following in
the in the next demo do we have the demo
machine please so when we last left our
application in the prior demo we had
this generic database access application
that had loose pages and query pages and
so here's a list page right now let's
say that we're just picky developers and
we don't want that that garbage can on
the right to show up there and the Edit
icon on the left to show up so you just
don't want that but then you bring up
the web assistant and you realize that I
didn't think far enough and I didn't
really offer you a way of getting rid of
those things using the web assistant no
problem you still have access to that
page using the web assistant you can
tell it please give me the HTML to this
page copy the HTML of this page into my
project we did it we did this operation
before the demo can you bring up the
project once the HTML is copied into
your project you had you see it can you
point to the list yeah there it is
so we copied the the actual HTML that
direct web uses to generate that page is
now copied into your project we can open
that HTML in web objects builder and you
have full access to it to do to do edits
now there's something special about this
HTML remember this is the HTML that
comes from direct to web is HTML it's
HTML that should be able to adapt to all
kinds of models so you won't find any
references to your particular project
in this HTML there'll be a bunch of
repetitions and conditionals and no
reference to your specific model because
all of that is resolved until run time
so if we look at the actual raw HTML and
the bindings let's look at the bindings
there and let's say for example the
attributes order there if you look at
the line that resolves the display key
you will see a reference to the d2w
context right so this is the HTML we
direct web uses to to draw your applet
your page on runtime so it's a very
generic form of HTML you will see why
that's important in a minute for now can
we go back to the page briefly Ernest to
show what we wanted to do in Internet
Explorer remember we wanted to get rid
of the of the of the trashcan and the
Edit icon
so first let's show that we're actually
editing that page Ernest is going to
type a little message saying this is my
HTML we make the font a little bigger so
that you can all see we save and then we
we I pre compile the app before before
this part of the demo so we were able to
refresh the page and just so you know
where we are accessing this version of
the HTML so now we go back and do the
actual changes we wanted to do we wanted
to get rid of the trashcan so we look
for the trashcan and we just get rid of
it we don't want it in our application
and we want to change the Edit icon from
being an image to a hyperlink with text
right so the this is not a session in
graphic design so I'm not going to
impress you with any fancy HTML editing
I just want to show you as developers
that you have access to that HTML and
you refresh and those are the changes
right so you might say well so what
that's what HT that's what web objects
does yes it's what web objects does but
can you bring up the web assistant
remember that this is still a direct to
web page so on one hand you have access
to
the HTML and you do to your layout as
you as you please but on the other hand
look at the title property over can you
can you make the browser don't refresh
it yeah see the title being there on the
right let's say that we want them to
move the title over to the left and
remove the creation date row column I'm
sorry so we can still use the web
assistant for that we do save and then
we hit refresh right so you don't lose
the ability to - to the dynamic aspects
of direct web by editing the HTML those
that have used direct web in the past
and are familiar with freezing pages
this is not freezing pages this is
generating templates in Prior versions
of direct to web you would freeze your
page and you have full access to the
Java and the HTML but then you would
lose this right so that's the high level
you're changing the HTML now let's go a
little low level do you see where it
says description text and resolution
those strings are kind of kind of long
let's say that you as developers have
developed have written a little
component that shortened strings that
only displays the first 20 characters of
your of your string it could be anything
else but for demo purposes you have a
little component that shortened strings
we have such a thing in our in our
project can you bring up the project
please show the component short string
so just a normal web objects component
that takes an object and a key binding
and if it if it receives a string value
that is greater than 20 20 characters it
just it just truncates it okay nothing
nothing special here what's special is
that this could be any one of your
components now go back to the page and
and the browser now look at look at this
we don't stop the app we're still
running we go over into the web
assistant and we say for the description
we want to use a custom component whose
name is short string
so we type in short string there and
we're going to do the same thing for the
resolution text so without restarting
our application director web is going to
know that in that page it should plug in
or component so he's doing it for the
second one and remember that our
component had an object and a key
binding so that's how we instantiate
your component and we give you the
object we want you to display and it's
up to you
so now remember no restarting the app
just refreshing your browser
there's our component okay very very
simple I mean non non flashy stuff in
terms of the HTML we're showing you but
I hope that as developers you're seeing
the hooks of where you can plug in your
your your own code and your own HTML now
where let's can you bring up the rule
editor for the for the for the for the
model bring up the project first and
show the resources so you I'm
showing you all this without generating
much code right so where's all this
information about what I should be
displaying being stored as we do all
these configurations we're creating
rules specific to our application those
rules are being stored in a file called
the user dot d2w model file to look at
the file to look at that file you can
use a tool called the rule editor can
you can you bring up a little please
right so all those all those
configurations we're doing using the web
assistant are you are stored as rules in
this file which we use deliver to edit
so that's where that's where the magic
is going because I haven't been showing
you code I've shown you HTML but not
code but you're you're noticing that
we're I'm changing stuff so where's that
information going here that's where it
is so that's the end of our second demo
can we go back to the to the slides
please oh there there sorry does this
monitor still shows that
so I've given you an overview of the
architecture of director web and how the
rule system works now let's focus a
little more on us developers where let's
let's review some of the some of the
stuff I show you on the screen and where
as developers if you're working on a
director application where do you think
about plugging in your own HTML or your
own code well first of all don't forget
that a lot of the things in direct web
are now driven by rules so you're all
you're used to writing Java and changing
component definitions in with objects
builder now create another another space
in your brain to think about rules you
know you know maybe I could do some
maybe I don't need to write Java maybe I
don't need to change HTML here maybe I
could change this with rules so start
thinking in terms of can I just is it
maybe it's simple enough for me to add a
certain rule and my application could be
reconfigured so don't don't limit
yourself to Java a little bit unrelated
to rules but another another point where
you can plug in your own code is custom
components custom components is what I
used on the second demo to shorten the
string right so you probably have your
own components to display integers or
whatever you're displaying your own way
you use a custom component for that I'll
give a little more detail
you also have Java API to invoke direct
webpages you might have a web objects
application that does not use direct to
web or at least in some parts it doesn't
use the write to web and then the user
clicks somewhere
and they want to jump into a dynamic
directory web page there's Java API to
do that we also have name configurations
you might want to reuse a certain page
such as query in different in a slightly
different style without really rewriting
your whole page you can you can define
two versions of the page and use it
slightly differently I'm going to go
into detail into each one of these and
you also have Java API to plug in to the
rule
system rules like I said all of the
configuration information where we're
doing with rules is stored in two kinds
of in two files the configuration you're
doing with the web assistant which is
the web app let along side your
application is stored in the file called
user d2w model so anytime you you save
your changes in the web assistant they
go there you probably don't want to put
your own rules there because the web
assistant is going to override them
unless you're not using the web
assistant and and then you're never
saving out to that file again yeah but
if you're using the web assistant you
probably want to put your rules into the
second file which is called d2w d2w
model file you just add a text file to
your project and you start adding rules
there that's the second file also
remember that your entry point to rules
is this thing we call the d2w context so
we use key value coding and you do
somewhere in your code d2w context dot
and then the thing you want to resolve
to and it will be resolved to you by the
rule system now let's look at custom
components for custom components to work
you need to implement two bindings or
you need to be aware that director web
is going to give you two bindings
remember custom components are the thing
that we're shortening the string so
we're going to give you the object that
we're working with and the key that
we're currently displaying so again
having that information you do whatever
you want you display that that value as
you want using the HTML and and the
logic you want so you probably will end
up using key value coding somewhere in
your component in this in this manner
you've seen or key value coding
utilities in another session so
somewhere in your custom component
you're probably going to have a call a
line that does this it says okay get me
the actual value from the object that
you pass me and then you have the value
and then you do whatever whatever you
want with it and as you saw once you
have your custom component you can plug
it into you into into
application you either using the web
assistant or writing your own couple of
rules to plug it in you only need to do
two rules one saying for this for this
property please use the custom component
and the custom component name you should
use is this direct web api java api to
plug into direct web pages you can
instantiate and configure direct to web
pages from your code using java now
you don't use the normal web objects
mechanism to call up a page to get to a
page that uses director web instead your
entry point is the the main class of
direct way of d2w and the static method
on it called factory so that's that sort
of where you met instead of instead of
messaging what occasional application
your entry point for these kinds of
pages is d2w d2w factory now that class
implements methods that return all the
pages all the kinds of pages that
director web provides for you so there
are going to be methods in that class
that return the edit page for a certain
entity the list page for a certain
entity the query page for central entity
once you get back that page the object
you got back implements complies to an
interface that we define so that you can
configure it so within the director web
framework there are certain interface
definitions such as edit page interface
this page interface and query page
interface just to name some which you
use to message this page which is just
got back to configuration let me give
you a more concrete example let's say
that you have a web objects application
where you're doing your normal stuff and
you want to implement a method that
returns a direct web list page you
already know the data source where the
where the data is coming from you just
want to show that data up on the screen
using a direct web list page so your
method would be called something like
return a list page method
you know that what you're returning is
going to implement the list page the
list page interface because you're going
to be using direct web to get to this
page you use the factory to ask for the
list page for the entity I don't know
what entity notice that e the entity is
one of the attributes you pass through
this method that that's up to you right
so at this point you say T to W factory
dot
give me the list page for this entity
and we ask for a session to do certain
to do certain initializations so we give
you the list page but that's just a list
page without knowing where it's getting
its data from or where you want us to go
after you're done with it so you use the
methods implemented in the list page
interface to kind of initialize this
page so you do you set the data source
where I'm not showing where the data
source comes from is here that's that's
your responsibility the point is that
you tell us and you also tell us what
the next page you want to be after you
press return on the list page so this is
how you would call a list page using the
direct Web API or any or any other
direct web page named configurations
let's say that in the end the
application we have remember that we're
it's a bug tracking system we have ways
of querying on bugs and on users etc
let's say that for the query page we
have two levels of access for our users
we have simple users that only see a
limited number of fields they can query
on and we have advanced users that see a
much much bigger
set of fields to query on we want to use
the same page so we defined what we call
this a named configuration and we give
it or whatever name we want and in this
case we're going to call it our simple
query named configuration and our
advanced query named configuration once
you have these two configurations I'm
going to demo this I'm just showing you
the slide you call up the name
configuration using the method page for
configuration name which behaves
to the other methods I have shown you
the last thing I want to I want to talk
about is how to integrate your own code
into the rule system up to now the rules
we've shown you are these kinds of very
very simple rules that have a condition
on the left and I'm sorry I skipped one
well this is this is the slide is wrong
the instead of localized property name
it should have been a constant value
that was the first part of the animation
so after now we had we had rules that
had constant names that they the the
things they resolved to work were
constant specify the strings remember
where it said bug title and things like
that but what do you wouldn't it be nice
if when you're resolving the value of
this rule you're actually calling one of
your methods for example localized
property value let's say that's your
method you you want it define in code
how you're going to resolve this rule
you can you can implement that method in
the subclass of default assignment which
is also one of the classes provided in
director web here's an example of how
you would implement that you have a
subclass here called my assignment which
is a subclass of default assignment it
implements the method you can name it
however you want in this case it's
called localized property name within
the method because you have a subclass
of default assignment you have access to
the context remember the context is your
entry point to the rule system so once
you're in the context you can ask at a
what's the property I'm working on right
now what's the session by the way what
is the session I am dealing with and
then you do whatever you want with it
right I'm not showing you how you
localizing here is just the point is
that's that's where you do it that's the
entry point for you to execute your own
code you do whatever you want and then
you return a value to us let me show you
that with in the in the application do
we have the demo machine please
[Applause]
so this is our application let's review
where we are now
Ernest just logged into our application
and you'll notice that the first page
that came up was something which we call
the query all page this is the page
we're in from which you can query on any
entity in your database we don't like
that that's what I give you by default
you don't like it we're gonna change
that what we want to happen when the
user logs in is that instead of seeing
the query all page they jump right into
the bug query page we want to we want to
pull them straight into the page where
the query on a certain bug because
they're looking for bugs but not only
that we want to have that page be
different depending on the kind of user
that logged in if a normal user logged
in we only want them to query on two or
three attributes if an advanced user
logged in an engineer fixing the bug we
want them to be able to find bugs and
more attributes how do we do that we use
a named configuration how do we define a
named configuration with rules let's
bring up let's bring up the rule editor
so here we have the three rules that
define our simple query named
configuration remember the name is
arbitrary you can you can pick whatever
you want when you define the name
configuration the rule system needs to
know okay which task and which entity am
I dealing with when you ask for this
configuration so that's what the two
bottom rules are for it says if the name
configuration is simple query the entity
is bug that's what we're doing and what
we're doing with the bug is querying on
it so those are the two things we do
then the interesting the interesting
rule is the first one can you click on
that first one the first rule says if
we're in the simple query name
configuration and somebody asks us what
the display property keys are in other
this is just an internal director web
key if somebody asks us which which
properties of this entity should I
display in this case we say Oh first for
simple query we only want title
description project and creation date
for advanced query let's go now to the
rules that define the advanced query
we're using rule editor we have more
rules defined in this file but we're
filtering to show you only the ones that
are relevant to the demo so for the
advanced query again we define that we
say the advanced query is something that
deals with bugs and we query on bugs and
when you ask us what properties you want
to display we have a much bigger set of
lit a full set of the older properties
right so that's how we define the
configuration with three rules we're not
writing code we will write a couple
lines of code right now but we're not
rewriting you're out your page so how do
we plug in this rules into your page do
you remember that and when I gave the
first demo I said that the the the login
page didn't do anything it was just it
was just no logic you just click on the
logic and the login button we're going
to hook into that page
so that when the user clicks in the
clicks on the login button by default we
take you to the query old page we don't
want you we don't want you take you to
the query all page we want to check
which user logged in if they say if the
if a normal user logged in for demo
purposes normal users are going to have
the login username just user and
advanced users are going to have the
login username admin so can you go to
scroll down to the to the method so the
fault page is the method that is
executed when you log into the
application we have some very simple
logic here can you highlight the if the
if statement we initialize with the
session where you were with the kind of
user that we're using and we just do a
simple check you know if if the person
that logged in is called user let's call
up the simple query the simple query
name configuration if the person that
logged in is named admin let's call up
the advanced query query name page if
the person that logged in is none of
those let's let's bring up the default
page that should show up in any in any
direct web application we run the
application we log out logging is
there's nobody right now so we log in as
nobody there's a query old page we log
out we login as user there is our simple
query page we log out we login as admin
there's our advanced query page okay
again there's very little code to do all
this you're defining a lot of this in
rules which are stored in a text file
and you're in the code you saw there was
really just to plug in the the the the
page that we wanted to see right after
we logged in and to call up the name
configuration again where is this query
page you haven't even seen it it's it's
out in the director web framework and
it's working for you the last thing I
want to show you in the demo is can you
let's let's show the query page again
and they're in the browser so here's a
query page notice how the names of the
of the properties on the left are in
English it says title description
project state creator creation date
assignee and resolution okay but not
everybody speaks English in this world
we want to localize our application we
want to use the rule system to change
those titles without writing a lot of
code now the director web when it's
displaying this page its resolving a
binding called display name for property
as long as we can hook into that binding
and plug in our own code that localizes
the name we want to displayed we're okay
which is what we're going to do now in
the rule and we had disabled that rule
by the way so you wouldn't see it in the
first part of the demo now we enabled
the rule all the rule says is the
following
it says look at the lower left hand side
that's that sort of the condition part
of the rule it says if my task is query
and the entity I am dealing with this
bug and the key I'm trying to resolve is
display name for property that's one of
the keys that director web uses I want
to plug in my own method called
localized property name that method is
implemented in the custom class called
localized string assignment that's
that's my own class let's look at that
class that's that class is in
and we have a very dumb way of
localizing things right now we just have
a lookup table where we change from from
English to Spanish the point of this
class is that can you go down to where
we implement localized property value or
remember this is a subclass of default
assignment so we have the method we use
the context to get to the property we're
displaying and then we figure out which
user is logged in and then we use the
lookup table so don't don't really pay
attention to the details of the method
the point is this is where you plug in
your own code so now let's see how it
looks in our oh the other thing I want
to say about this method is for for demo
purposes if the if they know if the
basic user logs in the one that has the
user name user that person speaks
English so we won't localize their
strings if the advanced user logs in the
admin user that person speaks Spanish so
we will localize their strings so let's
look at the application
so we log out let's login as user we are
we are executing or localizing code but
we're deciding that this person speaks
English so we say remember we're using
the name configuration we see title
description project we logout we login
as admin and there we have our page with
the with the names of the properties in
Spanish ok
so quick review of can you log out
furnace quick review of what we
accomplished with this three demos first
you gave us a model we gave you a
full-fledged running database
application there it is you logged in we
have you have all this pages you don't
have to write four edits for a list for
queries those are there for you can you
go to the list page you weren't happy
with the pages we gave you from the HTML
point of view you changed it you weren't
happy with the pages we gave you from
the at the property level you plugged in
your own component can you log out can
you login as user you wanted to reuse
one page in two different configurations
you define the name configuration and
you have a simple and an advanced query
configuration can you log out you want
it to localize your application and take
advantage of the rules of the rule
system you you plot you define your own
little you're you have your localized
code somewhere you you define one rule
to resolve the property names in this
page and you have a localized page okay
that's the end of our direct webcam
now that was a very that was a very
simple I mean on flashy demo I didn't
want to distract from the essence of
where the hooks were for you as
developers so at this at this time I'd
like to bring up on stage
Patrice Gautier to show you how he has
used the retro web to solve a real-world
problem in a in a deployed and currently
running application trees thanks Miguel
good afternoon so I just want to spend a
few minutes and share with you the the
absolutely tremendous success we're
having with direct toil first thing I'd
like to explain is what we do in one
slide we're in the business of providing
business-to-business infrastructure for
real estate for large companies so we
have customers like Bank of America
Prudential IBM and so on and we provide
them with a mean of basically finding
landlords engaging them negotiating
closing lease and contracts online the
process is long and complex typically
three to six months and it's made
complex because there's a lot of actors
touching this process you have the real
estate department of these companies you
have brokers agents service providers
lawyers architects and so on and they
all do something at some point in the
process so when we model this we end up
with a pretty large set of iou's
something like 300 so as a developer you
know when you start to deal with that
volume of data you should be very scared
because that means a lot of code for you
to write and maintain we have three
production application and they have
7700 unique pages in them
we also have internal applications so
what we decided to do seeing this volume
is we decided to beta base almost all of
our pages on director web something like
95 percent at the moment is using the
very same pages or extended version of
these that Miguel showed you we have
about 2,200 roles but only 18 templates
a lot of our pages come from these
templates about 95 percent
and what that means is we spent our time
mostly doing two things writing business
logic writing little custom components
like the the component that was
shortening the string that Miguel showed
you and doing rules only three per page
and basically the upshot of all this is
that we're able to achieve a tremendous
volume of functionality with very few
people and a lot less time than our
competitors so I have a few screenshots
to show you I hope that they're big
enough for you see this is an example of
this page this is a direct web list page
you can see that it looks nothing like
what Miguel had it has custom navigation
everything you see on this page pretty
much is written by rules from the state
of the navigation the strings you see on
the screen all the names even the the
number of items shown per page and so on
here's a more interesting page we've
added the a wizard creation page which
is a stepped wizard and we've added a
few feature features to the standard
direct web inspect or edit page you can
notice if if you can see them that some
of the fields have stars on their left
which means that they're mandatory one
really interesting characteristic of
direct web pages is that they know what
property of the mother displayed and so
they have access to a lot of information
that is not typical to a direct webpage
they know for example if a property is
mandatory because the mouth contains our
information so it's just a matter of
automatically displaying a star whenever
that is the case and that is done
automatically you'll have anything to do
another thing you can notice is that
some of these fields have units on their
right that that is worth spending a
minute explaining how that works because
that it goes at the very heart of the
raw power what happened is when we have
this app at the beginning it didn't have
any of these units and everybody started
coming back to us and say well we don't
know what parking spaces is expressed as
because sometimes it's a ratio sometimes
the number spot that you really have to
have units so we start thinking about
how can we integrate this with the
direct web page and the answer it turns
out to be really simple we done three
three things the first thing we did is
add an entry in the user info deck
of whatever property were talking about
for example parking spaces we would say
spaces and the user info dictionary in
the model then we add one component that
is able to look up that property in this
plate on the right of the text field and
then we add exactly one rule that says
if on the property you're displaying you
find the unit in the user info
dictionary then use my unit component
and without one rule units show up
throughout the app throughout 700 pages
so you can imagine if you start
expanding on that amount of time you
were able to save other things of
interest on this page notice that we've
also completely changed the way
validation works all the errors are
collected at the top and displayed in a
English format here is a an edit tab
page again we've changed the way it
works we've added sections I don't know
if you can see them but there's three
tabs and two sections in that tab here's
a tab inspect page much the same as the
other what I want to show you on this
page is how the help system works again
direct web doesn't come with a ton of
help and you can see here we have two
kinds of help we have the level I but
ins that are next to each field and that
works the same way as the unit basically
what we've did is create a help database
and let our tech writer access that
database through of course a direct web
application so he or she accesses that
database and creates a help entry for
the size range of our project for
example the scrubber is that bit of
Texas store and database when the app
runs again because it knows we're
properly displaying it's able to look up
that bit of text and display it behind
the eye button if you press the I button
little Jascha window will pop up with
the help and because it knows that it's
attached to that property wherever that
property shows up in the app the help
will be there you don't have to do
anything and similarly the help that you
see on top of the window comes from the
database and our tech writers actually
have the ability to edit the help on the
direct web app and to see the result of
your edit live on the app I don't know
how many of you have to deal with
web design teams or tech rival teams but
typically but it's not what happens you
have to ask them for help files
integrate them in the app and then have
them later look at the result here they
can do it live that's a very big
advantage and here's a slightly more
complex page this is a tab page and has
to pick lists in them this is the page
that we use to engage or reject
responses just to see that you can
actually nest direct web pages with
indirect web pages you have three in
this page so I hope by those few
examples I've shown you that two things
a direct web is not a toy you can scale
to very large amounts of data if you use
it properly it'll be a tremendous tool
to save time and effort to give you a
point of reference our apps the seven
apps that I mentioned the beginning were
developed by about four to six people
over one year our competitors doing the
same type of functionality have teams
between 30 and 80 people
and one last thing I want to mention if
you missed the stepwise announcement on
Tuesday we are open sourcing four of the
base frameworks that are used in those
apps you can find them on our website
I've posted the URL on Omni and the step
wise thank you back can you go whoops
thanks for each thank you so in summary
the work toya integrates into the web
objects development model this isn't any
new strange technology that you have to
you joining curve for you you already
know a lot of what you have to know by
being with objects developers we give
you a head start with a lot of pre-built
functionality we give you an application
for free the default layout on behavior
can be customized that's that was the
main point of the session you you have a
lot of places where you can plug in your
HTML and your code as developers rules
introduce a new level of customization
for your direct web applications so
think Java would also think a higher
Maido level there in your in the way you
develop your applications and of course
direct aware of rules
so there's our lab hours I believe
tomorrow is the last day only half date
up to 3:30 interesting sessions coming
up in this room an advanced talk on EOF
after that in the same room the session
on advanced Java client which uses the
same rule engine of director web which
provides a Java front-end to your
applications and the feedback form
tomorrow contact information
you