TechnologyRediscovery / codenforce

municipal code enforcement database application
GNU General Public License v3.0
2 stars 3 forks source link

Property use type management page #203

Open edarsow opened 3 years ago

edarsow commented 3 years ago

A property use type is a classification of what a given parcel is/can be used for, such as commercial retail, single occupancy dwelling, rental, etc.

Javaland has an object called PropertyUseType that lives inside of a Parcel but there's no management page for a user to actually see a list of all possible PUTs and create new ones, etc.

Existing infrastructure

The PropertyIntegrator already has methods for getting, updating, and inserting property use type: eg:

Your task

Study the page iconManage.xhtml that displays a list of all Icon objects. Note that it has a big table that shows all possible system icons, and each icon has a link/button on each row for viewing the record in a pop-up box. There's also a button at the top that allows you to add a new Icon.

We want to mirror this functionality with PropertyUseType objects. You'll get a list of all the PUTs by asking the PropertyIntegrator for a list of all possible PUTs: public List<PropertyUseType> getPropertyUseTypeList()

You'll keep working with the backing bean called PropertyUseTypeBB modeled after IconBB. Study where IconBB is located in the file structure and create your backing bean alongside IconBB.

PropertyCoordinator methods

Study the PropertyCoordinator: It needs to have methods for inserting updating and deactivating PropertyUseType objects, so methods like insertPropertyUseType(PropertyUseType put) and 'updatePropertyUseType(PropertyUseType put)`. These methods in the coordinator then need to check to make sure values in the PUT align to business rules (i.e. must have a non-null name, description is optional, zone class ID is optional, and Icon is optional)

Advanced project

Note that propertyusetype table contains a foreign key to the icon table. What would be cool is when a user adds or updates a put, they could see the list of Icons and their samples that we can manage on iconManage.xhtml--the page you are using as a template. So you'd have to learn how to select an object from a data table, inject it into the PropertyUseType, and then pass that whole nested bundle through your coordinator and down to the integrator.

Note that when we interact with the business objects (PUTs, or Icons) we usually store the whole java object as a field on the parent (i.e. a Property has a PropertyUseType inside it). Since the DB is keyed to the integer IDs only, the integrator classes, ask the object, "If your Property Use Type is not null, then I'll extract its ID and inject it into the SQL statement and send it down to postgres")

Git

Please create your own git branch off of the branch named recovered to begin your work. DO NOT PUSH TO recovered since Eric is managing final inclusion of revisions on the production branch.

Resources

We are building using the Java Enterprise Edition (Java EE) 7's web container technology. See Oracle's tutorial on this tech and we can discuss a good book if you want paper. Start with the section on the Web tier: Don't forget the EL sub-section

Primefaces showcase shows how we use all the tags that start with <p: