FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First...

29
FSP Tracking System 1.0 FSP Business Agent Design Document Prepared for: Ministry of Forests Information Management Group Document Revision 0.1 May 23, 2006

Transcript of FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First...

Page 1: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

FSP Tracking System 10 FSP Business Agent Design Document Prepared for Ministry of Forests Information Management Group Document Revision 01 May 23 2006

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 2

Document Change Control

REVISION NUMBER DATE OF ISSUE AUTHOR(S) BRIEF DESCRIPTION OF CHANGE

01 June 6 2006 Vivid Solutions First version of the document for internal review

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 3

Document Sign-Off

The undersigned have read and agree with the content of this document Project Leader VIVID Solutions Inc

Project Manager Ministry of Forests

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 4

Table of Contents

1 SCOPE 5

11 REFERENCES 5 12 DOCUMENT CONVENTIONS 5

2 FSP BUSINESS AGENT - HIGH LEVEL OVERVIEW 6

3 FSP BUSINESS AGENT ndash DETAILED SPECIFICATIONS 9

31 BUSINESS AGENT IMPLEMENTATION 9 32 DATA PARSING 9 33 SUBMISSION PROCESSING 11 34 DATA VALIDATION - DAO INTERFACE SPECIFICATIONS12

341FSP_XML_SUBMISSIONUSER_SUBMISSION_DATA 12

342FSP_XML_SUBMISSIONVALID_FSP 13

343FSP_XML_SUBMISSIONACCUMULATE_ORG_UNIT 13

344FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER14

345FSP_XML_SUBMISSIONACCUMULATE_FDU 14

346FSP_XML_SUBMISSIONACCUMULATE_STANDARD 14

347RESULTS_XML_SUBMISSIONACCUMULATE_STANDARDS_LAYER 16

348RESULTS_XML_SUBMISSIONACCUMULATE_SPECIES 17

349FSP_VALIDATE_XMLFSP_VALIDATION 17

3410FSP_PROCESS_XMLPROCESS_XML_SUBMISSION 20

35 REPORTING ERRORS 22

4 SPATIAL PROCESSING29

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 5

1 SCOPE

The scope of this design document includes the components required to process a Forest Stewardship Plan electronic submission received from the Forest Industry or BC Timber Sales More specifically it includes the design specifications for

1 FSP Business Agent ndash The Oracle Advanced Queue (OAQ) Agent that receives the electronic submission from the Electronic Submission Framework validates the data and puts it into the appropriate FSP tables

11 REFERENCES

The document is technical in nature and assumes the reader is familiar with messaging architectures in particular Oracle Advanced Queueing Oracle Spatial GML and Oracle PLSQL Other document references include

FSP Requirements documents Oracle Advanced Queuing Investigation FSPTS Detailed Design FSP XML Schema Specification Logical and physical data models for the FSP Tracking System (See Appendix )

12 DOCUMENT CONVENTIONS

Because this document details with both XML and Oracle table fields often with the same name a document convention has been applied to differentiate the fields XML fields start are enclosed in ltgt and table fields are not Java objects or properties are enclosed in

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 6

2 FSP BUSINESS AGENT - HIGH LEVEL OVERVIEW

The diagram on the following page represents the overall submission process The FSPSVC box shows the processing that is done by the FSP_SVC The boxes on the right side of the diagram represent Oracle packages that perform the business rule validation and storage of the submission in the appropriate FSP tables Each application is either committed or rolled back at the end of the processing by the FSP_SVC The diagram is followed by a detailed description of each step

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 7

FSP_PROCESS_XML

FSP_VALIDATE_XML

FSPSVC

ESF ESF FSP SubmissionFSP XML SubmissionPARSE XML

TOPOLOGY VALIDATION

Cursor of error messages

VALIDATE_FDUS

VALIDATE_STANDARDS

VALIDATE_PLAN_HOLDERS

Cursor of error messages

Invokes

Invokes

Invokes

HANDLE SUBMISSION

Java Representation of Submission

Java Representation of Submission

Java Representation of Submission

VALIDATE FOREST STEWARDSHIP PLAN

MOVE FSP DATA FROM TEMP TABLE TO OPERATIONAL TABLES

COMMIT OR ROLLBACK

Similar to RESULTS but note minor differences in XML elements and some differences in optionality

User submission data (once)

FSP_XML_SUBMISSION (Oracle Package)

ACCUMULATE_STANDARD

USER_SUBMISSION_DATA

ACCUMULATE_LAYER

ACCUMULATE_SPECIES

ACCUMULATE_BGC

Cursor of error messages

Standards Info (Once for each Standard )

Cursor of error messages

BGC BEC Info (Once for each BGC )

Cursor of error messages

Layer Info (Once for each Layer )

Cursor of error messages

Species Info (Once for each Layer Species )

ENSURE VALID USER DATA

ACCUMULATE FSP DATA TO TEMP TABLEUNTIL A COMPLETE APPLICATION IS PROCESSED

Cursor of error messages

Invokes

ACCUMULATE_PLAN_HOLDER

ACCUMULATE_ORG_UNIT

ACCUMULATE_FDU

VALID_FSP

Cursor of error messages

Licensees (Plan Holder ) Info (Once for each Licensee )

Cursor of error messages

Org Units Info (Once for each Org Unit )

Cursor of error messages

FDU Info (Once for each FDU )

Cursor of error messages

FSP Info (Once )

VALIDATE_ORG_UNITS

VALIDATE_FSP

FSP_VALIDATION

Invokes

PROCESS_FDUS

PROCESS_STANDARDS

PROCESS_LICENSEES

Invokes

Invokes

Invokes

Invokes

PROCESS_ORG_UNITS

PROCESS_FSP

PROCESS_XML_SUBMISSION

Invokes

PROCESS_USER_DATA

Invokes

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 8

The high level flow of the submission process futher describing the diagram on the previous page is as follows 1 The FSP business Agent (FSPSVC) receives a message from the Electronic Submission

Framework via an Oracle Message Queue The message is read and the XML is parsed checking well-formed against the FSP XML Schema

2 A set of accumulator stored procedures are called to ldquoaccumulaterdquo the FSP components

of the submission 3 Once the data is accumulated it can be validated Each component of the FSP

submission is validated The complete FSP must validate or the submission is rejected and the appropriate messages are sent back to the submitter to help determine the issues

4 If the submission is valid it is processed and stored in database using the package

FSP_PROCESS_XML The spatial data for the FDUs is also stored in the database 5 Once the data is stored it will be available in the district and licenseersquos INBOX 6 The transaction is either committed or rolled back if any one of these compoents failed

In the case of a rollback the message will be left on the queue and attempted again Causes of failure are typically infrastructure (eg insufficient rollback space)

The following sections provide more detail on each of these steps

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 9

3 FSP BUSINESS AGENT ndash DETAILED SPECIFICATIONS

The XML submission is forestStewardshipPlan centric ie each transactional unit will be encompassed within ltforestStewardshipPlangt and ltforestStewardshipPlangt tag pairs All data within this block will be related to the FSP as defined in this block Only at single FSP unit can exist in the same submission although the business rule may change in a later release to allow a licensee to submit multiple FSPs in a single submission For information on the schema please see the FSP Submission Schema and an example FSP submission

31 BUSINESS AGENT IMPLEMENTATION

The FSP Business Agent will be written as a Java Application that will listen for messages on an Oracle Advanced Queue The implementation will start with the base class as defined in the Electronic Submission Framework project The base class will define the methods for manipulating (eg Add view remove) messages on an Oracle Advanced Queue Refer to the Agent Design Section of the ESF Queue Agent Best Practices Document for the specific details on how to create a message agent See also ESF Submissions Web Service ndash Client Developerrsquos Guide The remainder of this section provides the more detailed processing that the FSP Business Agent must implement once it receives a new submission from the queue

32 DATA PARSING

Parsing of a submission will be done using VIXB (Vivid XML Binding) The XML will be parsed into a set of java objects modelling the XML For more information on VIXB see the VIXB users guide In a nutshell VIXB configures a SAX XML parser with call backs to a Sax handler The handler then passes the parsed data to tag-specific extractors which know how to ldquoextractrdquo the data When the extractor is complete it then calls an application specific processor The processor is then responsible to perform validation and processing Following is a UML class diagram of the FSP domain classes which will be created Note some of these entities may already be defined for previous MoFR apps and can be named or refactored accordingly however the XML tag information is specific to FSP and must be parsed and validated accordingly For clarity not all gettersetter methods are included

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 10

+getName() string(idl)+setName()+getFSP_ID() unsigned long(idl)+setAmendment()+getAmendment() short(idl)+getStatus() short(idl)+setStatus()+setPlanStartDate()+getPlanStartDate() long long(idl)+getPlanTerm() short(idl)+setPlanTerm()+getPlanContactPerson() PlanContactPerson+requiresApproval() boolean(idl)+setRequiresApprovalInd()

-planName string(idl)-FSP_ID unsigned long(idl)-amendmentNumber short(idl) = 0-dateSubmitted unsigned long(idl)-status-planStartDate unsigned long(idl)-planTerm short(idl) = 5-requiresApprovalInd boolean(idl)

ForestStewardShipPlan

-name string(idl)

ForestDevelopmentUnit

-bgcZone string(idl)-bgcSubzone string(idl)-bgcVariant string(idl)-bgcPhase string(idl)-bgcSiteSeries string(idl)-bgcSiteType string(idl)-gbcSeral string(idl)-maxAllowableDisturbance float(idl)-standardsRationale string(idl)-regenObligationInd boolean(idl)-regenOffseti short(idl)-earlyOffset short(idl)-lateOffset short(idl)

StockingStandard-clientCode string(idl)-licenceNumber string(idl)

PlanHolder

1

0

1

0

1

1

-licenceNumber string(idl)

ForestLicence

1

1

-

spatial

1

1

+getDistrictCode() string(idl)

-districtCode string(idl)

OrgUnit

1 1

+getName() string(idl)+setName()+getEmail() string(idl)+setEmail()+getPhone() unsigned long(idl)+setPhone()

-Name string(idl)-emailAddress string(idl)-telephone unsigned long(idl)

PlanContactPerson

11

Amended FSP might not include stocking standards

Amended FSP might not include FDUs

-stockingLayerCode string(idl)-wellSpaced unsigned long(idl)-minPrefWellSpaced unsigned long(idl)-residualBasalArea unsigned long(idl)-minHorizontalDistance unsigned long(idl)-minPostSpacing unsigned long(idl)-maxPostSpacing unsigned long(idl)-maxConifer unsigned long(idl)-heightRelativeToComp unsigned long(idl)-heightRelativeToCompCode string(idl)

StandardLayer

1

1

-speciesCode string(idl)-minHeight float(idl)-preferredSpeciesInd boolean(idl)

StandardLayerSpecies11

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 11

33 SUBMISSION PROCESSING

All the data for a Forest Stewardship Plan is required in order to validate it To address this all the data for an FSP is ldquoaccumulatedrdquo in temporary database tables Once the data is accumulated validation can occur Accumulation is done by calling functions in the FSP_XML_SUBMISSION package Validation functions are implemented in the FSP_VALIDATION package General Note 1 All procedures have at least one ldquoOUTrdquo parameter This is a string that will

contain any error messages that occur during the operation Other ldquoOUTrdquo parameters will be database identifying values for that object that are required for future processes (ie other agents) and so must be stored

2 For the initial FSP submission (amendment 0) the submitter must submit at least

one document as an attachment a a legal FSP document (MSWord or PDF) (Error 1) b The submitter may also include other supporting documentation as

attached files c The files must have approved extension (doc pdf xls zip jpg) (Error

2)

The pseudo code to validate a Forest Stewardship Plan is as follows

Begin Transaction

Call FSP_XML_SUBMISSIONUSER_SUBMISSION_DATA once

Call FSP_XML_SUBMISSIONVALID_FSP once

Call FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER for each ltplanHoldergt

For each OrgUnit element

Call FSP_XML_SUBMISSIONACCUMULATE_ORG_UNIT

For each PlanHolder element

Call FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER

For each ForestDevelopmentUnit Call FSP_XML_SUBMISSIONACCUMULATE_FDU

For each StockingStandard element

Call FSP_XML_SUBMISSIONACCUMULATE_STANDARD

For each StandardLayer element

Call FSP_XML_SUBMISSIONACCUMULATE_LAYER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 12

For each StandardLayerSpecies

Call FSP_XML_SUBMISSIONACCUMULATE_SPECIES

Call FSP_VALIDATE_XMLFSP_VALIDATION

If errors then

ROLLBACK the transaction

Note If system erros then return false to base agent so job is left on queue If validation errors then return true to remove job from queue and error messages are sent back to the client

Else

Call FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

COMMIT

34 DATA VALIDATION - DAO INTERFACE SPECIFICATIONS

This section details the interface between the Java business agent and the Oracle packages that implement amalgamation validation and processing It can be used in conjunction with the previous sections to define the detailed package interface

341 FSP_XML_SUBMISSIONUSER_SUBMISSION_DATA

Capture the submission metadata coming from ESF Confirm that the individual making the FSP submission has valid authority

to submit via ESF (Error 3)

PROCEDURE USER_SUBMISSION_DATA( P_FSP_SUBMISSION_ID IN NUMBER

P_SUBMITTED_BY IN VARCHAR2 P_CLIENT_NUMBER IN VARCHAR2 P_CLIENT_LOCN_CODE IN VARCHAR2 P_ORG_UNIT_NO IN NUMBER P_SUBMISSION_TIMESTAMP IN DATE P_USER_FILENAME IN VARCHAR2 P_USER_AUTHORITY IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_SUBMISSION_ID Comes from file message from ESF

P_SUBMITTED_BY Comes from file message from ESF

P_CLIENT_NUMBER Comes from file message from ESF

P_CLIENT_LOCN_CODE Comes from file message from ESF

P_ADMIN_DISTRICT_NO orgUnitNo from submission metadata ltdistrictCodegt value

P_SUBMISSION_TIMESTAMP Comes from file message from ESF

P_USER_FILENAME Comes from file message from ESF

P_USER_AUTHORITY Set to lsquoACrsquo

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 13

342 FSP_XML_SUBMISSIONACCUMULATE_FSP

Call once for the ltForestStewardshipPlangt entity Ensure only one such entity is included If no errors are returned then proceed If FSP already exists (this is an amendment) return the FSP_ID PROCEDURE VALID_FSP (P_FSP_ID IN OUT NUMBER

P_PLAN_NAME IN VARCHAR2 P_PLAN_TERM_YEARS IN NUMBER P_PLAN_TERM_COMMENCEMENT IN DATE P_ACTION_CODE IN VARCHAR2 P_SUBMITTER_NAME IN VARCHAR2 P_SUBMITTER_EMAIL IN VARCHAR2 P_SUBMITTER_TELEPHONE IN VARCHAR2 P_AMENDMENT_IND IN VARCHAR2 P_AMENDMENT_COMMENT IN VARCHAR2 P_AMENDMENT_APPROVAL_IND IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_OPENING_ID ltfspIDgt or from previous procedure call

P_PLAN_NAME ltplanNamegt

P_PLAN_TERM_YEARS ltplanTermYearsgt

P_PLAN_TERM_COMMENCEMENT ltplanTermCommencementgt

P_ACTION_CODE ltactionCodegt

P_SUBMITTER_NAME ltlicenseeContactgt

P_SUBMITTER_EMAIL ltemailAddressgt

P_SUBMITTER_TELEPHONE lttelphoneNumbergt

P_AMENDMENT_IND ltamendmentIndgt

P_AMENDMENT_COMMENT ltamendmentCommentgt

P_AMENDMENT_APPROVAL_IND ltadmendmentApprovalRequiredgt

343 FSP_XML_SUBMISSIONACCUMULATE_ORG_UNIT

Call once for each ltdistrictCodePropertygt in ltForestStewardshipPlangt PROCEDURE ACCUMULATE_PLAN_HOLDER(

P_FSP_ID IN NUMBER P_DISTRICT_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_DISTRICT_CODE ltdistrictCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 14

344 FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER

Call once for each ltPlanHoldergt in the FSP PROCEDURE ACCUMULATE_PLAN_HOLDER(

P_FSP_ID IN NUMBER P_CLIENT_NUMBER IN VARCHAR2 P_CLIENT_LICENSE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_CLIENT_NUMBER Comes from file message from ESF

P_CLIENT_LICENCE Comes from file message from ESF

345 FSP_XML_SUBMISSIONACCUMULATE_FDU

Call once for each ltFDUgt in the FSP PROCEDURE ACCUMULATE_FDU(

P_FSP_ID IN NUMBER P_FDU_NAME IN VARCHAR2 P_CLIENT_LICENCES IN VARRAY OF VARCHAR2 P_GEOMETRY IN MDSYSSDO_GEOMETRY P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_FDU_NAME ltfduNamegt

P_CLIENT_LICENCES ltFDUgtltlicenseNumbergt

P_GEOMETRY FDU ltextentOfgt as SDO_GEOMETRY

346 FSP_XML_SUBMISSIONACCUMULATE_STANDARD

Call once for each ltStockingStandardgt in the FSP

PROCEDURE ACCUMULATE_STANDARD( P_STANDARDS_REGIME_ID IN OUT NUMBER P_STANDARDS_REGIME_NAME IN VARCHAR2 P_STANDARDS_OBJECTIVE IN VARCHAR2 P_REGEN_DELAY_OFFSET_YRS IN NUMBER P_REGEN_OBLIGATION_IND IN VARCHAR2 P_EARLY_OFFSET_YRS IN NUMBER P_LATE_OFFSET_YRS IN NUMBER P_GEOGRAPHIC_DESCRIPTION IN VARCHAR2 P_ADDITIONAL_STANDARDS IN VARCHAR2

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 15

P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt

P_STANDARDS_REGIME_NAME ltstandardsRegimeNamegt

P_STANDARDS_OBJECTIVE ltstandardsObjectivegt

P_REGEN_DELAY_OFFSET_YRS ltregenOffsetgt from regenObjectivesProperty

P_REGEN_OBLIGATION_IND ltregenObligationIndgt from regenObjectivesProperty

P_EARLY_OFFSET_YRS ltearlyOffsetgt from regenObjectivesProperty

P_LATE_OFFSET_YRS ltlateOffsetgt from regenObjectivesProperty

P_GEOGRAPHIC_DESCRIPTION ltgeographicDescriptiongt

P_ADDITIONAL_STANDARDS ltadditionalStandardsgt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 16

347 RESULTS_XML_SUBMISSIONACCUMULATE_STANDARDS_LAYER

For each StandardLayer within a Standards Regime call

PROCEDURE ACCUMULATE_STANDARDS_LAYER (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_STOCKING_LAYER_ID OUT NUMBER P_TARGET_STOCKING IN NUMBER P_RESIDUAL_BASAL_AREA IN NUMBER P_MIN_HORIZONTAL_DISTANCE IN NUMBER P_MIN_PREF_STOCKING_STANDARD IN NUMBER P_MIN_POST_SPACING IN NUMBER P_MIN_STOCKING_STANDARD IN NUMBER P_MAX_POST_SPACING IN NUMBER P_MAX_CONIFER IN NUMBER P_HGHT_RELATIVE_TO_COMP IN NUMBER P_HGHT_RELATIVE_COMP_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID From ltstandardsRegimeIdgt or previous procedure

P_STOCKING_LAYER_CODE ltstockingLayerCodegt

P_STOCKING_LAYER_ID This value is returned

P_TARGET_STOCKING ltwellSpacedgt

P_RESIDUAL_BASAL_AREA ltresidualBasalAreagt

P_MIN_HORIZONTAL_DISTANCE ltminHorizontalDistancegt

P_PREF_STOCKING_STANDARD ltminPrefWellSpacedgt

P_MIN_POST_SPACING ltminPostSpacinggt

P_MIN_STOCKING_STANDARD ltminStockingStandardgt

P_MAX_POST_SPACING ltmaxPostSpacinggt

P_MAX_CONIFER ltmaxConifergt

P_HGHT_RELATIVE_COMP ltheightRelativeToCompgt

P_HGHT_RELATIVE_COMP_CODE ltheightRelativeToCompCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 17

348 RESULTS_XML_SUBMISSIONACCUMULATE_SPECIES

Call once for each StandardLayerSpecies within a StandardLayer

PROCEDURE ACCUMULATE_SPECIES (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_SPECIES_CODE IN VARCHAR2 P_STOCKING_LAYER_ID IN NUMBER P_PREFERRED_IND IN VARCHAR2 P_MIN_HEIGHT IN NUMBER P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt or previous procedure

P_STOCKING_LAYER_CODE STOCKING_LAYER_CODE from StandardLayer

P_SPECIES_CODE ltspeciesCodegt

P_STOCKING_LAYER_ID STOCKING_LAYER_ID from StandardLayer

P_STOCKING_STANDARD_UNIT_ID STOCKING_STANDARD_UNIT_ID from StandardLayer

P_PREFERRED_IND ltpreferredSpeciesIndgt

P_MIN_HEIGHT ltminHeightgt

P_SUBMITTED_BY Comes from file message from ESF

349 FSP_VALIDATE_XMLFSP_VALIDATION

Call after the the submission has been accumulated and no errors were returned FSP_VALIDATION is a procedure that calls a chain of other procedures that validate parts of the submission data The overall results are returned

FSP_VALIDATE_XMLVALIDATE_PLAN_HOLDER

BUSINESS RULES

At least one named licensee (forest client) forest licence pair in ltPlanHoldergt (Error 4 5 6)

That each named licensee actually exists and owns the licence listed

(Error 7)

FSP_VALIDATE_XMLVALIDATE_ORG_UNITS

BUSINESS RULES

At least one ltdistrictCodegt named (Error 8) Code resolves to a valid existing MoFR Forest District (Error 9)

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 18

FSP_VALIDATE_XMLVALIDATE_FSP

BUSINESS RULES

Ensure only a single ltForestStewardshipPlangt entity is included (Error 10)

Submission metadata ltlicenseeContactgt(Error 11)

ltemailAddressgt(Error 12) and lttelephoneNumbergt (Error 13) provided (no nulls)

Is this an original submission or an amendment (ltamendmentIndicatorgt)

(Error 14)

If original submission confirm o Plan name provided (Error 15) o Required document attached

FSP legal plan document (Error 1) o At least one ltForestDevelopmentUnitgt included (Error 16) o At least one ltStockingStandardgt included (Error 17)

ltfspIDgt (conditional) this is amendment or update

o If provided ensure a matching FSP_ID already exists in the database (Error 18)

o If existing FSP_ID status = ldquoApprovedrdquo this must be an amendment ensure that ltamendmentIndgt = ldquoTrdquo (Error 19)

o If existing FSP_ID status = ldquoRejectedrdquo this is a mistaken attempt to re-submit the same FSP (Error 20)

o If existing FSP_ID status = ldquoDraftrdquo this is an update anything submitted will overwrite existing FSP_ID record

ltplanNamegt (conditional)

o If provided and no ltfspIDgt provided this is a new submission Ensure that ltamendmentIndgt = lsquoFrsquo (Error 21)

ltplanTermgt (optional) if included is less than or equal to 5 (Error 22) ltplanStartDategt (optional) if included is valid date (Error 23) ltactionCodegt

o if ldquoNrdquo (New) Must be new FSP ensure no matching FSP_ID

FSP_AMENDMENT_NUMBER primary key already exists o if ldquoUrdquo (Update)

Must be existing FSP ensure a match to FSP_ID and FSP_AMENDMENT_NUMBER key exists

Existing FSP must be in ldquoDraftrdquo status o if ldquoArdquo (Append)

Must an existing FSP in ldquoDraftrdquo status Explicitly designed for appending GML map data to an

existing FSP

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 19

Must not already by any FOREST_DEVELOPMENT_UNIT entries for this FSP

ltamendmentIndgt (mandatory)

o Must be one of ldquoTrdquo or ldquoFrdquo (Error 24) o If ldquoTrdquo ensure ltfspIDgt provided and matches an existing FSP_ID in

the database (error 25) also ensure that the status of the existing FSP_ID = ldquoApprovedrdquo (error 26)

o If ldquoFrdquo and no ltfspIDgt provided this is a new submission o If ldquoFrdquo and ltfspIDgt provided must be an update ensure it

matches an existing FSP_ID with status = ldquoDraftrdquo (Error 27) ltamendmentApprovalRequiredIndgt (conditional)

o If ltamendmentIndgt is ldquotruerdquo must be included and set to one of ldquoTrdquo or ldquoFrdquo (Error 28)

FSP_VALIDATE_XMLVALIDATE_FDUS

BUSINESS RULES

Validate Geometry o polygon area gt 0 o polygon boundary length gt 0 o Other

Validate Identifier o ltfduNamegt must exist and not be null (Error 29) o ltfduNamegt must be unique within the FSP (no duplicates) (Error

30)

Validate Licences o Each FDU must have at least one forest licence applying (Error 31) o Each licence must be owned by one of the licensees listed for this

FSP ltplanHoldergtltlicenceNumbergt (Error 32)

FSP_VALIDATE_XMLVALIDATE_STANDARDS

BUSINESS RULES

Stocking Standards o For FSPs the stocking standard is nearly identical to the

ltStandardsAmendmentTypegt in the RESULTS schema with the following exceptions

The following elements from RESULTS ltStandardsTypegt have been added

ltbgcZonegt ltbgcSubzonegt ltbgcVariantgt ltbgcPhasegt ltbgcSiteSeriesgt ltbgcSiteTypegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 20

ltbgcSeralgt ltmaximumAllowableSoilDisturbancegt

o Therefore the equivalent Validation procedures from Results 30 can be used here with minor amendments

o FSP Stocking Standards do not have a spatial component and are not linked to any piece of ground

3410 FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

Call if no errors returned in any of the steps above PROCEDURE PROCESS_XML_SUBMISSION(

P_POST IN VARCHAR2 P_RESULTS OUT ref_results)

Procedure parameter Data Value P_POST Validate only indicator from fsp

submission metadata

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 21

The following diagram shows the decision points on how to process the submission depending on input parameters The pre-defined states refer procedures defined below

ltfspIDgt

Y

ltplanNamegt

N Error must havePlan name

N

fspID ==FSP_ID

Error UnknownFSP

N

FSP_IDSTATUS

Y

Error cannotUpdate or amend

RejectedSubmitted

ltamendmentIndgt

Approved

Error amendment requiredF

AmendApproval

Ind

T

AmendmentTo

Inbox

T

AmendmentAuto

Approve

UpdateExisting

PlanDraft

Create NewFSP

Y

End

End

End

FSP with same FSP_ID exists in database

FSP Submission

Validate

ESF FSPSubmissionAccumulate

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 22

3411 CREATE_NEW_FSP

This procedure will create a new ForestStewardshipPlan and all related entities in the production database

FOREST_STEWARDSHIP_PLAN TABLE

Source Destination FSP_SEQNEXTVAL FSP_ID 0 FSP_AMENDMENT_NUMBER STATUS for ldquoSubmittedrdquo FSP_STATUS_CODE ltplanNamegt PLAN_NAME ltplanTermYearsgt PLAN_TERM_YEARS ltplanTermCommencementgt PLAN_START_DATE ltplanTermCommencementgt + ltplanTermYearsgt

PLAN_END_DATE

ESF submission date PLAN_SUBMISSION_DATE ltlicenseeContactgt CONTACT_NAME lttelphoneNumbergt TELEPHONE_NUMBER ltemailAddressgt EMAIL_ADDRESS

FSP_AGREEMENT_HOLDER TABLE

Source Destination ltPlanHoldergtltclientCodegt CLIENT_NUMBER

FSP_ORG_UNIT TABLE

Source Destination ORG_UNITORG_UNIT_NO for ltdistrictCodegt

ORG_UNIT_NO

FSP_STATUS_HISTORY TABLE

Source Destination FSP_STATUS_HISTORY_SEQ FSP_STATUS_HISTORY_ID ldquoSubmittedrdquo code from FSP_STATUS_CODE

FSP_STATUS_CODE

ldquoNew Submissionrdquo STATUS_COMMENT

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 23

FSP_ATTACHMENT TABLE

Source Destination ESF framework ATTACHMENT_DESCRIPTION ATTACHMENT_NAME ATTACHMENT_SIZE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

3412 UPDATE_EXISTING_PLAN

For ESF submissions only the FDU map spatial component ltFDUPropertygt can be submitted as an update Part of the validation is to ensure that no other data is included with the ESF submission file except ltfspIDgt and ltFDUPropertygt This may be an INSERT or an UPDATE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination ltfspIDgt FSP_ID FOREST_STEWARDSHIP_PLAN FSP_AMENDMENT_NUMBER

FSP_AMENDMENT_NUMBER

FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 24

3413 AMENDMENT_AUTO_APPROVE

This is to create an amendment that does not require approval It is in effect a new FSP submission that automatically goes to ldquoApprovedrdquo status and increments the FSP_AMENDMENT_NUMBER Processing depends on what the licensee has submitted It may be one or more of

headeradministrative information (such as adding a new licensee) or amending a plan term

a new legal FSP document a new GML map of all the FDUs (spatial data if amended must be

completely replaced) new stocking standards

Process the data as if it were a new submission (see above) with the following exceptions

Do an INSERT INTO FOREST_STEWARDSHIP_PLAN setting FSP_AMENDMENT_NUMBER = MAX(FSP_AMENDMENT_NUMBER) + 1

Copy all fields from FOREST_STEWARDSHIP_PLAN from the most recent amendment (or the original submission record if no amendments)

UPDATE any fields in FOREST_STEWARSHIP_PLAN for this new entry that are provided in the XML submission that is any of ltplanNamegt ltplanTermYearsgt ltplanTermCommencementgt ltlicenseeContactgt lttelephoneNumbergt ltemailAddressgt

Any attachments must be INSERTed into FSP_ATTACHMENT with the new FSP_AMENDMENT_NUMBER (also FSP_ATTACHMENT_CONTENT)

Set FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoAPPRrdquo for this new record

INSERT INTO FSP_STATUS_HISTORY (FSP_STATUS_HISTORY_ID FSP_ID FSP_AMENDMENT_NUMBER FSP_STATUS_CODE STATUS_COMMENT) VALUES (SEQNEXTVAL ltFSP_IDgt ltnew FSP_AMENDMENT_NUMBERgt ldquoAPPRrdquo ltamendmentCommentgt) Be sure to use the new FSP_AMENDMENT_NUMBER in INSERTing any STANDARDS_REGIME or FOREST_DEVELOPMENT_UNIT records

3414 AMENDMENT_TO_INBOX

This is to create an amendment that requires approval The FSP submission is put in ldquoSubmittedrdquo status so that it will show up in the relevant District Inboxes The FSP_AMENDMENT_NUMBER is incremented Proceed as above (AMENDMENT_AUTO_INCREMENT) except

SET FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoSUBMrdquo (for Submitted)

SET FSP_STATUS_HISTORYSTATUS_CODE = ldquoSUBMrdquo for new record

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 25

35 DOMAIN CODES

The following codes will be set up in the database in static code tables (all fields are VARCHAR2)

FSP_STATUS_CODE TABLE

FSP_STATUS_CODE DESCRIPTION SUBM Submitted DRFT Draft APPR Approved REJ Rejected OTBH Opportunity To Be Heard

FSP_REVIEW_MILESTONE_TYPE_CODE TABLE

FSP_REVIEW_MILESTONE_ TYPE_CODE

DESCRIPTION

FNR First Nations Review CampE Results amp Strategies reviewed by CampE TEN Objectives Results amp Strategies reviewed by

Tenures DDM Sent to DDM for Determination OTHR Other

FSP_ATTACHMENT_TYPE_CODE TABLE

FSP_ATTACHMENT_TYPE_CODE DESCRIPTION FSP FSP legal document MAP Map of FDUs SS Stocking Standards report AMDS Amendment Description DDMD DDM Decision Letter OTHR Other Attachment

FEATURE_CLASSES TABLE

FEATURE_CLASS_SKEY DESCRIPTION FEATURE_CLASS_KEY To be defined

36 REPORTING ERRORS

If an error is detected in a submission it must be reported back to the electronic submission framework The method for doing that is to post a message to a queue detailing the submission number and the error message The licensee will be able to check back to the Electronic Submission WebSite and view the error The Electronic Submission Framework will also send an email to the client detailing the message

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 26

The specification for how to report an error can be found in the ESF Queue Agent Best Practices Document The message content for FSP will be a concatenation of the ltFSP Submission IDgt ltDescriptiongt field and the message returned from the validation routines above To send a message about a submission you will need to supply the FSP submission ID for the submission The FSP submission ID is supplied with the message from ESF and stored in the FSP_ELECTRONIC_SUBMISSION table Refer to the Status Agent in the ESF Queue Agent Best Practices document for details on how to send a message to ESF The following code is provided as a sample only and the final syntax should be from the ESF Queue Agent Best Practices Document StatusAgent sa = new StatusAgent (ldquoFSP Business Agentrdquo) sasendStatus (ltForestStewardshipPlanSubmissionIDgt StatusMessageREJECTED ldquo100rdquo ltForestStewardshipPlangtlt083D02800509gt + ldquofailedrdquo + outMessage) saclose() Note Expectation is that outmessage will contain details as to what part of the FSP failed (eg Tenure Forest Development Unit or Stocking Standard) In the case of invalid data processing stops at this point for the FSP No data for this submission will be added to FSP database

361 ERROR MESSAGES

These error messages may be generated during the accumulation validation and processing phases They are referenced by number in the procedure documentation above

1 A legal FSP document must be attached to this submission Please attach a document containing your Forest Stewardship Plan

2 The attached file ltnamegt does not have a recognizable file extension Atachments must be one of MSWord (doc) Portable Document Format (pdf) MS Excel (xls) ZIP archive (zip) or JPEG graphic (jpg) Please resubmit with appropriate file attachments

3 You do not have the proper authority to submit an FSP via ESF Please contact the appropriate MoFR District office to obtain the necessary ldquoSubmitterrdquo authority role

4 The FSP submitted does not name any plan holders At least one holder of a major BC Forest license must be named in the plan

5 No forest license number was found for a named plan holder You must name all forest licenses which apply within the FSP

6 A plan holderrsquos license number could not be verified Please check the validity of the plan holder MoFR client codes

7 A forest license number listed is not owned by any of the plan holders of this FSP Please check the validity of the plan holder MoFR client codes and their licence numbers

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 27

8 At least one BC Forest District must be listed for this FSP Each District responsible for the area included in the FSP must be listed

9 The MoFR District Code is not recognized Please check the spelling of the District code(s) included or check with the appropriate District office for the proper code

10 More than one Forest Stewardship Plan (FSP) was included in this submission At the present time each ESF submission may contain only a single FSP

11 The submission must include the name of a contact person responsible for communicating with MoFR about this FSP submission

12 The submission must include the email address of a contact person responsible for communicating with MoFR about this FSP submission

13 The submission must include the telephone number of a contact person responsible for communicating with MoFR about this FSP submission

14 The submission must indicate whether or not this is an original FSP or an amendment to an existing FSP

15 The FSP must have a name 16 The FSP must include at least one Forest Development Unit (FDU) 17 The FSP must include at least one Stocking Standard 18 This submission refers to an FSP that does not exist in the Ministryrsquos

database Please check the FSP ID number provided after your original submission

19 An FSP with the same FSP ID number already exists in the Ministryrsquos database yet you have not indicated that this is an amendment If the intention is to amend an existing FSP please include the correct FSP ID and make sure the ltamendmentIndgt flag is set to ldquotruerdquo

20 The FSP you are trying to amend has been rejected You cannot amend or replace a rejected FSP You must make a brand new submission When doing so do not include an FSP ID number

21 The submission appears to be a new FSP yet the amendment indicator is set to true (ltamendmentIndgt = ldquotruerdquo) Either provide an FSP ID to amend an existing FSP or set the amendment indicator to ldquofalserdquo

22 The FSP plan term has been set to greater than 5 years FSPs are valid for a maximum of 5 years unless an extension is approved

23 The plan commencement date provided is not valid 24 A value for ltamendmentIndgt must be provided it must be set to either ldquotruerdquo or ldquofalserdquo

25 The submission appears to be for an FSP amendment (ltamendmentIndgt = ldquotruerdquo) however no FSP is referenced Please be sure to include the FSP ID number provided with the original submission

26 You cannot amend an FSP that is not approved Ensure you have provided the correct FSP ID number issued with the original submission and confirm that the FSP is approved

27 An FSP with the same FSP ID number already exists in the database Before you can update this FSP it must be placed in Draft status by the District Manager

28 The submission appears to be an amendment to an existing FSP However you have not stated whether or not this amendment requires Ministry approval Please ensure that the ltamendmentApprovalRequiredIndgt is set to one of ldquotruerdquo or ldquofalserdquo

29 A Forest development Unit (FDU) was submitted without a name A name must be provided for each FDU

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 28

30 The same name has been provided for more than one Forest Development Unit (FDU) Each FDU in a submission must have a unique name

31 A Forest Development Unit (FDU) was submitted that did not list a forest licence number that applies Each FDU must have at least one license number applied

32 A forest license number was supplied that does not appear to be owned by any of the plan holders for this FSP Each Forest Development Unit (FDU) must be listed with at least one forest license owned by one of the plan holders for this FSP

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting

Page 2: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 2

Document Change Control

REVISION NUMBER DATE OF ISSUE AUTHOR(S) BRIEF DESCRIPTION OF CHANGE

01 June 6 2006 Vivid Solutions First version of the document for internal review

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 3

Document Sign-Off

The undersigned have read and agree with the content of this document Project Leader VIVID Solutions Inc

Project Manager Ministry of Forests

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 4

Table of Contents

1 SCOPE 5

11 REFERENCES 5 12 DOCUMENT CONVENTIONS 5

2 FSP BUSINESS AGENT - HIGH LEVEL OVERVIEW 6

3 FSP BUSINESS AGENT ndash DETAILED SPECIFICATIONS 9

31 BUSINESS AGENT IMPLEMENTATION 9 32 DATA PARSING 9 33 SUBMISSION PROCESSING 11 34 DATA VALIDATION - DAO INTERFACE SPECIFICATIONS12

341FSP_XML_SUBMISSIONUSER_SUBMISSION_DATA 12

342FSP_XML_SUBMISSIONVALID_FSP 13

343FSP_XML_SUBMISSIONACCUMULATE_ORG_UNIT 13

344FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER14

345FSP_XML_SUBMISSIONACCUMULATE_FDU 14

346FSP_XML_SUBMISSIONACCUMULATE_STANDARD 14

347RESULTS_XML_SUBMISSIONACCUMULATE_STANDARDS_LAYER 16

348RESULTS_XML_SUBMISSIONACCUMULATE_SPECIES 17

349FSP_VALIDATE_XMLFSP_VALIDATION 17

3410FSP_PROCESS_XMLPROCESS_XML_SUBMISSION 20

35 REPORTING ERRORS 22

4 SPATIAL PROCESSING29

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 5

1 SCOPE

The scope of this design document includes the components required to process a Forest Stewardship Plan electronic submission received from the Forest Industry or BC Timber Sales More specifically it includes the design specifications for

1 FSP Business Agent ndash The Oracle Advanced Queue (OAQ) Agent that receives the electronic submission from the Electronic Submission Framework validates the data and puts it into the appropriate FSP tables

11 REFERENCES

The document is technical in nature and assumes the reader is familiar with messaging architectures in particular Oracle Advanced Queueing Oracle Spatial GML and Oracle PLSQL Other document references include

FSP Requirements documents Oracle Advanced Queuing Investigation FSPTS Detailed Design FSP XML Schema Specification Logical and physical data models for the FSP Tracking System (See Appendix )

12 DOCUMENT CONVENTIONS

Because this document details with both XML and Oracle table fields often with the same name a document convention has been applied to differentiate the fields XML fields start are enclosed in ltgt and table fields are not Java objects or properties are enclosed in

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 6

2 FSP BUSINESS AGENT - HIGH LEVEL OVERVIEW

The diagram on the following page represents the overall submission process The FSPSVC box shows the processing that is done by the FSP_SVC The boxes on the right side of the diagram represent Oracle packages that perform the business rule validation and storage of the submission in the appropriate FSP tables Each application is either committed or rolled back at the end of the processing by the FSP_SVC The diagram is followed by a detailed description of each step

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 7

FSP_PROCESS_XML

FSP_VALIDATE_XML

FSPSVC

ESF ESF FSP SubmissionFSP XML SubmissionPARSE XML

TOPOLOGY VALIDATION

Cursor of error messages

VALIDATE_FDUS

VALIDATE_STANDARDS

VALIDATE_PLAN_HOLDERS

Cursor of error messages

Invokes

Invokes

Invokes

HANDLE SUBMISSION

Java Representation of Submission

Java Representation of Submission

Java Representation of Submission

VALIDATE FOREST STEWARDSHIP PLAN

MOVE FSP DATA FROM TEMP TABLE TO OPERATIONAL TABLES

COMMIT OR ROLLBACK

Similar to RESULTS but note minor differences in XML elements and some differences in optionality

User submission data (once)

FSP_XML_SUBMISSION (Oracle Package)

ACCUMULATE_STANDARD

USER_SUBMISSION_DATA

ACCUMULATE_LAYER

ACCUMULATE_SPECIES

ACCUMULATE_BGC

Cursor of error messages

Standards Info (Once for each Standard )

Cursor of error messages

BGC BEC Info (Once for each BGC )

Cursor of error messages

Layer Info (Once for each Layer )

Cursor of error messages

Species Info (Once for each Layer Species )

ENSURE VALID USER DATA

ACCUMULATE FSP DATA TO TEMP TABLEUNTIL A COMPLETE APPLICATION IS PROCESSED

Cursor of error messages

Invokes

ACCUMULATE_PLAN_HOLDER

ACCUMULATE_ORG_UNIT

ACCUMULATE_FDU

VALID_FSP

Cursor of error messages

Licensees (Plan Holder ) Info (Once for each Licensee )

Cursor of error messages

Org Units Info (Once for each Org Unit )

Cursor of error messages

FDU Info (Once for each FDU )

Cursor of error messages

FSP Info (Once )

VALIDATE_ORG_UNITS

VALIDATE_FSP

FSP_VALIDATION

Invokes

PROCESS_FDUS

PROCESS_STANDARDS

PROCESS_LICENSEES

Invokes

Invokes

Invokes

Invokes

PROCESS_ORG_UNITS

PROCESS_FSP

PROCESS_XML_SUBMISSION

Invokes

PROCESS_USER_DATA

Invokes

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 8

The high level flow of the submission process futher describing the diagram on the previous page is as follows 1 The FSP business Agent (FSPSVC) receives a message from the Electronic Submission

Framework via an Oracle Message Queue The message is read and the XML is parsed checking well-formed against the FSP XML Schema

2 A set of accumulator stored procedures are called to ldquoaccumulaterdquo the FSP components

of the submission 3 Once the data is accumulated it can be validated Each component of the FSP

submission is validated The complete FSP must validate or the submission is rejected and the appropriate messages are sent back to the submitter to help determine the issues

4 If the submission is valid it is processed and stored in database using the package

FSP_PROCESS_XML The spatial data for the FDUs is also stored in the database 5 Once the data is stored it will be available in the district and licenseersquos INBOX 6 The transaction is either committed or rolled back if any one of these compoents failed

In the case of a rollback the message will be left on the queue and attempted again Causes of failure are typically infrastructure (eg insufficient rollback space)

The following sections provide more detail on each of these steps

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 9

3 FSP BUSINESS AGENT ndash DETAILED SPECIFICATIONS

The XML submission is forestStewardshipPlan centric ie each transactional unit will be encompassed within ltforestStewardshipPlangt and ltforestStewardshipPlangt tag pairs All data within this block will be related to the FSP as defined in this block Only at single FSP unit can exist in the same submission although the business rule may change in a later release to allow a licensee to submit multiple FSPs in a single submission For information on the schema please see the FSP Submission Schema and an example FSP submission

31 BUSINESS AGENT IMPLEMENTATION

The FSP Business Agent will be written as a Java Application that will listen for messages on an Oracle Advanced Queue The implementation will start with the base class as defined in the Electronic Submission Framework project The base class will define the methods for manipulating (eg Add view remove) messages on an Oracle Advanced Queue Refer to the Agent Design Section of the ESF Queue Agent Best Practices Document for the specific details on how to create a message agent See also ESF Submissions Web Service ndash Client Developerrsquos Guide The remainder of this section provides the more detailed processing that the FSP Business Agent must implement once it receives a new submission from the queue

32 DATA PARSING

Parsing of a submission will be done using VIXB (Vivid XML Binding) The XML will be parsed into a set of java objects modelling the XML For more information on VIXB see the VIXB users guide In a nutshell VIXB configures a SAX XML parser with call backs to a Sax handler The handler then passes the parsed data to tag-specific extractors which know how to ldquoextractrdquo the data When the extractor is complete it then calls an application specific processor The processor is then responsible to perform validation and processing Following is a UML class diagram of the FSP domain classes which will be created Note some of these entities may already be defined for previous MoFR apps and can be named or refactored accordingly however the XML tag information is specific to FSP and must be parsed and validated accordingly For clarity not all gettersetter methods are included

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 10

+getName() string(idl)+setName()+getFSP_ID() unsigned long(idl)+setAmendment()+getAmendment() short(idl)+getStatus() short(idl)+setStatus()+setPlanStartDate()+getPlanStartDate() long long(idl)+getPlanTerm() short(idl)+setPlanTerm()+getPlanContactPerson() PlanContactPerson+requiresApproval() boolean(idl)+setRequiresApprovalInd()

-planName string(idl)-FSP_ID unsigned long(idl)-amendmentNumber short(idl) = 0-dateSubmitted unsigned long(idl)-status-planStartDate unsigned long(idl)-planTerm short(idl) = 5-requiresApprovalInd boolean(idl)

ForestStewardShipPlan

-name string(idl)

ForestDevelopmentUnit

-bgcZone string(idl)-bgcSubzone string(idl)-bgcVariant string(idl)-bgcPhase string(idl)-bgcSiteSeries string(idl)-bgcSiteType string(idl)-gbcSeral string(idl)-maxAllowableDisturbance float(idl)-standardsRationale string(idl)-regenObligationInd boolean(idl)-regenOffseti short(idl)-earlyOffset short(idl)-lateOffset short(idl)

StockingStandard-clientCode string(idl)-licenceNumber string(idl)

PlanHolder

1

0

1

0

1

1

-licenceNumber string(idl)

ForestLicence

1

1

-

spatial

1

1

+getDistrictCode() string(idl)

-districtCode string(idl)

OrgUnit

1 1

+getName() string(idl)+setName()+getEmail() string(idl)+setEmail()+getPhone() unsigned long(idl)+setPhone()

-Name string(idl)-emailAddress string(idl)-telephone unsigned long(idl)

PlanContactPerson

11

Amended FSP might not include stocking standards

Amended FSP might not include FDUs

-stockingLayerCode string(idl)-wellSpaced unsigned long(idl)-minPrefWellSpaced unsigned long(idl)-residualBasalArea unsigned long(idl)-minHorizontalDistance unsigned long(idl)-minPostSpacing unsigned long(idl)-maxPostSpacing unsigned long(idl)-maxConifer unsigned long(idl)-heightRelativeToComp unsigned long(idl)-heightRelativeToCompCode string(idl)

StandardLayer

1

1

-speciesCode string(idl)-minHeight float(idl)-preferredSpeciesInd boolean(idl)

StandardLayerSpecies11

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 11

33 SUBMISSION PROCESSING

All the data for a Forest Stewardship Plan is required in order to validate it To address this all the data for an FSP is ldquoaccumulatedrdquo in temporary database tables Once the data is accumulated validation can occur Accumulation is done by calling functions in the FSP_XML_SUBMISSION package Validation functions are implemented in the FSP_VALIDATION package General Note 1 All procedures have at least one ldquoOUTrdquo parameter This is a string that will

contain any error messages that occur during the operation Other ldquoOUTrdquo parameters will be database identifying values for that object that are required for future processes (ie other agents) and so must be stored

2 For the initial FSP submission (amendment 0) the submitter must submit at least

one document as an attachment a a legal FSP document (MSWord or PDF) (Error 1) b The submitter may also include other supporting documentation as

attached files c The files must have approved extension (doc pdf xls zip jpg) (Error

2)

The pseudo code to validate a Forest Stewardship Plan is as follows

Begin Transaction

Call FSP_XML_SUBMISSIONUSER_SUBMISSION_DATA once

Call FSP_XML_SUBMISSIONVALID_FSP once

Call FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER for each ltplanHoldergt

For each OrgUnit element

Call FSP_XML_SUBMISSIONACCUMULATE_ORG_UNIT

For each PlanHolder element

Call FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER

For each ForestDevelopmentUnit Call FSP_XML_SUBMISSIONACCUMULATE_FDU

For each StockingStandard element

Call FSP_XML_SUBMISSIONACCUMULATE_STANDARD

For each StandardLayer element

Call FSP_XML_SUBMISSIONACCUMULATE_LAYER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 12

For each StandardLayerSpecies

Call FSP_XML_SUBMISSIONACCUMULATE_SPECIES

Call FSP_VALIDATE_XMLFSP_VALIDATION

If errors then

ROLLBACK the transaction

Note If system erros then return false to base agent so job is left on queue If validation errors then return true to remove job from queue and error messages are sent back to the client

Else

Call FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

COMMIT

34 DATA VALIDATION - DAO INTERFACE SPECIFICATIONS

This section details the interface between the Java business agent and the Oracle packages that implement amalgamation validation and processing It can be used in conjunction with the previous sections to define the detailed package interface

341 FSP_XML_SUBMISSIONUSER_SUBMISSION_DATA

Capture the submission metadata coming from ESF Confirm that the individual making the FSP submission has valid authority

to submit via ESF (Error 3)

PROCEDURE USER_SUBMISSION_DATA( P_FSP_SUBMISSION_ID IN NUMBER

P_SUBMITTED_BY IN VARCHAR2 P_CLIENT_NUMBER IN VARCHAR2 P_CLIENT_LOCN_CODE IN VARCHAR2 P_ORG_UNIT_NO IN NUMBER P_SUBMISSION_TIMESTAMP IN DATE P_USER_FILENAME IN VARCHAR2 P_USER_AUTHORITY IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_SUBMISSION_ID Comes from file message from ESF

P_SUBMITTED_BY Comes from file message from ESF

P_CLIENT_NUMBER Comes from file message from ESF

P_CLIENT_LOCN_CODE Comes from file message from ESF

P_ADMIN_DISTRICT_NO orgUnitNo from submission metadata ltdistrictCodegt value

P_SUBMISSION_TIMESTAMP Comes from file message from ESF

P_USER_FILENAME Comes from file message from ESF

P_USER_AUTHORITY Set to lsquoACrsquo

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 13

342 FSP_XML_SUBMISSIONACCUMULATE_FSP

Call once for the ltForestStewardshipPlangt entity Ensure only one such entity is included If no errors are returned then proceed If FSP already exists (this is an amendment) return the FSP_ID PROCEDURE VALID_FSP (P_FSP_ID IN OUT NUMBER

P_PLAN_NAME IN VARCHAR2 P_PLAN_TERM_YEARS IN NUMBER P_PLAN_TERM_COMMENCEMENT IN DATE P_ACTION_CODE IN VARCHAR2 P_SUBMITTER_NAME IN VARCHAR2 P_SUBMITTER_EMAIL IN VARCHAR2 P_SUBMITTER_TELEPHONE IN VARCHAR2 P_AMENDMENT_IND IN VARCHAR2 P_AMENDMENT_COMMENT IN VARCHAR2 P_AMENDMENT_APPROVAL_IND IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_OPENING_ID ltfspIDgt or from previous procedure call

P_PLAN_NAME ltplanNamegt

P_PLAN_TERM_YEARS ltplanTermYearsgt

P_PLAN_TERM_COMMENCEMENT ltplanTermCommencementgt

P_ACTION_CODE ltactionCodegt

P_SUBMITTER_NAME ltlicenseeContactgt

P_SUBMITTER_EMAIL ltemailAddressgt

P_SUBMITTER_TELEPHONE lttelphoneNumbergt

P_AMENDMENT_IND ltamendmentIndgt

P_AMENDMENT_COMMENT ltamendmentCommentgt

P_AMENDMENT_APPROVAL_IND ltadmendmentApprovalRequiredgt

343 FSP_XML_SUBMISSIONACCUMULATE_ORG_UNIT

Call once for each ltdistrictCodePropertygt in ltForestStewardshipPlangt PROCEDURE ACCUMULATE_PLAN_HOLDER(

P_FSP_ID IN NUMBER P_DISTRICT_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_DISTRICT_CODE ltdistrictCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 14

344 FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER

Call once for each ltPlanHoldergt in the FSP PROCEDURE ACCUMULATE_PLAN_HOLDER(

P_FSP_ID IN NUMBER P_CLIENT_NUMBER IN VARCHAR2 P_CLIENT_LICENSE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_CLIENT_NUMBER Comes from file message from ESF

P_CLIENT_LICENCE Comes from file message from ESF

345 FSP_XML_SUBMISSIONACCUMULATE_FDU

Call once for each ltFDUgt in the FSP PROCEDURE ACCUMULATE_FDU(

P_FSP_ID IN NUMBER P_FDU_NAME IN VARCHAR2 P_CLIENT_LICENCES IN VARRAY OF VARCHAR2 P_GEOMETRY IN MDSYSSDO_GEOMETRY P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_FDU_NAME ltfduNamegt

P_CLIENT_LICENCES ltFDUgtltlicenseNumbergt

P_GEOMETRY FDU ltextentOfgt as SDO_GEOMETRY

346 FSP_XML_SUBMISSIONACCUMULATE_STANDARD

Call once for each ltStockingStandardgt in the FSP

PROCEDURE ACCUMULATE_STANDARD( P_STANDARDS_REGIME_ID IN OUT NUMBER P_STANDARDS_REGIME_NAME IN VARCHAR2 P_STANDARDS_OBJECTIVE IN VARCHAR2 P_REGEN_DELAY_OFFSET_YRS IN NUMBER P_REGEN_OBLIGATION_IND IN VARCHAR2 P_EARLY_OFFSET_YRS IN NUMBER P_LATE_OFFSET_YRS IN NUMBER P_GEOGRAPHIC_DESCRIPTION IN VARCHAR2 P_ADDITIONAL_STANDARDS IN VARCHAR2

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 15

P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt

P_STANDARDS_REGIME_NAME ltstandardsRegimeNamegt

P_STANDARDS_OBJECTIVE ltstandardsObjectivegt

P_REGEN_DELAY_OFFSET_YRS ltregenOffsetgt from regenObjectivesProperty

P_REGEN_OBLIGATION_IND ltregenObligationIndgt from regenObjectivesProperty

P_EARLY_OFFSET_YRS ltearlyOffsetgt from regenObjectivesProperty

P_LATE_OFFSET_YRS ltlateOffsetgt from regenObjectivesProperty

P_GEOGRAPHIC_DESCRIPTION ltgeographicDescriptiongt

P_ADDITIONAL_STANDARDS ltadditionalStandardsgt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 16

347 RESULTS_XML_SUBMISSIONACCUMULATE_STANDARDS_LAYER

For each StandardLayer within a Standards Regime call

PROCEDURE ACCUMULATE_STANDARDS_LAYER (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_STOCKING_LAYER_ID OUT NUMBER P_TARGET_STOCKING IN NUMBER P_RESIDUAL_BASAL_AREA IN NUMBER P_MIN_HORIZONTAL_DISTANCE IN NUMBER P_MIN_PREF_STOCKING_STANDARD IN NUMBER P_MIN_POST_SPACING IN NUMBER P_MIN_STOCKING_STANDARD IN NUMBER P_MAX_POST_SPACING IN NUMBER P_MAX_CONIFER IN NUMBER P_HGHT_RELATIVE_TO_COMP IN NUMBER P_HGHT_RELATIVE_COMP_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID From ltstandardsRegimeIdgt or previous procedure

P_STOCKING_LAYER_CODE ltstockingLayerCodegt

P_STOCKING_LAYER_ID This value is returned

P_TARGET_STOCKING ltwellSpacedgt

P_RESIDUAL_BASAL_AREA ltresidualBasalAreagt

P_MIN_HORIZONTAL_DISTANCE ltminHorizontalDistancegt

P_PREF_STOCKING_STANDARD ltminPrefWellSpacedgt

P_MIN_POST_SPACING ltminPostSpacinggt

P_MIN_STOCKING_STANDARD ltminStockingStandardgt

P_MAX_POST_SPACING ltmaxPostSpacinggt

P_MAX_CONIFER ltmaxConifergt

P_HGHT_RELATIVE_COMP ltheightRelativeToCompgt

P_HGHT_RELATIVE_COMP_CODE ltheightRelativeToCompCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 17

348 RESULTS_XML_SUBMISSIONACCUMULATE_SPECIES

Call once for each StandardLayerSpecies within a StandardLayer

PROCEDURE ACCUMULATE_SPECIES (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_SPECIES_CODE IN VARCHAR2 P_STOCKING_LAYER_ID IN NUMBER P_PREFERRED_IND IN VARCHAR2 P_MIN_HEIGHT IN NUMBER P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt or previous procedure

P_STOCKING_LAYER_CODE STOCKING_LAYER_CODE from StandardLayer

P_SPECIES_CODE ltspeciesCodegt

P_STOCKING_LAYER_ID STOCKING_LAYER_ID from StandardLayer

P_STOCKING_STANDARD_UNIT_ID STOCKING_STANDARD_UNIT_ID from StandardLayer

P_PREFERRED_IND ltpreferredSpeciesIndgt

P_MIN_HEIGHT ltminHeightgt

P_SUBMITTED_BY Comes from file message from ESF

349 FSP_VALIDATE_XMLFSP_VALIDATION

Call after the the submission has been accumulated and no errors were returned FSP_VALIDATION is a procedure that calls a chain of other procedures that validate parts of the submission data The overall results are returned

FSP_VALIDATE_XMLVALIDATE_PLAN_HOLDER

BUSINESS RULES

At least one named licensee (forest client) forest licence pair in ltPlanHoldergt (Error 4 5 6)

That each named licensee actually exists and owns the licence listed

(Error 7)

FSP_VALIDATE_XMLVALIDATE_ORG_UNITS

BUSINESS RULES

At least one ltdistrictCodegt named (Error 8) Code resolves to a valid existing MoFR Forest District (Error 9)

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 18

FSP_VALIDATE_XMLVALIDATE_FSP

BUSINESS RULES

Ensure only a single ltForestStewardshipPlangt entity is included (Error 10)

Submission metadata ltlicenseeContactgt(Error 11)

ltemailAddressgt(Error 12) and lttelephoneNumbergt (Error 13) provided (no nulls)

Is this an original submission or an amendment (ltamendmentIndicatorgt)

(Error 14)

If original submission confirm o Plan name provided (Error 15) o Required document attached

FSP legal plan document (Error 1) o At least one ltForestDevelopmentUnitgt included (Error 16) o At least one ltStockingStandardgt included (Error 17)

ltfspIDgt (conditional) this is amendment or update

o If provided ensure a matching FSP_ID already exists in the database (Error 18)

o If existing FSP_ID status = ldquoApprovedrdquo this must be an amendment ensure that ltamendmentIndgt = ldquoTrdquo (Error 19)

o If existing FSP_ID status = ldquoRejectedrdquo this is a mistaken attempt to re-submit the same FSP (Error 20)

o If existing FSP_ID status = ldquoDraftrdquo this is an update anything submitted will overwrite existing FSP_ID record

ltplanNamegt (conditional)

o If provided and no ltfspIDgt provided this is a new submission Ensure that ltamendmentIndgt = lsquoFrsquo (Error 21)

ltplanTermgt (optional) if included is less than or equal to 5 (Error 22) ltplanStartDategt (optional) if included is valid date (Error 23) ltactionCodegt

o if ldquoNrdquo (New) Must be new FSP ensure no matching FSP_ID

FSP_AMENDMENT_NUMBER primary key already exists o if ldquoUrdquo (Update)

Must be existing FSP ensure a match to FSP_ID and FSP_AMENDMENT_NUMBER key exists

Existing FSP must be in ldquoDraftrdquo status o if ldquoArdquo (Append)

Must an existing FSP in ldquoDraftrdquo status Explicitly designed for appending GML map data to an

existing FSP

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 19

Must not already by any FOREST_DEVELOPMENT_UNIT entries for this FSP

ltamendmentIndgt (mandatory)

o Must be one of ldquoTrdquo or ldquoFrdquo (Error 24) o If ldquoTrdquo ensure ltfspIDgt provided and matches an existing FSP_ID in

the database (error 25) also ensure that the status of the existing FSP_ID = ldquoApprovedrdquo (error 26)

o If ldquoFrdquo and no ltfspIDgt provided this is a new submission o If ldquoFrdquo and ltfspIDgt provided must be an update ensure it

matches an existing FSP_ID with status = ldquoDraftrdquo (Error 27) ltamendmentApprovalRequiredIndgt (conditional)

o If ltamendmentIndgt is ldquotruerdquo must be included and set to one of ldquoTrdquo or ldquoFrdquo (Error 28)

FSP_VALIDATE_XMLVALIDATE_FDUS

BUSINESS RULES

Validate Geometry o polygon area gt 0 o polygon boundary length gt 0 o Other

Validate Identifier o ltfduNamegt must exist and not be null (Error 29) o ltfduNamegt must be unique within the FSP (no duplicates) (Error

30)

Validate Licences o Each FDU must have at least one forest licence applying (Error 31) o Each licence must be owned by one of the licensees listed for this

FSP ltplanHoldergtltlicenceNumbergt (Error 32)

FSP_VALIDATE_XMLVALIDATE_STANDARDS

BUSINESS RULES

Stocking Standards o For FSPs the stocking standard is nearly identical to the

ltStandardsAmendmentTypegt in the RESULTS schema with the following exceptions

The following elements from RESULTS ltStandardsTypegt have been added

ltbgcZonegt ltbgcSubzonegt ltbgcVariantgt ltbgcPhasegt ltbgcSiteSeriesgt ltbgcSiteTypegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 20

ltbgcSeralgt ltmaximumAllowableSoilDisturbancegt

o Therefore the equivalent Validation procedures from Results 30 can be used here with minor amendments

o FSP Stocking Standards do not have a spatial component and are not linked to any piece of ground

3410 FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

Call if no errors returned in any of the steps above PROCEDURE PROCESS_XML_SUBMISSION(

P_POST IN VARCHAR2 P_RESULTS OUT ref_results)

Procedure parameter Data Value P_POST Validate only indicator from fsp

submission metadata

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 21

The following diagram shows the decision points on how to process the submission depending on input parameters The pre-defined states refer procedures defined below

ltfspIDgt

Y

ltplanNamegt

N Error must havePlan name

N

fspID ==FSP_ID

Error UnknownFSP

N

FSP_IDSTATUS

Y

Error cannotUpdate or amend

RejectedSubmitted

ltamendmentIndgt

Approved

Error amendment requiredF

AmendApproval

Ind

T

AmendmentTo

Inbox

T

AmendmentAuto

Approve

UpdateExisting

PlanDraft

Create NewFSP

Y

End

End

End

FSP with same FSP_ID exists in database

FSP Submission

Validate

ESF FSPSubmissionAccumulate

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 22

3411 CREATE_NEW_FSP

This procedure will create a new ForestStewardshipPlan and all related entities in the production database

FOREST_STEWARDSHIP_PLAN TABLE

Source Destination FSP_SEQNEXTVAL FSP_ID 0 FSP_AMENDMENT_NUMBER STATUS for ldquoSubmittedrdquo FSP_STATUS_CODE ltplanNamegt PLAN_NAME ltplanTermYearsgt PLAN_TERM_YEARS ltplanTermCommencementgt PLAN_START_DATE ltplanTermCommencementgt + ltplanTermYearsgt

PLAN_END_DATE

ESF submission date PLAN_SUBMISSION_DATE ltlicenseeContactgt CONTACT_NAME lttelphoneNumbergt TELEPHONE_NUMBER ltemailAddressgt EMAIL_ADDRESS

FSP_AGREEMENT_HOLDER TABLE

Source Destination ltPlanHoldergtltclientCodegt CLIENT_NUMBER

FSP_ORG_UNIT TABLE

Source Destination ORG_UNITORG_UNIT_NO for ltdistrictCodegt

ORG_UNIT_NO

FSP_STATUS_HISTORY TABLE

Source Destination FSP_STATUS_HISTORY_SEQ FSP_STATUS_HISTORY_ID ldquoSubmittedrdquo code from FSP_STATUS_CODE

FSP_STATUS_CODE

ldquoNew Submissionrdquo STATUS_COMMENT

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 23

FSP_ATTACHMENT TABLE

Source Destination ESF framework ATTACHMENT_DESCRIPTION ATTACHMENT_NAME ATTACHMENT_SIZE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

3412 UPDATE_EXISTING_PLAN

For ESF submissions only the FDU map spatial component ltFDUPropertygt can be submitted as an update Part of the validation is to ensure that no other data is included with the ESF submission file except ltfspIDgt and ltFDUPropertygt This may be an INSERT or an UPDATE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination ltfspIDgt FSP_ID FOREST_STEWARDSHIP_PLAN FSP_AMENDMENT_NUMBER

FSP_AMENDMENT_NUMBER

FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 24

3413 AMENDMENT_AUTO_APPROVE

This is to create an amendment that does not require approval It is in effect a new FSP submission that automatically goes to ldquoApprovedrdquo status and increments the FSP_AMENDMENT_NUMBER Processing depends on what the licensee has submitted It may be one or more of

headeradministrative information (such as adding a new licensee) or amending a plan term

a new legal FSP document a new GML map of all the FDUs (spatial data if amended must be

completely replaced) new stocking standards

Process the data as if it were a new submission (see above) with the following exceptions

Do an INSERT INTO FOREST_STEWARDSHIP_PLAN setting FSP_AMENDMENT_NUMBER = MAX(FSP_AMENDMENT_NUMBER) + 1

Copy all fields from FOREST_STEWARDSHIP_PLAN from the most recent amendment (or the original submission record if no amendments)

UPDATE any fields in FOREST_STEWARSHIP_PLAN for this new entry that are provided in the XML submission that is any of ltplanNamegt ltplanTermYearsgt ltplanTermCommencementgt ltlicenseeContactgt lttelephoneNumbergt ltemailAddressgt

Any attachments must be INSERTed into FSP_ATTACHMENT with the new FSP_AMENDMENT_NUMBER (also FSP_ATTACHMENT_CONTENT)

Set FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoAPPRrdquo for this new record

INSERT INTO FSP_STATUS_HISTORY (FSP_STATUS_HISTORY_ID FSP_ID FSP_AMENDMENT_NUMBER FSP_STATUS_CODE STATUS_COMMENT) VALUES (SEQNEXTVAL ltFSP_IDgt ltnew FSP_AMENDMENT_NUMBERgt ldquoAPPRrdquo ltamendmentCommentgt) Be sure to use the new FSP_AMENDMENT_NUMBER in INSERTing any STANDARDS_REGIME or FOREST_DEVELOPMENT_UNIT records

3414 AMENDMENT_TO_INBOX

This is to create an amendment that requires approval The FSP submission is put in ldquoSubmittedrdquo status so that it will show up in the relevant District Inboxes The FSP_AMENDMENT_NUMBER is incremented Proceed as above (AMENDMENT_AUTO_INCREMENT) except

SET FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoSUBMrdquo (for Submitted)

SET FSP_STATUS_HISTORYSTATUS_CODE = ldquoSUBMrdquo for new record

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 25

35 DOMAIN CODES

The following codes will be set up in the database in static code tables (all fields are VARCHAR2)

FSP_STATUS_CODE TABLE

FSP_STATUS_CODE DESCRIPTION SUBM Submitted DRFT Draft APPR Approved REJ Rejected OTBH Opportunity To Be Heard

FSP_REVIEW_MILESTONE_TYPE_CODE TABLE

FSP_REVIEW_MILESTONE_ TYPE_CODE

DESCRIPTION

FNR First Nations Review CampE Results amp Strategies reviewed by CampE TEN Objectives Results amp Strategies reviewed by

Tenures DDM Sent to DDM for Determination OTHR Other

FSP_ATTACHMENT_TYPE_CODE TABLE

FSP_ATTACHMENT_TYPE_CODE DESCRIPTION FSP FSP legal document MAP Map of FDUs SS Stocking Standards report AMDS Amendment Description DDMD DDM Decision Letter OTHR Other Attachment

FEATURE_CLASSES TABLE

FEATURE_CLASS_SKEY DESCRIPTION FEATURE_CLASS_KEY To be defined

36 REPORTING ERRORS

If an error is detected in a submission it must be reported back to the electronic submission framework The method for doing that is to post a message to a queue detailing the submission number and the error message The licensee will be able to check back to the Electronic Submission WebSite and view the error The Electronic Submission Framework will also send an email to the client detailing the message

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 26

The specification for how to report an error can be found in the ESF Queue Agent Best Practices Document The message content for FSP will be a concatenation of the ltFSP Submission IDgt ltDescriptiongt field and the message returned from the validation routines above To send a message about a submission you will need to supply the FSP submission ID for the submission The FSP submission ID is supplied with the message from ESF and stored in the FSP_ELECTRONIC_SUBMISSION table Refer to the Status Agent in the ESF Queue Agent Best Practices document for details on how to send a message to ESF The following code is provided as a sample only and the final syntax should be from the ESF Queue Agent Best Practices Document StatusAgent sa = new StatusAgent (ldquoFSP Business Agentrdquo) sasendStatus (ltForestStewardshipPlanSubmissionIDgt StatusMessageREJECTED ldquo100rdquo ltForestStewardshipPlangtlt083D02800509gt + ldquofailedrdquo + outMessage) saclose() Note Expectation is that outmessage will contain details as to what part of the FSP failed (eg Tenure Forest Development Unit or Stocking Standard) In the case of invalid data processing stops at this point for the FSP No data for this submission will be added to FSP database

361 ERROR MESSAGES

These error messages may be generated during the accumulation validation and processing phases They are referenced by number in the procedure documentation above

1 A legal FSP document must be attached to this submission Please attach a document containing your Forest Stewardship Plan

2 The attached file ltnamegt does not have a recognizable file extension Atachments must be one of MSWord (doc) Portable Document Format (pdf) MS Excel (xls) ZIP archive (zip) or JPEG graphic (jpg) Please resubmit with appropriate file attachments

3 You do not have the proper authority to submit an FSP via ESF Please contact the appropriate MoFR District office to obtain the necessary ldquoSubmitterrdquo authority role

4 The FSP submitted does not name any plan holders At least one holder of a major BC Forest license must be named in the plan

5 No forest license number was found for a named plan holder You must name all forest licenses which apply within the FSP

6 A plan holderrsquos license number could not be verified Please check the validity of the plan holder MoFR client codes

7 A forest license number listed is not owned by any of the plan holders of this FSP Please check the validity of the plan holder MoFR client codes and their licence numbers

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 27

8 At least one BC Forest District must be listed for this FSP Each District responsible for the area included in the FSP must be listed

9 The MoFR District Code is not recognized Please check the spelling of the District code(s) included or check with the appropriate District office for the proper code

10 More than one Forest Stewardship Plan (FSP) was included in this submission At the present time each ESF submission may contain only a single FSP

11 The submission must include the name of a contact person responsible for communicating with MoFR about this FSP submission

12 The submission must include the email address of a contact person responsible for communicating with MoFR about this FSP submission

13 The submission must include the telephone number of a contact person responsible for communicating with MoFR about this FSP submission

14 The submission must indicate whether or not this is an original FSP or an amendment to an existing FSP

15 The FSP must have a name 16 The FSP must include at least one Forest Development Unit (FDU) 17 The FSP must include at least one Stocking Standard 18 This submission refers to an FSP that does not exist in the Ministryrsquos

database Please check the FSP ID number provided after your original submission

19 An FSP with the same FSP ID number already exists in the Ministryrsquos database yet you have not indicated that this is an amendment If the intention is to amend an existing FSP please include the correct FSP ID and make sure the ltamendmentIndgt flag is set to ldquotruerdquo

20 The FSP you are trying to amend has been rejected You cannot amend or replace a rejected FSP You must make a brand new submission When doing so do not include an FSP ID number

21 The submission appears to be a new FSP yet the amendment indicator is set to true (ltamendmentIndgt = ldquotruerdquo) Either provide an FSP ID to amend an existing FSP or set the amendment indicator to ldquofalserdquo

22 The FSP plan term has been set to greater than 5 years FSPs are valid for a maximum of 5 years unless an extension is approved

23 The plan commencement date provided is not valid 24 A value for ltamendmentIndgt must be provided it must be set to either ldquotruerdquo or ldquofalserdquo

25 The submission appears to be for an FSP amendment (ltamendmentIndgt = ldquotruerdquo) however no FSP is referenced Please be sure to include the FSP ID number provided with the original submission

26 You cannot amend an FSP that is not approved Ensure you have provided the correct FSP ID number issued with the original submission and confirm that the FSP is approved

27 An FSP with the same FSP ID number already exists in the database Before you can update this FSP it must be placed in Draft status by the District Manager

28 The submission appears to be an amendment to an existing FSP However you have not stated whether or not this amendment requires Ministry approval Please ensure that the ltamendmentApprovalRequiredIndgt is set to one of ldquotruerdquo or ldquofalserdquo

29 A Forest development Unit (FDU) was submitted without a name A name must be provided for each FDU

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 28

30 The same name has been provided for more than one Forest Development Unit (FDU) Each FDU in a submission must have a unique name

31 A Forest Development Unit (FDU) was submitted that did not list a forest licence number that applies Each FDU must have at least one license number applied

32 A forest license number was supplied that does not appear to be owned by any of the plan holders for this FSP Each Forest Development Unit (FDU) must be listed with at least one forest license owned by one of the plan holders for this FSP

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting

Page 3: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 3

Document Sign-Off

The undersigned have read and agree with the content of this document Project Leader VIVID Solutions Inc

Project Manager Ministry of Forests

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 4

Table of Contents

1 SCOPE 5

11 REFERENCES 5 12 DOCUMENT CONVENTIONS 5

2 FSP BUSINESS AGENT - HIGH LEVEL OVERVIEW 6

3 FSP BUSINESS AGENT ndash DETAILED SPECIFICATIONS 9

31 BUSINESS AGENT IMPLEMENTATION 9 32 DATA PARSING 9 33 SUBMISSION PROCESSING 11 34 DATA VALIDATION - DAO INTERFACE SPECIFICATIONS12

341FSP_XML_SUBMISSIONUSER_SUBMISSION_DATA 12

342FSP_XML_SUBMISSIONVALID_FSP 13

343FSP_XML_SUBMISSIONACCUMULATE_ORG_UNIT 13

344FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER14

345FSP_XML_SUBMISSIONACCUMULATE_FDU 14

346FSP_XML_SUBMISSIONACCUMULATE_STANDARD 14

347RESULTS_XML_SUBMISSIONACCUMULATE_STANDARDS_LAYER 16

348RESULTS_XML_SUBMISSIONACCUMULATE_SPECIES 17

349FSP_VALIDATE_XMLFSP_VALIDATION 17

3410FSP_PROCESS_XMLPROCESS_XML_SUBMISSION 20

35 REPORTING ERRORS 22

4 SPATIAL PROCESSING29

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 5

1 SCOPE

The scope of this design document includes the components required to process a Forest Stewardship Plan electronic submission received from the Forest Industry or BC Timber Sales More specifically it includes the design specifications for

1 FSP Business Agent ndash The Oracle Advanced Queue (OAQ) Agent that receives the electronic submission from the Electronic Submission Framework validates the data and puts it into the appropriate FSP tables

11 REFERENCES

The document is technical in nature and assumes the reader is familiar with messaging architectures in particular Oracle Advanced Queueing Oracle Spatial GML and Oracle PLSQL Other document references include

FSP Requirements documents Oracle Advanced Queuing Investigation FSPTS Detailed Design FSP XML Schema Specification Logical and physical data models for the FSP Tracking System (See Appendix )

12 DOCUMENT CONVENTIONS

Because this document details with both XML and Oracle table fields often with the same name a document convention has been applied to differentiate the fields XML fields start are enclosed in ltgt and table fields are not Java objects or properties are enclosed in

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 6

2 FSP BUSINESS AGENT - HIGH LEVEL OVERVIEW

The diagram on the following page represents the overall submission process The FSPSVC box shows the processing that is done by the FSP_SVC The boxes on the right side of the diagram represent Oracle packages that perform the business rule validation and storage of the submission in the appropriate FSP tables Each application is either committed or rolled back at the end of the processing by the FSP_SVC The diagram is followed by a detailed description of each step

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 7

FSP_PROCESS_XML

FSP_VALIDATE_XML

FSPSVC

ESF ESF FSP SubmissionFSP XML SubmissionPARSE XML

TOPOLOGY VALIDATION

Cursor of error messages

VALIDATE_FDUS

VALIDATE_STANDARDS

VALIDATE_PLAN_HOLDERS

Cursor of error messages

Invokes

Invokes

Invokes

HANDLE SUBMISSION

Java Representation of Submission

Java Representation of Submission

Java Representation of Submission

VALIDATE FOREST STEWARDSHIP PLAN

MOVE FSP DATA FROM TEMP TABLE TO OPERATIONAL TABLES

COMMIT OR ROLLBACK

Similar to RESULTS but note minor differences in XML elements and some differences in optionality

User submission data (once)

FSP_XML_SUBMISSION (Oracle Package)

ACCUMULATE_STANDARD

USER_SUBMISSION_DATA

ACCUMULATE_LAYER

ACCUMULATE_SPECIES

ACCUMULATE_BGC

Cursor of error messages

Standards Info (Once for each Standard )

Cursor of error messages

BGC BEC Info (Once for each BGC )

Cursor of error messages

Layer Info (Once for each Layer )

Cursor of error messages

Species Info (Once for each Layer Species )

ENSURE VALID USER DATA

ACCUMULATE FSP DATA TO TEMP TABLEUNTIL A COMPLETE APPLICATION IS PROCESSED

Cursor of error messages

Invokes

ACCUMULATE_PLAN_HOLDER

ACCUMULATE_ORG_UNIT

ACCUMULATE_FDU

VALID_FSP

Cursor of error messages

Licensees (Plan Holder ) Info (Once for each Licensee )

Cursor of error messages

Org Units Info (Once for each Org Unit )

Cursor of error messages

FDU Info (Once for each FDU )

Cursor of error messages

FSP Info (Once )

VALIDATE_ORG_UNITS

VALIDATE_FSP

FSP_VALIDATION

Invokes

PROCESS_FDUS

PROCESS_STANDARDS

PROCESS_LICENSEES

Invokes

Invokes

Invokes

Invokes

PROCESS_ORG_UNITS

PROCESS_FSP

PROCESS_XML_SUBMISSION

Invokes

PROCESS_USER_DATA

Invokes

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 8

The high level flow of the submission process futher describing the diagram on the previous page is as follows 1 The FSP business Agent (FSPSVC) receives a message from the Electronic Submission

Framework via an Oracle Message Queue The message is read and the XML is parsed checking well-formed against the FSP XML Schema

2 A set of accumulator stored procedures are called to ldquoaccumulaterdquo the FSP components

of the submission 3 Once the data is accumulated it can be validated Each component of the FSP

submission is validated The complete FSP must validate or the submission is rejected and the appropriate messages are sent back to the submitter to help determine the issues

4 If the submission is valid it is processed and stored in database using the package

FSP_PROCESS_XML The spatial data for the FDUs is also stored in the database 5 Once the data is stored it will be available in the district and licenseersquos INBOX 6 The transaction is either committed or rolled back if any one of these compoents failed

In the case of a rollback the message will be left on the queue and attempted again Causes of failure are typically infrastructure (eg insufficient rollback space)

The following sections provide more detail on each of these steps

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 9

3 FSP BUSINESS AGENT ndash DETAILED SPECIFICATIONS

The XML submission is forestStewardshipPlan centric ie each transactional unit will be encompassed within ltforestStewardshipPlangt and ltforestStewardshipPlangt tag pairs All data within this block will be related to the FSP as defined in this block Only at single FSP unit can exist in the same submission although the business rule may change in a later release to allow a licensee to submit multiple FSPs in a single submission For information on the schema please see the FSP Submission Schema and an example FSP submission

31 BUSINESS AGENT IMPLEMENTATION

The FSP Business Agent will be written as a Java Application that will listen for messages on an Oracle Advanced Queue The implementation will start with the base class as defined in the Electronic Submission Framework project The base class will define the methods for manipulating (eg Add view remove) messages on an Oracle Advanced Queue Refer to the Agent Design Section of the ESF Queue Agent Best Practices Document for the specific details on how to create a message agent See also ESF Submissions Web Service ndash Client Developerrsquos Guide The remainder of this section provides the more detailed processing that the FSP Business Agent must implement once it receives a new submission from the queue

32 DATA PARSING

Parsing of a submission will be done using VIXB (Vivid XML Binding) The XML will be parsed into a set of java objects modelling the XML For more information on VIXB see the VIXB users guide In a nutshell VIXB configures a SAX XML parser with call backs to a Sax handler The handler then passes the parsed data to tag-specific extractors which know how to ldquoextractrdquo the data When the extractor is complete it then calls an application specific processor The processor is then responsible to perform validation and processing Following is a UML class diagram of the FSP domain classes which will be created Note some of these entities may already be defined for previous MoFR apps and can be named or refactored accordingly however the XML tag information is specific to FSP and must be parsed and validated accordingly For clarity not all gettersetter methods are included

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 10

+getName() string(idl)+setName()+getFSP_ID() unsigned long(idl)+setAmendment()+getAmendment() short(idl)+getStatus() short(idl)+setStatus()+setPlanStartDate()+getPlanStartDate() long long(idl)+getPlanTerm() short(idl)+setPlanTerm()+getPlanContactPerson() PlanContactPerson+requiresApproval() boolean(idl)+setRequiresApprovalInd()

-planName string(idl)-FSP_ID unsigned long(idl)-amendmentNumber short(idl) = 0-dateSubmitted unsigned long(idl)-status-planStartDate unsigned long(idl)-planTerm short(idl) = 5-requiresApprovalInd boolean(idl)

ForestStewardShipPlan

-name string(idl)

ForestDevelopmentUnit

-bgcZone string(idl)-bgcSubzone string(idl)-bgcVariant string(idl)-bgcPhase string(idl)-bgcSiteSeries string(idl)-bgcSiteType string(idl)-gbcSeral string(idl)-maxAllowableDisturbance float(idl)-standardsRationale string(idl)-regenObligationInd boolean(idl)-regenOffseti short(idl)-earlyOffset short(idl)-lateOffset short(idl)

StockingStandard-clientCode string(idl)-licenceNumber string(idl)

PlanHolder

1

0

1

0

1

1

-licenceNumber string(idl)

ForestLicence

1

1

-

spatial

1

1

+getDistrictCode() string(idl)

-districtCode string(idl)

OrgUnit

1 1

+getName() string(idl)+setName()+getEmail() string(idl)+setEmail()+getPhone() unsigned long(idl)+setPhone()

-Name string(idl)-emailAddress string(idl)-telephone unsigned long(idl)

PlanContactPerson

11

Amended FSP might not include stocking standards

Amended FSP might not include FDUs

-stockingLayerCode string(idl)-wellSpaced unsigned long(idl)-minPrefWellSpaced unsigned long(idl)-residualBasalArea unsigned long(idl)-minHorizontalDistance unsigned long(idl)-minPostSpacing unsigned long(idl)-maxPostSpacing unsigned long(idl)-maxConifer unsigned long(idl)-heightRelativeToComp unsigned long(idl)-heightRelativeToCompCode string(idl)

StandardLayer

1

1

-speciesCode string(idl)-minHeight float(idl)-preferredSpeciesInd boolean(idl)

StandardLayerSpecies11

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 11

33 SUBMISSION PROCESSING

All the data for a Forest Stewardship Plan is required in order to validate it To address this all the data for an FSP is ldquoaccumulatedrdquo in temporary database tables Once the data is accumulated validation can occur Accumulation is done by calling functions in the FSP_XML_SUBMISSION package Validation functions are implemented in the FSP_VALIDATION package General Note 1 All procedures have at least one ldquoOUTrdquo parameter This is a string that will

contain any error messages that occur during the operation Other ldquoOUTrdquo parameters will be database identifying values for that object that are required for future processes (ie other agents) and so must be stored

2 For the initial FSP submission (amendment 0) the submitter must submit at least

one document as an attachment a a legal FSP document (MSWord or PDF) (Error 1) b The submitter may also include other supporting documentation as

attached files c The files must have approved extension (doc pdf xls zip jpg) (Error

2)

The pseudo code to validate a Forest Stewardship Plan is as follows

Begin Transaction

Call FSP_XML_SUBMISSIONUSER_SUBMISSION_DATA once

Call FSP_XML_SUBMISSIONVALID_FSP once

Call FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER for each ltplanHoldergt

For each OrgUnit element

Call FSP_XML_SUBMISSIONACCUMULATE_ORG_UNIT

For each PlanHolder element

Call FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER

For each ForestDevelopmentUnit Call FSP_XML_SUBMISSIONACCUMULATE_FDU

For each StockingStandard element

Call FSP_XML_SUBMISSIONACCUMULATE_STANDARD

For each StandardLayer element

Call FSP_XML_SUBMISSIONACCUMULATE_LAYER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 12

For each StandardLayerSpecies

Call FSP_XML_SUBMISSIONACCUMULATE_SPECIES

Call FSP_VALIDATE_XMLFSP_VALIDATION

If errors then

ROLLBACK the transaction

Note If system erros then return false to base agent so job is left on queue If validation errors then return true to remove job from queue and error messages are sent back to the client

Else

Call FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

COMMIT

34 DATA VALIDATION - DAO INTERFACE SPECIFICATIONS

This section details the interface between the Java business agent and the Oracle packages that implement amalgamation validation and processing It can be used in conjunction with the previous sections to define the detailed package interface

341 FSP_XML_SUBMISSIONUSER_SUBMISSION_DATA

Capture the submission metadata coming from ESF Confirm that the individual making the FSP submission has valid authority

to submit via ESF (Error 3)

PROCEDURE USER_SUBMISSION_DATA( P_FSP_SUBMISSION_ID IN NUMBER

P_SUBMITTED_BY IN VARCHAR2 P_CLIENT_NUMBER IN VARCHAR2 P_CLIENT_LOCN_CODE IN VARCHAR2 P_ORG_UNIT_NO IN NUMBER P_SUBMISSION_TIMESTAMP IN DATE P_USER_FILENAME IN VARCHAR2 P_USER_AUTHORITY IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_SUBMISSION_ID Comes from file message from ESF

P_SUBMITTED_BY Comes from file message from ESF

P_CLIENT_NUMBER Comes from file message from ESF

P_CLIENT_LOCN_CODE Comes from file message from ESF

P_ADMIN_DISTRICT_NO orgUnitNo from submission metadata ltdistrictCodegt value

P_SUBMISSION_TIMESTAMP Comes from file message from ESF

P_USER_FILENAME Comes from file message from ESF

P_USER_AUTHORITY Set to lsquoACrsquo

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 13

342 FSP_XML_SUBMISSIONACCUMULATE_FSP

Call once for the ltForestStewardshipPlangt entity Ensure only one such entity is included If no errors are returned then proceed If FSP already exists (this is an amendment) return the FSP_ID PROCEDURE VALID_FSP (P_FSP_ID IN OUT NUMBER

P_PLAN_NAME IN VARCHAR2 P_PLAN_TERM_YEARS IN NUMBER P_PLAN_TERM_COMMENCEMENT IN DATE P_ACTION_CODE IN VARCHAR2 P_SUBMITTER_NAME IN VARCHAR2 P_SUBMITTER_EMAIL IN VARCHAR2 P_SUBMITTER_TELEPHONE IN VARCHAR2 P_AMENDMENT_IND IN VARCHAR2 P_AMENDMENT_COMMENT IN VARCHAR2 P_AMENDMENT_APPROVAL_IND IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_OPENING_ID ltfspIDgt or from previous procedure call

P_PLAN_NAME ltplanNamegt

P_PLAN_TERM_YEARS ltplanTermYearsgt

P_PLAN_TERM_COMMENCEMENT ltplanTermCommencementgt

P_ACTION_CODE ltactionCodegt

P_SUBMITTER_NAME ltlicenseeContactgt

P_SUBMITTER_EMAIL ltemailAddressgt

P_SUBMITTER_TELEPHONE lttelphoneNumbergt

P_AMENDMENT_IND ltamendmentIndgt

P_AMENDMENT_COMMENT ltamendmentCommentgt

P_AMENDMENT_APPROVAL_IND ltadmendmentApprovalRequiredgt

343 FSP_XML_SUBMISSIONACCUMULATE_ORG_UNIT

Call once for each ltdistrictCodePropertygt in ltForestStewardshipPlangt PROCEDURE ACCUMULATE_PLAN_HOLDER(

P_FSP_ID IN NUMBER P_DISTRICT_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_DISTRICT_CODE ltdistrictCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 14

344 FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER

Call once for each ltPlanHoldergt in the FSP PROCEDURE ACCUMULATE_PLAN_HOLDER(

P_FSP_ID IN NUMBER P_CLIENT_NUMBER IN VARCHAR2 P_CLIENT_LICENSE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_CLIENT_NUMBER Comes from file message from ESF

P_CLIENT_LICENCE Comes from file message from ESF

345 FSP_XML_SUBMISSIONACCUMULATE_FDU

Call once for each ltFDUgt in the FSP PROCEDURE ACCUMULATE_FDU(

P_FSP_ID IN NUMBER P_FDU_NAME IN VARCHAR2 P_CLIENT_LICENCES IN VARRAY OF VARCHAR2 P_GEOMETRY IN MDSYSSDO_GEOMETRY P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_FDU_NAME ltfduNamegt

P_CLIENT_LICENCES ltFDUgtltlicenseNumbergt

P_GEOMETRY FDU ltextentOfgt as SDO_GEOMETRY

346 FSP_XML_SUBMISSIONACCUMULATE_STANDARD

Call once for each ltStockingStandardgt in the FSP

PROCEDURE ACCUMULATE_STANDARD( P_STANDARDS_REGIME_ID IN OUT NUMBER P_STANDARDS_REGIME_NAME IN VARCHAR2 P_STANDARDS_OBJECTIVE IN VARCHAR2 P_REGEN_DELAY_OFFSET_YRS IN NUMBER P_REGEN_OBLIGATION_IND IN VARCHAR2 P_EARLY_OFFSET_YRS IN NUMBER P_LATE_OFFSET_YRS IN NUMBER P_GEOGRAPHIC_DESCRIPTION IN VARCHAR2 P_ADDITIONAL_STANDARDS IN VARCHAR2

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 15

P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt

P_STANDARDS_REGIME_NAME ltstandardsRegimeNamegt

P_STANDARDS_OBJECTIVE ltstandardsObjectivegt

P_REGEN_DELAY_OFFSET_YRS ltregenOffsetgt from regenObjectivesProperty

P_REGEN_OBLIGATION_IND ltregenObligationIndgt from regenObjectivesProperty

P_EARLY_OFFSET_YRS ltearlyOffsetgt from regenObjectivesProperty

P_LATE_OFFSET_YRS ltlateOffsetgt from regenObjectivesProperty

P_GEOGRAPHIC_DESCRIPTION ltgeographicDescriptiongt

P_ADDITIONAL_STANDARDS ltadditionalStandardsgt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 16

347 RESULTS_XML_SUBMISSIONACCUMULATE_STANDARDS_LAYER

For each StandardLayer within a Standards Regime call

PROCEDURE ACCUMULATE_STANDARDS_LAYER (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_STOCKING_LAYER_ID OUT NUMBER P_TARGET_STOCKING IN NUMBER P_RESIDUAL_BASAL_AREA IN NUMBER P_MIN_HORIZONTAL_DISTANCE IN NUMBER P_MIN_PREF_STOCKING_STANDARD IN NUMBER P_MIN_POST_SPACING IN NUMBER P_MIN_STOCKING_STANDARD IN NUMBER P_MAX_POST_SPACING IN NUMBER P_MAX_CONIFER IN NUMBER P_HGHT_RELATIVE_TO_COMP IN NUMBER P_HGHT_RELATIVE_COMP_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID From ltstandardsRegimeIdgt or previous procedure

P_STOCKING_LAYER_CODE ltstockingLayerCodegt

P_STOCKING_LAYER_ID This value is returned

P_TARGET_STOCKING ltwellSpacedgt

P_RESIDUAL_BASAL_AREA ltresidualBasalAreagt

P_MIN_HORIZONTAL_DISTANCE ltminHorizontalDistancegt

P_PREF_STOCKING_STANDARD ltminPrefWellSpacedgt

P_MIN_POST_SPACING ltminPostSpacinggt

P_MIN_STOCKING_STANDARD ltminStockingStandardgt

P_MAX_POST_SPACING ltmaxPostSpacinggt

P_MAX_CONIFER ltmaxConifergt

P_HGHT_RELATIVE_COMP ltheightRelativeToCompgt

P_HGHT_RELATIVE_COMP_CODE ltheightRelativeToCompCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 17

348 RESULTS_XML_SUBMISSIONACCUMULATE_SPECIES

Call once for each StandardLayerSpecies within a StandardLayer

PROCEDURE ACCUMULATE_SPECIES (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_SPECIES_CODE IN VARCHAR2 P_STOCKING_LAYER_ID IN NUMBER P_PREFERRED_IND IN VARCHAR2 P_MIN_HEIGHT IN NUMBER P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt or previous procedure

P_STOCKING_LAYER_CODE STOCKING_LAYER_CODE from StandardLayer

P_SPECIES_CODE ltspeciesCodegt

P_STOCKING_LAYER_ID STOCKING_LAYER_ID from StandardLayer

P_STOCKING_STANDARD_UNIT_ID STOCKING_STANDARD_UNIT_ID from StandardLayer

P_PREFERRED_IND ltpreferredSpeciesIndgt

P_MIN_HEIGHT ltminHeightgt

P_SUBMITTED_BY Comes from file message from ESF

349 FSP_VALIDATE_XMLFSP_VALIDATION

Call after the the submission has been accumulated and no errors were returned FSP_VALIDATION is a procedure that calls a chain of other procedures that validate parts of the submission data The overall results are returned

FSP_VALIDATE_XMLVALIDATE_PLAN_HOLDER

BUSINESS RULES

At least one named licensee (forest client) forest licence pair in ltPlanHoldergt (Error 4 5 6)

That each named licensee actually exists and owns the licence listed

(Error 7)

FSP_VALIDATE_XMLVALIDATE_ORG_UNITS

BUSINESS RULES

At least one ltdistrictCodegt named (Error 8) Code resolves to a valid existing MoFR Forest District (Error 9)

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 18

FSP_VALIDATE_XMLVALIDATE_FSP

BUSINESS RULES

Ensure only a single ltForestStewardshipPlangt entity is included (Error 10)

Submission metadata ltlicenseeContactgt(Error 11)

ltemailAddressgt(Error 12) and lttelephoneNumbergt (Error 13) provided (no nulls)

Is this an original submission or an amendment (ltamendmentIndicatorgt)

(Error 14)

If original submission confirm o Plan name provided (Error 15) o Required document attached

FSP legal plan document (Error 1) o At least one ltForestDevelopmentUnitgt included (Error 16) o At least one ltStockingStandardgt included (Error 17)

ltfspIDgt (conditional) this is amendment or update

o If provided ensure a matching FSP_ID already exists in the database (Error 18)

o If existing FSP_ID status = ldquoApprovedrdquo this must be an amendment ensure that ltamendmentIndgt = ldquoTrdquo (Error 19)

o If existing FSP_ID status = ldquoRejectedrdquo this is a mistaken attempt to re-submit the same FSP (Error 20)

o If existing FSP_ID status = ldquoDraftrdquo this is an update anything submitted will overwrite existing FSP_ID record

ltplanNamegt (conditional)

o If provided and no ltfspIDgt provided this is a new submission Ensure that ltamendmentIndgt = lsquoFrsquo (Error 21)

ltplanTermgt (optional) if included is less than or equal to 5 (Error 22) ltplanStartDategt (optional) if included is valid date (Error 23) ltactionCodegt

o if ldquoNrdquo (New) Must be new FSP ensure no matching FSP_ID

FSP_AMENDMENT_NUMBER primary key already exists o if ldquoUrdquo (Update)

Must be existing FSP ensure a match to FSP_ID and FSP_AMENDMENT_NUMBER key exists

Existing FSP must be in ldquoDraftrdquo status o if ldquoArdquo (Append)

Must an existing FSP in ldquoDraftrdquo status Explicitly designed for appending GML map data to an

existing FSP

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 19

Must not already by any FOREST_DEVELOPMENT_UNIT entries for this FSP

ltamendmentIndgt (mandatory)

o Must be one of ldquoTrdquo or ldquoFrdquo (Error 24) o If ldquoTrdquo ensure ltfspIDgt provided and matches an existing FSP_ID in

the database (error 25) also ensure that the status of the existing FSP_ID = ldquoApprovedrdquo (error 26)

o If ldquoFrdquo and no ltfspIDgt provided this is a new submission o If ldquoFrdquo and ltfspIDgt provided must be an update ensure it

matches an existing FSP_ID with status = ldquoDraftrdquo (Error 27) ltamendmentApprovalRequiredIndgt (conditional)

o If ltamendmentIndgt is ldquotruerdquo must be included and set to one of ldquoTrdquo or ldquoFrdquo (Error 28)

FSP_VALIDATE_XMLVALIDATE_FDUS

BUSINESS RULES

Validate Geometry o polygon area gt 0 o polygon boundary length gt 0 o Other

Validate Identifier o ltfduNamegt must exist and not be null (Error 29) o ltfduNamegt must be unique within the FSP (no duplicates) (Error

30)

Validate Licences o Each FDU must have at least one forest licence applying (Error 31) o Each licence must be owned by one of the licensees listed for this

FSP ltplanHoldergtltlicenceNumbergt (Error 32)

FSP_VALIDATE_XMLVALIDATE_STANDARDS

BUSINESS RULES

Stocking Standards o For FSPs the stocking standard is nearly identical to the

ltStandardsAmendmentTypegt in the RESULTS schema with the following exceptions

The following elements from RESULTS ltStandardsTypegt have been added

ltbgcZonegt ltbgcSubzonegt ltbgcVariantgt ltbgcPhasegt ltbgcSiteSeriesgt ltbgcSiteTypegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 20

ltbgcSeralgt ltmaximumAllowableSoilDisturbancegt

o Therefore the equivalent Validation procedures from Results 30 can be used here with minor amendments

o FSP Stocking Standards do not have a spatial component and are not linked to any piece of ground

3410 FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

Call if no errors returned in any of the steps above PROCEDURE PROCESS_XML_SUBMISSION(

P_POST IN VARCHAR2 P_RESULTS OUT ref_results)

Procedure parameter Data Value P_POST Validate only indicator from fsp

submission metadata

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 21

The following diagram shows the decision points on how to process the submission depending on input parameters The pre-defined states refer procedures defined below

ltfspIDgt

Y

ltplanNamegt

N Error must havePlan name

N

fspID ==FSP_ID

Error UnknownFSP

N

FSP_IDSTATUS

Y

Error cannotUpdate or amend

RejectedSubmitted

ltamendmentIndgt

Approved

Error amendment requiredF

AmendApproval

Ind

T

AmendmentTo

Inbox

T

AmendmentAuto

Approve

UpdateExisting

PlanDraft

Create NewFSP

Y

End

End

End

FSP with same FSP_ID exists in database

FSP Submission

Validate

ESF FSPSubmissionAccumulate

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 22

3411 CREATE_NEW_FSP

This procedure will create a new ForestStewardshipPlan and all related entities in the production database

FOREST_STEWARDSHIP_PLAN TABLE

Source Destination FSP_SEQNEXTVAL FSP_ID 0 FSP_AMENDMENT_NUMBER STATUS for ldquoSubmittedrdquo FSP_STATUS_CODE ltplanNamegt PLAN_NAME ltplanTermYearsgt PLAN_TERM_YEARS ltplanTermCommencementgt PLAN_START_DATE ltplanTermCommencementgt + ltplanTermYearsgt

PLAN_END_DATE

ESF submission date PLAN_SUBMISSION_DATE ltlicenseeContactgt CONTACT_NAME lttelphoneNumbergt TELEPHONE_NUMBER ltemailAddressgt EMAIL_ADDRESS

FSP_AGREEMENT_HOLDER TABLE

Source Destination ltPlanHoldergtltclientCodegt CLIENT_NUMBER

FSP_ORG_UNIT TABLE

Source Destination ORG_UNITORG_UNIT_NO for ltdistrictCodegt

ORG_UNIT_NO

FSP_STATUS_HISTORY TABLE

Source Destination FSP_STATUS_HISTORY_SEQ FSP_STATUS_HISTORY_ID ldquoSubmittedrdquo code from FSP_STATUS_CODE

FSP_STATUS_CODE

ldquoNew Submissionrdquo STATUS_COMMENT

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 23

FSP_ATTACHMENT TABLE

Source Destination ESF framework ATTACHMENT_DESCRIPTION ATTACHMENT_NAME ATTACHMENT_SIZE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

3412 UPDATE_EXISTING_PLAN

For ESF submissions only the FDU map spatial component ltFDUPropertygt can be submitted as an update Part of the validation is to ensure that no other data is included with the ESF submission file except ltfspIDgt and ltFDUPropertygt This may be an INSERT or an UPDATE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination ltfspIDgt FSP_ID FOREST_STEWARDSHIP_PLAN FSP_AMENDMENT_NUMBER

FSP_AMENDMENT_NUMBER

FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 24

3413 AMENDMENT_AUTO_APPROVE

This is to create an amendment that does not require approval It is in effect a new FSP submission that automatically goes to ldquoApprovedrdquo status and increments the FSP_AMENDMENT_NUMBER Processing depends on what the licensee has submitted It may be one or more of

headeradministrative information (such as adding a new licensee) or amending a plan term

a new legal FSP document a new GML map of all the FDUs (spatial data if amended must be

completely replaced) new stocking standards

Process the data as if it were a new submission (see above) with the following exceptions

Do an INSERT INTO FOREST_STEWARDSHIP_PLAN setting FSP_AMENDMENT_NUMBER = MAX(FSP_AMENDMENT_NUMBER) + 1

Copy all fields from FOREST_STEWARDSHIP_PLAN from the most recent amendment (or the original submission record if no amendments)

UPDATE any fields in FOREST_STEWARSHIP_PLAN for this new entry that are provided in the XML submission that is any of ltplanNamegt ltplanTermYearsgt ltplanTermCommencementgt ltlicenseeContactgt lttelephoneNumbergt ltemailAddressgt

Any attachments must be INSERTed into FSP_ATTACHMENT with the new FSP_AMENDMENT_NUMBER (also FSP_ATTACHMENT_CONTENT)

Set FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoAPPRrdquo for this new record

INSERT INTO FSP_STATUS_HISTORY (FSP_STATUS_HISTORY_ID FSP_ID FSP_AMENDMENT_NUMBER FSP_STATUS_CODE STATUS_COMMENT) VALUES (SEQNEXTVAL ltFSP_IDgt ltnew FSP_AMENDMENT_NUMBERgt ldquoAPPRrdquo ltamendmentCommentgt) Be sure to use the new FSP_AMENDMENT_NUMBER in INSERTing any STANDARDS_REGIME or FOREST_DEVELOPMENT_UNIT records

3414 AMENDMENT_TO_INBOX

This is to create an amendment that requires approval The FSP submission is put in ldquoSubmittedrdquo status so that it will show up in the relevant District Inboxes The FSP_AMENDMENT_NUMBER is incremented Proceed as above (AMENDMENT_AUTO_INCREMENT) except

SET FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoSUBMrdquo (for Submitted)

SET FSP_STATUS_HISTORYSTATUS_CODE = ldquoSUBMrdquo for new record

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 25

35 DOMAIN CODES

The following codes will be set up in the database in static code tables (all fields are VARCHAR2)

FSP_STATUS_CODE TABLE

FSP_STATUS_CODE DESCRIPTION SUBM Submitted DRFT Draft APPR Approved REJ Rejected OTBH Opportunity To Be Heard

FSP_REVIEW_MILESTONE_TYPE_CODE TABLE

FSP_REVIEW_MILESTONE_ TYPE_CODE

DESCRIPTION

FNR First Nations Review CampE Results amp Strategies reviewed by CampE TEN Objectives Results amp Strategies reviewed by

Tenures DDM Sent to DDM for Determination OTHR Other

FSP_ATTACHMENT_TYPE_CODE TABLE

FSP_ATTACHMENT_TYPE_CODE DESCRIPTION FSP FSP legal document MAP Map of FDUs SS Stocking Standards report AMDS Amendment Description DDMD DDM Decision Letter OTHR Other Attachment

FEATURE_CLASSES TABLE

FEATURE_CLASS_SKEY DESCRIPTION FEATURE_CLASS_KEY To be defined

36 REPORTING ERRORS

If an error is detected in a submission it must be reported back to the electronic submission framework The method for doing that is to post a message to a queue detailing the submission number and the error message The licensee will be able to check back to the Electronic Submission WebSite and view the error The Electronic Submission Framework will also send an email to the client detailing the message

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 26

The specification for how to report an error can be found in the ESF Queue Agent Best Practices Document The message content for FSP will be a concatenation of the ltFSP Submission IDgt ltDescriptiongt field and the message returned from the validation routines above To send a message about a submission you will need to supply the FSP submission ID for the submission The FSP submission ID is supplied with the message from ESF and stored in the FSP_ELECTRONIC_SUBMISSION table Refer to the Status Agent in the ESF Queue Agent Best Practices document for details on how to send a message to ESF The following code is provided as a sample only and the final syntax should be from the ESF Queue Agent Best Practices Document StatusAgent sa = new StatusAgent (ldquoFSP Business Agentrdquo) sasendStatus (ltForestStewardshipPlanSubmissionIDgt StatusMessageREJECTED ldquo100rdquo ltForestStewardshipPlangtlt083D02800509gt + ldquofailedrdquo + outMessage) saclose() Note Expectation is that outmessage will contain details as to what part of the FSP failed (eg Tenure Forest Development Unit or Stocking Standard) In the case of invalid data processing stops at this point for the FSP No data for this submission will be added to FSP database

361 ERROR MESSAGES

These error messages may be generated during the accumulation validation and processing phases They are referenced by number in the procedure documentation above

1 A legal FSP document must be attached to this submission Please attach a document containing your Forest Stewardship Plan

2 The attached file ltnamegt does not have a recognizable file extension Atachments must be one of MSWord (doc) Portable Document Format (pdf) MS Excel (xls) ZIP archive (zip) or JPEG graphic (jpg) Please resubmit with appropriate file attachments

3 You do not have the proper authority to submit an FSP via ESF Please contact the appropriate MoFR District office to obtain the necessary ldquoSubmitterrdquo authority role

4 The FSP submitted does not name any plan holders At least one holder of a major BC Forest license must be named in the plan

5 No forest license number was found for a named plan holder You must name all forest licenses which apply within the FSP

6 A plan holderrsquos license number could not be verified Please check the validity of the plan holder MoFR client codes

7 A forest license number listed is not owned by any of the plan holders of this FSP Please check the validity of the plan holder MoFR client codes and their licence numbers

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 27

8 At least one BC Forest District must be listed for this FSP Each District responsible for the area included in the FSP must be listed

9 The MoFR District Code is not recognized Please check the spelling of the District code(s) included or check with the appropriate District office for the proper code

10 More than one Forest Stewardship Plan (FSP) was included in this submission At the present time each ESF submission may contain only a single FSP

11 The submission must include the name of a contact person responsible for communicating with MoFR about this FSP submission

12 The submission must include the email address of a contact person responsible for communicating with MoFR about this FSP submission

13 The submission must include the telephone number of a contact person responsible for communicating with MoFR about this FSP submission

14 The submission must indicate whether or not this is an original FSP or an amendment to an existing FSP

15 The FSP must have a name 16 The FSP must include at least one Forest Development Unit (FDU) 17 The FSP must include at least one Stocking Standard 18 This submission refers to an FSP that does not exist in the Ministryrsquos

database Please check the FSP ID number provided after your original submission

19 An FSP with the same FSP ID number already exists in the Ministryrsquos database yet you have not indicated that this is an amendment If the intention is to amend an existing FSP please include the correct FSP ID and make sure the ltamendmentIndgt flag is set to ldquotruerdquo

20 The FSP you are trying to amend has been rejected You cannot amend or replace a rejected FSP You must make a brand new submission When doing so do not include an FSP ID number

21 The submission appears to be a new FSP yet the amendment indicator is set to true (ltamendmentIndgt = ldquotruerdquo) Either provide an FSP ID to amend an existing FSP or set the amendment indicator to ldquofalserdquo

22 The FSP plan term has been set to greater than 5 years FSPs are valid for a maximum of 5 years unless an extension is approved

23 The plan commencement date provided is not valid 24 A value for ltamendmentIndgt must be provided it must be set to either ldquotruerdquo or ldquofalserdquo

25 The submission appears to be for an FSP amendment (ltamendmentIndgt = ldquotruerdquo) however no FSP is referenced Please be sure to include the FSP ID number provided with the original submission

26 You cannot amend an FSP that is not approved Ensure you have provided the correct FSP ID number issued with the original submission and confirm that the FSP is approved

27 An FSP with the same FSP ID number already exists in the database Before you can update this FSP it must be placed in Draft status by the District Manager

28 The submission appears to be an amendment to an existing FSP However you have not stated whether or not this amendment requires Ministry approval Please ensure that the ltamendmentApprovalRequiredIndgt is set to one of ldquotruerdquo or ldquofalserdquo

29 A Forest development Unit (FDU) was submitted without a name A name must be provided for each FDU

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 28

30 The same name has been provided for more than one Forest Development Unit (FDU) Each FDU in a submission must have a unique name

31 A Forest Development Unit (FDU) was submitted that did not list a forest licence number that applies Each FDU must have at least one license number applied

32 A forest license number was supplied that does not appear to be owned by any of the plan holders for this FSP Each Forest Development Unit (FDU) must be listed with at least one forest license owned by one of the plan holders for this FSP

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting

Page 4: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 4

Table of Contents

1 SCOPE 5

11 REFERENCES 5 12 DOCUMENT CONVENTIONS 5

2 FSP BUSINESS AGENT - HIGH LEVEL OVERVIEW 6

3 FSP BUSINESS AGENT ndash DETAILED SPECIFICATIONS 9

31 BUSINESS AGENT IMPLEMENTATION 9 32 DATA PARSING 9 33 SUBMISSION PROCESSING 11 34 DATA VALIDATION - DAO INTERFACE SPECIFICATIONS12

341FSP_XML_SUBMISSIONUSER_SUBMISSION_DATA 12

342FSP_XML_SUBMISSIONVALID_FSP 13

343FSP_XML_SUBMISSIONACCUMULATE_ORG_UNIT 13

344FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER14

345FSP_XML_SUBMISSIONACCUMULATE_FDU 14

346FSP_XML_SUBMISSIONACCUMULATE_STANDARD 14

347RESULTS_XML_SUBMISSIONACCUMULATE_STANDARDS_LAYER 16

348RESULTS_XML_SUBMISSIONACCUMULATE_SPECIES 17

349FSP_VALIDATE_XMLFSP_VALIDATION 17

3410FSP_PROCESS_XMLPROCESS_XML_SUBMISSION 20

35 REPORTING ERRORS 22

4 SPATIAL PROCESSING29

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 5

1 SCOPE

The scope of this design document includes the components required to process a Forest Stewardship Plan electronic submission received from the Forest Industry or BC Timber Sales More specifically it includes the design specifications for

1 FSP Business Agent ndash The Oracle Advanced Queue (OAQ) Agent that receives the electronic submission from the Electronic Submission Framework validates the data and puts it into the appropriate FSP tables

11 REFERENCES

The document is technical in nature and assumes the reader is familiar with messaging architectures in particular Oracle Advanced Queueing Oracle Spatial GML and Oracle PLSQL Other document references include

FSP Requirements documents Oracle Advanced Queuing Investigation FSPTS Detailed Design FSP XML Schema Specification Logical and physical data models for the FSP Tracking System (See Appendix )

12 DOCUMENT CONVENTIONS

Because this document details with both XML and Oracle table fields often with the same name a document convention has been applied to differentiate the fields XML fields start are enclosed in ltgt and table fields are not Java objects or properties are enclosed in

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 6

2 FSP BUSINESS AGENT - HIGH LEVEL OVERVIEW

The diagram on the following page represents the overall submission process The FSPSVC box shows the processing that is done by the FSP_SVC The boxes on the right side of the diagram represent Oracle packages that perform the business rule validation and storage of the submission in the appropriate FSP tables Each application is either committed or rolled back at the end of the processing by the FSP_SVC The diagram is followed by a detailed description of each step

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 7

FSP_PROCESS_XML

FSP_VALIDATE_XML

FSPSVC

ESF ESF FSP SubmissionFSP XML SubmissionPARSE XML

TOPOLOGY VALIDATION

Cursor of error messages

VALIDATE_FDUS

VALIDATE_STANDARDS

VALIDATE_PLAN_HOLDERS

Cursor of error messages

Invokes

Invokes

Invokes

HANDLE SUBMISSION

Java Representation of Submission

Java Representation of Submission

Java Representation of Submission

VALIDATE FOREST STEWARDSHIP PLAN

MOVE FSP DATA FROM TEMP TABLE TO OPERATIONAL TABLES

COMMIT OR ROLLBACK

Similar to RESULTS but note minor differences in XML elements and some differences in optionality

User submission data (once)

FSP_XML_SUBMISSION (Oracle Package)

ACCUMULATE_STANDARD

USER_SUBMISSION_DATA

ACCUMULATE_LAYER

ACCUMULATE_SPECIES

ACCUMULATE_BGC

Cursor of error messages

Standards Info (Once for each Standard )

Cursor of error messages

BGC BEC Info (Once for each BGC )

Cursor of error messages

Layer Info (Once for each Layer )

Cursor of error messages

Species Info (Once for each Layer Species )

ENSURE VALID USER DATA

ACCUMULATE FSP DATA TO TEMP TABLEUNTIL A COMPLETE APPLICATION IS PROCESSED

Cursor of error messages

Invokes

ACCUMULATE_PLAN_HOLDER

ACCUMULATE_ORG_UNIT

ACCUMULATE_FDU

VALID_FSP

Cursor of error messages

Licensees (Plan Holder ) Info (Once for each Licensee )

Cursor of error messages

Org Units Info (Once for each Org Unit )

Cursor of error messages

FDU Info (Once for each FDU )

Cursor of error messages

FSP Info (Once )

VALIDATE_ORG_UNITS

VALIDATE_FSP

FSP_VALIDATION

Invokes

PROCESS_FDUS

PROCESS_STANDARDS

PROCESS_LICENSEES

Invokes

Invokes

Invokes

Invokes

PROCESS_ORG_UNITS

PROCESS_FSP

PROCESS_XML_SUBMISSION

Invokes

PROCESS_USER_DATA

Invokes

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 8

The high level flow of the submission process futher describing the diagram on the previous page is as follows 1 The FSP business Agent (FSPSVC) receives a message from the Electronic Submission

Framework via an Oracle Message Queue The message is read and the XML is parsed checking well-formed against the FSP XML Schema

2 A set of accumulator stored procedures are called to ldquoaccumulaterdquo the FSP components

of the submission 3 Once the data is accumulated it can be validated Each component of the FSP

submission is validated The complete FSP must validate or the submission is rejected and the appropriate messages are sent back to the submitter to help determine the issues

4 If the submission is valid it is processed and stored in database using the package

FSP_PROCESS_XML The spatial data for the FDUs is also stored in the database 5 Once the data is stored it will be available in the district and licenseersquos INBOX 6 The transaction is either committed or rolled back if any one of these compoents failed

In the case of a rollback the message will be left on the queue and attempted again Causes of failure are typically infrastructure (eg insufficient rollback space)

The following sections provide more detail on each of these steps

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 9

3 FSP BUSINESS AGENT ndash DETAILED SPECIFICATIONS

The XML submission is forestStewardshipPlan centric ie each transactional unit will be encompassed within ltforestStewardshipPlangt and ltforestStewardshipPlangt tag pairs All data within this block will be related to the FSP as defined in this block Only at single FSP unit can exist in the same submission although the business rule may change in a later release to allow a licensee to submit multiple FSPs in a single submission For information on the schema please see the FSP Submission Schema and an example FSP submission

31 BUSINESS AGENT IMPLEMENTATION

The FSP Business Agent will be written as a Java Application that will listen for messages on an Oracle Advanced Queue The implementation will start with the base class as defined in the Electronic Submission Framework project The base class will define the methods for manipulating (eg Add view remove) messages on an Oracle Advanced Queue Refer to the Agent Design Section of the ESF Queue Agent Best Practices Document for the specific details on how to create a message agent See also ESF Submissions Web Service ndash Client Developerrsquos Guide The remainder of this section provides the more detailed processing that the FSP Business Agent must implement once it receives a new submission from the queue

32 DATA PARSING

Parsing of a submission will be done using VIXB (Vivid XML Binding) The XML will be parsed into a set of java objects modelling the XML For more information on VIXB see the VIXB users guide In a nutshell VIXB configures a SAX XML parser with call backs to a Sax handler The handler then passes the parsed data to tag-specific extractors which know how to ldquoextractrdquo the data When the extractor is complete it then calls an application specific processor The processor is then responsible to perform validation and processing Following is a UML class diagram of the FSP domain classes which will be created Note some of these entities may already be defined for previous MoFR apps and can be named or refactored accordingly however the XML tag information is specific to FSP and must be parsed and validated accordingly For clarity not all gettersetter methods are included

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 10

+getName() string(idl)+setName()+getFSP_ID() unsigned long(idl)+setAmendment()+getAmendment() short(idl)+getStatus() short(idl)+setStatus()+setPlanStartDate()+getPlanStartDate() long long(idl)+getPlanTerm() short(idl)+setPlanTerm()+getPlanContactPerson() PlanContactPerson+requiresApproval() boolean(idl)+setRequiresApprovalInd()

-planName string(idl)-FSP_ID unsigned long(idl)-amendmentNumber short(idl) = 0-dateSubmitted unsigned long(idl)-status-planStartDate unsigned long(idl)-planTerm short(idl) = 5-requiresApprovalInd boolean(idl)

ForestStewardShipPlan

-name string(idl)

ForestDevelopmentUnit

-bgcZone string(idl)-bgcSubzone string(idl)-bgcVariant string(idl)-bgcPhase string(idl)-bgcSiteSeries string(idl)-bgcSiteType string(idl)-gbcSeral string(idl)-maxAllowableDisturbance float(idl)-standardsRationale string(idl)-regenObligationInd boolean(idl)-regenOffseti short(idl)-earlyOffset short(idl)-lateOffset short(idl)

StockingStandard-clientCode string(idl)-licenceNumber string(idl)

PlanHolder

1

0

1

0

1

1

-licenceNumber string(idl)

ForestLicence

1

1

-

spatial

1

1

+getDistrictCode() string(idl)

-districtCode string(idl)

OrgUnit

1 1

+getName() string(idl)+setName()+getEmail() string(idl)+setEmail()+getPhone() unsigned long(idl)+setPhone()

-Name string(idl)-emailAddress string(idl)-telephone unsigned long(idl)

PlanContactPerson

11

Amended FSP might not include stocking standards

Amended FSP might not include FDUs

-stockingLayerCode string(idl)-wellSpaced unsigned long(idl)-minPrefWellSpaced unsigned long(idl)-residualBasalArea unsigned long(idl)-minHorizontalDistance unsigned long(idl)-minPostSpacing unsigned long(idl)-maxPostSpacing unsigned long(idl)-maxConifer unsigned long(idl)-heightRelativeToComp unsigned long(idl)-heightRelativeToCompCode string(idl)

StandardLayer

1

1

-speciesCode string(idl)-minHeight float(idl)-preferredSpeciesInd boolean(idl)

StandardLayerSpecies11

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 11

33 SUBMISSION PROCESSING

All the data for a Forest Stewardship Plan is required in order to validate it To address this all the data for an FSP is ldquoaccumulatedrdquo in temporary database tables Once the data is accumulated validation can occur Accumulation is done by calling functions in the FSP_XML_SUBMISSION package Validation functions are implemented in the FSP_VALIDATION package General Note 1 All procedures have at least one ldquoOUTrdquo parameter This is a string that will

contain any error messages that occur during the operation Other ldquoOUTrdquo parameters will be database identifying values for that object that are required for future processes (ie other agents) and so must be stored

2 For the initial FSP submission (amendment 0) the submitter must submit at least

one document as an attachment a a legal FSP document (MSWord or PDF) (Error 1) b The submitter may also include other supporting documentation as

attached files c The files must have approved extension (doc pdf xls zip jpg) (Error

2)

The pseudo code to validate a Forest Stewardship Plan is as follows

Begin Transaction

Call FSP_XML_SUBMISSIONUSER_SUBMISSION_DATA once

Call FSP_XML_SUBMISSIONVALID_FSP once

Call FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER for each ltplanHoldergt

For each OrgUnit element

Call FSP_XML_SUBMISSIONACCUMULATE_ORG_UNIT

For each PlanHolder element

Call FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER

For each ForestDevelopmentUnit Call FSP_XML_SUBMISSIONACCUMULATE_FDU

For each StockingStandard element

Call FSP_XML_SUBMISSIONACCUMULATE_STANDARD

For each StandardLayer element

Call FSP_XML_SUBMISSIONACCUMULATE_LAYER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 12

For each StandardLayerSpecies

Call FSP_XML_SUBMISSIONACCUMULATE_SPECIES

Call FSP_VALIDATE_XMLFSP_VALIDATION

If errors then

ROLLBACK the transaction

Note If system erros then return false to base agent so job is left on queue If validation errors then return true to remove job from queue and error messages are sent back to the client

Else

Call FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

COMMIT

34 DATA VALIDATION - DAO INTERFACE SPECIFICATIONS

This section details the interface between the Java business agent and the Oracle packages that implement amalgamation validation and processing It can be used in conjunction with the previous sections to define the detailed package interface

341 FSP_XML_SUBMISSIONUSER_SUBMISSION_DATA

Capture the submission metadata coming from ESF Confirm that the individual making the FSP submission has valid authority

to submit via ESF (Error 3)

PROCEDURE USER_SUBMISSION_DATA( P_FSP_SUBMISSION_ID IN NUMBER

P_SUBMITTED_BY IN VARCHAR2 P_CLIENT_NUMBER IN VARCHAR2 P_CLIENT_LOCN_CODE IN VARCHAR2 P_ORG_UNIT_NO IN NUMBER P_SUBMISSION_TIMESTAMP IN DATE P_USER_FILENAME IN VARCHAR2 P_USER_AUTHORITY IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_SUBMISSION_ID Comes from file message from ESF

P_SUBMITTED_BY Comes from file message from ESF

P_CLIENT_NUMBER Comes from file message from ESF

P_CLIENT_LOCN_CODE Comes from file message from ESF

P_ADMIN_DISTRICT_NO orgUnitNo from submission metadata ltdistrictCodegt value

P_SUBMISSION_TIMESTAMP Comes from file message from ESF

P_USER_FILENAME Comes from file message from ESF

P_USER_AUTHORITY Set to lsquoACrsquo

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 13

342 FSP_XML_SUBMISSIONACCUMULATE_FSP

Call once for the ltForestStewardshipPlangt entity Ensure only one such entity is included If no errors are returned then proceed If FSP already exists (this is an amendment) return the FSP_ID PROCEDURE VALID_FSP (P_FSP_ID IN OUT NUMBER

P_PLAN_NAME IN VARCHAR2 P_PLAN_TERM_YEARS IN NUMBER P_PLAN_TERM_COMMENCEMENT IN DATE P_ACTION_CODE IN VARCHAR2 P_SUBMITTER_NAME IN VARCHAR2 P_SUBMITTER_EMAIL IN VARCHAR2 P_SUBMITTER_TELEPHONE IN VARCHAR2 P_AMENDMENT_IND IN VARCHAR2 P_AMENDMENT_COMMENT IN VARCHAR2 P_AMENDMENT_APPROVAL_IND IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_OPENING_ID ltfspIDgt or from previous procedure call

P_PLAN_NAME ltplanNamegt

P_PLAN_TERM_YEARS ltplanTermYearsgt

P_PLAN_TERM_COMMENCEMENT ltplanTermCommencementgt

P_ACTION_CODE ltactionCodegt

P_SUBMITTER_NAME ltlicenseeContactgt

P_SUBMITTER_EMAIL ltemailAddressgt

P_SUBMITTER_TELEPHONE lttelphoneNumbergt

P_AMENDMENT_IND ltamendmentIndgt

P_AMENDMENT_COMMENT ltamendmentCommentgt

P_AMENDMENT_APPROVAL_IND ltadmendmentApprovalRequiredgt

343 FSP_XML_SUBMISSIONACCUMULATE_ORG_UNIT

Call once for each ltdistrictCodePropertygt in ltForestStewardshipPlangt PROCEDURE ACCUMULATE_PLAN_HOLDER(

P_FSP_ID IN NUMBER P_DISTRICT_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_DISTRICT_CODE ltdistrictCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 14

344 FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER

Call once for each ltPlanHoldergt in the FSP PROCEDURE ACCUMULATE_PLAN_HOLDER(

P_FSP_ID IN NUMBER P_CLIENT_NUMBER IN VARCHAR2 P_CLIENT_LICENSE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_CLIENT_NUMBER Comes from file message from ESF

P_CLIENT_LICENCE Comes from file message from ESF

345 FSP_XML_SUBMISSIONACCUMULATE_FDU

Call once for each ltFDUgt in the FSP PROCEDURE ACCUMULATE_FDU(

P_FSP_ID IN NUMBER P_FDU_NAME IN VARCHAR2 P_CLIENT_LICENCES IN VARRAY OF VARCHAR2 P_GEOMETRY IN MDSYSSDO_GEOMETRY P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_FDU_NAME ltfduNamegt

P_CLIENT_LICENCES ltFDUgtltlicenseNumbergt

P_GEOMETRY FDU ltextentOfgt as SDO_GEOMETRY

346 FSP_XML_SUBMISSIONACCUMULATE_STANDARD

Call once for each ltStockingStandardgt in the FSP

PROCEDURE ACCUMULATE_STANDARD( P_STANDARDS_REGIME_ID IN OUT NUMBER P_STANDARDS_REGIME_NAME IN VARCHAR2 P_STANDARDS_OBJECTIVE IN VARCHAR2 P_REGEN_DELAY_OFFSET_YRS IN NUMBER P_REGEN_OBLIGATION_IND IN VARCHAR2 P_EARLY_OFFSET_YRS IN NUMBER P_LATE_OFFSET_YRS IN NUMBER P_GEOGRAPHIC_DESCRIPTION IN VARCHAR2 P_ADDITIONAL_STANDARDS IN VARCHAR2

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 15

P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt

P_STANDARDS_REGIME_NAME ltstandardsRegimeNamegt

P_STANDARDS_OBJECTIVE ltstandardsObjectivegt

P_REGEN_DELAY_OFFSET_YRS ltregenOffsetgt from regenObjectivesProperty

P_REGEN_OBLIGATION_IND ltregenObligationIndgt from regenObjectivesProperty

P_EARLY_OFFSET_YRS ltearlyOffsetgt from regenObjectivesProperty

P_LATE_OFFSET_YRS ltlateOffsetgt from regenObjectivesProperty

P_GEOGRAPHIC_DESCRIPTION ltgeographicDescriptiongt

P_ADDITIONAL_STANDARDS ltadditionalStandardsgt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 16

347 RESULTS_XML_SUBMISSIONACCUMULATE_STANDARDS_LAYER

For each StandardLayer within a Standards Regime call

PROCEDURE ACCUMULATE_STANDARDS_LAYER (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_STOCKING_LAYER_ID OUT NUMBER P_TARGET_STOCKING IN NUMBER P_RESIDUAL_BASAL_AREA IN NUMBER P_MIN_HORIZONTAL_DISTANCE IN NUMBER P_MIN_PREF_STOCKING_STANDARD IN NUMBER P_MIN_POST_SPACING IN NUMBER P_MIN_STOCKING_STANDARD IN NUMBER P_MAX_POST_SPACING IN NUMBER P_MAX_CONIFER IN NUMBER P_HGHT_RELATIVE_TO_COMP IN NUMBER P_HGHT_RELATIVE_COMP_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID From ltstandardsRegimeIdgt or previous procedure

P_STOCKING_LAYER_CODE ltstockingLayerCodegt

P_STOCKING_LAYER_ID This value is returned

P_TARGET_STOCKING ltwellSpacedgt

P_RESIDUAL_BASAL_AREA ltresidualBasalAreagt

P_MIN_HORIZONTAL_DISTANCE ltminHorizontalDistancegt

P_PREF_STOCKING_STANDARD ltminPrefWellSpacedgt

P_MIN_POST_SPACING ltminPostSpacinggt

P_MIN_STOCKING_STANDARD ltminStockingStandardgt

P_MAX_POST_SPACING ltmaxPostSpacinggt

P_MAX_CONIFER ltmaxConifergt

P_HGHT_RELATIVE_COMP ltheightRelativeToCompgt

P_HGHT_RELATIVE_COMP_CODE ltheightRelativeToCompCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 17

348 RESULTS_XML_SUBMISSIONACCUMULATE_SPECIES

Call once for each StandardLayerSpecies within a StandardLayer

PROCEDURE ACCUMULATE_SPECIES (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_SPECIES_CODE IN VARCHAR2 P_STOCKING_LAYER_ID IN NUMBER P_PREFERRED_IND IN VARCHAR2 P_MIN_HEIGHT IN NUMBER P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt or previous procedure

P_STOCKING_LAYER_CODE STOCKING_LAYER_CODE from StandardLayer

P_SPECIES_CODE ltspeciesCodegt

P_STOCKING_LAYER_ID STOCKING_LAYER_ID from StandardLayer

P_STOCKING_STANDARD_UNIT_ID STOCKING_STANDARD_UNIT_ID from StandardLayer

P_PREFERRED_IND ltpreferredSpeciesIndgt

P_MIN_HEIGHT ltminHeightgt

P_SUBMITTED_BY Comes from file message from ESF

349 FSP_VALIDATE_XMLFSP_VALIDATION

Call after the the submission has been accumulated and no errors were returned FSP_VALIDATION is a procedure that calls a chain of other procedures that validate parts of the submission data The overall results are returned

FSP_VALIDATE_XMLVALIDATE_PLAN_HOLDER

BUSINESS RULES

At least one named licensee (forest client) forest licence pair in ltPlanHoldergt (Error 4 5 6)

That each named licensee actually exists and owns the licence listed

(Error 7)

FSP_VALIDATE_XMLVALIDATE_ORG_UNITS

BUSINESS RULES

At least one ltdistrictCodegt named (Error 8) Code resolves to a valid existing MoFR Forest District (Error 9)

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 18

FSP_VALIDATE_XMLVALIDATE_FSP

BUSINESS RULES

Ensure only a single ltForestStewardshipPlangt entity is included (Error 10)

Submission metadata ltlicenseeContactgt(Error 11)

ltemailAddressgt(Error 12) and lttelephoneNumbergt (Error 13) provided (no nulls)

Is this an original submission or an amendment (ltamendmentIndicatorgt)

(Error 14)

If original submission confirm o Plan name provided (Error 15) o Required document attached

FSP legal plan document (Error 1) o At least one ltForestDevelopmentUnitgt included (Error 16) o At least one ltStockingStandardgt included (Error 17)

ltfspIDgt (conditional) this is amendment or update

o If provided ensure a matching FSP_ID already exists in the database (Error 18)

o If existing FSP_ID status = ldquoApprovedrdquo this must be an amendment ensure that ltamendmentIndgt = ldquoTrdquo (Error 19)

o If existing FSP_ID status = ldquoRejectedrdquo this is a mistaken attempt to re-submit the same FSP (Error 20)

o If existing FSP_ID status = ldquoDraftrdquo this is an update anything submitted will overwrite existing FSP_ID record

ltplanNamegt (conditional)

o If provided and no ltfspIDgt provided this is a new submission Ensure that ltamendmentIndgt = lsquoFrsquo (Error 21)

ltplanTermgt (optional) if included is less than or equal to 5 (Error 22) ltplanStartDategt (optional) if included is valid date (Error 23) ltactionCodegt

o if ldquoNrdquo (New) Must be new FSP ensure no matching FSP_ID

FSP_AMENDMENT_NUMBER primary key already exists o if ldquoUrdquo (Update)

Must be existing FSP ensure a match to FSP_ID and FSP_AMENDMENT_NUMBER key exists

Existing FSP must be in ldquoDraftrdquo status o if ldquoArdquo (Append)

Must an existing FSP in ldquoDraftrdquo status Explicitly designed for appending GML map data to an

existing FSP

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 19

Must not already by any FOREST_DEVELOPMENT_UNIT entries for this FSP

ltamendmentIndgt (mandatory)

o Must be one of ldquoTrdquo or ldquoFrdquo (Error 24) o If ldquoTrdquo ensure ltfspIDgt provided and matches an existing FSP_ID in

the database (error 25) also ensure that the status of the existing FSP_ID = ldquoApprovedrdquo (error 26)

o If ldquoFrdquo and no ltfspIDgt provided this is a new submission o If ldquoFrdquo and ltfspIDgt provided must be an update ensure it

matches an existing FSP_ID with status = ldquoDraftrdquo (Error 27) ltamendmentApprovalRequiredIndgt (conditional)

o If ltamendmentIndgt is ldquotruerdquo must be included and set to one of ldquoTrdquo or ldquoFrdquo (Error 28)

FSP_VALIDATE_XMLVALIDATE_FDUS

BUSINESS RULES

Validate Geometry o polygon area gt 0 o polygon boundary length gt 0 o Other

Validate Identifier o ltfduNamegt must exist and not be null (Error 29) o ltfduNamegt must be unique within the FSP (no duplicates) (Error

30)

Validate Licences o Each FDU must have at least one forest licence applying (Error 31) o Each licence must be owned by one of the licensees listed for this

FSP ltplanHoldergtltlicenceNumbergt (Error 32)

FSP_VALIDATE_XMLVALIDATE_STANDARDS

BUSINESS RULES

Stocking Standards o For FSPs the stocking standard is nearly identical to the

ltStandardsAmendmentTypegt in the RESULTS schema with the following exceptions

The following elements from RESULTS ltStandardsTypegt have been added

ltbgcZonegt ltbgcSubzonegt ltbgcVariantgt ltbgcPhasegt ltbgcSiteSeriesgt ltbgcSiteTypegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 20

ltbgcSeralgt ltmaximumAllowableSoilDisturbancegt

o Therefore the equivalent Validation procedures from Results 30 can be used here with minor amendments

o FSP Stocking Standards do not have a spatial component and are not linked to any piece of ground

3410 FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

Call if no errors returned in any of the steps above PROCEDURE PROCESS_XML_SUBMISSION(

P_POST IN VARCHAR2 P_RESULTS OUT ref_results)

Procedure parameter Data Value P_POST Validate only indicator from fsp

submission metadata

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 21

The following diagram shows the decision points on how to process the submission depending on input parameters The pre-defined states refer procedures defined below

ltfspIDgt

Y

ltplanNamegt

N Error must havePlan name

N

fspID ==FSP_ID

Error UnknownFSP

N

FSP_IDSTATUS

Y

Error cannotUpdate or amend

RejectedSubmitted

ltamendmentIndgt

Approved

Error amendment requiredF

AmendApproval

Ind

T

AmendmentTo

Inbox

T

AmendmentAuto

Approve

UpdateExisting

PlanDraft

Create NewFSP

Y

End

End

End

FSP with same FSP_ID exists in database

FSP Submission

Validate

ESF FSPSubmissionAccumulate

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 22

3411 CREATE_NEW_FSP

This procedure will create a new ForestStewardshipPlan and all related entities in the production database

FOREST_STEWARDSHIP_PLAN TABLE

Source Destination FSP_SEQNEXTVAL FSP_ID 0 FSP_AMENDMENT_NUMBER STATUS for ldquoSubmittedrdquo FSP_STATUS_CODE ltplanNamegt PLAN_NAME ltplanTermYearsgt PLAN_TERM_YEARS ltplanTermCommencementgt PLAN_START_DATE ltplanTermCommencementgt + ltplanTermYearsgt

PLAN_END_DATE

ESF submission date PLAN_SUBMISSION_DATE ltlicenseeContactgt CONTACT_NAME lttelphoneNumbergt TELEPHONE_NUMBER ltemailAddressgt EMAIL_ADDRESS

FSP_AGREEMENT_HOLDER TABLE

Source Destination ltPlanHoldergtltclientCodegt CLIENT_NUMBER

FSP_ORG_UNIT TABLE

Source Destination ORG_UNITORG_UNIT_NO for ltdistrictCodegt

ORG_UNIT_NO

FSP_STATUS_HISTORY TABLE

Source Destination FSP_STATUS_HISTORY_SEQ FSP_STATUS_HISTORY_ID ldquoSubmittedrdquo code from FSP_STATUS_CODE

FSP_STATUS_CODE

ldquoNew Submissionrdquo STATUS_COMMENT

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 23

FSP_ATTACHMENT TABLE

Source Destination ESF framework ATTACHMENT_DESCRIPTION ATTACHMENT_NAME ATTACHMENT_SIZE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

3412 UPDATE_EXISTING_PLAN

For ESF submissions only the FDU map spatial component ltFDUPropertygt can be submitted as an update Part of the validation is to ensure that no other data is included with the ESF submission file except ltfspIDgt and ltFDUPropertygt This may be an INSERT or an UPDATE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination ltfspIDgt FSP_ID FOREST_STEWARDSHIP_PLAN FSP_AMENDMENT_NUMBER

FSP_AMENDMENT_NUMBER

FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 24

3413 AMENDMENT_AUTO_APPROVE

This is to create an amendment that does not require approval It is in effect a new FSP submission that automatically goes to ldquoApprovedrdquo status and increments the FSP_AMENDMENT_NUMBER Processing depends on what the licensee has submitted It may be one or more of

headeradministrative information (such as adding a new licensee) or amending a plan term

a new legal FSP document a new GML map of all the FDUs (spatial data if amended must be

completely replaced) new stocking standards

Process the data as if it were a new submission (see above) with the following exceptions

Do an INSERT INTO FOREST_STEWARDSHIP_PLAN setting FSP_AMENDMENT_NUMBER = MAX(FSP_AMENDMENT_NUMBER) + 1

Copy all fields from FOREST_STEWARDSHIP_PLAN from the most recent amendment (or the original submission record if no amendments)

UPDATE any fields in FOREST_STEWARSHIP_PLAN for this new entry that are provided in the XML submission that is any of ltplanNamegt ltplanTermYearsgt ltplanTermCommencementgt ltlicenseeContactgt lttelephoneNumbergt ltemailAddressgt

Any attachments must be INSERTed into FSP_ATTACHMENT with the new FSP_AMENDMENT_NUMBER (also FSP_ATTACHMENT_CONTENT)

Set FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoAPPRrdquo for this new record

INSERT INTO FSP_STATUS_HISTORY (FSP_STATUS_HISTORY_ID FSP_ID FSP_AMENDMENT_NUMBER FSP_STATUS_CODE STATUS_COMMENT) VALUES (SEQNEXTVAL ltFSP_IDgt ltnew FSP_AMENDMENT_NUMBERgt ldquoAPPRrdquo ltamendmentCommentgt) Be sure to use the new FSP_AMENDMENT_NUMBER in INSERTing any STANDARDS_REGIME or FOREST_DEVELOPMENT_UNIT records

3414 AMENDMENT_TO_INBOX

This is to create an amendment that requires approval The FSP submission is put in ldquoSubmittedrdquo status so that it will show up in the relevant District Inboxes The FSP_AMENDMENT_NUMBER is incremented Proceed as above (AMENDMENT_AUTO_INCREMENT) except

SET FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoSUBMrdquo (for Submitted)

SET FSP_STATUS_HISTORYSTATUS_CODE = ldquoSUBMrdquo for new record

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 25

35 DOMAIN CODES

The following codes will be set up in the database in static code tables (all fields are VARCHAR2)

FSP_STATUS_CODE TABLE

FSP_STATUS_CODE DESCRIPTION SUBM Submitted DRFT Draft APPR Approved REJ Rejected OTBH Opportunity To Be Heard

FSP_REVIEW_MILESTONE_TYPE_CODE TABLE

FSP_REVIEW_MILESTONE_ TYPE_CODE

DESCRIPTION

FNR First Nations Review CampE Results amp Strategies reviewed by CampE TEN Objectives Results amp Strategies reviewed by

Tenures DDM Sent to DDM for Determination OTHR Other

FSP_ATTACHMENT_TYPE_CODE TABLE

FSP_ATTACHMENT_TYPE_CODE DESCRIPTION FSP FSP legal document MAP Map of FDUs SS Stocking Standards report AMDS Amendment Description DDMD DDM Decision Letter OTHR Other Attachment

FEATURE_CLASSES TABLE

FEATURE_CLASS_SKEY DESCRIPTION FEATURE_CLASS_KEY To be defined

36 REPORTING ERRORS

If an error is detected in a submission it must be reported back to the electronic submission framework The method for doing that is to post a message to a queue detailing the submission number and the error message The licensee will be able to check back to the Electronic Submission WebSite and view the error The Electronic Submission Framework will also send an email to the client detailing the message

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 26

The specification for how to report an error can be found in the ESF Queue Agent Best Practices Document The message content for FSP will be a concatenation of the ltFSP Submission IDgt ltDescriptiongt field and the message returned from the validation routines above To send a message about a submission you will need to supply the FSP submission ID for the submission The FSP submission ID is supplied with the message from ESF and stored in the FSP_ELECTRONIC_SUBMISSION table Refer to the Status Agent in the ESF Queue Agent Best Practices document for details on how to send a message to ESF The following code is provided as a sample only and the final syntax should be from the ESF Queue Agent Best Practices Document StatusAgent sa = new StatusAgent (ldquoFSP Business Agentrdquo) sasendStatus (ltForestStewardshipPlanSubmissionIDgt StatusMessageREJECTED ldquo100rdquo ltForestStewardshipPlangtlt083D02800509gt + ldquofailedrdquo + outMessage) saclose() Note Expectation is that outmessage will contain details as to what part of the FSP failed (eg Tenure Forest Development Unit or Stocking Standard) In the case of invalid data processing stops at this point for the FSP No data for this submission will be added to FSP database

361 ERROR MESSAGES

These error messages may be generated during the accumulation validation and processing phases They are referenced by number in the procedure documentation above

1 A legal FSP document must be attached to this submission Please attach a document containing your Forest Stewardship Plan

2 The attached file ltnamegt does not have a recognizable file extension Atachments must be one of MSWord (doc) Portable Document Format (pdf) MS Excel (xls) ZIP archive (zip) or JPEG graphic (jpg) Please resubmit with appropriate file attachments

3 You do not have the proper authority to submit an FSP via ESF Please contact the appropriate MoFR District office to obtain the necessary ldquoSubmitterrdquo authority role

4 The FSP submitted does not name any plan holders At least one holder of a major BC Forest license must be named in the plan

5 No forest license number was found for a named plan holder You must name all forest licenses which apply within the FSP

6 A plan holderrsquos license number could not be verified Please check the validity of the plan holder MoFR client codes

7 A forest license number listed is not owned by any of the plan holders of this FSP Please check the validity of the plan holder MoFR client codes and their licence numbers

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 27

8 At least one BC Forest District must be listed for this FSP Each District responsible for the area included in the FSP must be listed

9 The MoFR District Code is not recognized Please check the spelling of the District code(s) included or check with the appropriate District office for the proper code

10 More than one Forest Stewardship Plan (FSP) was included in this submission At the present time each ESF submission may contain only a single FSP

11 The submission must include the name of a contact person responsible for communicating with MoFR about this FSP submission

12 The submission must include the email address of a contact person responsible for communicating with MoFR about this FSP submission

13 The submission must include the telephone number of a contact person responsible for communicating with MoFR about this FSP submission

14 The submission must indicate whether or not this is an original FSP or an amendment to an existing FSP

15 The FSP must have a name 16 The FSP must include at least one Forest Development Unit (FDU) 17 The FSP must include at least one Stocking Standard 18 This submission refers to an FSP that does not exist in the Ministryrsquos

database Please check the FSP ID number provided after your original submission

19 An FSP with the same FSP ID number already exists in the Ministryrsquos database yet you have not indicated that this is an amendment If the intention is to amend an existing FSP please include the correct FSP ID and make sure the ltamendmentIndgt flag is set to ldquotruerdquo

20 The FSP you are trying to amend has been rejected You cannot amend or replace a rejected FSP You must make a brand new submission When doing so do not include an FSP ID number

21 The submission appears to be a new FSP yet the amendment indicator is set to true (ltamendmentIndgt = ldquotruerdquo) Either provide an FSP ID to amend an existing FSP or set the amendment indicator to ldquofalserdquo

22 The FSP plan term has been set to greater than 5 years FSPs are valid for a maximum of 5 years unless an extension is approved

23 The plan commencement date provided is not valid 24 A value for ltamendmentIndgt must be provided it must be set to either ldquotruerdquo or ldquofalserdquo

25 The submission appears to be for an FSP amendment (ltamendmentIndgt = ldquotruerdquo) however no FSP is referenced Please be sure to include the FSP ID number provided with the original submission

26 You cannot amend an FSP that is not approved Ensure you have provided the correct FSP ID number issued with the original submission and confirm that the FSP is approved

27 An FSP with the same FSP ID number already exists in the database Before you can update this FSP it must be placed in Draft status by the District Manager

28 The submission appears to be an amendment to an existing FSP However you have not stated whether or not this amendment requires Ministry approval Please ensure that the ltamendmentApprovalRequiredIndgt is set to one of ldquotruerdquo or ldquofalserdquo

29 A Forest development Unit (FDU) was submitted without a name A name must be provided for each FDU

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 28

30 The same name has been provided for more than one Forest Development Unit (FDU) Each FDU in a submission must have a unique name

31 A Forest Development Unit (FDU) was submitted that did not list a forest licence number that applies Each FDU must have at least one license number applied

32 A forest license number was supplied that does not appear to be owned by any of the plan holders for this FSP Each Forest Development Unit (FDU) must be listed with at least one forest license owned by one of the plan holders for this FSP

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting

Page 5: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 5

1 SCOPE

The scope of this design document includes the components required to process a Forest Stewardship Plan electronic submission received from the Forest Industry or BC Timber Sales More specifically it includes the design specifications for

1 FSP Business Agent ndash The Oracle Advanced Queue (OAQ) Agent that receives the electronic submission from the Electronic Submission Framework validates the data and puts it into the appropriate FSP tables

11 REFERENCES

The document is technical in nature and assumes the reader is familiar with messaging architectures in particular Oracle Advanced Queueing Oracle Spatial GML and Oracle PLSQL Other document references include

FSP Requirements documents Oracle Advanced Queuing Investigation FSPTS Detailed Design FSP XML Schema Specification Logical and physical data models for the FSP Tracking System (See Appendix )

12 DOCUMENT CONVENTIONS

Because this document details with both XML and Oracle table fields often with the same name a document convention has been applied to differentiate the fields XML fields start are enclosed in ltgt and table fields are not Java objects or properties are enclosed in

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 6

2 FSP BUSINESS AGENT - HIGH LEVEL OVERVIEW

The diagram on the following page represents the overall submission process The FSPSVC box shows the processing that is done by the FSP_SVC The boxes on the right side of the diagram represent Oracle packages that perform the business rule validation and storage of the submission in the appropriate FSP tables Each application is either committed or rolled back at the end of the processing by the FSP_SVC The diagram is followed by a detailed description of each step

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 7

FSP_PROCESS_XML

FSP_VALIDATE_XML

FSPSVC

ESF ESF FSP SubmissionFSP XML SubmissionPARSE XML

TOPOLOGY VALIDATION

Cursor of error messages

VALIDATE_FDUS

VALIDATE_STANDARDS

VALIDATE_PLAN_HOLDERS

Cursor of error messages

Invokes

Invokes

Invokes

HANDLE SUBMISSION

Java Representation of Submission

Java Representation of Submission

Java Representation of Submission

VALIDATE FOREST STEWARDSHIP PLAN

MOVE FSP DATA FROM TEMP TABLE TO OPERATIONAL TABLES

COMMIT OR ROLLBACK

Similar to RESULTS but note minor differences in XML elements and some differences in optionality

User submission data (once)

FSP_XML_SUBMISSION (Oracle Package)

ACCUMULATE_STANDARD

USER_SUBMISSION_DATA

ACCUMULATE_LAYER

ACCUMULATE_SPECIES

ACCUMULATE_BGC

Cursor of error messages

Standards Info (Once for each Standard )

Cursor of error messages

BGC BEC Info (Once for each BGC )

Cursor of error messages

Layer Info (Once for each Layer )

Cursor of error messages

Species Info (Once for each Layer Species )

ENSURE VALID USER DATA

ACCUMULATE FSP DATA TO TEMP TABLEUNTIL A COMPLETE APPLICATION IS PROCESSED

Cursor of error messages

Invokes

ACCUMULATE_PLAN_HOLDER

ACCUMULATE_ORG_UNIT

ACCUMULATE_FDU

VALID_FSP

Cursor of error messages

Licensees (Plan Holder ) Info (Once for each Licensee )

Cursor of error messages

Org Units Info (Once for each Org Unit )

Cursor of error messages

FDU Info (Once for each FDU )

Cursor of error messages

FSP Info (Once )

VALIDATE_ORG_UNITS

VALIDATE_FSP

FSP_VALIDATION

Invokes

PROCESS_FDUS

PROCESS_STANDARDS

PROCESS_LICENSEES

Invokes

Invokes

Invokes

Invokes

PROCESS_ORG_UNITS

PROCESS_FSP

PROCESS_XML_SUBMISSION

Invokes

PROCESS_USER_DATA

Invokes

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 8

The high level flow of the submission process futher describing the diagram on the previous page is as follows 1 The FSP business Agent (FSPSVC) receives a message from the Electronic Submission

Framework via an Oracle Message Queue The message is read and the XML is parsed checking well-formed against the FSP XML Schema

2 A set of accumulator stored procedures are called to ldquoaccumulaterdquo the FSP components

of the submission 3 Once the data is accumulated it can be validated Each component of the FSP

submission is validated The complete FSP must validate or the submission is rejected and the appropriate messages are sent back to the submitter to help determine the issues

4 If the submission is valid it is processed and stored in database using the package

FSP_PROCESS_XML The spatial data for the FDUs is also stored in the database 5 Once the data is stored it will be available in the district and licenseersquos INBOX 6 The transaction is either committed or rolled back if any one of these compoents failed

In the case of a rollback the message will be left on the queue and attempted again Causes of failure are typically infrastructure (eg insufficient rollback space)

The following sections provide more detail on each of these steps

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 9

3 FSP BUSINESS AGENT ndash DETAILED SPECIFICATIONS

The XML submission is forestStewardshipPlan centric ie each transactional unit will be encompassed within ltforestStewardshipPlangt and ltforestStewardshipPlangt tag pairs All data within this block will be related to the FSP as defined in this block Only at single FSP unit can exist in the same submission although the business rule may change in a later release to allow a licensee to submit multiple FSPs in a single submission For information on the schema please see the FSP Submission Schema and an example FSP submission

31 BUSINESS AGENT IMPLEMENTATION

The FSP Business Agent will be written as a Java Application that will listen for messages on an Oracle Advanced Queue The implementation will start with the base class as defined in the Electronic Submission Framework project The base class will define the methods for manipulating (eg Add view remove) messages on an Oracle Advanced Queue Refer to the Agent Design Section of the ESF Queue Agent Best Practices Document for the specific details on how to create a message agent See also ESF Submissions Web Service ndash Client Developerrsquos Guide The remainder of this section provides the more detailed processing that the FSP Business Agent must implement once it receives a new submission from the queue

32 DATA PARSING

Parsing of a submission will be done using VIXB (Vivid XML Binding) The XML will be parsed into a set of java objects modelling the XML For more information on VIXB see the VIXB users guide In a nutshell VIXB configures a SAX XML parser with call backs to a Sax handler The handler then passes the parsed data to tag-specific extractors which know how to ldquoextractrdquo the data When the extractor is complete it then calls an application specific processor The processor is then responsible to perform validation and processing Following is a UML class diagram of the FSP domain classes which will be created Note some of these entities may already be defined for previous MoFR apps and can be named or refactored accordingly however the XML tag information is specific to FSP and must be parsed and validated accordingly For clarity not all gettersetter methods are included

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 10

+getName() string(idl)+setName()+getFSP_ID() unsigned long(idl)+setAmendment()+getAmendment() short(idl)+getStatus() short(idl)+setStatus()+setPlanStartDate()+getPlanStartDate() long long(idl)+getPlanTerm() short(idl)+setPlanTerm()+getPlanContactPerson() PlanContactPerson+requiresApproval() boolean(idl)+setRequiresApprovalInd()

-planName string(idl)-FSP_ID unsigned long(idl)-amendmentNumber short(idl) = 0-dateSubmitted unsigned long(idl)-status-planStartDate unsigned long(idl)-planTerm short(idl) = 5-requiresApprovalInd boolean(idl)

ForestStewardShipPlan

-name string(idl)

ForestDevelopmentUnit

-bgcZone string(idl)-bgcSubzone string(idl)-bgcVariant string(idl)-bgcPhase string(idl)-bgcSiteSeries string(idl)-bgcSiteType string(idl)-gbcSeral string(idl)-maxAllowableDisturbance float(idl)-standardsRationale string(idl)-regenObligationInd boolean(idl)-regenOffseti short(idl)-earlyOffset short(idl)-lateOffset short(idl)

StockingStandard-clientCode string(idl)-licenceNumber string(idl)

PlanHolder

1

0

1

0

1

1

-licenceNumber string(idl)

ForestLicence

1

1

-

spatial

1

1

+getDistrictCode() string(idl)

-districtCode string(idl)

OrgUnit

1 1

+getName() string(idl)+setName()+getEmail() string(idl)+setEmail()+getPhone() unsigned long(idl)+setPhone()

-Name string(idl)-emailAddress string(idl)-telephone unsigned long(idl)

PlanContactPerson

11

Amended FSP might not include stocking standards

Amended FSP might not include FDUs

-stockingLayerCode string(idl)-wellSpaced unsigned long(idl)-minPrefWellSpaced unsigned long(idl)-residualBasalArea unsigned long(idl)-minHorizontalDistance unsigned long(idl)-minPostSpacing unsigned long(idl)-maxPostSpacing unsigned long(idl)-maxConifer unsigned long(idl)-heightRelativeToComp unsigned long(idl)-heightRelativeToCompCode string(idl)

StandardLayer

1

1

-speciesCode string(idl)-minHeight float(idl)-preferredSpeciesInd boolean(idl)

StandardLayerSpecies11

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 11

33 SUBMISSION PROCESSING

All the data for a Forest Stewardship Plan is required in order to validate it To address this all the data for an FSP is ldquoaccumulatedrdquo in temporary database tables Once the data is accumulated validation can occur Accumulation is done by calling functions in the FSP_XML_SUBMISSION package Validation functions are implemented in the FSP_VALIDATION package General Note 1 All procedures have at least one ldquoOUTrdquo parameter This is a string that will

contain any error messages that occur during the operation Other ldquoOUTrdquo parameters will be database identifying values for that object that are required for future processes (ie other agents) and so must be stored

2 For the initial FSP submission (amendment 0) the submitter must submit at least

one document as an attachment a a legal FSP document (MSWord or PDF) (Error 1) b The submitter may also include other supporting documentation as

attached files c The files must have approved extension (doc pdf xls zip jpg) (Error

2)

The pseudo code to validate a Forest Stewardship Plan is as follows

Begin Transaction

Call FSP_XML_SUBMISSIONUSER_SUBMISSION_DATA once

Call FSP_XML_SUBMISSIONVALID_FSP once

Call FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER for each ltplanHoldergt

For each OrgUnit element

Call FSP_XML_SUBMISSIONACCUMULATE_ORG_UNIT

For each PlanHolder element

Call FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER

For each ForestDevelopmentUnit Call FSP_XML_SUBMISSIONACCUMULATE_FDU

For each StockingStandard element

Call FSP_XML_SUBMISSIONACCUMULATE_STANDARD

For each StandardLayer element

Call FSP_XML_SUBMISSIONACCUMULATE_LAYER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 12

For each StandardLayerSpecies

Call FSP_XML_SUBMISSIONACCUMULATE_SPECIES

Call FSP_VALIDATE_XMLFSP_VALIDATION

If errors then

ROLLBACK the transaction

Note If system erros then return false to base agent so job is left on queue If validation errors then return true to remove job from queue and error messages are sent back to the client

Else

Call FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

COMMIT

34 DATA VALIDATION - DAO INTERFACE SPECIFICATIONS

This section details the interface between the Java business agent and the Oracle packages that implement amalgamation validation and processing It can be used in conjunction with the previous sections to define the detailed package interface

341 FSP_XML_SUBMISSIONUSER_SUBMISSION_DATA

Capture the submission metadata coming from ESF Confirm that the individual making the FSP submission has valid authority

to submit via ESF (Error 3)

PROCEDURE USER_SUBMISSION_DATA( P_FSP_SUBMISSION_ID IN NUMBER

P_SUBMITTED_BY IN VARCHAR2 P_CLIENT_NUMBER IN VARCHAR2 P_CLIENT_LOCN_CODE IN VARCHAR2 P_ORG_UNIT_NO IN NUMBER P_SUBMISSION_TIMESTAMP IN DATE P_USER_FILENAME IN VARCHAR2 P_USER_AUTHORITY IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_SUBMISSION_ID Comes from file message from ESF

P_SUBMITTED_BY Comes from file message from ESF

P_CLIENT_NUMBER Comes from file message from ESF

P_CLIENT_LOCN_CODE Comes from file message from ESF

P_ADMIN_DISTRICT_NO orgUnitNo from submission metadata ltdistrictCodegt value

P_SUBMISSION_TIMESTAMP Comes from file message from ESF

P_USER_FILENAME Comes from file message from ESF

P_USER_AUTHORITY Set to lsquoACrsquo

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 13

342 FSP_XML_SUBMISSIONACCUMULATE_FSP

Call once for the ltForestStewardshipPlangt entity Ensure only one such entity is included If no errors are returned then proceed If FSP already exists (this is an amendment) return the FSP_ID PROCEDURE VALID_FSP (P_FSP_ID IN OUT NUMBER

P_PLAN_NAME IN VARCHAR2 P_PLAN_TERM_YEARS IN NUMBER P_PLAN_TERM_COMMENCEMENT IN DATE P_ACTION_CODE IN VARCHAR2 P_SUBMITTER_NAME IN VARCHAR2 P_SUBMITTER_EMAIL IN VARCHAR2 P_SUBMITTER_TELEPHONE IN VARCHAR2 P_AMENDMENT_IND IN VARCHAR2 P_AMENDMENT_COMMENT IN VARCHAR2 P_AMENDMENT_APPROVAL_IND IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_OPENING_ID ltfspIDgt or from previous procedure call

P_PLAN_NAME ltplanNamegt

P_PLAN_TERM_YEARS ltplanTermYearsgt

P_PLAN_TERM_COMMENCEMENT ltplanTermCommencementgt

P_ACTION_CODE ltactionCodegt

P_SUBMITTER_NAME ltlicenseeContactgt

P_SUBMITTER_EMAIL ltemailAddressgt

P_SUBMITTER_TELEPHONE lttelphoneNumbergt

P_AMENDMENT_IND ltamendmentIndgt

P_AMENDMENT_COMMENT ltamendmentCommentgt

P_AMENDMENT_APPROVAL_IND ltadmendmentApprovalRequiredgt

343 FSP_XML_SUBMISSIONACCUMULATE_ORG_UNIT

Call once for each ltdistrictCodePropertygt in ltForestStewardshipPlangt PROCEDURE ACCUMULATE_PLAN_HOLDER(

P_FSP_ID IN NUMBER P_DISTRICT_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_DISTRICT_CODE ltdistrictCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 14

344 FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER

Call once for each ltPlanHoldergt in the FSP PROCEDURE ACCUMULATE_PLAN_HOLDER(

P_FSP_ID IN NUMBER P_CLIENT_NUMBER IN VARCHAR2 P_CLIENT_LICENSE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_CLIENT_NUMBER Comes from file message from ESF

P_CLIENT_LICENCE Comes from file message from ESF

345 FSP_XML_SUBMISSIONACCUMULATE_FDU

Call once for each ltFDUgt in the FSP PROCEDURE ACCUMULATE_FDU(

P_FSP_ID IN NUMBER P_FDU_NAME IN VARCHAR2 P_CLIENT_LICENCES IN VARRAY OF VARCHAR2 P_GEOMETRY IN MDSYSSDO_GEOMETRY P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_FDU_NAME ltfduNamegt

P_CLIENT_LICENCES ltFDUgtltlicenseNumbergt

P_GEOMETRY FDU ltextentOfgt as SDO_GEOMETRY

346 FSP_XML_SUBMISSIONACCUMULATE_STANDARD

Call once for each ltStockingStandardgt in the FSP

PROCEDURE ACCUMULATE_STANDARD( P_STANDARDS_REGIME_ID IN OUT NUMBER P_STANDARDS_REGIME_NAME IN VARCHAR2 P_STANDARDS_OBJECTIVE IN VARCHAR2 P_REGEN_DELAY_OFFSET_YRS IN NUMBER P_REGEN_OBLIGATION_IND IN VARCHAR2 P_EARLY_OFFSET_YRS IN NUMBER P_LATE_OFFSET_YRS IN NUMBER P_GEOGRAPHIC_DESCRIPTION IN VARCHAR2 P_ADDITIONAL_STANDARDS IN VARCHAR2

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 15

P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt

P_STANDARDS_REGIME_NAME ltstandardsRegimeNamegt

P_STANDARDS_OBJECTIVE ltstandardsObjectivegt

P_REGEN_DELAY_OFFSET_YRS ltregenOffsetgt from regenObjectivesProperty

P_REGEN_OBLIGATION_IND ltregenObligationIndgt from regenObjectivesProperty

P_EARLY_OFFSET_YRS ltearlyOffsetgt from regenObjectivesProperty

P_LATE_OFFSET_YRS ltlateOffsetgt from regenObjectivesProperty

P_GEOGRAPHIC_DESCRIPTION ltgeographicDescriptiongt

P_ADDITIONAL_STANDARDS ltadditionalStandardsgt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 16

347 RESULTS_XML_SUBMISSIONACCUMULATE_STANDARDS_LAYER

For each StandardLayer within a Standards Regime call

PROCEDURE ACCUMULATE_STANDARDS_LAYER (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_STOCKING_LAYER_ID OUT NUMBER P_TARGET_STOCKING IN NUMBER P_RESIDUAL_BASAL_AREA IN NUMBER P_MIN_HORIZONTAL_DISTANCE IN NUMBER P_MIN_PREF_STOCKING_STANDARD IN NUMBER P_MIN_POST_SPACING IN NUMBER P_MIN_STOCKING_STANDARD IN NUMBER P_MAX_POST_SPACING IN NUMBER P_MAX_CONIFER IN NUMBER P_HGHT_RELATIVE_TO_COMP IN NUMBER P_HGHT_RELATIVE_COMP_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID From ltstandardsRegimeIdgt or previous procedure

P_STOCKING_LAYER_CODE ltstockingLayerCodegt

P_STOCKING_LAYER_ID This value is returned

P_TARGET_STOCKING ltwellSpacedgt

P_RESIDUAL_BASAL_AREA ltresidualBasalAreagt

P_MIN_HORIZONTAL_DISTANCE ltminHorizontalDistancegt

P_PREF_STOCKING_STANDARD ltminPrefWellSpacedgt

P_MIN_POST_SPACING ltminPostSpacinggt

P_MIN_STOCKING_STANDARD ltminStockingStandardgt

P_MAX_POST_SPACING ltmaxPostSpacinggt

P_MAX_CONIFER ltmaxConifergt

P_HGHT_RELATIVE_COMP ltheightRelativeToCompgt

P_HGHT_RELATIVE_COMP_CODE ltheightRelativeToCompCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 17

348 RESULTS_XML_SUBMISSIONACCUMULATE_SPECIES

Call once for each StandardLayerSpecies within a StandardLayer

PROCEDURE ACCUMULATE_SPECIES (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_SPECIES_CODE IN VARCHAR2 P_STOCKING_LAYER_ID IN NUMBER P_PREFERRED_IND IN VARCHAR2 P_MIN_HEIGHT IN NUMBER P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt or previous procedure

P_STOCKING_LAYER_CODE STOCKING_LAYER_CODE from StandardLayer

P_SPECIES_CODE ltspeciesCodegt

P_STOCKING_LAYER_ID STOCKING_LAYER_ID from StandardLayer

P_STOCKING_STANDARD_UNIT_ID STOCKING_STANDARD_UNIT_ID from StandardLayer

P_PREFERRED_IND ltpreferredSpeciesIndgt

P_MIN_HEIGHT ltminHeightgt

P_SUBMITTED_BY Comes from file message from ESF

349 FSP_VALIDATE_XMLFSP_VALIDATION

Call after the the submission has been accumulated and no errors were returned FSP_VALIDATION is a procedure that calls a chain of other procedures that validate parts of the submission data The overall results are returned

FSP_VALIDATE_XMLVALIDATE_PLAN_HOLDER

BUSINESS RULES

At least one named licensee (forest client) forest licence pair in ltPlanHoldergt (Error 4 5 6)

That each named licensee actually exists and owns the licence listed

(Error 7)

FSP_VALIDATE_XMLVALIDATE_ORG_UNITS

BUSINESS RULES

At least one ltdistrictCodegt named (Error 8) Code resolves to a valid existing MoFR Forest District (Error 9)

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 18

FSP_VALIDATE_XMLVALIDATE_FSP

BUSINESS RULES

Ensure only a single ltForestStewardshipPlangt entity is included (Error 10)

Submission metadata ltlicenseeContactgt(Error 11)

ltemailAddressgt(Error 12) and lttelephoneNumbergt (Error 13) provided (no nulls)

Is this an original submission or an amendment (ltamendmentIndicatorgt)

(Error 14)

If original submission confirm o Plan name provided (Error 15) o Required document attached

FSP legal plan document (Error 1) o At least one ltForestDevelopmentUnitgt included (Error 16) o At least one ltStockingStandardgt included (Error 17)

ltfspIDgt (conditional) this is amendment or update

o If provided ensure a matching FSP_ID already exists in the database (Error 18)

o If existing FSP_ID status = ldquoApprovedrdquo this must be an amendment ensure that ltamendmentIndgt = ldquoTrdquo (Error 19)

o If existing FSP_ID status = ldquoRejectedrdquo this is a mistaken attempt to re-submit the same FSP (Error 20)

o If existing FSP_ID status = ldquoDraftrdquo this is an update anything submitted will overwrite existing FSP_ID record

ltplanNamegt (conditional)

o If provided and no ltfspIDgt provided this is a new submission Ensure that ltamendmentIndgt = lsquoFrsquo (Error 21)

ltplanTermgt (optional) if included is less than or equal to 5 (Error 22) ltplanStartDategt (optional) if included is valid date (Error 23) ltactionCodegt

o if ldquoNrdquo (New) Must be new FSP ensure no matching FSP_ID

FSP_AMENDMENT_NUMBER primary key already exists o if ldquoUrdquo (Update)

Must be existing FSP ensure a match to FSP_ID and FSP_AMENDMENT_NUMBER key exists

Existing FSP must be in ldquoDraftrdquo status o if ldquoArdquo (Append)

Must an existing FSP in ldquoDraftrdquo status Explicitly designed for appending GML map data to an

existing FSP

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 19

Must not already by any FOREST_DEVELOPMENT_UNIT entries for this FSP

ltamendmentIndgt (mandatory)

o Must be one of ldquoTrdquo or ldquoFrdquo (Error 24) o If ldquoTrdquo ensure ltfspIDgt provided and matches an existing FSP_ID in

the database (error 25) also ensure that the status of the existing FSP_ID = ldquoApprovedrdquo (error 26)

o If ldquoFrdquo and no ltfspIDgt provided this is a new submission o If ldquoFrdquo and ltfspIDgt provided must be an update ensure it

matches an existing FSP_ID with status = ldquoDraftrdquo (Error 27) ltamendmentApprovalRequiredIndgt (conditional)

o If ltamendmentIndgt is ldquotruerdquo must be included and set to one of ldquoTrdquo or ldquoFrdquo (Error 28)

FSP_VALIDATE_XMLVALIDATE_FDUS

BUSINESS RULES

Validate Geometry o polygon area gt 0 o polygon boundary length gt 0 o Other

Validate Identifier o ltfduNamegt must exist and not be null (Error 29) o ltfduNamegt must be unique within the FSP (no duplicates) (Error

30)

Validate Licences o Each FDU must have at least one forest licence applying (Error 31) o Each licence must be owned by one of the licensees listed for this

FSP ltplanHoldergtltlicenceNumbergt (Error 32)

FSP_VALIDATE_XMLVALIDATE_STANDARDS

BUSINESS RULES

Stocking Standards o For FSPs the stocking standard is nearly identical to the

ltStandardsAmendmentTypegt in the RESULTS schema with the following exceptions

The following elements from RESULTS ltStandardsTypegt have been added

ltbgcZonegt ltbgcSubzonegt ltbgcVariantgt ltbgcPhasegt ltbgcSiteSeriesgt ltbgcSiteTypegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 20

ltbgcSeralgt ltmaximumAllowableSoilDisturbancegt

o Therefore the equivalent Validation procedures from Results 30 can be used here with minor amendments

o FSP Stocking Standards do not have a spatial component and are not linked to any piece of ground

3410 FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

Call if no errors returned in any of the steps above PROCEDURE PROCESS_XML_SUBMISSION(

P_POST IN VARCHAR2 P_RESULTS OUT ref_results)

Procedure parameter Data Value P_POST Validate only indicator from fsp

submission metadata

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 21

The following diagram shows the decision points on how to process the submission depending on input parameters The pre-defined states refer procedures defined below

ltfspIDgt

Y

ltplanNamegt

N Error must havePlan name

N

fspID ==FSP_ID

Error UnknownFSP

N

FSP_IDSTATUS

Y

Error cannotUpdate or amend

RejectedSubmitted

ltamendmentIndgt

Approved

Error amendment requiredF

AmendApproval

Ind

T

AmendmentTo

Inbox

T

AmendmentAuto

Approve

UpdateExisting

PlanDraft

Create NewFSP

Y

End

End

End

FSP with same FSP_ID exists in database

FSP Submission

Validate

ESF FSPSubmissionAccumulate

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 22

3411 CREATE_NEW_FSP

This procedure will create a new ForestStewardshipPlan and all related entities in the production database

FOREST_STEWARDSHIP_PLAN TABLE

Source Destination FSP_SEQNEXTVAL FSP_ID 0 FSP_AMENDMENT_NUMBER STATUS for ldquoSubmittedrdquo FSP_STATUS_CODE ltplanNamegt PLAN_NAME ltplanTermYearsgt PLAN_TERM_YEARS ltplanTermCommencementgt PLAN_START_DATE ltplanTermCommencementgt + ltplanTermYearsgt

PLAN_END_DATE

ESF submission date PLAN_SUBMISSION_DATE ltlicenseeContactgt CONTACT_NAME lttelphoneNumbergt TELEPHONE_NUMBER ltemailAddressgt EMAIL_ADDRESS

FSP_AGREEMENT_HOLDER TABLE

Source Destination ltPlanHoldergtltclientCodegt CLIENT_NUMBER

FSP_ORG_UNIT TABLE

Source Destination ORG_UNITORG_UNIT_NO for ltdistrictCodegt

ORG_UNIT_NO

FSP_STATUS_HISTORY TABLE

Source Destination FSP_STATUS_HISTORY_SEQ FSP_STATUS_HISTORY_ID ldquoSubmittedrdquo code from FSP_STATUS_CODE

FSP_STATUS_CODE

ldquoNew Submissionrdquo STATUS_COMMENT

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 23

FSP_ATTACHMENT TABLE

Source Destination ESF framework ATTACHMENT_DESCRIPTION ATTACHMENT_NAME ATTACHMENT_SIZE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

3412 UPDATE_EXISTING_PLAN

For ESF submissions only the FDU map spatial component ltFDUPropertygt can be submitted as an update Part of the validation is to ensure that no other data is included with the ESF submission file except ltfspIDgt and ltFDUPropertygt This may be an INSERT or an UPDATE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination ltfspIDgt FSP_ID FOREST_STEWARDSHIP_PLAN FSP_AMENDMENT_NUMBER

FSP_AMENDMENT_NUMBER

FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 24

3413 AMENDMENT_AUTO_APPROVE

This is to create an amendment that does not require approval It is in effect a new FSP submission that automatically goes to ldquoApprovedrdquo status and increments the FSP_AMENDMENT_NUMBER Processing depends on what the licensee has submitted It may be one or more of

headeradministrative information (such as adding a new licensee) or amending a plan term

a new legal FSP document a new GML map of all the FDUs (spatial data if amended must be

completely replaced) new stocking standards

Process the data as if it were a new submission (see above) with the following exceptions

Do an INSERT INTO FOREST_STEWARDSHIP_PLAN setting FSP_AMENDMENT_NUMBER = MAX(FSP_AMENDMENT_NUMBER) + 1

Copy all fields from FOREST_STEWARDSHIP_PLAN from the most recent amendment (or the original submission record if no amendments)

UPDATE any fields in FOREST_STEWARSHIP_PLAN for this new entry that are provided in the XML submission that is any of ltplanNamegt ltplanTermYearsgt ltplanTermCommencementgt ltlicenseeContactgt lttelephoneNumbergt ltemailAddressgt

Any attachments must be INSERTed into FSP_ATTACHMENT with the new FSP_AMENDMENT_NUMBER (also FSP_ATTACHMENT_CONTENT)

Set FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoAPPRrdquo for this new record

INSERT INTO FSP_STATUS_HISTORY (FSP_STATUS_HISTORY_ID FSP_ID FSP_AMENDMENT_NUMBER FSP_STATUS_CODE STATUS_COMMENT) VALUES (SEQNEXTVAL ltFSP_IDgt ltnew FSP_AMENDMENT_NUMBERgt ldquoAPPRrdquo ltamendmentCommentgt) Be sure to use the new FSP_AMENDMENT_NUMBER in INSERTing any STANDARDS_REGIME or FOREST_DEVELOPMENT_UNIT records

3414 AMENDMENT_TO_INBOX

This is to create an amendment that requires approval The FSP submission is put in ldquoSubmittedrdquo status so that it will show up in the relevant District Inboxes The FSP_AMENDMENT_NUMBER is incremented Proceed as above (AMENDMENT_AUTO_INCREMENT) except

SET FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoSUBMrdquo (for Submitted)

SET FSP_STATUS_HISTORYSTATUS_CODE = ldquoSUBMrdquo for new record

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 25

35 DOMAIN CODES

The following codes will be set up in the database in static code tables (all fields are VARCHAR2)

FSP_STATUS_CODE TABLE

FSP_STATUS_CODE DESCRIPTION SUBM Submitted DRFT Draft APPR Approved REJ Rejected OTBH Opportunity To Be Heard

FSP_REVIEW_MILESTONE_TYPE_CODE TABLE

FSP_REVIEW_MILESTONE_ TYPE_CODE

DESCRIPTION

FNR First Nations Review CampE Results amp Strategies reviewed by CampE TEN Objectives Results amp Strategies reviewed by

Tenures DDM Sent to DDM for Determination OTHR Other

FSP_ATTACHMENT_TYPE_CODE TABLE

FSP_ATTACHMENT_TYPE_CODE DESCRIPTION FSP FSP legal document MAP Map of FDUs SS Stocking Standards report AMDS Amendment Description DDMD DDM Decision Letter OTHR Other Attachment

FEATURE_CLASSES TABLE

FEATURE_CLASS_SKEY DESCRIPTION FEATURE_CLASS_KEY To be defined

36 REPORTING ERRORS

If an error is detected in a submission it must be reported back to the electronic submission framework The method for doing that is to post a message to a queue detailing the submission number and the error message The licensee will be able to check back to the Electronic Submission WebSite and view the error The Electronic Submission Framework will also send an email to the client detailing the message

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 26

The specification for how to report an error can be found in the ESF Queue Agent Best Practices Document The message content for FSP will be a concatenation of the ltFSP Submission IDgt ltDescriptiongt field and the message returned from the validation routines above To send a message about a submission you will need to supply the FSP submission ID for the submission The FSP submission ID is supplied with the message from ESF and stored in the FSP_ELECTRONIC_SUBMISSION table Refer to the Status Agent in the ESF Queue Agent Best Practices document for details on how to send a message to ESF The following code is provided as a sample only and the final syntax should be from the ESF Queue Agent Best Practices Document StatusAgent sa = new StatusAgent (ldquoFSP Business Agentrdquo) sasendStatus (ltForestStewardshipPlanSubmissionIDgt StatusMessageREJECTED ldquo100rdquo ltForestStewardshipPlangtlt083D02800509gt + ldquofailedrdquo + outMessage) saclose() Note Expectation is that outmessage will contain details as to what part of the FSP failed (eg Tenure Forest Development Unit or Stocking Standard) In the case of invalid data processing stops at this point for the FSP No data for this submission will be added to FSP database

361 ERROR MESSAGES

These error messages may be generated during the accumulation validation and processing phases They are referenced by number in the procedure documentation above

1 A legal FSP document must be attached to this submission Please attach a document containing your Forest Stewardship Plan

2 The attached file ltnamegt does not have a recognizable file extension Atachments must be one of MSWord (doc) Portable Document Format (pdf) MS Excel (xls) ZIP archive (zip) or JPEG graphic (jpg) Please resubmit with appropriate file attachments

3 You do not have the proper authority to submit an FSP via ESF Please contact the appropriate MoFR District office to obtain the necessary ldquoSubmitterrdquo authority role

4 The FSP submitted does not name any plan holders At least one holder of a major BC Forest license must be named in the plan

5 No forest license number was found for a named plan holder You must name all forest licenses which apply within the FSP

6 A plan holderrsquos license number could not be verified Please check the validity of the plan holder MoFR client codes

7 A forest license number listed is not owned by any of the plan holders of this FSP Please check the validity of the plan holder MoFR client codes and their licence numbers

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 27

8 At least one BC Forest District must be listed for this FSP Each District responsible for the area included in the FSP must be listed

9 The MoFR District Code is not recognized Please check the spelling of the District code(s) included or check with the appropriate District office for the proper code

10 More than one Forest Stewardship Plan (FSP) was included in this submission At the present time each ESF submission may contain only a single FSP

11 The submission must include the name of a contact person responsible for communicating with MoFR about this FSP submission

12 The submission must include the email address of a contact person responsible for communicating with MoFR about this FSP submission

13 The submission must include the telephone number of a contact person responsible for communicating with MoFR about this FSP submission

14 The submission must indicate whether or not this is an original FSP or an amendment to an existing FSP

15 The FSP must have a name 16 The FSP must include at least one Forest Development Unit (FDU) 17 The FSP must include at least one Stocking Standard 18 This submission refers to an FSP that does not exist in the Ministryrsquos

database Please check the FSP ID number provided after your original submission

19 An FSP with the same FSP ID number already exists in the Ministryrsquos database yet you have not indicated that this is an amendment If the intention is to amend an existing FSP please include the correct FSP ID and make sure the ltamendmentIndgt flag is set to ldquotruerdquo

20 The FSP you are trying to amend has been rejected You cannot amend or replace a rejected FSP You must make a brand new submission When doing so do not include an FSP ID number

21 The submission appears to be a new FSP yet the amendment indicator is set to true (ltamendmentIndgt = ldquotruerdquo) Either provide an FSP ID to amend an existing FSP or set the amendment indicator to ldquofalserdquo

22 The FSP plan term has been set to greater than 5 years FSPs are valid for a maximum of 5 years unless an extension is approved

23 The plan commencement date provided is not valid 24 A value for ltamendmentIndgt must be provided it must be set to either ldquotruerdquo or ldquofalserdquo

25 The submission appears to be for an FSP amendment (ltamendmentIndgt = ldquotruerdquo) however no FSP is referenced Please be sure to include the FSP ID number provided with the original submission

26 You cannot amend an FSP that is not approved Ensure you have provided the correct FSP ID number issued with the original submission and confirm that the FSP is approved

27 An FSP with the same FSP ID number already exists in the database Before you can update this FSP it must be placed in Draft status by the District Manager

28 The submission appears to be an amendment to an existing FSP However you have not stated whether or not this amendment requires Ministry approval Please ensure that the ltamendmentApprovalRequiredIndgt is set to one of ldquotruerdquo or ldquofalserdquo

29 A Forest development Unit (FDU) was submitted without a name A name must be provided for each FDU

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 28

30 The same name has been provided for more than one Forest Development Unit (FDU) Each FDU in a submission must have a unique name

31 A Forest Development Unit (FDU) was submitted that did not list a forest licence number that applies Each FDU must have at least one license number applied

32 A forest license number was supplied that does not appear to be owned by any of the plan holders for this FSP Each Forest Development Unit (FDU) must be listed with at least one forest license owned by one of the plan holders for this FSP

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting

Page 6: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 6

2 FSP BUSINESS AGENT - HIGH LEVEL OVERVIEW

The diagram on the following page represents the overall submission process The FSPSVC box shows the processing that is done by the FSP_SVC The boxes on the right side of the diagram represent Oracle packages that perform the business rule validation and storage of the submission in the appropriate FSP tables Each application is either committed or rolled back at the end of the processing by the FSP_SVC The diagram is followed by a detailed description of each step

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 7

FSP_PROCESS_XML

FSP_VALIDATE_XML

FSPSVC

ESF ESF FSP SubmissionFSP XML SubmissionPARSE XML

TOPOLOGY VALIDATION

Cursor of error messages

VALIDATE_FDUS

VALIDATE_STANDARDS

VALIDATE_PLAN_HOLDERS

Cursor of error messages

Invokes

Invokes

Invokes

HANDLE SUBMISSION

Java Representation of Submission

Java Representation of Submission

Java Representation of Submission

VALIDATE FOREST STEWARDSHIP PLAN

MOVE FSP DATA FROM TEMP TABLE TO OPERATIONAL TABLES

COMMIT OR ROLLBACK

Similar to RESULTS but note minor differences in XML elements and some differences in optionality

User submission data (once)

FSP_XML_SUBMISSION (Oracle Package)

ACCUMULATE_STANDARD

USER_SUBMISSION_DATA

ACCUMULATE_LAYER

ACCUMULATE_SPECIES

ACCUMULATE_BGC

Cursor of error messages

Standards Info (Once for each Standard )

Cursor of error messages

BGC BEC Info (Once for each BGC )

Cursor of error messages

Layer Info (Once for each Layer )

Cursor of error messages

Species Info (Once for each Layer Species )

ENSURE VALID USER DATA

ACCUMULATE FSP DATA TO TEMP TABLEUNTIL A COMPLETE APPLICATION IS PROCESSED

Cursor of error messages

Invokes

ACCUMULATE_PLAN_HOLDER

ACCUMULATE_ORG_UNIT

ACCUMULATE_FDU

VALID_FSP

Cursor of error messages

Licensees (Plan Holder ) Info (Once for each Licensee )

Cursor of error messages

Org Units Info (Once for each Org Unit )

Cursor of error messages

FDU Info (Once for each FDU )

Cursor of error messages

FSP Info (Once )

VALIDATE_ORG_UNITS

VALIDATE_FSP

FSP_VALIDATION

Invokes

PROCESS_FDUS

PROCESS_STANDARDS

PROCESS_LICENSEES

Invokes

Invokes

Invokes

Invokes

PROCESS_ORG_UNITS

PROCESS_FSP

PROCESS_XML_SUBMISSION

Invokes

PROCESS_USER_DATA

Invokes

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 8

The high level flow of the submission process futher describing the diagram on the previous page is as follows 1 The FSP business Agent (FSPSVC) receives a message from the Electronic Submission

Framework via an Oracle Message Queue The message is read and the XML is parsed checking well-formed against the FSP XML Schema

2 A set of accumulator stored procedures are called to ldquoaccumulaterdquo the FSP components

of the submission 3 Once the data is accumulated it can be validated Each component of the FSP

submission is validated The complete FSP must validate or the submission is rejected and the appropriate messages are sent back to the submitter to help determine the issues

4 If the submission is valid it is processed and stored in database using the package

FSP_PROCESS_XML The spatial data for the FDUs is also stored in the database 5 Once the data is stored it will be available in the district and licenseersquos INBOX 6 The transaction is either committed or rolled back if any one of these compoents failed

In the case of a rollback the message will be left on the queue and attempted again Causes of failure are typically infrastructure (eg insufficient rollback space)

The following sections provide more detail on each of these steps

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 9

3 FSP BUSINESS AGENT ndash DETAILED SPECIFICATIONS

The XML submission is forestStewardshipPlan centric ie each transactional unit will be encompassed within ltforestStewardshipPlangt and ltforestStewardshipPlangt tag pairs All data within this block will be related to the FSP as defined in this block Only at single FSP unit can exist in the same submission although the business rule may change in a later release to allow a licensee to submit multiple FSPs in a single submission For information on the schema please see the FSP Submission Schema and an example FSP submission

31 BUSINESS AGENT IMPLEMENTATION

The FSP Business Agent will be written as a Java Application that will listen for messages on an Oracle Advanced Queue The implementation will start with the base class as defined in the Electronic Submission Framework project The base class will define the methods for manipulating (eg Add view remove) messages on an Oracle Advanced Queue Refer to the Agent Design Section of the ESF Queue Agent Best Practices Document for the specific details on how to create a message agent See also ESF Submissions Web Service ndash Client Developerrsquos Guide The remainder of this section provides the more detailed processing that the FSP Business Agent must implement once it receives a new submission from the queue

32 DATA PARSING

Parsing of a submission will be done using VIXB (Vivid XML Binding) The XML will be parsed into a set of java objects modelling the XML For more information on VIXB see the VIXB users guide In a nutshell VIXB configures a SAX XML parser with call backs to a Sax handler The handler then passes the parsed data to tag-specific extractors which know how to ldquoextractrdquo the data When the extractor is complete it then calls an application specific processor The processor is then responsible to perform validation and processing Following is a UML class diagram of the FSP domain classes which will be created Note some of these entities may already be defined for previous MoFR apps and can be named or refactored accordingly however the XML tag information is specific to FSP and must be parsed and validated accordingly For clarity not all gettersetter methods are included

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 10

+getName() string(idl)+setName()+getFSP_ID() unsigned long(idl)+setAmendment()+getAmendment() short(idl)+getStatus() short(idl)+setStatus()+setPlanStartDate()+getPlanStartDate() long long(idl)+getPlanTerm() short(idl)+setPlanTerm()+getPlanContactPerson() PlanContactPerson+requiresApproval() boolean(idl)+setRequiresApprovalInd()

-planName string(idl)-FSP_ID unsigned long(idl)-amendmentNumber short(idl) = 0-dateSubmitted unsigned long(idl)-status-planStartDate unsigned long(idl)-planTerm short(idl) = 5-requiresApprovalInd boolean(idl)

ForestStewardShipPlan

-name string(idl)

ForestDevelopmentUnit

-bgcZone string(idl)-bgcSubzone string(idl)-bgcVariant string(idl)-bgcPhase string(idl)-bgcSiteSeries string(idl)-bgcSiteType string(idl)-gbcSeral string(idl)-maxAllowableDisturbance float(idl)-standardsRationale string(idl)-regenObligationInd boolean(idl)-regenOffseti short(idl)-earlyOffset short(idl)-lateOffset short(idl)

StockingStandard-clientCode string(idl)-licenceNumber string(idl)

PlanHolder

1

0

1

0

1

1

-licenceNumber string(idl)

ForestLicence

1

1

-

spatial

1

1

+getDistrictCode() string(idl)

-districtCode string(idl)

OrgUnit

1 1

+getName() string(idl)+setName()+getEmail() string(idl)+setEmail()+getPhone() unsigned long(idl)+setPhone()

-Name string(idl)-emailAddress string(idl)-telephone unsigned long(idl)

PlanContactPerson

11

Amended FSP might not include stocking standards

Amended FSP might not include FDUs

-stockingLayerCode string(idl)-wellSpaced unsigned long(idl)-minPrefWellSpaced unsigned long(idl)-residualBasalArea unsigned long(idl)-minHorizontalDistance unsigned long(idl)-minPostSpacing unsigned long(idl)-maxPostSpacing unsigned long(idl)-maxConifer unsigned long(idl)-heightRelativeToComp unsigned long(idl)-heightRelativeToCompCode string(idl)

StandardLayer

1

1

-speciesCode string(idl)-minHeight float(idl)-preferredSpeciesInd boolean(idl)

StandardLayerSpecies11

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 11

33 SUBMISSION PROCESSING

All the data for a Forest Stewardship Plan is required in order to validate it To address this all the data for an FSP is ldquoaccumulatedrdquo in temporary database tables Once the data is accumulated validation can occur Accumulation is done by calling functions in the FSP_XML_SUBMISSION package Validation functions are implemented in the FSP_VALIDATION package General Note 1 All procedures have at least one ldquoOUTrdquo parameter This is a string that will

contain any error messages that occur during the operation Other ldquoOUTrdquo parameters will be database identifying values for that object that are required for future processes (ie other agents) and so must be stored

2 For the initial FSP submission (amendment 0) the submitter must submit at least

one document as an attachment a a legal FSP document (MSWord or PDF) (Error 1) b The submitter may also include other supporting documentation as

attached files c The files must have approved extension (doc pdf xls zip jpg) (Error

2)

The pseudo code to validate a Forest Stewardship Plan is as follows

Begin Transaction

Call FSP_XML_SUBMISSIONUSER_SUBMISSION_DATA once

Call FSP_XML_SUBMISSIONVALID_FSP once

Call FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER for each ltplanHoldergt

For each OrgUnit element

Call FSP_XML_SUBMISSIONACCUMULATE_ORG_UNIT

For each PlanHolder element

Call FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER

For each ForestDevelopmentUnit Call FSP_XML_SUBMISSIONACCUMULATE_FDU

For each StockingStandard element

Call FSP_XML_SUBMISSIONACCUMULATE_STANDARD

For each StandardLayer element

Call FSP_XML_SUBMISSIONACCUMULATE_LAYER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 12

For each StandardLayerSpecies

Call FSP_XML_SUBMISSIONACCUMULATE_SPECIES

Call FSP_VALIDATE_XMLFSP_VALIDATION

If errors then

ROLLBACK the transaction

Note If system erros then return false to base agent so job is left on queue If validation errors then return true to remove job from queue and error messages are sent back to the client

Else

Call FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

COMMIT

34 DATA VALIDATION - DAO INTERFACE SPECIFICATIONS

This section details the interface between the Java business agent and the Oracle packages that implement amalgamation validation and processing It can be used in conjunction with the previous sections to define the detailed package interface

341 FSP_XML_SUBMISSIONUSER_SUBMISSION_DATA

Capture the submission metadata coming from ESF Confirm that the individual making the FSP submission has valid authority

to submit via ESF (Error 3)

PROCEDURE USER_SUBMISSION_DATA( P_FSP_SUBMISSION_ID IN NUMBER

P_SUBMITTED_BY IN VARCHAR2 P_CLIENT_NUMBER IN VARCHAR2 P_CLIENT_LOCN_CODE IN VARCHAR2 P_ORG_UNIT_NO IN NUMBER P_SUBMISSION_TIMESTAMP IN DATE P_USER_FILENAME IN VARCHAR2 P_USER_AUTHORITY IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_SUBMISSION_ID Comes from file message from ESF

P_SUBMITTED_BY Comes from file message from ESF

P_CLIENT_NUMBER Comes from file message from ESF

P_CLIENT_LOCN_CODE Comes from file message from ESF

P_ADMIN_DISTRICT_NO orgUnitNo from submission metadata ltdistrictCodegt value

P_SUBMISSION_TIMESTAMP Comes from file message from ESF

P_USER_FILENAME Comes from file message from ESF

P_USER_AUTHORITY Set to lsquoACrsquo

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 13

342 FSP_XML_SUBMISSIONACCUMULATE_FSP

Call once for the ltForestStewardshipPlangt entity Ensure only one such entity is included If no errors are returned then proceed If FSP already exists (this is an amendment) return the FSP_ID PROCEDURE VALID_FSP (P_FSP_ID IN OUT NUMBER

P_PLAN_NAME IN VARCHAR2 P_PLAN_TERM_YEARS IN NUMBER P_PLAN_TERM_COMMENCEMENT IN DATE P_ACTION_CODE IN VARCHAR2 P_SUBMITTER_NAME IN VARCHAR2 P_SUBMITTER_EMAIL IN VARCHAR2 P_SUBMITTER_TELEPHONE IN VARCHAR2 P_AMENDMENT_IND IN VARCHAR2 P_AMENDMENT_COMMENT IN VARCHAR2 P_AMENDMENT_APPROVAL_IND IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_OPENING_ID ltfspIDgt or from previous procedure call

P_PLAN_NAME ltplanNamegt

P_PLAN_TERM_YEARS ltplanTermYearsgt

P_PLAN_TERM_COMMENCEMENT ltplanTermCommencementgt

P_ACTION_CODE ltactionCodegt

P_SUBMITTER_NAME ltlicenseeContactgt

P_SUBMITTER_EMAIL ltemailAddressgt

P_SUBMITTER_TELEPHONE lttelphoneNumbergt

P_AMENDMENT_IND ltamendmentIndgt

P_AMENDMENT_COMMENT ltamendmentCommentgt

P_AMENDMENT_APPROVAL_IND ltadmendmentApprovalRequiredgt

343 FSP_XML_SUBMISSIONACCUMULATE_ORG_UNIT

Call once for each ltdistrictCodePropertygt in ltForestStewardshipPlangt PROCEDURE ACCUMULATE_PLAN_HOLDER(

P_FSP_ID IN NUMBER P_DISTRICT_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_DISTRICT_CODE ltdistrictCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 14

344 FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER

Call once for each ltPlanHoldergt in the FSP PROCEDURE ACCUMULATE_PLAN_HOLDER(

P_FSP_ID IN NUMBER P_CLIENT_NUMBER IN VARCHAR2 P_CLIENT_LICENSE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_CLIENT_NUMBER Comes from file message from ESF

P_CLIENT_LICENCE Comes from file message from ESF

345 FSP_XML_SUBMISSIONACCUMULATE_FDU

Call once for each ltFDUgt in the FSP PROCEDURE ACCUMULATE_FDU(

P_FSP_ID IN NUMBER P_FDU_NAME IN VARCHAR2 P_CLIENT_LICENCES IN VARRAY OF VARCHAR2 P_GEOMETRY IN MDSYSSDO_GEOMETRY P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_FDU_NAME ltfduNamegt

P_CLIENT_LICENCES ltFDUgtltlicenseNumbergt

P_GEOMETRY FDU ltextentOfgt as SDO_GEOMETRY

346 FSP_XML_SUBMISSIONACCUMULATE_STANDARD

Call once for each ltStockingStandardgt in the FSP

PROCEDURE ACCUMULATE_STANDARD( P_STANDARDS_REGIME_ID IN OUT NUMBER P_STANDARDS_REGIME_NAME IN VARCHAR2 P_STANDARDS_OBJECTIVE IN VARCHAR2 P_REGEN_DELAY_OFFSET_YRS IN NUMBER P_REGEN_OBLIGATION_IND IN VARCHAR2 P_EARLY_OFFSET_YRS IN NUMBER P_LATE_OFFSET_YRS IN NUMBER P_GEOGRAPHIC_DESCRIPTION IN VARCHAR2 P_ADDITIONAL_STANDARDS IN VARCHAR2

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 15

P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt

P_STANDARDS_REGIME_NAME ltstandardsRegimeNamegt

P_STANDARDS_OBJECTIVE ltstandardsObjectivegt

P_REGEN_DELAY_OFFSET_YRS ltregenOffsetgt from regenObjectivesProperty

P_REGEN_OBLIGATION_IND ltregenObligationIndgt from regenObjectivesProperty

P_EARLY_OFFSET_YRS ltearlyOffsetgt from regenObjectivesProperty

P_LATE_OFFSET_YRS ltlateOffsetgt from regenObjectivesProperty

P_GEOGRAPHIC_DESCRIPTION ltgeographicDescriptiongt

P_ADDITIONAL_STANDARDS ltadditionalStandardsgt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 16

347 RESULTS_XML_SUBMISSIONACCUMULATE_STANDARDS_LAYER

For each StandardLayer within a Standards Regime call

PROCEDURE ACCUMULATE_STANDARDS_LAYER (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_STOCKING_LAYER_ID OUT NUMBER P_TARGET_STOCKING IN NUMBER P_RESIDUAL_BASAL_AREA IN NUMBER P_MIN_HORIZONTAL_DISTANCE IN NUMBER P_MIN_PREF_STOCKING_STANDARD IN NUMBER P_MIN_POST_SPACING IN NUMBER P_MIN_STOCKING_STANDARD IN NUMBER P_MAX_POST_SPACING IN NUMBER P_MAX_CONIFER IN NUMBER P_HGHT_RELATIVE_TO_COMP IN NUMBER P_HGHT_RELATIVE_COMP_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID From ltstandardsRegimeIdgt or previous procedure

P_STOCKING_LAYER_CODE ltstockingLayerCodegt

P_STOCKING_LAYER_ID This value is returned

P_TARGET_STOCKING ltwellSpacedgt

P_RESIDUAL_BASAL_AREA ltresidualBasalAreagt

P_MIN_HORIZONTAL_DISTANCE ltminHorizontalDistancegt

P_PREF_STOCKING_STANDARD ltminPrefWellSpacedgt

P_MIN_POST_SPACING ltminPostSpacinggt

P_MIN_STOCKING_STANDARD ltminStockingStandardgt

P_MAX_POST_SPACING ltmaxPostSpacinggt

P_MAX_CONIFER ltmaxConifergt

P_HGHT_RELATIVE_COMP ltheightRelativeToCompgt

P_HGHT_RELATIVE_COMP_CODE ltheightRelativeToCompCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 17

348 RESULTS_XML_SUBMISSIONACCUMULATE_SPECIES

Call once for each StandardLayerSpecies within a StandardLayer

PROCEDURE ACCUMULATE_SPECIES (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_SPECIES_CODE IN VARCHAR2 P_STOCKING_LAYER_ID IN NUMBER P_PREFERRED_IND IN VARCHAR2 P_MIN_HEIGHT IN NUMBER P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt or previous procedure

P_STOCKING_LAYER_CODE STOCKING_LAYER_CODE from StandardLayer

P_SPECIES_CODE ltspeciesCodegt

P_STOCKING_LAYER_ID STOCKING_LAYER_ID from StandardLayer

P_STOCKING_STANDARD_UNIT_ID STOCKING_STANDARD_UNIT_ID from StandardLayer

P_PREFERRED_IND ltpreferredSpeciesIndgt

P_MIN_HEIGHT ltminHeightgt

P_SUBMITTED_BY Comes from file message from ESF

349 FSP_VALIDATE_XMLFSP_VALIDATION

Call after the the submission has been accumulated and no errors were returned FSP_VALIDATION is a procedure that calls a chain of other procedures that validate parts of the submission data The overall results are returned

FSP_VALIDATE_XMLVALIDATE_PLAN_HOLDER

BUSINESS RULES

At least one named licensee (forest client) forest licence pair in ltPlanHoldergt (Error 4 5 6)

That each named licensee actually exists and owns the licence listed

(Error 7)

FSP_VALIDATE_XMLVALIDATE_ORG_UNITS

BUSINESS RULES

At least one ltdistrictCodegt named (Error 8) Code resolves to a valid existing MoFR Forest District (Error 9)

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 18

FSP_VALIDATE_XMLVALIDATE_FSP

BUSINESS RULES

Ensure only a single ltForestStewardshipPlangt entity is included (Error 10)

Submission metadata ltlicenseeContactgt(Error 11)

ltemailAddressgt(Error 12) and lttelephoneNumbergt (Error 13) provided (no nulls)

Is this an original submission or an amendment (ltamendmentIndicatorgt)

(Error 14)

If original submission confirm o Plan name provided (Error 15) o Required document attached

FSP legal plan document (Error 1) o At least one ltForestDevelopmentUnitgt included (Error 16) o At least one ltStockingStandardgt included (Error 17)

ltfspIDgt (conditional) this is amendment or update

o If provided ensure a matching FSP_ID already exists in the database (Error 18)

o If existing FSP_ID status = ldquoApprovedrdquo this must be an amendment ensure that ltamendmentIndgt = ldquoTrdquo (Error 19)

o If existing FSP_ID status = ldquoRejectedrdquo this is a mistaken attempt to re-submit the same FSP (Error 20)

o If existing FSP_ID status = ldquoDraftrdquo this is an update anything submitted will overwrite existing FSP_ID record

ltplanNamegt (conditional)

o If provided and no ltfspIDgt provided this is a new submission Ensure that ltamendmentIndgt = lsquoFrsquo (Error 21)

ltplanTermgt (optional) if included is less than or equal to 5 (Error 22) ltplanStartDategt (optional) if included is valid date (Error 23) ltactionCodegt

o if ldquoNrdquo (New) Must be new FSP ensure no matching FSP_ID

FSP_AMENDMENT_NUMBER primary key already exists o if ldquoUrdquo (Update)

Must be existing FSP ensure a match to FSP_ID and FSP_AMENDMENT_NUMBER key exists

Existing FSP must be in ldquoDraftrdquo status o if ldquoArdquo (Append)

Must an existing FSP in ldquoDraftrdquo status Explicitly designed for appending GML map data to an

existing FSP

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 19

Must not already by any FOREST_DEVELOPMENT_UNIT entries for this FSP

ltamendmentIndgt (mandatory)

o Must be one of ldquoTrdquo or ldquoFrdquo (Error 24) o If ldquoTrdquo ensure ltfspIDgt provided and matches an existing FSP_ID in

the database (error 25) also ensure that the status of the existing FSP_ID = ldquoApprovedrdquo (error 26)

o If ldquoFrdquo and no ltfspIDgt provided this is a new submission o If ldquoFrdquo and ltfspIDgt provided must be an update ensure it

matches an existing FSP_ID with status = ldquoDraftrdquo (Error 27) ltamendmentApprovalRequiredIndgt (conditional)

o If ltamendmentIndgt is ldquotruerdquo must be included and set to one of ldquoTrdquo or ldquoFrdquo (Error 28)

FSP_VALIDATE_XMLVALIDATE_FDUS

BUSINESS RULES

Validate Geometry o polygon area gt 0 o polygon boundary length gt 0 o Other

Validate Identifier o ltfduNamegt must exist and not be null (Error 29) o ltfduNamegt must be unique within the FSP (no duplicates) (Error

30)

Validate Licences o Each FDU must have at least one forest licence applying (Error 31) o Each licence must be owned by one of the licensees listed for this

FSP ltplanHoldergtltlicenceNumbergt (Error 32)

FSP_VALIDATE_XMLVALIDATE_STANDARDS

BUSINESS RULES

Stocking Standards o For FSPs the stocking standard is nearly identical to the

ltStandardsAmendmentTypegt in the RESULTS schema with the following exceptions

The following elements from RESULTS ltStandardsTypegt have been added

ltbgcZonegt ltbgcSubzonegt ltbgcVariantgt ltbgcPhasegt ltbgcSiteSeriesgt ltbgcSiteTypegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 20

ltbgcSeralgt ltmaximumAllowableSoilDisturbancegt

o Therefore the equivalent Validation procedures from Results 30 can be used here with minor amendments

o FSP Stocking Standards do not have a spatial component and are not linked to any piece of ground

3410 FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

Call if no errors returned in any of the steps above PROCEDURE PROCESS_XML_SUBMISSION(

P_POST IN VARCHAR2 P_RESULTS OUT ref_results)

Procedure parameter Data Value P_POST Validate only indicator from fsp

submission metadata

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 21

The following diagram shows the decision points on how to process the submission depending on input parameters The pre-defined states refer procedures defined below

ltfspIDgt

Y

ltplanNamegt

N Error must havePlan name

N

fspID ==FSP_ID

Error UnknownFSP

N

FSP_IDSTATUS

Y

Error cannotUpdate or amend

RejectedSubmitted

ltamendmentIndgt

Approved

Error amendment requiredF

AmendApproval

Ind

T

AmendmentTo

Inbox

T

AmendmentAuto

Approve

UpdateExisting

PlanDraft

Create NewFSP

Y

End

End

End

FSP with same FSP_ID exists in database

FSP Submission

Validate

ESF FSPSubmissionAccumulate

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 22

3411 CREATE_NEW_FSP

This procedure will create a new ForestStewardshipPlan and all related entities in the production database

FOREST_STEWARDSHIP_PLAN TABLE

Source Destination FSP_SEQNEXTVAL FSP_ID 0 FSP_AMENDMENT_NUMBER STATUS for ldquoSubmittedrdquo FSP_STATUS_CODE ltplanNamegt PLAN_NAME ltplanTermYearsgt PLAN_TERM_YEARS ltplanTermCommencementgt PLAN_START_DATE ltplanTermCommencementgt + ltplanTermYearsgt

PLAN_END_DATE

ESF submission date PLAN_SUBMISSION_DATE ltlicenseeContactgt CONTACT_NAME lttelphoneNumbergt TELEPHONE_NUMBER ltemailAddressgt EMAIL_ADDRESS

FSP_AGREEMENT_HOLDER TABLE

Source Destination ltPlanHoldergtltclientCodegt CLIENT_NUMBER

FSP_ORG_UNIT TABLE

Source Destination ORG_UNITORG_UNIT_NO for ltdistrictCodegt

ORG_UNIT_NO

FSP_STATUS_HISTORY TABLE

Source Destination FSP_STATUS_HISTORY_SEQ FSP_STATUS_HISTORY_ID ldquoSubmittedrdquo code from FSP_STATUS_CODE

FSP_STATUS_CODE

ldquoNew Submissionrdquo STATUS_COMMENT

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 23

FSP_ATTACHMENT TABLE

Source Destination ESF framework ATTACHMENT_DESCRIPTION ATTACHMENT_NAME ATTACHMENT_SIZE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

3412 UPDATE_EXISTING_PLAN

For ESF submissions only the FDU map spatial component ltFDUPropertygt can be submitted as an update Part of the validation is to ensure that no other data is included with the ESF submission file except ltfspIDgt and ltFDUPropertygt This may be an INSERT or an UPDATE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination ltfspIDgt FSP_ID FOREST_STEWARDSHIP_PLAN FSP_AMENDMENT_NUMBER

FSP_AMENDMENT_NUMBER

FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 24

3413 AMENDMENT_AUTO_APPROVE

This is to create an amendment that does not require approval It is in effect a new FSP submission that automatically goes to ldquoApprovedrdquo status and increments the FSP_AMENDMENT_NUMBER Processing depends on what the licensee has submitted It may be one or more of

headeradministrative information (such as adding a new licensee) or amending a plan term

a new legal FSP document a new GML map of all the FDUs (spatial data if amended must be

completely replaced) new stocking standards

Process the data as if it were a new submission (see above) with the following exceptions

Do an INSERT INTO FOREST_STEWARDSHIP_PLAN setting FSP_AMENDMENT_NUMBER = MAX(FSP_AMENDMENT_NUMBER) + 1

Copy all fields from FOREST_STEWARDSHIP_PLAN from the most recent amendment (or the original submission record if no amendments)

UPDATE any fields in FOREST_STEWARSHIP_PLAN for this new entry that are provided in the XML submission that is any of ltplanNamegt ltplanTermYearsgt ltplanTermCommencementgt ltlicenseeContactgt lttelephoneNumbergt ltemailAddressgt

Any attachments must be INSERTed into FSP_ATTACHMENT with the new FSP_AMENDMENT_NUMBER (also FSP_ATTACHMENT_CONTENT)

Set FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoAPPRrdquo for this new record

INSERT INTO FSP_STATUS_HISTORY (FSP_STATUS_HISTORY_ID FSP_ID FSP_AMENDMENT_NUMBER FSP_STATUS_CODE STATUS_COMMENT) VALUES (SEQNEXTVAL ltFSP_IDgt ltnew FSP_AMENDMENT_NUMBERgt ldquoAPPRrdquo ltamendmentCommentgt) Be sure to use the new FSP_AMENDMENT_NUMBER in INSERTing any STANDARDS_REGIME or FOREST_DEVELOPMENT_UNIT records

3414 AMENDMENT_TO_INBOX

This is to create an amendment that requires approval The FSP submission is put in ldquoSubmittedrdquo status so that it will show up in the relevant District Inboxes The FSP_AMENDMENT_NUMBER is incremented Proceed as above (AMENDMENT_AUTO_INCREMENT) except

SET FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoSUBMrdquo (for Submitted)

SET FSP_STATUS_HISTORYSTATUS_CODE = ldquoSUBMrdquo for new record

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 25

35 DOMAIN CODES

The following codes will be set up in the database in static code tables (all fields are VARCHAR2)

FSP_STATUS_CODE TABLE

FSP_STATUS_CODE DESCRIPTION SUBM Submitted DRFT Draft APPR Approved REJ Rejected OTBH Opportunity To Be Heard

FSP_REVIEW_MILESTONE_TYPE_CODE TABLE

FSP_REVIEW_MILESTONE_ TYPE_CODE

DESCRIPTION

FNR First Nations Review CampE Results amp Strategies reviewed by CampE TEN Objectives Results amp Strategies reviewed by

Tenures DDM Sent to DDM for Determination OTHR Other

FSP_ATTACHMENT_TYPE_CODE TABLE

FSP_ATTACHMENT_TYPE_CODE DESCRIPTION FSP FSP legal document MAP Map of FDUs SS Stocking Standards report AMDS Amendment Description DDMD DDM Decision Letter OTHR Other Attachment

FEATURE_CLASSES TABLE

FEATURE_CLASS_SKEY DESCRIPTION FEATURE_CLASS_KEY To be defined

36 REPORTING ERRORS

If an error is detected in a submission it must be reported back to the electronic submission framework The method for doing that is to post a message to a queue detailing the submission number and the error message The licensee will be able to check back to the Electronic Submission WebSite and view the error The Electronic Submission Framework will also send an email to the client detailing the message

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 26

The specification for how to report an error can be found in the ESF Queue Agent Best Practices Document The message content for FSP will be a concatenation of the ltFSP Submission IDgt ltDescriptiongt field and the message returned from the validation routines above To send a message about a submission you will need to supply the FSP submission ID for the submission The FSP submission ID is supplied with the message from ESF and stored in the FSP_ELECTRONIC_SUBMISSION table Refer to the Status Agent in the ESF Queue Agent Best Practices document for details on how to send a message to ESF The following code is provided as a sample only and the final syntax should be from the ESF Queue Agent Best Practices Document StatusAgent sa = new StatusAgent (ldquoFSP Business Agentrdquo) sasendStatus (ltForestStewardshipPlanSubmissionIDgt StatusMessageREJECTED ldquo100rdquo ltForestStewardshipPlangtlt083D02800509gt + ldquofailedrdquo + outMessage) saclose() Note Expectation is that outmessage will contain details as to what part of the FSP failed (eg Tenure Forest Development Unit or Stocking Standard) In the case of invalid data processing stops at this point for the FSP No data for this submission will be added to FSP database

361 ERROR MESSAGES

These error messages may be generated during the accumulation validation and processing phases They are referenced by number in the procedure documentation above

1 A legal FSP document must be attached to this submission Please attach a document containing your Forest Stewardship Plan

2 The attached file ltnamegt does not have a recognizable file extension Atachments must be one of MSWord (doc) Portable Document Format (pdf) MS Excel (xls) ZIP archive (zip) or JPEG graphic (jpg) Please resubmit with appropriate file attachments

3 You do not have the proper authority to submit an FSP via ESF Please contact the appropriate MoFR District office to obtain the necessary ldquoSubmitterrdquo authority role

4 The FSP submitted does not name any plan holders At least one holder of a major BC Forest license must be named in the plan

5 No forest license number was found for a named plan holder You must name all forest licenses which apply within the FSP

6 A plan holderrsquos license number could not be verified Please check the validity of the plan holder MoFR client codes

7 A forest license number listed is not owned by any of the plan holders of this FSP Please check the validity of the plan holder MoFR client codes and their licence numbers

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 27

8 At least one BC Forest District must be listed for this FSP Each District responsible for the area included in the FSP must be listed

9 The MoFR District Code is not recognized Please check the spelling of the District code(s) included or check with the appropriate District office for the proper code

10 More than one Forest Stewardship Plan (FSP) was included in this submission At the present time each ESF submission may contain only a single FSP

11 The submission must include the name of a contact person responsible for communicating with MoFR about this FSP submission

12 The submission must include the email address of a contact person responsible for communicating with MoFR about this FSP submission

13 The submission must include the telephone number of a contact person responsible for communicating with MoFR about this FSP submission

14 The submission must indicate whether or not this is an original FSP or an amendment to an existing FSP

15 The FSP must have a name 16 The FSP must include at least one Forest Development Unit (FDU) 17 The FSP must include at least one Stocking Standard 18 This submission refers to an FSP that does not exist in the Ministryrsquos

database Please check the FSP ID number provided after your original submission

19 An FSP with the same FSP ID number already exists in the Ministryrsquos database yet you have not indicated that this is an amendment If the intention is to amend an existing FSP please include the correct FSP ID and make sure the ltamendmentIndgt flag is set to ldquotruerdquo

20 The FSP you are trying to amend has been rejected You cannot amend or replace a rejected FSP You must make a brand new submission When doing so do not include an FSP ID number

21 The submission appears to be a new FSP yet the amendment indicator is set to true (ltamendmentIndgt = ldquotruerdquo) Either provide an FSP ID to amend an existing FSP or set the amendment indicator to ldquofalserdquo

22 The FSP plan term has been set to greater than 5 years FSPs are valid for a maximum of 5 years unless an extension is approved

23 The plan commencement date provided is not valid 24 A value for ltamendmentIndgt must be provided it must be set to either ldquotruerdquo or ldquofalserdquo

25 The submission appears to be for an FSP amendment (ltamendmentIndgt = ldquotruerdquo) however no FSP is referenced Please be sure to include the FSP ID number provided with the original submission

26 You cannot amend an FSP that is not approved Ensure you have provided the correct FSP ID number issued with the original submission and confirm that the FSP is approved

27 An FSP with the same FSP ID number already exists in the database Before you can update this FSP it must be placed in Draft status by the District Manager

28 The submission appears to be an amendment to an existing FSP However you have not stated whether or not this amendment requires Ministry approval Please ensure that the ltamendmentApprovalRequiredIndgt is set to one of ldquotruerdquo or ldquofalserdquo

29 A Forest development Unit (FDU) was submitted without a name A name must be provided for each FDU

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 28

30 The same name has been provided for more than one Forest Development Unit (FDU) Each FDU in a submission must have a unique name

31 A Forest Development Unit (FDU) was submitted that did not list a forest licence number that applies Each FDU must have at least one license number applied

32 A forest license number was supplied that does not appear to be owned by any of the plan holders for this FSP Each Forest Development Unit (FDU) must be listed with at least one forest license owned by one of the plan holders for this FSP

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting

Page 7: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 7

FSP_PROCESS_XML

FSP_VALIDATE_XML

FSPSVC

ESF ESF FSP SubmissionFSP XML SubmissionPARSE XML

TOPOLOGY VALIDATION

Cursor of error messages

VALIDATE_FDUS

VALIDATE_STANDARDS

VALIDATE_PLAN_HOLDERS

Cursor of error messages

Invokes

Invokes

Invokes

HANDLE SUBMISSION

Java Representation of Submission

Java Representation of Submission

Java Representation of Submission

VALIDATE FOREST STEWARDSHIP PLAN

MOVE FSP DATA FROM TEMP TABLE TO OPERATIONAL TABLES

COMMIT OR ROLLBACK

Similar to RESULTS but note minor differences in XML elements and some differences in optionality

User submission data (once)

FSP_XML_SUBMISSION (Oracle Package)

ACCUMULATE_STANDARD

USER_SUBMISSION_DATA

ACCUMULATE_LAYER

ACCUMULATE_SPECIES

ACCUMULATE_BGC

Cursor of error messages

Standards Info (Once for each Standard )

Cursor of error messages

BGC BEC Info (Once for each BGC )

Cursor of error messages

Layer Info (Once for each Layer )

Cursor of error messages

Species Info (Once for each Layer Species )

ENSURE VALID USER DATA

ACCUMULATE FSP DATA TO TEMP TABLEUNTIL A COMPLETE APPLICATION IS PROCESSED

Cursor of error messages

Invokes

ACCUMULATE_PLAN_HOLDER

ACCUMULATE_ORG_UNIT

ACCUMULATE_FDU

VALID_FSP

Cursor of error messages

Licensees (Plan Holder ) Info (Once for each Licensee )

Cursor of error messages

Org Units Info (Once for each Org Unit )

Cursor of error messages

FDU Info (Once for each FDU )

Cursor of error messages

FSP Info (Once )

VALIDATE_ORG_UNITS

VALIDATE_FSP

FSP_VALIDATION

Invokes

PROCESS_FDUS

PROCESS_STANDARDS

PROCESS_LICENSEES

Invokes

Invokes

Invokes

Invokes

PROCESS_ORG_UNITS

PROCESS_FSP

PROCESS_XML_SUBMISSION

Invokes

PROCESS_USER_DATA

Invokes

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 8

The high level flow of the submission process futher describing the diagram on the previous page is as follows 1 The FSP business Agent (FSPSVC) receives a message from the Electronic Submission

Framework via an Oracle Message Queue The message is read and the XML is parsed checking well-formed against the FSP XML Schema

2 A set of accumulator stored procedures are called to ldquoaccumulaterdquo the FSP components

of the submission 3 Once the data is accumulated it can be validated Each component of the FSP

submission is validated The complete FSP must validate or the submission is rejected and the appropriate messages are sent back to the submitter to help determine the issues

4 If the submission is valid it is processed and stored in database using the package

FSP_PROCESS_XML The spatial data for the FDUs is also stored in the database 5 Once the data is stored it will be available in the district and licenseersquos INBOX 6 The transaction is either committed or rolled back if any one of these compoents failed

In the case of a rollback the message will be left on the queue and attempted again Causes of failure are typically infrastructure (eg insufficient rollback space)

The following sections provide more detail on each of these steps

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 9

3 FSP BUSINESS AGENT ndash DETAILED SPECIFICATIONS

The XML submission is forestStewardshipPlan centric ie each transactional unit will be encompassed within ltforestStewardshipPlangt and ltforestStewardshipPlangt tag pairs All data within this block will be related to the FSP as defined in this block Only at single FSP unit can exist in the same submission although the business rule may change in a later release to allow a licensee to submit multiple FSPs in a single submission For information on the schema please see the FSP Submission Schema and an example FSP submission

31 BUSINESS AGENT IMPLEMENTATION

The FSP Business Agent will be written as a Java Application that will listen for messages on an Oracle Advanced Queue The implementation will start with the base class as defined in the Electronic Submission Framework project The base class will define the methods for manipulating (eg Add view remove) messages on an Oracle Advanced Queue Refer to the Agent Design Section of the ESF Queue Agent Best Practices Document for the specific details on how to create a message agent See also ESF Submissions Web Service ndash Client Developerrsquos Guide The remainder of this section provides the more detailed processing that the FSP Business Agent must implement once it receives a new submission from the queue

32 DATA PARSING

Parsing of a submission will be done using VIXB (Vivid XML Binding) The XML will be parsed into a set of java objects modelling the XML For more information on VIXB see the VIXB users guide In a nutshell VIXB configures a SAX XML parser with call backs to a Sax handler The handler then passes the parsed data to tag-specific extractors which know how to ldquoextractrdquo the data When the extractor is complete it then calls an application specific processor The processor is then responsible to perform validation and processing Following is a UML class diagram of the FSP domain classes which will be created Note some of these entities may already be defined for previous MoFR apps and can be named or refactored accordingly however the XML tag information is specific to FSP and must be parsed and validated accordingly For clarity not all gettersetter methods are included

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 10

+getName() string(idl)+setName()+getFSP_ID() unsigned long(idl)+setAmendment()+getAmendment() short(idl)+getStatus() short(idl)+setStatus()+setPlanStartDate()+getPlanStartDate() long long(idl)+getPlanTerm() short(idl)+setPlanTerm()+getPlanContactPerson() PlanContactPerson+requiresApproval() boolean(idl)+setRequiresApprovalInd()

-planName string(idl)-FSP_ID unsigned long(idl)-amendmentNumber short(idl) = 0-dateSubmitted unsigned long(idl)-status-planStartDate unsigned long(idl)-planTerm short(idl) = 5-requiresApprovalInd boolean(idl)

ForestStewardShipPlan

-name string(idl)

ForestDevelopmentUnit

-bgcZone string(idl)-bgcSubzone string(idl)-bgcVariant string(idl)-bgcPhase string(idl)-bgcSiteSeries string(idl)-bgcSiteType string(idl)-gbcSeral string(idl)-maxAllowableDisturbance float(idl)-standardsRationale string(idl)-regenObligationInd boolean(idl)-regenOffseti short(idl)-earlyOffset short(idl)-lateOffset short(idl)

StockingStandard-clientCode string(idl)-licenceNumber string(idl)

PlanHolder

1

0

1

0

1

1

-licenceNumber string(idl)

ForestLicence

1

1

-

spatial

1

1

+getDistrictCode() string(idl)

-districtCode string(idl)

OrgUnit

1 1

+getName() string(idl)+setName()+getEmail() string(idl)+setEmail()+getPhone() unsigned long(idl)+setPhone()

-Name string(idl)-emailAddress string(idl)-telephone unsigned long(idl)

PlanContactPerson

11

Amended FSP might not include stocking standards

Amended FSP might not include FDUs

-stockingLayerCode string(idl)-wellSpaced unsigned long(idl)-minPrefWellSpaced unsigned long(idl)-residualBasalArea unsigned long(idl)-minHorizontalDistance unsigned long(idl)-minPostSpacing unsigned long(idl)-maxPostSpacing unsigned long(idl)-maxConifer unsigned long(idl)-heightRelativeToComp unsigned long(idl)-heightRelativeToCompCode string(idl)

StandardLayer

1

1

-speciesCode string(idl)-minHeight float(idl)-preferredSpeciesInd boolean(idl)

StandardLayerSpecies11

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 11

33 SUBMISSION PROCESSING

All the data for a Forest Stewardship Plan is required in order to validate it To address this all the data for an FSP is ldquoaccumulatedrdquo in temporary database tables Once the data is accumulated validation can occur Accumulation is done by calling functions in the FSP_XML_SUBMISSION package Validation functions are implemented in the FSP_VALIDATION package General Note 1 All procedures have at least one ldquoOUTrdquo parameter This is a string that will

contain any error messages that occur during the operation Other ldquoOUTrdquo parameters will be database identifying values for that object that are required for future processes (ie other agents) and so must be stored

2 For the initial FSP submission (amendment 0) the submitter must submit at least

one document as an attachment a a legal FSP document (MSWord or PDF) (Error 1) b The submitter may also include other supporting documentation as

attached files c The files must have approved extension (doc pdf xls zip jpg) (Error

2)

The pseudo code to validate a Forest Stewardship Plan is as follows

Begin Transaction

Call FSP_XML_SUBMISSIONUSER_SUBMISSION_DATA once

Call FSP_XML_SUBMISSIONVALID_FSP once

Call FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER for each ltplanHoldergt

For each OrgUnit element

Call FSP_XML_SUBMISSIONACCUMULATE_ORG_UNIT

For each PlanHolder element

Call FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER

For each ForestDevelopmentUnit Call FSP_XML_SUBMISSIONACCUMULATE_FDU

For each StockingStandard element

Call FSP_XML_SUBMISSIONACCUMULATE_STANDARD

For each StandardLayer element

Call FSP_XML_SUBMISSIONACCUMULATE_LAYER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 12

For each StandardLayerSpecies

Call FSP_XML_SUBMISSIONACCUMULATE_SPECIES

Call FSP_VALIDATE_XMLFSP_VALIDATION

If errors then

ROLLBACK the transaction

Note If system erros then return false to base agent so job is left on queue If validation errors then return true to remove job from queue and error messages are sent back to the client

Else

Call FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

COMMIT

34 DATA VALIDATION - DAO INTERFACE SPECIFICATIONS

This section details the interface between the Java business agent and the Oracle packages that implement amalgamation validation and processing It can be used in conjunction with the previous sections to define the detailed package interface

341 FSP_XML_SUBMISSIONUSER_SUBMISSION_DATA

Capture the submission metadata coming from ESF Confirm that the individual making the FSP submission has valid authority

to submit via ESF (Error 3)

PROCEDURE USER_SUBMISSION_DATA( P_FSP_SUBMISSION_ID IN NUMBER

P_SUBMITTED_BY IN VARCHAR2 P_CLIENT_NUMBER IN VARCHAR2 P_CLIENT_LOCN_CODE IN VARCHAR2 P_ORG_UNIT_NO IN NUMBER P_SUBMISSION_TIMESTAMP IN DATE P_USER_FILENAME IN VARCHAR2 P_USER_AUTHORITY IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_SUBMISSION_ID Comes from file message from ESF

P_SUBMITTED_BY Comes from file message from ESF

P_CLIENT_NUMBER Comes from file message from ESF

P_CLIENT_LOCN_CODE Comes from file message from ESF

P_ADMIN_DISTRICT_NO orgUnitNo from submission metadata ltdistrictCodegt value

P_SUBMISSION_TIMESTAMP Comes from file message from ESF

P_USER_FILENAME Comes from file message from ESF

P_USER_AUTHORITY Set to lsquoACrsquo

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 13

342 FSP_XML_SUBMISSIONACCUMULATE_FSP

Call once for the ltForestStewardshipPlangt entity Ensure only one such entity is included If no errors are returned then proceed If FSP already exists (this is an amendment) return the FSP_ID PROCEDURE VALID_FSP (P_FSP_ID IN OUT NUMBER

P_PLAN_NAME IN VARCHAR2 P_PLAN_TERM_YEARS IN NUMBER P_PLAN_TERM_COMMENCEMENT IN DATE P_ACTION_CODE IN VARCHAR2 P_SUBMITTER_NAME IN VARCHAR2 P_SUBMITTER_EMAIL IN VARCHAR2 P_SUBMITTER_TELEPHONE IN VARCHAR2 P_AMENDMENT_IND IN VARCHAR2 P_AMENDMENT_COMMENT IN VARCHAR2 P_AMENDMENT_APPROVAL_IND IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_OPENING_ID ltfspIDgt or from previous procedure call

P_PLAN_NAME ltplanNamegt

P_PLAN_TERM_YEARS ltplanTermYearsgt

P_PLAN_TERM_COMMENCEMENT ltplanTermCommencementgt

P_ACTION_CODE ltactionCodegt

P_SUBMITTER_NAME ltlicenseeContactgt

P_SUBMITTER_EMAIL ltemailAddressgt

P_SUBMITTER_TELEPHONE lttelphoneNumbergt

P_AMENDMENT_IND ltamendmentIndgt

P_AMENDMENT_COMMENT ltamendmentCommentgt

P_AMENDMENT_APPROVAL_IND ltadmendmentApprovalRequiredgt

343 FSP_XML_SUBMISSIONACCUMULATE_ORG_UNIT

Call once for each ltdistrictCodePropertygt in ltForestStewardshipPlangt PROCEDURE ACCUMULATE_PLAN_HOLDER(

P_FSP_ID IN NUMBER P_DISTRICT_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_DISTRICT_CODE ltdistrictCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 14

344 FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER

Call once for each ltPlanHoldergt in the FSP PROCEDURE ACCUMULATE_PLAN_HOLDER(

P_FSP_ID IN NUMBER P_CLIENT_NUMBER IN VARCHAR2 P_CLIENT_LICENSE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_CLIENT_NUMBER Comes from file message from ESF

P_CLIENT_LICENCE Comes from file message from ESF

345 FSP_XML_SUBMISSIONACCUMULATE_FDU

Call once for each ltFDUgt in the FSP PROCEDURE ACCUMULATE_FDU(

P_FSP_ID IN NUMBER P_FDU_NAME IN VARCHAR2 P_CLIENT_LICENCES IN VARRAY OF VARCHAR2 P_GEOMETRY IN MDSYSSDO_GEOMETRY P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_FDU_NAME ltfduNamegt

P_CLIENT_LICENCES ltFDUgtltlicenseNumbergt

P_GEOMETRY FDU ltextentOfgt as SDO_GEOMETRY

346 FSP_XML_SUBMISSIONACCUMULATE_STANDARD

Call once for each ltStockingStandardgt in the FSP

PROCEDURE ACCUMULATE_STANDARD( P_STANDARDS_REGIME_ID IN OUT NUMBER P_STANDARDS_REGIME_NAME IN VARCHAR2 P_STANDARDS_OBJECTIVE IN VARCHAR2 P_REGEN_DELAY_OFFSET_YRS IN NUMBER P_REGEN_OBLIGATION_IND IN VARCHAR2 P_EARLY_OFFSET_YRS IN NUMBER P_LATE_OFFSET_YRS IN NUMBER P_GEOGRAPHIC_DESCRIPTION IN VARCHAR2 P_ADDITIONAL_STANDARDS IN VARCHAR2

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 15

P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt

P_STANDARDS_REGIME_NAME ltstandardsRegimeNamegt

P_STANDARDS_OBJECTIVE ltstandardsObjectivegt

P_REGEN_DELAY_OFFSET_YRS ltregenOffsetgt from regenObjectivesProperty

P_REGEN_OBLIGATION_IND ltregenObligationIndgt from regenObjectivesProperty

P_EARLY_OFFSET_YRS ltearlyOffsetgt from regenObjectivesProperty

P_LATE_OFFSET_YRS ltlateOffsetgt from regenObjectivesProperty

P_GEOGRAPHIC_DESCRIPTION ltgeographicDescriptiongt

P_ADDITIONAL_STANDARDS ltadditionalStandardsgt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 16

347 RESULTS_XML_SUBMISSIONACCUMULATE_STANDARDS_LAYER

For each StandardLayer within a Standards Regime call

PROCEDURE ACCUMULATE_STANDARDS_LAYER (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_STOCKING_LAYER_ID OUT NUMBER P_TARGET_STOCKING IN NUMBER P_RESIDUAL_BASAL_AREA IN NUMBER P_MIN_HORIZONTAL_DISTANCE IN NUMBER P_MIN_PREF_STOCKING_STANDARD IN NUMBER P_MIN_POST_SPACING IN NUMBER P_MIN_STOCKING_STANDARD IN NUMBER P_MAX_POST_SPACING IN NUMBER P_MAX_CONIFER IN NUMBER P_HGHT_RELATIVE_TO_COMP IN NUMBER P_HGHT_RELATIVE_COMP_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID From ltstandardsRegimeIdgt or previous procedure

P_STOCKING_LAYER_CODE ltstockingLayerCodegt

P_STOCKING_LAYER_ID This value is returned

P_TARGET_STOCKING ltwellSpacedgt

P_RESIDUAL_BASAL_AREA ltresidualBasalAreagt

P_MIN_HORIZONTAL_DISTANCE ltminHorizontalDistancegt

P_PREF_STOCKING_STANDARD ltminPrefWellSpacedgt

P_MIN_POST_SPACING ltminPostSpacinggt

P_MIN_STOCKING_STANDARD ltminStockingStandardgt

P_MAX_POST_SPACING ltmaxPostSpacinggt

P_MAX_CONIFER ltmaxConifergt

P_HGHT_RELATIVE_COMP ltheightRelativeToCompgt

P_HGHT_RELATIVE_COMP_CODE ltheightRelativeToCompCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 17

348 RESULTS_XML_SUBMISSIONACCUMULATE_SPECIES

Call once for each StandardLayerSpecies within a StandardLayer

PROCEDURE ACCUMULATE_SPECIES (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_SPECIES_CODE IN VARCHAR2 P_STOCKING_LAYER_ID IN NUMBER P_PREFERRED_IND IN VARCHAR2 P_MIN_HEIGHT IN NUMBER P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt or previous procedure

P_STOCKING_LAYER_CODE STOCKING_LAYER_CODE from StandardLayer

P_SPECIES_CODE ltspeciesCodegt

P_STOCKING_LAYER_ID STOCKING_LAYER_ID from StandardLayer

P_STOCKING_STANDARD_UNIT_ID STOCKING_STANDARD_UNIT_ID from StandardLayer

P_PREFERRED_IND ltpreferredSpeciesIndgt

P_MIN_HEIGHT ltminHeightgt

P_SUBMITTED_BY Comes from file message from ESF

349 FSP_VALIDATE_XMLFSP_VALIDATION

Call after the the submission has been accumulated and no errors were returned FSP_VALIDATION is a procedure that calls a chain of other procedures that validate parts of the submission data The overall results are returned

FSP_VALIDATE_XMLVALIDATE_PLAN_HOLDER

BUSINESS RULES

At least one named licensee (forest client) forest licence pair in ltPlanHoldergt (Error 4 5 6)

That each named licensee actually exists and owns the licence listed

(Error 7)

FSP_VALIDATE_XMLVALIDATE_ORG_UNITS

BUSINESS RULES

At least one ltdistrictCodegt named (Error 8) Code resolves to a valid existing MoFR Forest District (Error 9)

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 18

FSP_VALIDATE_XMLVALIDATE_FSP

BUSINESS RULES

Ensure only a single ltForestStewardshipPlangt entity is included (Error 10)

Submission metadata ltlicenseeContactgt(Error 11)

ltemailAddressgt(Error 12) and lttelephoneNumbergt (Error 13) provided (no nulls)

Is this an original submission or an amendment (ltamendmentIndicatorgt)

(Error 14)

If original submission confirm o Plan name provided (Error 15) o Required document attached

FSP legal plan document (Error 1) o At least one ltForestDevelopmentUnitgt included (Error 16) o At least one ltStockingStandardgt included (Error 17)

ltfspIDgt (conditional) this is amendment or update

o If provided ensure a matching FSP_ID already exists in the database (Error 18)

o If existing FSP_ID status = ldquoApprovedrdquo this must be an amendment ensure that ltamendmentIndgt = ldquoTrdquo (Error 19)

o If existing FSP_ID status = ldquoRejectedrdquo this is a mistaken attempt to re-submit the same FSP (Error 20)

o If existing FSP_ID status = ldquoDraftrdquo this is an update anything submitted will overwrite existing FSP_ID record

ltplanNamegt (conditional)

o If provided and no ltfspIDgt provided this is a new submission Ensure that ltamendmentIndgt = lsquoFrsquo (Error 21)

ltplanTermgt (optional) if included is less than or equal to 5 (Error 22) ltplanStartDategt (optional) if included is valid date (Error 23) ltactionCodegt

o if ldquoNrdquo (New) Must be new FSP ensure no matching FSP_ID

FSP_AMENDMENT_NUMBER primary key already exists o if ldquoUrdquo (Update)

Must be existing FSP ensure a match to FSP_ID and FSP_AMENDMENT_NUMBER key exists

Existing FSP must be in ldquoDraftrdquo status o if ldquoArdquo (Append)

Must an existing FSP in ldquoDraftrdquo status Explicitly designed for appending GML map data to an

existing FSP

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 19

Must not already by any FOREST_DEVELOPMENT_UNIT entries for this FSP

ltamendmentIndgt (mandatory)

o Must be one of ldquoTrdquo or ldquoFrdquo (Error 24) o If ldquoTrdquo ensure ltfspIDgt provided and matches an existing FSP_ID in

the database (error 25) also ensure that the status of the existing FSP_ID = ldquoApprovedrdquo (error 26)

o If ldquoFrdquo and no ltfspIDgt provided this is a new submission o If ldquoFrdquo and ltfspIDgt provided must be an update ensure it

matches an existing FSP_ID with status = ldquoDraftrdquo (Error 27) ltamendmentApprovalRequiredIndgt (conditional)

o If ltamendmentIndgt is ldquotruerdquo must be included and set to one of ldquoTrdquo or ldquoFrdquo (Error 28)

FSP_VALIDATE_XMLVALIDATE_FDUS

BUSINESS RULES

Validate Geometry o polygon area gt 0 o polygon boundary length gt 0 o Other

Validate Identifier o ltfduNamegt must exist and not be null (Error 29) o ltfduNamegt must be unique within the FSP (no duplicates) (Error

30)

Validate Licences o Each FDU must have at least one forest licence applying (Error 31) o Each licence must be owned by one of the licensees listed for this

FSP ltplanHoldergtltlicenceNumbergt (Error 32)

FSP_VALIDATE_XMLVALIDATE_STANDARDS

BUSINESS RULES

Stocking Standards o For FSPs the stocking standard is nearly identical to the

ltStandardsAmendmentTypegt in the RESULTS schema with the following exceptions

The following elements from RESULTS ltStandardsTypegt have been added

ltbgcZonegt ltbgcSubzonegt ltbgcVariantgt ltbgcPhasegt ltbgcSiteSeriesgt ltbgcSiteTypegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 20

ltbgcSeralgt ltmaximumAllowableSoilDisturbancegt

o Therefore the equivalent Validation procedures from Results 30 can be used here with minor amendments

o FSP Stocking Standards do not have a spatial component and are not linked to any piece of ground

3410 FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

Call if no errors returned in any of the steps above PROCEDURE PROCESS_XML_SUBMISSION(

P_POST IN VARCHAR2 P_RESULTS OUT ref_results)

Procedure parameter Data Value P_POST Validate only indicator from fsp

submission metadata

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 21

The following diagram shows the decision points on how to process the submission depending on input parameters The pre-defined states refer procedures defined below

ltfspIDgt

Y

ltplanNamegt

N Error must havePlan name

N

fspID ==FSP_ID

Error UnknownFSP

N

FSP_IDSTATUS

Y

Error cannotUpdate or amend

RejectedSubmitted

ltamendmentIndgt

Approved

Error amendment requiredF

AmendApproval

Ind

T

AmendmentTo

Inbox

T

AmendmentAuto

Approve

UpdateExisting

PlanDraft

Create NewFSP

Y

End

End

End

FSP with same FSP_ID exists in database

FSP Submission

Validate

ESF FSPSubmissionAccumulate

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 22

3411 CREATE_NEW_FSP

This procedure will create a new ForestStewardshipPlan and all related entities in the production database

FOREST_STEWARDSHIP_PLAN TABLE

Source Destination FSP_SEQNEXTVAL FSP_ID 0 FSP_AMENDMENT_NUMBER STATUS for ldquoSubmittedrdquo FSP_STATUS_CODE ltplanNamegt PLAN_NAME ltplanTermYearsgt PLAN_TERM_YEARS ltplanTermCommencementgt PLAN_START_DATE ltplanTermCommencementgt + ltplanTermYearsgt

PLAN_END_DATE

ESF submission date PLAN_SUBMISSION_DATE ltlicenseeContactgt CONTACT_NAME lttelphoneNumbergt TELEPHONE_NUMBER ltemailAddressgt EMAIL_ADDRESS

FSP_AGREEMENT_HOLDER TABLE

Source Destination ltPlanHoldergtltclientCodegt CLIENT_NUMBER

FSP_ORG_UNIT TABLE

Source Destination ORG_UNITORG_UNIT_NO for ltdistrictCodegt

ORG_UNIT_NO

FSP_STATUS_HISTORY TABLE

Source Destination FSP_STATUS_HISTORY_SEQ FSP_STATUS_HISTORY_ID ldquoSubmittedrdquo code from FSP_STATUS_CODE

FSP_STATUS_CODE

ldquoNew Submissionrdquo STATUS_COMMENT

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 23

FSP_ATTACHMENT TABLE

Source Destination ESF framework ATTACHMENT_DESCRIPTION ATTACHMENT_NAME ATTACHMENT_SIZE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

3412 UPDATE_EXISTING_PLAN

For ESF submissions only the FDU map spatial component ltFDUPropertygt can be submitted as an update Part of the validation is to ensure that no other data is included with the ESF submission file except ltfspIDgt and ltFDUPropertygt This may be an INSERT or an UPDATE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination ltfspIDgt FSP_ID FOREST_STEWARDSHIP_PLAN FSP_AMENDMENT_NUMBER

FSP_AMENDMENT_NUMBER

FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 24

3413 AMENDMENT_AUTO_APPROVE

This is to create an amendment that does not require approval It is in effect a new FSP submission that automatically goes to ldquoApprovedrdquo status and increments the FSP_AMENDMENT_NUMBER Processing depends on what the licensee has submitted It may be one or more of

headeradministrative information (such as adding a new licensee) or amending a plan term

a new legal FSP document a new GML map of all the FDUs (spatial data if amended must be

completely replaced) new stocking standards

Process the data as if it were a new submission (see above) with the following exceptions

Do an INSERT INTO FOREST_STEWARDSHIP_PLAN setting FSP_AMENDMENT_NUMBER = MAX(FSP_AMENDMENT_NUMBER) + 1

Copy all fields from FOREST_STEWARDSHIP_PLAN from the most recent amendment (or the original submission record if no amendments)

UPDATE any fields in FOREST_STEWARSHIP_PLAN for this new entry that are provided in the XML submission that is any of ltplanNamegt ltplanTermYearsgt ltplanTermCommencementgt ltlicenseeContactgt lttelephoneNumbergt ltemailAddressgt

Any attachments must be INSERTed into FSP_ATTACHMENT with the new FSP_AMENDMENT_NUMBER (also FSP_ATTACHMENT_CONTENT)

Set FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoAPPRrdquo for this new record

INSERT INTO FSP_STATUS_HISTORY (FSP_STATUS_HISTORY_ID FSP_ID FSP_AMENDMENT_NUMBER FSP_STATUS_CODE STATUS_COMMENT) VALUES (SEQNEXTVAL ltFSP_IDgt ltnew FSP_AMENDMENT_NUMBERgt ldquoAPPRrdquo ltamendmentCommentgt) Be sure to use the new FSP_AMENDMENT_NUMBER in INSERTing any STANDARDS_REGIME or FOREST_DEVELOPMENT_UNIT records

3414 AMENDMENT_TO_INBOX

This is to create an amendment that requires approval The FSP submission is put in ldquoSubmittedrdquo status so that it will show up in the relevant District Inboxes The FSP_AMENDMENT_NUMBER is incremented Proceed as above (AMENDMENT_AUTO_INCREMENT) except

SET FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoSUBMrdquo (for Submitted)

SET FSP_STATUS_HISTORYSTATUS_CODE = ldquoSUBMrdquo for new record

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 25

35 DOMAIN CODES

The following codes will be set up in the database in static code tables (all fields are VARCHAR2)

FSP_STATUS_CODE TABLE

FSP_STATUS_CODE DESCRIPTION SUBM Submitted DRFT Draft APPR Approved REJ Rejected OTBH Opportunity To Be Heard

FSP_REVIEW_MILESTONE_TYPE_CODE TABLE

FSP_REVIEW_MILESTONE_ TYPE_CODE

DESCRIPTION

FNR First Nations Review CampE Results amp Strategies reviewed by CampE TEN Objectives Results amp Strategies reviewed by

Tenures DDM Sent to DDM for Determination OTHR Other

FSP_ATTACHMENT_TYPE_CODE TABLE

FSP_ATTACHMENT_TYPE_CODE DESCRIPTION FSP FSP legal document MAP Map of FDUs SS Stocking Standards report AMDS Amendment Description DDMD DDM Decision Letter OTHR Other Attachment

FEATURE_CLASSES TABLE

FEATURE_CLASS_SKEY DESCRIPTION FEATURE_CLASS_KEY To be defined

36 REPORTING ERRORS

If an error is detected in a submission it must be reported back to the electronic submission framework The method for doing that is to post a message to a queue detailing the submission number and the error message The licensee will be able to check back to the Electronic Submission WebSite and view the error The Electronic Submission Framework will also send an email to the client detailing the message

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 26

The specification for how to report an error can be found in the ESF Queue Agent Best Practices Document The message content for FSP will be a concatenation of the ltFSP Submission IDgt ltDescriptiongt field and the message returned from the validation routines above To send a message about a submission you will need to supply the FSP submission ID for the submission The FSP submission ID is supplied with the message from ESF and stored in the FSP_ELECTRONIC_SUBMISSION table Refer to the Status Agent in the ESF Queue Agent Best Practices document for details on how to send a message to ESF The following code is provided as a sample only and the final syntax should be from the ESF Queue Agent Best Practices Document StatusAgent sa = new StatusAgent (ldquoFSP Business Agentrdquo) sasendStatus (ltForestStewardshipPlanSubmissionIDgt StatusMessageREJECTED ldquo100rdquo ltForestStewardshipPlangtlt083D02800509gt + ldquofailedrdquo + outMessage) saclose() Note Expectation is that outmessage will contain details as to what part of the FSP failed (eg Tenure Forest Development Unit or Stocking Standard) In the case of invalid data processing stops at this point for the FSP No data for this submission will be added to FSP database

361 ERROR MESSAGES

These error messages may be generated during the accumulation validation and processing phases They are referenced by number in the procedure documentation above

1 A legal FSP document must be attached to this submission Please attach a document containing your Forest Stewardship Plan

2 The attached file ltnamegt does not have a recognizable file extension Atachments must be one of MSWord (doc) Portable Document Format (pdf) MS Excel (xls) ZIP archive (zip) or JPEG graphic (jpg) Please resubmit with appropriate file attachments

3 You do not have the proper authority to submit an FSP via ESF Please contact the appropriate MoFR District office to obtain the necessary ldquoSubmitterrdquo authority role

4 The FSP submitted does not name any plan holders At least one holder of a major BC Forest license must be named in the plan

5 No forest license number was found for a named plan holder You must name all forest licenses which apply within the FSP

6 A plan holderrsquos license number could not be verified Please check the validity of the plan holder MoFR client codes

7 A forest license number listed is not owned by any of the plan holders of this FSP Please check the validity of the plan holder MoFR client codes and their licence numbers

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 27

8 At least one BC Forest District must be listed for this FSP Each District responsible for the area included in the FSP must be listed

9 The MoFR District Code is not recognized Please check the spelling of the District code(s) included or check with the appropriate District office for the proper code

10 More than one Forest Stewardship Plan (FSP) was included in this submission At the present time each ESF submission may contain only a single FSP

11 The submission must include the name of a contact person responsible for communicating with MoFR about this FSP submission

12 The submission must include the email address of a contact person responsible for communicating with MoFR about this FSP submission

13 The submission must include the telephone number of a contact person responsible for communicating with MoFR about this FSP submission

14 The submission must indicate whether or not this is an original FSP or an amendment to an existing FSP

15 The FSP must have a name 16 The FSP must include at least one Forest Development Unit (FDU) 17 The FSP must include at least one Stocking Standard 18 This submission refers to an FSP that does not exist in the Ministryrsquos

database Please check the FSP ID number provided after your original submission

19 An FSP with the same FSP ID number already exists in the Ministryrsquos database yet you have not indicated that this is an amendment If the intention is to amend an existing FSP please include the correct FSP ID and make sure the ltamendmentIndgt flag is set to ldquotruerdquo

20 The FSP you are trying to amend has been rejected You cannot amend or replace a rejected FSP You must make a brand new submission When doing so do not include an FSP ID number

21 The submission appears to be a new FSP yet the amendment indicator is set to true (ltamendmentIndgt = ldquotruerdquo) Either provide an FSP ID to amend an existing FSP or set the amendment indicator to ldquofalserdquo

22 The FSP plan term has been set to greater than 5 years FSPs are valid for a maximum of 5 years unless an extension is approved

23 The plan commencement date provided is not valid 24 A value for ltamendmentIndgt must be provided it must be set to either ldquotruerdquo or ldquofalserdquo

25 The submission appears to be for an FSP amendment (ltamendmentIndgt = ldquotruerdquo) however no FSP is referenced Please be sure to include the FSP ID number provided with the original submission

26 You cannot amend an FSP that is not approved Ensure you have provided the correct FSP ID number issued with the original submission and confirm that the FSP is approved

27 An FSP with the same FSP ID number already exists in the database Before you can update this FSP it must be placed in Draft status by the District Manager

28 The submission appears to be an amendment to an existing FSP However you have not stated whether or not this amendment requires Ministry approval Please ensure that the ltamendmentApprovalRequiredIndgt is set to one of ldquotruerdquo or ldquofalserdquo

29 A Forest development Unit (FDU) was submitted without a name A name must be provided for each FDU

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 28

30 The same name has been provided for more than one Forest Development Unit (FDU) Each FDU in a submission must have a unique name

31 A Forest Development Unit (FDU) was submitted that did not list a forest licence number that applies Each FDU must have at least one license number applied

32 A forest license number was supplied that does not appear to be owned by any of the plan holders for this FSP Each Forest Development Unit (FDU) must be listed with at least one forest license owned by one of the plan holders for this FSP

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting

Page 8: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 8

The high level flow of the submission process futher describing the diagram on the previous page is as follows 1 The FSP business Agent (FSPSVC) receives a message from the Electronic Submission

Framework via an Oracle Message Queue The message is read and the XML is parsed checking well-formed against the FSP XML Schema

2 A set of accumulator stored procedures are called to ldquoaccumulaterdquo the FSP components

of the submission 3 Once the data is accumulated it can be validated Each component of the FSP

submission is validated The complete FSP must validate or the submission is rejected and the appropriate messages are sent back to the submitter to help determine the issues

4 If the submission is valid it is processed and stored in database using the package

FSP_PROCESS_XML The spatial data for the FDUs is also stored in the database 5 Once the data is stored it will be available in the district and licenseersquos INBOX 6 The transaction is either committed or rolled back if any one of these compoents failed

In the case of a rollback the message will be left on the queue and attempted again Causes of failure are typically infrastructure (eg insufficient rollback space)

The following sections provide more detail on each of these steps

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 9

3 FSP BUSINESS AGENT ndash DETAILED SPECIFICATIONS

The XML submission is forestStewardshipPlan centric ie each transactional unit will be encompassed within ltforestStewardshipPlangt and ltforestStewardshipPlangt tag pairs All data within this block will be related to the FSP as defined in this block Only at single FSP unit can exist in the same submission although the business rule may change in a later release to allow a licensee to submit multiple FSPs in a single submission For information on the schema please see the FSP Submission Schema and an example FSP submission

31 BUSINESS AGENT IMPLEMENTATION

The FSP Business Agent will be written as a Java Application that will listen for messages on an Oracle Advanced Queue The implementation will start with the base class as defined in the Electronic Submission Framework project The base class will define the methods for manipulating (eg Add view remove) messages on an Oracle Advanced Queue Refer to the Agent Design Section of the ESF Queue Agent Best Practices Document for the specific details on how to create a message agent See also ESF Submissions Web Service ndash Client Developerrsquos Guide The remainder of this section provides the more detailed processing that the FSP Business Agent must implement once it receives a new submission from the queue

32 DATA PARSING

Parsing of a submission will be done using VIXB (Vivid XML Binding) The XML will be parsed into a set of java objects modelling the XML For more information on VIXB see the VIXB users guide In a nutshell VIXB configures a SAX XML parser with call backs to a Sax handler The handler then passes the parsed data to tag-specific extractors which know how to ldquoextractrdquo the data When the extractor is complete it then calls an application specific processor The processor is then responsible to perform validation and processing Following is a UML class diagram of the FSP domain classes which will be created Note some of these entities may already be defined for previous MoFR apps and can be named or refactored accordingly however the XML tag information is specific to FSP and must be parsed and validated accordingly For clarity not all gettersetter methods are included

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 10

+getName() string(idl)+setName()+getFSP_ID() unsigned long(idl)+setAmendment()+getAmendment() short(idl)+getStatus() short(idl)+setStatus()+setPlanStartDate()+getPlanStartDate() long long(idl)+getPlanTerm() short(idl)+setPlanTerm()+getPlanContactPerson() PlanContactPerson+requiresApproval() boolean(idl)+setRequiresApprovalInd()

-planName string(idl)-FSP_ID unsigned long(idl)-amendmentNumber short(idl) = 0-dateSubmitted unsigned long(idl)-status-planStartDate unsigned long(idl)-planTerm short(idl) = 5-requiresApprovalInd boolean(idl)

ForestStewardShipPlan

-name string(idl)

ForestDevelopmentUnit

-bgcZone string(idl)-bgcSubzone string(idl)-bgcVariant string(idl)-bgcPhase string(idl)-bgcSiteSeries string(idl)-bgcSiteType string(idl)-gbcSeral string(idl)-maxAllowableDisturbance float(idl)-standardsRationale string(idl)-regenObligationInd boolean(idl)-regenOffseti short(idl)-earlyOffset short(idl)-lateOffset short(idl)

StockingStandard-clientCode string(idl)-licenceNumber string(idl)

PlanHolder

1

0

1

0

1

1

-licenceNumber string(idl)

ForestLicence

1

1

-

spatial

1

1

+getDistrictCode() string(idl)

-districtCode string(idl)

OrgUnit

1 1

+getName() string(idl)+setName()+getEmail() string(idl)+setEmail()+getPhone() unsigned long(idl)+setPhone()

-Name string(idl)-emailAddress string(idl)-telephone unsigned long(idl)

PlanContactPerson

11

Amended FSP might not include stocking standards

Amended FSP might not include FDUs

-stockingLayerCode string(idl)-wellSpaced unsigned long(idl)-minPrefWellSpaced unsigned long(idl)-residualBasalArea unsigned long(idl)-minHorizontalDistance unsigned long(idl)-minPostSpacing unsigned long(idl)-maxPostSpacing unsigned long(idl)-maxConifer unsigned long(idl)-heightRelativeToComp unsigned long(idl)-heightRelativeToCompCode string(idl)

StandardLayer

1

1

-speciesCode string(idl)-minHeight float(idl)-preferredSpeciesInd boolean(idl)

StandardLayerSpecies11

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 11

33 SUBMISSION PROCESSING

All the data for a Forest Stewardship Plan is required in order to validate it To address this all the data for an FSP is ldquoaccumulatedrdquo in temporary database tables Once the data is accumulated validation can occur Accumulation is done by calling functions in the FSP_XML_SUBMISSION package Validation functions are implemented in the FSP_VALIDATION package General Note 1 All procedures have at least one ldquoOUTrdquo parameter This is a string that will

contain any error messages that occur during the operation Other ldquoOUTrdquo parameters will be database identifying values for that object that are required for future processes (ie other agents) and so must be stored

2 For the initial FSP submission (amendment 0) the submitter must submit at least

one document as an attachment a a legal FSP document (MSWord or PDF) (Error 1) b The submitter may also include other supporting documentation as

attached files c The files must have approved extension (doc pdf xls zip jpg) (Error

2)

The pseudo code to validate a Forest Stewardship Plan is as follows

Begin Transaction

Call FSP_XML_SUBMISSIONUSER_SUBMISSION_DATA once

Call FSP_XML_SUBMISSIONVALID_FSP once

Call FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER for each ltplanHoldergt

For each OrgUnit element

Call FSP_XML_SUBMISSIONACCUMULATE_ORG_UNIT

For each PlanHolder element

Call FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER

For each ForestDevelopmentUnit Call FSP_XML_SUBMISSIONACCUMULATE_FDU

For each StockingStandard element

Call FSP_XML_SUBMISSIONACCUMULATE_STANDARD

For each StandardLayer element

Call FSP_XML_SUBMISSIONACCUMULATE_LAYER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 12

For each StandardLayerSpecies

Call FSP_XML_SUBMISSIONACCUMULATE_SPECIES

Call FSP_VALIDATE_XMLFSP_VALIDATION

If errors then

ROLLBACK the transaction

Note If system erros then return false to base agent so job is left on queue If validation errors then return true to remove job from queue and error messages are sent back to the client

Else

Call FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

COMMIT

34 DATA VALIDATION - DAO INTERFACE SPECIFICATIONS

This section details the interface between the Java business agent and the Oracle packages that implement amalgamation validation and processing It can be used in conjunction with the previous sections to define the detailed package interface

341 FSP_XML_SUBMISSIONUSER_SUBMISSION_DATA

Capture the submission metadata coming from ESF Confirm that the individual making the FSP submission has valid authority

to submit via ESF (Error 3)

PROCEDURE USER_SUBMISSION_DATA( P_FSP_SUBMISSION_ID IN NUMBER

P_SUBMITTED_BY IN VARCHAR2 P_CLIENT_NUMBER IN VARCHAR2 P_CLIENT_LOCN_CODE IN VARCHAR2 P_ORG_UNIT_NO IN NUMBER P_SUBMISSION_TIMESTAMP IN DATE P_USER_FILENAME IN VARCHAR2 P_USER_AUTHORITY IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_SUBMISSION_ID Comes from file message from ESF

P_SUBMITTED_BY Comes from file message from ESF

P_CLIENT_NUMBER Comes from file message from ESF

P_CLIENT_LOCN_CODE Comes from file message from ESF

P_ADMIN_DISTRICT_NO orgUnitNo from submission metadata ltdistrictCodegt value

P_SUBMISSION_TIMESTAMP Comes from file message from ESF

P_USER_FILENAME Comes from file message from ESF

P_USER_AUTHORITY Set to lsquoACrsquo

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 13

342 FSP_XML_SUBMISSIONACCUMULATE_FSP

Call once for the ltForestStewardshipPlangt entity Ensure only one such entity is included If no errors are returned then proceed If FSP already exists (this is an amendment) return the FSP_ID PROCEDURE VALID_FSP (P_FSP_ID IN OUT NUMBER

P_PLAN_NAME IN VARCHAR2 P_PLAN_TERM_YEARS IN NUMBER P_PLAN_TERM_COMMENCEMENT IN DATE P_ACTION_CODE IN VARCHAR2 P_SUBMITTER_NAME IN VARCHAR2 P_SUBMITTER_EMAIL IN VARCHAR2 P_SUBMITTER_TELEPHONE IN VARCHAR2 P_AMENDMENT_IND IN VARCHAR2 P_AMENDMENT_COMMENT IN VARCHAR2 P_AMENDMENT_APPROVAL_IND IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_OPENING_ID ltfspIDgt or from previous procedure call

P_PLAN_NAME ltplanNamegt

P_PLAN_TERM_YEARS ltplanTermYearsgt

P_PLAN_TERM_COMMENCEMENT ltplanTermCommencementgt

P_ACTION_CODE ltactionCodegt

P_SUBMITTER_NAME ltlicenseeContactgt

P_SUBMITTER_EMAIL ltemailAddressgt

P_SUBMITTER_TELEPHONE lttelphoneNumbergt

P_AMENDMENT_IND ltamendmentIndgt

P_AMENDMENT_COMMENT ltamendmentCommentgt

P_AMENDMENT_APPROVAL_IND ltadmendmentApprovalRequiredgt

343 FSP_XML_SUBMISSIONACCUMULATE_ORG_UNIT

Call once for each ltdistrictCodePropertygt in ltForestStewardshipPlangt PROCEDURE ACCUMULATE_PLAN_HOLDER(

P_FSP_ID IN NUMBER P_DISTRICT_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_DISTRICT_CODE ltdistrictCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 14

344 FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER

Call once for each ltPlanHoldergt in the FSP PROCEDURE ACCUMULATE_PLAN_HOLDER(

P_FSP_ID IN NUMBER P_CLIENT_NUMBER IN VARCHAR2 P_CLIENT_LICENSE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_CLIENT_NUMBER Comes from file message from ESF

P_CLIENT_LICENCE Comes from file message from ESF

345 FSP_XML_SUBMISSIONACCUMULATE_FDU

Call once for each ltFDUgt in the FSP PROCEDURE ACCUMULATE_FDU(

P_FSP_ID IN NUMBER P_FDU_NAME IN VARCHAR2 P_CLIENT_LICENCES IN VARRAY OF VARCHAR2 P_GEOMETRY IN MDSYSSDO_GEOMETRY P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_FDU_NAME ltfduNamegt

P_CLIENT_LICENCES ltFDUgtltlicenseNumbergt

P_GEOMETRY FDU ltextentOfgt as SDO_GEOMETRY

346 FSP_XML_SUBMISSIONACCUMULATE_STANDARD

Call once for each ltStockingStandardgt in the FSP

PROCEDURE ACCUMULATE_STANDARD( P_STANDARDS_REGIME_ID IN OUT NUMBER P_STANDARDS_REGIME_NAME IN VARCHAR2 P_STANDARDS_OBJECTIVE IN VARCHAR2 P_REGEN_DELAY_OFFSET_YRS IN NUMBER P_REGEN_OBLIGATION_IND IN VARCHAR2 P_EARLY_OFFSET_YRS IN NUMBER P_LATE_OFFSET_YRS IN NUMBER P_GEOGRAPHIC_DESCRIPTION IN VARCHAR2 P_ADDITIONAL_STANDARDS IN VARCHAR2

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 15

P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt

P_STANDARDS_REGIME_NAME ltstandardsRegimeNamegt

P_STANDARDS_OBJECTIVE ltstandardsObjectivegt

P_REGEN_DELAY_OFFSET_YRS ltregenOffsetgt from regenObjectivesProperty

P_REGEN_OBLIGATION_IND ltregenObligationIndgt from regenObjectivesProperty

P_EARLY_OFFSET_YRS ltearlyOffsetgt from regenObjectivesProperty

P_LATE_OFFSET_YRS ltlateOffsetgt from regenObjectivesProperty

P_GEOGRAPHIC_DESCRIPTION ltgeographicDescriptiongt

P_ADDITIONAL_STANDARDS ltadditionalStandardsgt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 16

347 RESULTS_XML_SUBMISSIONACCUMULATE_STANDARDS_LAYER

For each StandardLayer within a Standards Regime call

PROCEDURE ACCUMULATE_STANDARDS_LAYER (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_STOCKING_LAYER_ID OUT NUMBER P_TARGET_STOCKING IN NUMBER P_RESIDUAL_BASAL_AREA IN NUMBER P_MIN_HORIZONTAL_DISTANCE IN NUMBER P_MIN_PREF_STOCKING_STANDARD IN NUMBER P_MIN_POST_SPACING IN NUMBER P_MIN_STOCKING_STANDARD IN NUMBER P_MAX_POST_SPACING IN NUMBER P_MAX_CONIFER IN NUMBER P_HGHT_RELATIVE_TO_COMP IN NUMBER P_HGHT_RELATIVE_COMP_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID From ltstandardsRegimeIdgt or previous procedure

P_STOCKING_LAYER_CODE ltstockingLayerCodegt

P_STOCKING_LAYER_ID This value is returned

P_TARGET_STOCKING ltwellSpacedgt

P_RESIDUAL_BASAL_AREA ltresidualBasalAreagt

P_MIN_HORIZONTAL_DISTANCE ltminHorizontalDistancegt

P_PREF_STOCKING_STANDARD ltminPrefWellSpacedgt

P_MIN_POST_SPACING ltminPostSpacinggt

P_MIN_STOCKING_STANDARD ltminStockingStandardgt

P_MAX_POST_SPACING ltmaxPostSpacinggt

P_MAX_CONIFER ltmaxConifergt

P_HGHT_RELATIVE_COMP ltheightRelativeToCompgt

P_HGHT_RELATIVE_COMP_CODE ltheightRelativeToCompCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 17

348 RESULTS_XML_SUBMISSIONACCUMULATE_SPECIES

Call once for each StandardLayerSpecies within a StandardLayer

PROCEDURE ACCUMULATE_SPECIES (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_SPECIES_CODE IN VARCHAR2 P_STOCKING_LAYER_ID IN NUMBER P_PREFERRED_IND IN VARCHAR2 P_MIN_HEIGHT IN NUMBER P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt or previous procedure

P_STOCKING_LAYER_CODE STOCKING_LAYER_CODE from StandardLayer

P_SPECIES_CODE ltspeciesCodegt

P_STOCKING_LAYER_ID STOCKING_LAYER_ID from StandardLayer

P_STOCKING_STANDARD_UNIT_ID STOCKING_STANDARD_UNIT_ID from StandardLayer

P_PREFERRED_IND ltpreferredSpeciesIndgt

P_MIN_HEIGHT ltminHeightgt

P_SUBMITTED_BY Comes from file message from ESF

349 FSP_VALIDATE_XMLFSP_VALIDATION

Call after the the submission has been accumulated and no errors were returned FSP_VALIDATION is a procedure that calls a chain of other procedures that validate parts of the submission data The overall results are returned

FSP_VALIDATE_XMLVALIDATE_PLAN_HOLDER

BUSINESS RULES

At least one named licensee (forest client) forest licence pair in ltPlanHoldergt (Error 4 5 6)

That each named licensee actually exists and owns the licence listed

(Error 7)

FSP_VALIDATE_XMLVALIDATE_ORG_UNITS

BUSINESS RULES

At least one ltdistrictCodegt named (Error 8) Code resolves to a valid existing MoFR Forest District (Error 9)

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 18

FSP_VALIDATE_XMLVALIDATE_FSP

BUSINESS RULES

Ensure only a single ltForestStewardshipPlangt entity is included (Error 10)

Submission metadata ltlicenseeContactgt(Error 11)

ltemailAddressgt(Error 12) and lttelephoneNumbergt (Error 13) provided (no nulls)

Is this an original submission or an amendment (ltamendmentIndicatorgt)

(Error 14)

If original submission confirm o Plan name provided (Error 15) o Required document attached

FSP legal plan document (Error 1) o At least one ltForestDevelopmentUnitgt included (Error 16) o At least one ltStockingStandardgt included (Error 17)

ltfspIDgt (conditional) this is amendment or update

o If provided ensure a matching FSP_ID already exists in the database (Error 18)

o If existing FSP_ID status = ldquoApprovedrdquo this must be an amendment ensure that ltamendmentIndgt = ldquoTrdquo (Error 19)

o If existing FSP_ID status = ldquoRejectedrdquo this is a mistaken attempt to re-submit the same FSP (Error 20)

o If existing FSP_ID status = ldquoDraftrdquo this is an update anything submitted will overwrite existing FSP_ID record

ltplanNamegt (conditional)

o If provided and no ltfspIDgt provided this is a new submission Ensure that ltamendmentIndgt = lsquoFrsquo (Error 21)

ltplanTermgt (optional) if included is less than or equal to 5 (Error 22) ltplanStartDategt (optional) if included is valid date (Error 23) ltactionCodegt

o if ldquoNrdquo (New) Must be new FSP ensure no matching FSP_ID

FSP_AMENDMENT_NUMBER primary key already exists o if ldquoUrdquo (Update)

Must be existing FSP ensure a match to FSP_ID and FSP_AMENDMENT_NUMBER key exists

Existing FSP must be in ldquoDraftrdquo status o if ldquoArdquo (Append)

Must an existing FSP in ldquoDraftrdquo status Explicitly designed for appending GML map data to an

existing FSP

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 19

Must not already by any FOREST_DEVELOPMENT_UNIT entries for this FSP

ltamendmentIndgt (mandatory)

o Must be one of ldquoTrdquo or ldquoFrdquo (Error 24) o If ldquoTrdquo ensure ltfspIDgt provided and matches an existing FSP_ID in

the database (error 25) also ensure that the status of the existing FSP_ID = ldquoApprovedrdquo (error 26)

o If ldquoFrdquo and no ltfspIDgt provided this is a new submission o If ldquoFrdquo and ltfspIDgt provided must be an update ensure it

matches an existing FSP_ID with status = ldquoDraftrdquo (Error 27) ltamendmentApprovalRequiredIndgt (conditional)

o If ltamendmentIndgt is ldquotruerdquo must be included and set to one of ldquoTrdquo or ldquoFrdquo (Error 28)

FSP_VALIDATE_XMLVALIDATE_FDUS

BUSINESS RULES

Validate Geometry o polygon area gt 0 o polygon boundary length gt 0 o Other

Validate Identifier o ltfduNamegt must exist and not be null (Error 29) o ltfduNamegt must be unique within the FSP (no duplicates) (Error

30)

Validate Licences o Each FDU must have at least one forest licence applying (Error 31) o Each licence must be owned by one of the licensees listed for this

FSP ltplanHoldergtltlicenceNumbergt (Error 32)

FSP_VALIDATE_XMLVALIDATE_STANDARDS

BUSINESS RULES

Stocking Standards o For FSPs the stocking standard is nearly identical to the

ltStandardsAmendmentTypegt in the RESULTS schema with the following exceptions

The following elements from RESULTS ltStandardsTypegt have been added

ltbgcZonegt ltbgcSubzonegt ltbgcVariantgt ltbgcPhasegt ltbgcSiteSeriesgt ltbgcSiteTypegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 20

ltbgcSeralgt ltmaximumAllowableSoilDisturbancegt

o Therefore the equivalent Validation procedures from Results 30 can be used here with minor amendments

o FSP Stocking Standards do not have a spatial component and are not linked to any piece of ground

3410 FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

Call if no errors returned in any of the steps above PROCEDURE PROCESS_XML_SUBMISSION(

P_POST IN VARCHAR2 P_RESULTS OUT ref_results)

Procedure parameter Data Value P_POST Validate only indicator from fsp

submission metadata

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 21

The following diagram shows the decision points on how to process the submission depending on input parameters The pre-defined states refer procedures defined below

ltfspIDgt

Y

ltplanNamegt

N Error must havePlan name

N

fspID ==FSP_ID

Error UnknownFSP

N

FSP_IDSTATUS

Y

Error cannotUpdate or amend

RejectedSubmitted

ltamendmentIndgt

Approved

Error amendment requiredF

AmendApproval

Ind

T

AmendmentTo

Inbox

T

AmendmentAuto

Approve

UpdateExisting

PlanDraft

Create NewFSP

Y

End

End

End

FSP with same FSP_ID exists in database

FSP Submission

Validate

ESF FSPSubmissionAccumulate

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 22

3411 CREATE_NEW_FSP

This procedure will create a new ForestStewardshipPlan and all related entities in the production database

FOREST_STEWARDSHIP_PLAN TABLE

Source Destination FSP_SEQNEXTVAL FSP_ID 0 FSP_AMENDMENT_NUMBER STATUS for ldquoSubmittedrdquo FSP_STATUS_CODE ltplanNamegt PLAN_NAME ltplanTermYearsgt PLAN_TERM_YEARS ltplanTermCommencementgt PLAN_START_DATE ltplanTermCommencementgt + ltplanTermYearsgt

PLAN_END_DATE

ESF submission date PLAN_SUBMISSION_DATE ltlicenseeContactgt CONTACT_NAME lttelphoneNumbergt TELEPHONE_NUMBER ltemailAddressgt EMAIL_ADDRESS

FSP_AGREEMENT_HOLDER TABLE

Source Destination ltPlanHoldergtltclientCodegt CLIENT_NUMBER

FSP_ORG_UNIT TABLE

Source Destination ORG_UNITORG_UNIT_NO for ltdistrictCodegt

ORG_UNIT_NO

FSP_STATUS_HISTORY TABLE

Source Destination FSP_STATUS_HISTORY_SEQ FSP_STATUS_HISTORY_ID ldquoSubmittedrdquo code from FSP_STATUS_CODE

FSP_STATUS_CODE

ldquoNew Submissionrdquo STATUS_COMMENT

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 23

FSP_ATTACHMENT TABLE

Source Destination ESF framework ATTACHMENT_DESCRIPTION ATTACHMENT_NAME ATTACHMENT_SIZE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

3412 UPDATE_EXISTING_PLAN

For ESF submissions only the FDU map spatial component ltFDUPropertygt can be submitted as an update Part of the validation is to ensure that no other data is included with the ESF submission file except ltfspIDgt and ltFDUPropertygt This may be an INSERT or an UPDATE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination ltfspIDgt FSP_ID FOREST_STEWARDSHIP_PLAN FSP_AMENDMENT_NUMBER

FSP_AMENDMENT_NUMBER

FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 24

3413 AMENDMENT_AUTO_APPROVE

This is to create an amendment that does not require approval It is in effect a new FSP submission that automatically goes to ldquoApprovedrdquo status and increments the FSP_AMENDMENT_NUMBER Processing depends on what the licensee has submitted It may be one or more of

headeradministrative information (such as adding a new licensee) or amending a plan term

a new legal FSP document a new GML map of all the FDUs (spatial data if amended must be

completely replaced) new stocking standards

Process the data as if it were a new submission (see above) with the following exceptions

Do an INSERT INTO FOREST_STEWARDSHIP_PLAN setting FSP_AMENDMENT_NUMBER = MAX(FSP_AMENDMENT_NUMBER) + 1

Copy all fields from FOREST_STEWARDSHIP_PLAN from the most recent amendment (or the original submission record if no amendments)

UPDATE any fields in FOREST_STEWARSHIP_PLAN for this new entry that are provided in the XML submission that is any of ltplanNamegt ltplanTermYearsgt ltplanTermCommencementgt ltlicenseeContactgt lttelephoneNumbergt ltemailAddressgt

Any attachments must be INSERTed into FSP_ATTACHMENT with the new FSP_AMENDMENT_NUMBER (also FSP_ATTACHMENT_CONTENT)

Set FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoAPPRrdquo for this new record

INSERT INTO FSP_STATUS_HISTORY (FSP_STATUS_HISTORY_ID FSP_ID FSP_AMENDMENT_NUMBER FSP_STATUS_CODE STATUS_COMMENT) VALUES (SEQNEXTVAL ltFSP_IDgt ltnew FSP_AMENDMENT_NUMBERgt ldquoAPPRrdquo ltamendmentCommentgt) Be sure to use the new FSP_AMENDMENT_NUMBER in INSERTing any STANDARDS_REGIME or FOREST_DEVELOPMENT_UNIT records

3414 AMENDMENT_TO_INBOX

This is to create an amendment that requires approval The FSP submission is put in ldquoSubmittedrdquo status so that it will show up in the relevant District Inboxes The FSP_AMENDMENT_NUMBER is incremented Proceed as above (AMENDMENT_AUTO_INCREMENT) except

SET FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoSUBMrdquo (for Submitted)

SET FSP_STATUS_HISTORYSTATUS_CODE = ldquoSUBMrdquo for new record

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 25

35 DOMAIN CODES

The following codes will be set up in the database in static code tables (all fields are VARCHAR2)

FSP_STATUS_CODE TABLE

FSP_STATUS_CODE DESCRIPTION SUBM Submitted DRFT Draft APPR Approved REJ Rejected OTBH Opportunity To Be Heard

FSP_REVIEW_MILESTONE_TYPE_CODE TABLE

FSP_REVIEW_MILESTONE_ TYPE_CODE

DESCRIPTION

FNR First Nations Review CampE Results amp Strategies reviewed by CampE TEN Objectives Results amp Strategies reviewed by

Tenures DDM Sent to DDM for Determination OTHR Other

FSP_ATTACHMENT_TYPE_CODE TABLE

FSP_ATTACHMENT_TYPE_CODE DESCRIPTION FSP FSP legal document MAP Map of FDUs SS Stocking Standards report AMDS Amendment Description DDMD DDM Decision Letter OTHR Other Attachment

FEATURE_CLASSES TABLE

FEATURE_CLASS_SKEY DESCRIPTION FEATURE_CLASS_KEY To be defined

36 REPORTING ERRORS

If an error is detected in a submission it must be reported back to the electronic submission framework The method for doing that is to post a message to a queue detailing the submission number and the error message The licensee will be able to check back to the Electronic Submission WebSite and view the error The Electronic Submission Framework will also send an email to the client detailing the message

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 26

The specification for how to report an error can be found in the ESF Queue Agent Best Practices Document The message content for FSP will be a concatenation of the ltFSP Submission IDgt ltDescriptiongt field and the message returned from the validation routines above To send a message about a submission you will need to supply the FSP submission ID for the submission The FSP submission ID is supplied with the message from ESF and stored in the FSP_ELECTRONIC_SUBMISSION table Refer to the Status Agent in the ESF Queue Agent Best Practices document for details on how to send a message to ESF The following code is provided as a sample only and the final syntax should be from the ESF Queue Agent Best Practices Document StatusAgent sa = new StatusAgent (ldquoFSP Business Agentrdquo) sasendStatus (ltForestStewardshipPlanSubmissionIDgt StatusMessageREJECTED ldquo100rdquo ltForestStewardshipPlangtlt083D02800509gt + ldquofailedrdquo + outMessage) saclose() Note Expectation is that outmessage will contain details as to what part of the FSP failed (eg Tenure Forest Development Unit or Stocking Standard) In the case of invalid data processing stops at this point for the FSP No data for this submission will be added to FSP database

361 ERROR MESSAGES

These error messages may be generated during the accumulation validation and processing phases They are referenced by number in the procedure documentation above

1 A legal FSP document must be attached to this submission Please attach a document containing your Forest Stewardship Plan

2 The attached file ltnamegt does not have a recognizable file extension Atachments must be one of MSWord (doc) Portable Document Format (pdf) MS Excel (xls) ZIP archive (zip) or JPEG graphic (jpg) Please resubmit with appropriate file attachments

3 You do not have the proper authority to submit an FSP via ESF Please contact the appropriate MoFR District office to obtain the necessary ldquoSubmitterrdquo authority role

4 The FSP submitted does not name any plan holders At least one holder of a major BC Forest license must be named in the plan

5 No forest license number was found for a named plan holder You must name all forest licenses which apply within the FSP

6 A plan holderrsquos license number could not be verified Please check the validity of the plan holder MoFR client codes

7 A forest license number listed is not owned by any of the plan holders of this FSP Please check the validity of the plan holder MoFR client codes and their licence numbers

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 27

8 At least one BC Forest District must be listed for this FSP Each District responsible for the area included in the FSP must be listed

9 The MoFR District Code is not recognized Please check the spelling of the District code(s) included or check with the appropriate District office for the proper code

10 More than one Forest Stewardship Plan (FSP) was included in this submission At the present time each ESF submission may contain only a single FSP

11 The submission must include the name of a contact person responsible for communicating with MoFR about this FSP submission

12 The submission must include the email address of a contact person responsible for communicating with MoFR about this FSP submission

13 The submission must include the telephone number of a contact person responsible for communicating with MoFR about this FSP submission

14 The submission must indicate whether or not this is an original FSP or an amendment to an existing FSP

15 The FSP must have a name 16 The FSP must include at least one Forest Development Unit (FDU) 17 The FSP must include at least one Stocking Standard 18 This submission refers to an FSP that does not exist in the Ministryrsquos

database Please check the FSP ID number provided after your original submission

19 An FSP with the same FSP ID number already exists in the Ministryrsquos database yet you have not indicated that this is an amendment If the intention is to amend an existing FSP please include the correct FSP ID and make sure the ltamendmentIndgt flag is set to ldquotruerdquo

20 The FSP you are trying to amend has been rejected You cannot amend or replace a rejected FSP You must make a brand new submission When doing so do not include an FSP ID number

21 The submission appears to be a new FSP yet the amendment indicator is set to true (ltamendmentIndgt = ldquotruerdquo) Either provide an FSP ID to amend an existing FSP or set the amendment indicator to ldquofalserdquo

22 The FSP plan term has been set to greater than 5 years FSPs are valid for a maximum of 5 years unless an extension is approved

23 The plan commencement date provided is not valid 24 A value for ltamendmentIndgt must be provided it must be set to either ldquotruerdquo or ldquofalserdquo

25 The submission appears to be for an FSP amendment (ltamendmentIndgt = ldquotruerdquo) however no FSP is referenced Please be sure to include the FSP ID number provided with the original submission

26 You cannot amend an FSP that is not approved Ensure you have provided the correct FSP ID number issued with the original submission and confirm that the FSP is approved

27 An FSP with the same FSP ID number already exists in the database Before you can update this FSP it must be placed in Draft status by the District Manager

28 The submission appears to be an amendment to an existing FSP However you have not stated whether or not this amendment requires Ministry approval Please ensure that the ltamendmentApprovalRequiredIndgt is set to one of ldquotruerdquo or ldquofalserdquo

29 A Forest development Unit (FDU) was submitted without a name A name must be provided for each FDU

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 28

30 The same name has been provided for more than one Forest Development Unit (FDU) Each FDU in a submission must have a unique name

31 A Forest Development Unit (FDU) was submitted that did not list a forest licence number that applies Each FDU must have at least one license number applied

32 A forest license number was supplied that does not appear to be owned by any of the plan holders for this FSP Each Forest Development Unit (FDU) must be listed with at least one forest license owned by one of the plan holders for this FSP

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting

Page 9: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 9

3 FSP BUSINESS AGENT ndash DETAILED SPECIFICATIONS

The XML submission is forestStewardshipPlan centric ie each transactional unit will be encompassed within ltforestStewardshipPlangt and ltforestStewardshipPlangt tag pairs All data within this block will be related to the FSP as defined in this block Only at single FSP unit can exist in the same submission although the business rule may change in a later release to allow a licensee to submit multiple FSPs in a single submission For information on the schema please see the FSP Submission Schema and an example FSP submission

31 BUSINESS AGENT IMPLEMENTATION

The FSP Business Agent will be written as a Java Application that will listen for messages on an Oracle Advanced Queue The implementation will start with the base class as defined in the Electronic Submission Framework project The base class will define the methods for manipulating (eg Add view remove) messages on an Oracle Advanced Queue Refer to the Agent Design Section of the ESF Queue Agent Best Practices Document for the specific details on how to create a message agent See also ESF Submissions Web Service ndash Client Developerrsquos Guide The remainder of this section provides the more detailed processing that the FSP Business Agent must implement once it receives a new submission from the queue

32 DATA PARSING

Parsing of a submission will be done using VIXB (Vivid XML Binding) The XML will be parsed into a set of java objects modelling the XML For more information on VIXB see the VIXB users guide In a nutshell VIXB configures a SAX XML parser with call backs to a Sax handler The handler then passes the parsed data to tag-specific extractors which know how to ldquoextractrdquo the data When the extractor is complete it then calls an application specific processor The processor is then responsible to perform validation and processing Following is a UML class diagram of the FSP domain classes which will be created Note some of these entities may already be defined for previous MoFR apps and can be named or refactored accordingly however the XML tag information is specific to FSP and must be parsed and validated accordingly For clarity not all gettersetter methods are included

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 10

+getName() string(idl)+setName()+getFSP_ID() unsigned long(idl)+setAmendment()+getAmendment() short(idl)+getStatus() short(idl)+setStatus()+setPlanStartDate()+getPlanStartDate() long long(idl)+getPlanTerm() short(idl)+setPlanTerm()+getPlanContactPerson() PlanContactPerson+requiresApproval() boolean(idl)+setRequiresApprovalInd()

-planName string(idl)-FSP_ID unsigned long(idl)-amendmentNumber short(idl) = 0-dateSubmitted unsigned long(idl)-status-planStartDate unsigned long(idl)-planTerm short(idl) = 5-requiresApprovalInd boolean(idl)

ForestStewardShipPlan

-name string(idl)

ForestDevelopmentUnit

-bgcZone string(idl)-bgcSubzone string(idl)-bgcVariant string(idl)-bgcPhase string(idl)-bgcSiteSeries string(idl)-bgcSiteType string(idl)-gbcSeral string(idl)-maxAllowableDisturbance float(idl)-standardsRationale string(idl)-regenObligationInd boolean(idl)-regenOffseti short(idl)-earlyOffset short(idl)-lateOffset short(idl)

StockingStandard-clientCode string(idl)-licenceNumber string(idl)

PlanHolder

1

0

1

0

1

1

-licenceNumber string(idl)

ForestLicence

1

1

-

spatial

1

1

+getDistrictCode() string(idl)

-districtCode string(idl)

OrgUnit

1 1

+getName() string(idl)+setName()+getEmail() string(idl)+setEmail()+getPhone() unsigned long(idl)+setPhone()

-Name string(idl)-emailAddress string(idl)-telephone unsigned long(idl)

PlanContactPerson

11

Amended FSP might not include stocking standards

Amended FSP might not include FDUs

-stockingLayerCode string(idl)-wellSpaced unsigned long(idl)-minPrefWellSpaced unsigned long(idl)-residualBasalArea unsigned long(idl)-minHorizontalDistance unsigned long(idl)-minPostSpacing unsigned long(idl)-maxPostSpacing unsigned long(idl)-maxConifer unsigned long(idl)-heightRelativeToComp unsigned long(idl)-heightRelativeToCompCode string(idl)

StandardLayer

1

1

-speciesCode string(idl)-minHeight float(idl)-preferredSpeciesInd boolean(idl)

StandardLayerSpecies11

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 11

33 SUBMISSION PROCESSING

All the data for a Forest Stewardship Plan is required in order to validate it To address this all the data for an FSP is ldquoaccumulatedrdquo in temporary database tables Once the data is accumulated validation can occur Accumulation is done by calling functions in the FSP_XML_SUBMISSION package Validation functions are implemented in the FSP_VALIDATION package General Note 1 All procedures have at least one ldquoOUTrdquo parameter This is a string that will

contain any error messages that occur during the operation Other ldquoOUTrdquo parameters will be database identifying values for that object that are required for future processes (ie other agents) and so must be stored

2 For the initial FSP submission (amendment 0) the submitter must submit at least

one document as an attachment a a legal FSP document (MSWord or PDF) (Error 1) b The submitter may also include other supporting documentation as

attached files c The files must have approved extension (doc pdf xls zip jpg) (Error

2)

The pseudo code to validate a Forest Stewardship Plan is as follows

Begin Transaction

Call FSP_XML_SUBMISSIONUSER_SUBMISSION_DATA once

Call FSP_XML_SUBMISSIONVALID_FSP once

Call FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER for each ltplanHoldergt

For each OrgUnit element

Call FSP_XML_SUBMISSIONACCUMULATE_ORG_UNIT

For each PlanHolder element

Call FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER

For each ForestDevelopmentUnit Call FSP_XML_SUBMISSIONACCUMULATE_FDU

For each StockingStandard element

Call FSP_XML_SUBMISSIONACCUMULATE_STANDARD

For each StandardLayer element

Call FSP_XML_SUBMISSIONACCUMULATE_LAYER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 12

For each StandardLayerSpecies

Call FSP_XML_SUBMISSIONACCUMULATE_SPECIES

Call FSP_VALIDATE_XMLFSP_VALIDATION

If errors then

ROLLBACK the transaction

Note If system erros then return false to base agent so job is left on queue If validation errors then return true to remove job from queue and error messages are sent back to the client

Else

Call FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

COMMIT

34 DATA VALIDATION - DAO INTERFACE SPECIFICATIONS

This section details the interface between the Java business agent and the Oracle packages that implement amalgamation validation and processing It can be used in conjunction with the previous sections to define the detailed package interface

341 FSP_XML_SUBMISSIONUSER_SUBMISSION_DATA

Capture the submission metadata coming from ESF Confirm that the individual making the FSP submission has valid authority

to submit via ESF (Error 3)

PROCEDURE USER_SUBMISSION_DATA( P_FSP_SUBMISSION_ID IN NUMBER

P_SUBMITTED_BY IN VARCHAR2 P_CLIENT_NUMBER IN VARCHAR2 P_CLIENT_LOCN_CODE IN VARCHAR2 P_ORG_UNIT_NO IN NUMBER P_SUBMISSION_TIMESTAMP IN DATE P_USER_FILENAME IN VARCHAR2 P_USER_AUTHORITY IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_SUBMISSION_ID Comes from file message from ESF

P_SUBMITTED_BY Comes from file message from ESF

P_CLIENT_NUMBER Comes from file message from ESF

P_CLIENT_LOCN_CODE Comes from file message from ESF

P_ADMIN_DISTRICT_NO orgUnitNo from submission metadata ltdistrictCodegt value

P_SUBMISSION_TIMESTAMP Comes from file message from ESF

P_USER_FILENAME Comes from file message from ESF

P_USER_AUTHORITY Set to lsquoACrsquo

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 13

342 FSP_XML_SUBMISSIONACCUMULATE_FSP

Call once for the ltForestStewardshipPlangt entity Ensure only one such entity is included If no errors are returned then proceed If FSP already exists (this is an amendment) return the FSP_ID PROCEDURE VALID_FSP (P_FSP_ID IN OUT NUMBER

P_PLAN_NAME IN VARCHAR2 P_PLAN_TERM_YEARS IN NUMBER P_PLAN_TERM_COMMENCEMENT IN DATE P_ACTION_CODE IN VARCHAR2 P_SUBMITTER_NAME IN VARCHAR2 P_SUBMITTER_EMAIL IN VARCHAR2 P_SUBMITTER_TELEPHONE IN VARCHAR2 P_AMENDMENT_IND IN VARCHAR2 P_AMENDMENT_COMMENT IN VARCHAR2 P_AMENDMENT_APPROVAL_IND IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_OPENING_ID ltfspIDgt or from previous procedure call

P_PLAN_NAME ltplanNamegt

P_PLAN_TERM_YEARS ltplanTermYearsgt

P_PLAN_TERM_COMMENCEMENT ltplanTermCommencementgt

P_ACTION_CODE ltactionCodegt

P_SUBMITTER_NAME ltlicenseeContactgt

P_SUBMITTER_EMAIL ltemailAddressgt

P_SUBMITTER_TELEPHONE lttelphoneNumbergt

P_AMENDMENT_IND ltamendmentIndgt

P_AMENDMENT_COMMENT ltamendmentCommentgt

P_AMENDMENT_APPROVAL_IND ltadmendmentApprovalRequiredgt

343 FSP_XML_SUBMISSIONACCUMULATE_ORG_UNIT

Call once for each ltdistrictCodePropertygt in ltForestStewardshipPlangt PROCEDURE ACCUMULATE_PLAN_HOLDER(

P_FSP_ID IN NUMBER P_DISTRICT_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_DISTRICT_CODE ltdistrictCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 14

344 FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER

Call once for each ltPlanHoldergt in the FSP PROCEDURE ACCUMULATE_PLAN_HOLDER(

P_FSP_ID IN NUMBER P_CLIENT_NUMBER IN VARCHAR2 P_CLIENT_LICENSE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_CLIENT_NUMBER Comes from file message from ESF

P_CLIENT_LICENCE Comes from file message from ESF

345 FSP_XML_SUBMISSIONACCUMULATE_FDU

Call once for each ltFDUgt in the FSP PROCEDURE ACCUMULATE_FDU(

P_FSP_ID IN NUMBER P_FDU_NAME IN VARCHAR2 P_CLIENT_LICENCES IN VARRAY OF VARCHAR2 P_GEOMETRY IN MDSYSSDO_GEOMETRY P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_FDU_NAME ltfduNamegt

P_CLIENT_LICENCES ltFDUgtltlicenseNumbergt

P_GEOMETRY FDU ltextentOfgt as SDO_GEOMETRY

346 FSP_XML_SUBMISSIONACCUMULATE_STANDARD

Call once for each ltStockingStandardgt in the FSP

PROCEDURE ACCUMULATE_STANDARD( P_STANDARDS_REGIME_ID IN OUT NUMBER P_STANDARDS_REGIME_NAME IN VARCHAR2 P_STANDARDS_OBJECTIVE IN VARCHAR2 P_REGEN_DELAY_OFFSET_YRS IN NUMBER P_REGEN_OBLIGATION_IND IN VARCHAR2 P_EARLY_OFFSET_YRS IN NUMBER P_LATE_OFFSET_YRS IN NUMBER P_GEOGRAPHIC_DESCRIPTION IN VARCHAR2 P_ADDITIONAL_STANDARDS IN VARCHAR2

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 15

P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt

P_STANDARDS_REGIME_NAME ltstandardsRegimeNamegt

P_STANDARDS_OBJECTIVE ltstandardsObjectivegt

P_REGEN_DELAY_OFFSET_YRS ltregenOffsetgt from regenObjectivesProperty

P_REGEN_OBLIGATION_IND ltregenObligationIndgt from regenObjectivesProperty

P_EARLY_OFFSET_YRS ltearlyOffsetgt from regenObjectivesProperty

P_LATE_OFFSET_YRS ltlateOffsetgt from regenObjectivesProperty

P_GEOGRAPHIC_DESCRIPTION ltgeographicDescriptiongt

P_ADDITIONAL_STANDARDS ltadditionalStandardsgt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 16

347 RESULTS_XML_SUBMISSIONACCUMULATE_STANDARDS_LAYER

For each StandardLayer within a Standards Regime call

PROCEDURE ACCUMULATE_STANDARDS_LAYER (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_STOCKING_LAYER_ID OUT NUMBER P_TARGET_STOCKING IN NUMBER P_RESIDUAL_BASAL_AREA IN NUMBER P_MIN_HORIZONTAL_DISTANCE IN NUMBER P_MIN_PREF_STOCKING_STANDARD IN NUMBER P_MIN_POST_SPACING IN NUMBER P_MIN_STOCKING_STANDARD IN NUMBER P_MAX_POST_SPACING IN NUMBER P_MAX_CONIFER IN NUMBER P_HGHT_RELATIVE_TO_COMP IN NUMBER P_HGHT_RELATIVE_COMP_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID From ltstandardsRegimeIdgt or previous procedure

P_STOCKING_LAYER_CODE ltstockingLayerCodegt

P_STOCKING_LAYER_ID This value is returned

P_TARGET_STOCKING ltwellSpacedgt

P_RESIDUAL_BASAL_AREA ltresidualBasalAreagt

P_MIN_HORIZONTAL_DISTANCE ltminHorizontalDistancegt

P_PREF_STOCKING_STANDARD ltminPrefWellSpacedgt

P_MIN_POST_SPACING ltminPostSpacinggt

P_MIN_STOCKING_STANDARD ltminStockingStandardgt

P_MAX_POST_SPACING ltmaxPostSpacinggt

P_MAX_CONIFER ltmaxConifergt

P_HGHT_RELATIVE_COMP ltheightRelativeToCompgt

P_HGHT_RELATIVE_COMP_CODE ltheightRelativeToCompCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 17

348 RESULTS_XML_SUBMISSIONACCUMULATE_SPECIES

Call once for each StandardLayerSpecies within a StandardLayer

PROCEDURE ACCUMULATE_SPECIES (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_SPECIES_CODE IN VARCHAR2 P_STOCKING_LAYER_ID IN NUMBER P_PREFERRED_IND IN VARCHAR2 P_MIN_HEIGHT IN NUMBER P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt or previous procedure

P_STOCKING_LAYER_CODE STOCKING_LAYER_CODE from StandardLayer

P_SPECIES_CODE ltspeciesCodegt

P_STOCKING_LAYER_ID STOCKING_LAYER_ID from StandardLayer

P_STOCKING_STANDARD_UNIT_ID STOCKING_STANDARD_UNIT_ID from StandardLayer

P_PREFERRED_IND ltpreferredSpeciesIndgt

P_MIN_HEIGHT ltminHeightgt

P_SUBMITTED_BY Comes from file message from ESF

349 FSP_VALIDATE_XMLFSP_VALIDATION

Call after the the submission has been accumulated and no errors were returned FSP_VALIDATION is a procedure that calls a chain of other procedures that validate parts of the submission data The overall results are returned

FSP_VALIDATE_XMLVALIDATE_PLAN_HOLDER

BUSINESS RULES

At least one named licensee (forest client) forest licence pair in ltPlanHoldergt (Error 4 5 6)

That each named licensee actually exists and owns the licence listed

(Error 7)

FSP_VALIDATE_XMLVALIDATE_ORG_UNITS

BUSINESS RULES

At least one ltdistrictCodegt named (Error 8) Code resolves to a valid existing MoFR Forest District (Error 9)

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 18

FSP_VALIDATE_XMLVALIDATE_FSP

BUSINESS RULES

Ensure only a single ltForestStewardshipPlangt entity is included (Error 10)

Submission metadata ltlicenseeContactgt(Error 11)

ltemailAddressgt(Error 12) and lttelephoneNumbergt (Error 13) provided (no nulls)

Is this an original submission or an amendment (ltamendmentIndicatorgt)

(Error 14)

If original submission confirm o Plan name provided (Error 15) o Required document attached

FSP legal plan document (Error 1) o At least one ltForestDevelopmentUnitgt included (Error 16) o At least one ltStockingStandardgt included (Error 17)

ltfspIDgt (conditional) this is amendment or update

o If provided ensure a matching FSP_ID already exists in the database (Error 18)

o If existing FSP_ID status = ldquoApprovedrdquo this must be an amendment ensure that ltamendmentIndgt = ldquoTrdquo (Error 19)

o If existing FSP_ID status = ldquoRejectedrdquo this is a mistaken attempt to re-submit the same FSP (Error 20)

o If existing FSP_ID status = ldquoDraftrdquo this is an update anything submitted will overwrite existing FSP_ID record

ltplanNamegt (conditional)

o If provided and no ltfspIDgt provided this is a new submission Ensure that ltamendmentIndgt = lsquoFrsquo (Error 21)

ltplanTermgt (optional) if included is less than or equal to 5 (Error 22) ltplanStartDategt (optional) if included is valid date (Error 23) ltactionCodegt

o if ldquoNrdquo (New) Must be new FSP ensure no matching FSP_ID

FSP_AMENDMENT_NUMBER primary key already exists o if ldquoUrdquo (Update)

Must be existing FSP ensure a match to FSP_ID and FSP_AMENDMENT_NUMBER key exists

Existing FSP must be in ldquoDraftrdquo status o if ldquoArdquo (Append)

Must an existing FSP in ldquoDraftrdquo status Explicitly designed for appending GML map data to an

existing FSP

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 19

Must not already by any FOREST_DEVELOPMENT_UNIT entries for this FSP

ltamendmentIndgt (mandatory)

o Must be one of ldquoTrdquo or ldquoFrdquo (Error 24) o If ldquoTrdquo ensure ltfspIDgt provided and matches an existing FSP_ID in

the database (error 25) also ensure that the status of the existing FSP_ID = ldquoApprovedrdquo (error 26)

o If ldquoFrdquo and no ltfspIDgt provided this is a new submission o If ldquoFrdquo and ltfspIDgt provided must be an update ensure it

matches an existing FSP_ID with status = ldquoDraftrdquo (Error 27) ltamendmentApprovalRequiredIndgt (conditional)

o If ltamendmentIndgt is ldquotruerdquo must be included and set to one of ldquoTrdquo or ldquoFrdquo (Error 28)

FSP_VALIDATE_XMLVALIDATE_FDUS

BUSINESS RULES

Validate Geometry o polygon area gt 0 o polygon boundary length gt 0 o Other

Validate Identifier o ltfduNamegt must exist and not be null (Error 29) o ltfduNamegt must be unique within the FSP (no duplicates) (Error

30)

Validate Licences o Each FDU must have at least one forest licence applying (Error 31) o Each licence must be owned by one of the licensees listed for this

FSP ltplanHoldergtltlicenceNumbergt (Error 32)

FSP_VALIDATE_XMLVALIDATE_STANDARDS

BUSINESS RULES

Stocking Standards o For FSPs the stocking standard is nearly identical to the

ltStandardsAmendmentTypegt in the RESULTS schema with the following exceptions

The following elements from RESULTS ltStandardsTypegt have been added

ltbgcZonegt ltbgcSubzonegt ltbgcVariantgt ltbgcPhasegt ltbgcSiteSeriesgt ltbgcSiteTypegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 20

ltbgcSeralgt ltmaximumAllowableSoilDisturbancegt

o Therefore the equivalent Validation procedures from Results 30 can be used here with minor amendments

o FSP Stocking Standards do not have a spatial component and are not linked to any piece of ground

3410 FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

Call if no errors returned in any of the steps above PROCEDURE PROCESS_XML_SUBMISSION(

P_POST IN VARCHAR2 P_RESULTS OUT ref_results)

Procedure parameter Data Value P_POST Validate only indicator from fsp

submission metadata

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 21

The following diagram shows the decision points on how to process the submission depending on input parameters The pre-defined states refer procedures defined below

ltfspIDgt

Y

ltplanNamegt

N Error must havePlan name

N

fspID ==FSP_ID

Error UnknownFSP

N

FSP_IDSTATUS

Y

Error cannotUpdate or amend

RejectedSubmitted

ltamendmentIndgt

Approved

Error amendment requiredF

AmendApproval

Ind

T

AmendmentTo

Inbox

T

AmendmentAuto

Approve

UpdateExisting

PlanDraft

Create NewFSP

Y

End

End

End

FSP with same FSP_ID exists in database

FSP Submission

Validate

ESF FSPSubmissionAccumulate

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 22

3411 CREATE_NEW_FSP

This procedure will create a new ForestStewardshipPlan and all related entities in the production database

FOREST_STEWARDSHIP_PLAN TABLE

Source Destination FSP_SEQNEXTVAL FSP_ID 0 FSP_AMENDMENT_NUMBER STATUS for ldquoSubmittedrdquo FSP_STATUS_CODE ltplanNamegt PLAN_NAME ltplanTermYearsgt PLAN_TERM_YEARS ltplanTermCommencementgt PLAN_START_DATE ltplanTermCommencementgt + ltplanTermYearsgt

PLAN_END_DATE

ESF submission date PLAN_SUBMISSION_DATE ltlicenseeContactgt CONTACT_NAME lttelphoneNumbergt TELEPHONE_NUMBER ltemailAddressgt EMAIL_ADDRESS

FSP_AGREEMENT_HOLDER TABLE

Source Destination ltPlanHoldergtltclientCodegt CLIENT_NUMBER

FSP_ORG_UNIT TABLE

Source Destination ORG_UNITORG_UNIT_NO for ltdistrictCodegt

ORG_UNIT_NO

FSP_STATUS_HISTORY TABLE

Source Destination FSP_STATUS_HISTORY_SEQ FSP_STATUS_HISTORY_ID ldquoSubmittedrdquo code from FSP_STATUS_CODE

FSP_STATUS_CODE

ldquoNew Submissionrdquo STATUS_COMMENT

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 23

FSP_ATTACHMENT TABLE

Source Destination ESF framework ATTACHMENT_DESCRIPTION ATTACHMENT_NAME ATTACHMENT_SIZE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

3412 UPDATE_EXISTING_PLAN

For ESF submissions only the FDU map spatial component ltFDUPropertygt can be submitted as an update Part of the validation is to ensure that no other data is included with the ESF submission file except ltfspIDgt and ltFDUPropertygt This may be an INSERT or an UPDATE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination ltfspIDgt FSP_ID FOREST_STEWARDSHIP_PLAN FSP_AMENDMENT_NUMBER

FSP_AMENDMENT_NUMBER

FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 24

3413 AMENDMENT_AUTO_APPROVE

This is to create an amendment that does not require approval It is in effect a new FSP submission that automatically goes to ldquoApprovedrdquo status and increments the FSP_AMENDMENT_NUMBER Processing depends on what the licensee has submitted It may be one or more of

headeradministrative information (such as adding a new licensee) or amending a plan term

a new legal FSP document a new GML map of all the FDUs (spatial data if amended must be

completely replaced) new stocking standards

Process the data as if it were a new submission (see above) with the following exceptions

Do an INSERT INTO FOREST_STEWARDSHIP_PLAN setting FSP_AMENDMENT_NUMBER = MAX(FSP_AMENDMENT_NUMBER) + 1

Copy all fields from FOREST_STEWARDSHIP_PLAN from the most recent amendment (or the original submission record if no amendments)

UPDATE any fields in FOREST_STEWARSHIP_PLAN for this new entry that are provided in the XML submission that is any of ltplanNamegt ltplanTermYearsgt ltplanTermCommencementgt ltlicenseeContactgt lttelephoneNumbergt ltemailAddressgt

Any attachments must be INSERTed into FSP_ATTACHMENT with the new FSP_AMENDMENT_NUMBER (also FSP_ATTACHMENT_CONTENT)

Set FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoAPPRrdquo for this new record

INSERT INTO FSP_STATUS_HISTORY (FSP_STATUS_HISTORY_ID FSP_ID FSP_AMENDMENT_NUMBER FSP_STATUS_CODE STATUS_COMMENT) VALUES (SEQNEXTVAL ltFSP_IDgt ltnew FSP_AMENDMENT_NUMBERgt ldquoAPPRrdquo ltamendmentCommentgt) Be sure to use the new FSP_AMENDMENT_NUMBER in INSERTing any STANDARDS_REGIME or FOREST_DEVELOPMENT_UNIT records

3414 AMENDMENT_TO_INBOX

This is to create an amendment that requires approval The FSP submission is put in ldquoSubmittedrdquo status so that it will show up in the relevant District Inboxes The FSP_AMENDMENT_NUMBER is incremented Proceed as above (AMENDMENT_AUTO_INCREMENT) except

SET FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoSUBMrdquo (for Submitted)

SET FSP_STATUS_HISTORYSTATUS_CODE = ldquoSUBMrdquo for new record

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 25

35 DOMAIN CODES

The following codes will be set up in the database in static code tables (all fields are VARCHAR2)

FSP_STATUS_CODE TABLE

FSP_STATUS_CODE DESCRIPTION SUBM Submitted DRFT Draft APPR Approved REJ Rejected OTBH Opportunity To Be Heard

FSP_REVIEW_MILESTONE_TYPE_CODE TABLE

FSP_REVIEW_MILESTONE_ TYPE_CODE

DESCRIPTION

FNR First Nations Review CampE Results amp Strategies reviewed by CampE TEN Objectives Results amp Strategies reviewed by

Tenures DDM Sent to DDM for Determination OTHR Other

FSP_ATTACHMENT_TYPE_CODE TABLE

FSP_ATTACHMENT_TYPE_CODE DESCRIPTION FSP FSP legal document MAP Map of FDUs SS Stocking Standards report AMDS Amendment Description DDMD DDM Decision Letter OTHR Other Attachment

FEATURE_CLASSES TABLE

FEATURE_CLASS_SKEY DESCRIPTION FEATURE_CLASS_KEY To be defined

36 REPORTING ERRORS

If an error is detected in a submission it must be reported back to the electronic submission framework The method for doing that is to post a message to a queue detailing the submission number and the error message The licensee will be able to check back to the Electronic Submission WebSite and view the error The Electronic Submission Framework will also send an email to the client detailing the message

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 26

The specification for how to report an error can be found in the ESF Queue Agent Best Practices Document The message content for FSP will be a concatenation of the ltFSP Submission IDgt ltDescriptiongt field and the message returned from the validation routines above To send a message about a submission you will need to supply the FSP submission ID for the submission The FSP submission ID is supplied with the message from ESF and stored in the FSP_ELECTRONIC_SUBMISSION table Refer to the Status Agent in the ESF Queue Agent Best Practices document for details on how to send a message to ESF The following code is provided as a sample only and the final syntax should be from the ESF Queue Agent Best Practices Document StatusAgent sa = new StatusAgent (ldquoFSP Business Agentrdquo) sasendStatus (ltForestStewardshipPlanSubmissionIDgt StatusMessageREJECTED ldquo100rdquo ltForestStewardshipPlangtlt083D02800509gt + ldquofailedrdquo + outMessage) saclose() Note Expectation is that outmessage will contain details as to what part of the FSP failed (eg Tenure Forest Development Unit or Stocking Standard) In the case of invalid data processing stops at this point for the FSP No data for this submission will be added to FSP database

361 ERROR MESSAGES

These error messages may be generated during the accumulation validation and processing phases They are referenced by number in the procedure documentation above

1 A legal FSP document must be attached to this submission Please attach a document containing your Forest Stewardship Plan

2 The attached file ltnamegt does not have a recognizable file extension Atachments must be one of MSWord (doc) Portable Document Format (pdf) MS Excel (xls) ZIP archive (zip) or JPEG graphic (jpg) Please resubmit with appropriate file attachments

3 You do not have the proper authority to submit an FSP via ESF Please contact the appropriate MoFR District office to obtain the necessary ldquoSubmitterrdquo authority role

4 The FSP submitted does not name any plan holders At least one holder of a major BC Forest license must be named in the plan

5 No forest license number was found for a named plan holder You must name all forest licenses which apply within the FSP

6 A plan holderrsquos license number could not be verified Please check the validity of the plan holder MoFR client codes

7 A forest license number listed is not owned by any of the plan holders of this FSP Please check the validity of the plan holder MoFR client codes and their licence numbers

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 27

8 At least one BC Forest District must be listed for this FSP Each District responsible for the area included in the FSP must be listed

9 The MoFR District Code is not recognized Please check the spelling of the District code(s) included or check with the appropriate District office for the proper code

10 More than one Forest Stewardship Plan (FSP) was included in this submission At the present time each ESF submission may contain only a single FSP

11 The submission must include the name of a contact person responsible for communicating with MoFR about this FSP submission

12 The submission must include the email address of a contact person responsible for communicating with MoFR about this FSP submission

13 The submission must include the telephone number of a contact person responsible for communicating with MoFR about this FSP submission

14 The submission must indicate whether or not this is an original FSP or an amendment to an existing FSP

15 The FSP must have a name 16 The FSP must include at least one Forest Development Unit (FDU) 17 The FSP must include at least one Stocking Standard 18 This submission refers to an FSP that does not exist in the Ministryrsquos

database Please check the FSP ID number provided after your original submission

19 An FSP with the same FSP ID number already exists in the Ministryrsquos database yet you have not indicated that this is an amendment If the intention is to amend an existing FSP please include the correct FSP ID and make sure the ltamendmentIndgt flag is set to ldquotruerdquo

20 The FSP you are trying to amend has been rejected You cannot amend or replace a rejected FSP You must make a brand new submission When doing so do not include an FSP ID number

21 The submission appears to be a new FSP yet the amendment indicator is set to true (ltamendmentIndgt = ldquotruerdquo) Either provide an FSP ID to amend an existing FSP or set the amendment indicator to ldquofalserdquo

22 The FSP plan term has been set to greater than 5 years FSPs are valid for a maximum of 5 years unless an extension is approved

23 The plan commencement date provided is not valid 24 A value for ltamendmentIndgt must be provided it must be set to either ldquotruerdquo or ldquofalserdquo

25 The submission appears to be for an FSP amendment (ltamendmentIndgt = ldquotruerdquo) however no FSP is referenced Please be sure to include the FSP ID number provided with the original submission

26 You cannot amend an FSP that is not approved Ensure you have provided the correct FSP ID number issued with the original submission and confirm that the FSP is approved

27 An FSP with the same FSP ID number already exists in the database Before you can update this FSP it must be placed in Draft status by the District Manager

28 The submission appears to be an amendment to an existing FSP However you have not stated whether or not this amendment requires Ministry approval Please ensure that the ltamendmentApprovalRequiredIndgt is set to one of ldquotruerdquo or ldquofalserdquo

29 A Forest development Unit (FDU) was submitted without a name A name must be provided for each FDU

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 28

30 The same name has been provided for more than one Forest Development Unit (FDU) Each FDU in a submission must have a unique name

31 A Forest Development Unit (FDU) was submitted that did not list a forest licence number that applies Each FDU must have at least one license number applied

32 A forest license number was supplied that does not appear to be owned by any of the plan holders for this FSP Each Forest Development Unit (FDU) must be listed with at least one forest license owned by one of the plan holders for this FSP

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting

Page 10: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 10

+getName() string(idl)+setName()+getFSP_ID() unsigned long(idl)+setAmendment()+getAmendment() short(idl)+getStatus() short(idl)+setStatus()+setPlanStartDate()+getPlanStartDate() long long(idl)+getPlanTerm() short(idl)+setPlanTerm()+getPlanContactPerson() PlanContactPerson+requiresApproval() boolean(idl)+setRequiresApprovalInd()

-planName string(idl)-FSP_ID unsigned long(idl)-amendmentNumber short(idl) = 0-dateSubmitted unsigned long(idl)-status-planStartDate unsigned long(idl)-planTerm short(idl) = 5-requiresApprovalInd boolean(idl)

ForestStewardShipPlan

-name string(idl)

ForestDevelopmentUnit

-bgcZone string(idl)-bgcSubzone string(idl)-bgcVariant string(idl)-bgcPhase string(idl)-bgcSiteSeries string(idl)-bgcSiteType string(idl)-gbcSeral string(idl)-maxAllowableDisturbance float(idl)-standardsRationale string(idl)-regenObligationInd boolean(idl)-regenOffseti short(idl)-earlyOffset short(idl)-lateOffset short(idl)

StockingStandard-clientCode string(idl)-licenceNumber string(idl)

PlanHolder

1

0

1

0

1

1

-licenceNumber string(idl)

ForestLicence

1

1

-

spatial

1

1

+getDistrictCode() string(idl)

-districtCode string(idl)

OrgUnit

1 1

+getName() string(idl)+setName()+getEmail() string(idl)+setEmail()+getPhone() unsigned long(idl)+setPhone()

-Name string(idl)-emailAddress string(idl)-telephone unsigned long(idl)

PlanContactPerson

11

Amended FSP might not include stocking standards

Amended FSP might not include FDUs

-stockingLayerCode string(idl)-wellSpaced unsigned long(idl)-minPrefWellSpaced unsigned long(idl)-residualBasalArea unsigned long(idl)-minHorizontalDistance unsigned long(idl)-minPostSpacing unsigned long(idl)-maxPostSpacing unsigned long(idl)-maxConifer unsigned long(idl)-heightRelativeToComp unsigned long(idl)-heightRelativeToCompCode string(idl)

StandardLayer

1

1

-speciesCode string(idl)-minHeight float(idl)-preferredSpeciesInd boolean(idl)

StandardLayerSpecies11

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 11

33 SUBMISSION PROCESSING

All the data for a Forest Stewardship Plan is required in order to validate it To address this all the data for an FSP is ldquoaccumulatedrdquo in temporary database tables Once the data is accumulated validation can occur Accumulation is done by calling functions in the FSP_XML_SUBMISSION package Validation functions are implemented in the FSP_VALIDATION package General Note 1 All procedures have at least one ldquoOUTrdquo parameter This is a string that will

contain any error messages that occur during the operation Other ldquoOUTrdquo parameters will be database identifying values for that object that are required for future processes (ie other agents) and so must be stored

2 For the initial FSP submission (amendment 0) the submitter must submit at least

one document as an attachment a a legal FSP document (MSWord or PDF) (Error 1) b The submitter may also include other supporting documentation as

attached files c The files must have approved extension (doc pdf xls zip jpg) (Error

2)

The pseudo code to validate a Forest Stewardship Plan is as follows

Begin Transaction

Call FSP_XML_SUBMISSIONUSER_SUBMISSION_DATA once

Call FSP_XML_SUBMISSIONVALID_FSP once

Call FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER for each ltplanHoldergt

For each OrgUnit element

Call FSP_XML_SUBMISSIONACCUMULATE_ORG_UNIT

For each PlanHolder element

Call FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER

For each ForestDevelopmentUnit Call FSP_XML_SUBMISSIONACCUMULATE_FDU

For each StockingStandard element

Call FSP_XML_SUBMISSIONACCUMULATE_STANDARD

For each StandardLayer element

Call FSP_XML_SUBMISSIONACCUMULATE_LAYER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 12

For each StandardLayerSpecies

Call FSP_XML_SUBMISSIONACCUMULATE_SPECIES

Call FSP_VALIDATE_XMLFSP_VALIDATION

If errors then

ROLLBACK the transaction

Note If system erros then return false to base agent so job is left on queue If validation errors then return true to remove job from queue and error messages are sent back to the client

Else

Call FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

COMMIT

34 DATA VALIDATION - DAO INTERFACE SPECIFICATIONS

This section details the interface between the Java business agent and the Oracle packages that implement amalgamation validation and processing It can be used in conjunction with the previous sections to define the detailed package interface

341 FSP_XML_SUBMISSIONUSER_SUBMISSION_DATA

Capture the submission metadata coming from ESF Confirm that the individual making the FSP submission has valid authority

to submit via ESF (Error 3)

PROCEDURE USER_SUBMISSION_DATA( P_FSP_SUBMISSION_ID IN NUMBER

P_SUBMITTED_BY IN VARCHAR2 P_CLIENT_NUMBER IN VARCHAR2 P_CLIENT_LOCN_CODE IN VARCHAR2 P_ORG_UNIT_NO IN NUMBER P_SUBMISSION_TIMESTAMP IN DATE P_USER_FILENAME IN VARCHAR2 P_USER_AUTHORITY IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_SUBMISSION_ID Comes from file message from ESF

P_SUBMITTED_BY Comes from file message from ESF

P_CLIENT_NUMBER Comes from file message from ESF

P_CLIENT_LOCN_CODE Comes from file message from ESF

P_ADMIN_DISTRICT_NO orgUnitNo from submission metadata ltdistrictCodegt value

P_SUBMISSION_TIMESTAMP Comes from file message from ESF

P_USER_FILENAME Comes from file message from ESF

P_USER_AUTHORITY Set to lsquoACrsquo

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 13

342 FSP_XML_SUBMISSIONACCUMULATE_FSP

Call once for the ltForestStewardshipPlangt entity Ensure only one such entity is included If no errors are returned then proceed If FSP already exists (this is an amendment) return the FSP_ID PROCEDURE VALID_FSP (P_FSP_ID IN OUT NUMBER

P_PLAN_NAME IN VARCHAR2 P_PLAN_TERM_YEARS IN NUMBER P_PLAN_TERM_COMMENCEMENT IN DATE P_ACTION_CODE IN VARCHAR2 P_SUBMITTER_NAME IN VARCHAR2 P_SUBMITTER_EMAIL IN VARCHAR2 P_SUBMITTER_TELEPHONE IN VARCHAR2 P_AMENDMENT_IND IN VARCHAR2 P_AMENDMENT_COMMENT IN VARCHAR2 P_AMENDMENT_APPROVAL_IND IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_OPENING_ID ltfspIDgt or from previous procedure call

P_PLAN_NAME ltplanNamegt

P_PLAN_TERM_YEARS ltplanTermYearsgt

P_PLAN_TERM_COMMENCEMENT ltplanTermCommencementgt

P_ACTION_CODE ltactionCodegt

P_SUBMITTER_NAME ltlicenseeContactgt

P_SUBMITTER_EMAIL ltemailAddressgt

P_SUBMITTER_TELEPHONE lttelphoneNumbergt

P_AMENDMENT_IND ltamendmentIndgt

P_AMENDMENT_COMMENT ltamendmentCommentgt

P_AMENDMENT_APPROVAL_IND ltadmendmentApprovalRequiredgt

343 FSP_XML_SUBMISSIONACCUMULATE_ORG_UNIT

Call once for each ltdistrictCodePropertygt in ltForestStewardshipPlangt PROCEDURE ACCUMULATE_PLAN_HOLDER(

P_FSP_ID IN NUMBER P_DISTRICT_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_DISTRICT_CODE ltdistrictCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 14

344 FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER

Call once for each ltPlanHoldergt in the FSP PROCEDURE ACCUMULATE_PLAN_HOLDER(

P_FSP_ID IN NUMBER P_CLIENT_NUMBER IN VARCHAR2 P_CLIENT_LICENSE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_CLIENT_NUMBER Comes from file message from ESF

P_CLIENT_LICENCE Comes from file message from ESF

345 FSP_XML_SUBMISSIONACCUMULATE_FDU

Call once for each ltFDUgt in the FSP PROCEDURE ACCUMULATE_FDU(

P_FSP_ID IN NUMBER P_FDU_NAME IN VARCHAR2 P_CLIENT_LICENCES IN VARRAY OF VARCHAR2 P_GEOMETRY IN MDSYSSDO_GEOMETRY P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_FDU_NAME ltfduNamegt

P_CLIENT_LICENCES ltFDUgtltlicenseNumbergt

P_GEOMETRY FDU ltextentOfgt as SDO_GEOMETRY

346 FSP_XML_SUBMISSIONACCUMULATE_STANDARD

Call once for each ltStockingStandardgt in the FSP

PROCEDURE ACCUMULATE_STANDARD( P_STANDARDS_REGIME_ID IN OUT NUMBER P_STANDARDS_REGIME_NAME IN VARCHAR2 P_STANDARDS_OBJECTIVE IN VARCHAR2 P_REGEN_DELAY_OFFSET_YRS IN NUMBER P_REGEN_OBLIGATION_IND IN VARCHAR2 P_EARLY_OFFSET_YRS IN NUMBER P_LATE_OFFSET_YRS IN NUMBER P_GEOGRAPHIC_DESCRIPTION IN VARCHAR2 P_ADDITIONAL_STANDARDS IN VARCHAR2

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 15

P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt

P_STANDARDS_REGIME_NAME ltstandardsRegimeNamegt

P_STANDARDS_OBJECTIVE ltstandardsObjectivegt

P_REGEN_DELAY_OFFSET_YRS ltregenOffsetgt from regenObjectivesProperty

P_REGEN_OBLIGATION_IND ltregenObligationIndgt from regenObjectivesProperty

P_EARLY_OFFSET_YRS ltearlyOffsetgt from regenObjectivesProperty

P_LATE_OFFSET_YRS ltlateOffsetgt from regenObjectivesProperty

P_GEOGRAPHIC_DESCRIPTION ltgeographicDescriptiongt

P_ADDITIONAL_STANDARDS ltadditionalStandardsgt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 16

347 RESULTS_XML_SUBMISSIONACCUMULATE_STANDARDS_LAYER

For each StandardLayer within a Standards Regime call

PROCEDURE ACCUMULATE_STANDARDS_LAYER (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_STOCKING_LAYER_ID OUT NUMBER P_TARGET_STOCKING IN NUMBER P_RESIDUAL_BASAL_AREA IN NUMBER P_MIN_HORIZONTAL_DISTANCE IN NUMBER P_MIN_PREF_STOCKING_STANDARD IN NUMBER P_MIN_POST_SPACING IN NUMBER P_MIN_STOCKING_STANDARD IN NUMBER P_MAX_POST_SPACING IN NUMBER P_MAX_CONIFER IN NUMBER P_HGHT_RELATIVE_TO_COMP IN NUMBER P_HGHT_RELATIVE_COMP_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID From ltstandardsRegimeIdgt or previous procedure

P_STOCKING_LAYER_CODE ltstockingLayerCodegt

P_STOCKING_LAYER_ID This value is returned

P_TARGET_STOCKING ltwellSpacedgt

P_RESIDUAL_BASAL_AREA ltresidualBasalAreagt

P_MIN_HORIZONTAL_DISTANCE ltminHorizontalDistancegt

P_PREF_STOCKING_STANDARD ltminPrefWellSpacedgt

P_MIN_POST_SPACING ltminPostSpacinggt

P_MIN_STOCKING_STANDARD ltminStockingStandardgt

P_MAX_POST_SPACING ltmaxPostSpacinggt

P_MAX_CONIFER ltmaxConifergt

P_HGHT_RELATIVE_COMP ltheightRelativeToCompgt

P_HGHT_RELATIVE_COMP_CODE ltheightRelativeToCompCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 17

348 RESULTS_XML_SUBMISSIONACCUMULATE_SPECIES

Call once for each StandardLayerSpecies within a StandardLayer

PROCEDURE ACCUMULATE_SPECIES (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_SPECIES_CODE IN VARCHAR2 P_STOCKING_LAYER_ID IN NUMBER P_PREFERRED_IND IN VARCHAR2 P_MIN_HEIGHT IN NUMBER P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt or previous procedure

P_STOCKING_LAYER_CODE STOCKING_LAYER_CODE from StandardLayer

P_SPECIES_CODE ltspeciesCodegt

P_STOCKING_LAYER_ID STOCKING_LAYER_ID from StandardLayer

P_STOCKING_STANDARD_UNIT_ID STOCKING_STANDARD_UNIT_ID from StandardLayer

P_PREFERRED_IND ltpreferredSpeciesIndgt

P_MIN_HEIGHT ltminHeightgt

P_SUBMITTED_BY Comes from file message from ESF

349 FSP_VALIDATE_XMLFSP_VALIDATION

Call after the the submission has been accumulated and no errors were returned FSP_VALIDATION is a procedure that calls a chain of other procedures that validate parts of the submission data The overall results are returned

FSP_VALIDATE_XMLVALIDATE_PLAN_HOLDER

BUSINESS RULES

At least one named licensee (forest client) forest licence pair in ltPlanHoldergt (Error 4 5 6)

That each named licensee actually exists and owns the licence listed

(Error 7)

FSP_VALIDATE_XMLVALIDATE_ORG_UNITS

BUSINESS RULES

At least one ltdistrictCodegt named (Error 8) Code resolves to a valid existing MoFR Forest District (Error 9)

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 18

FSP_VALIDATE_XMLVALIDATE_FSP

BUSINESS RULES

Ensure only a single ltForestStewardshipPlangt entity is included (Error 10)

Submission metadata ltlicenseeContactgt(Error 11)

ltemailAddressgt(Error 12) and lttelephoneNumbergt (Error 13) provided (no nulls)

Is this an original submission or an amendment (ltamendmentIndicatorgt)

(Error 14)

If original submission confirm o Plan name provided (Error 15) o Required document attached

FSP legal plan document (Error 1) o At least one ltForestDevelopmentUnitgt included (Error 16) o At least one ltStockingStandardgt included (Error 17)

ltfspIDgt (conditional) this is amendment or update

o If provided ensure a matching FSP_ID already exists in the database (Error 18)

o If existing FSP_ID status = ldquoApprovedrdquo this must be an amendment ensure that ltamendmentIndgt = ldquoTrdquo (Error 19)

o If existing FSP_ID status = ldquoRejectedrdquo this is a mistaken attempt to re-submit the same FSP (Error 20)

o If existing FSP_ID status = ldquoDraftrdquo this is an update anything submitted will overwrite existing FSP_ID record

ltplanNamegt (conditional)

o If provided and no ltfspIDgt provided this is a new submission Ensure that ltamendmentIndgt = lsquoFrsquo (Error 21)

ltplanTermgt (optional) if included is less than or equal to 5 (Error 22) ltplanStartDategt (optional) if included is valid date (Error 23) ltactionCodegt

o if ldquoNrdquo (New) Must be new FSP ensure no matching FSP_ID

FSP_AMENDMENT_NUMBER primary key already exists o if ldquoUrdquo (Update)

Must be existing FSP ensure a match to FSP_ID and FSP_AMENDMENT_NUMBER key exists

Existing FSP must be in ldquoDraftrdquo status o if ldquoArdquo (Append)

Must an existing FSP in ldquoDraftrdquo status Explicitly designed for appending GML map data to an

existing FSP

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 19

Must not already by any FOREST_DEVELOPMENT_UNIT entries for this FSP

ltamendmentIndgt (mandatory)

o Must be one of ldquoTrdquo or ldquoFrdquo (Error 24) o If ldquoTrdquo ensure ltfspIDgt provided and matches an existing FSP_ID in

the database (error 25) also ensure that the status of the existing FSP_ID = ldquoApprovedrdquo (error 26)

o If ldquoFrdquo and no ltfspIDgt provided this is a new submission o If ldquoFrdquo and ltfspIDgt provided must be an update ensure it

matches an existing FSP_ID with status = ldquoDraftrdquo (Error 27) ltamendmentApprovalRequiredIndgt (conditional)

o If ltamendmentIndgt is ldquotruerdquo must be included and set to one of ldquoTrdquo or ldquoFrdquo (Error 28)

FSP_VALIDATE_XMLVALIDATE_FDUS

BUSINESS RULES

Validate Geometry o polygon area gt 0 o polygon boundary length gt 0 o Other

Validate Identifier o ltfduNamegt must exist and not be null (Error 29) o ltfduNamegt must be unique within the FSP (no duplicates) (Error

30)

Validate Licences o Each FDU must have at least one forest licence applying (Error 31) o Each licence must be owned by one of the licensees listed for this

FSP ltplanHoldergtltlicenceNumbergt (Error 32)

FSP_VALIDATE_XMLVALIDATE_STANDARDS

BUSINESS RULES

Stocking Standards o For FSPs the stocking standard is nearly identical to the

ltStandardsAmendmentTypegt in the RESULTS schema with the following exceptions

The following elements from RESULTS ltStandardsTypegt have been added

ltbgcZonegt ltbgcSubzonegt ltbgcVariantgt ltbgcPhasegt ltbgcSiteSeriesgt ltbgcSiteTypegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 20

ltbgcSeralgt ltmaximumAllowableSoilDisturbancegt

o Therefore the equivalent Validation procedures from Results 30 can be used here with minor amendments

o FSP Stocking Standards do not have a spatial component and are not linked to any piece of ground

3410 FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

Call if no errors returned in any of the steps above PROCEDURE PROCESS_XML_SUBMISSION(

P_POST IN VARCHAR2 P_RESULTS OUT ref_results)

Procedure parameter Data Value P_POST Validate only indicator from fsp

submission metadata

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 21

The following diagram shows the decision points on how to process the submission depending on input parameters The pre-defined states refer procedures defined below

ltfspIDgt

Y

ltplanNamegt

N Error must havePlan name

N

fspID ==FSP_ID

Error UnknownFSP

N

FSP_IDSTATUS

Y

Error cannotUpdate or amend

RejectedSubmitted

ltamendmentIndgt

Approved

Error amendment requiredF

AmendApproval

Ind

T

AmendmentTo

Inbox

T

AmendmentAuto

Approve

UpdateExisting

PlanDraft

Create NewFSP

Y

End

End

End

FSP with same FSP_ID exists in database

FSP Submission

Validate

ESF FSPSubmissionAccumulate

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 22

3411 CREATE_NEW_FSP

This procedure will create a new ForestStewardshipPlan and all related entities in the production database

FOREST_STEWARDSHIP_PLAN TABLE

Source Destination FSP_SEQNEXTVAL FSP_ID 0 FSP_AMENDMENT_NUMBER STATUS for ldquoSubmittedrdquo FSP_STATUS_CODE ltplanNamegt PLAN_NAME ltplanTermYearsgt PLAN_TERM_YEARS ltplanTermCommencementgt PLAN_START_DATE ltplanTermCommencementgt + ltplanTermYearsgt

PLAN_END_DATE

ESF submission date PLAN_SUBMISSION_DATE ltlicenseeContactgt CONTACT_NAME lttelphoneNumbergt TELEPHONE_NUMBER ltemailAddressgt EMAIL_ADDRESS

FSP_AGREEMENT_HOLDER TABLE

Source Destination ltPlanHoldergtltclientCodegt CLIENT_NUMBER

FSP_ORG_UNIT TABLE

Source Destination ORG_UNITORG_UNIT_NO for ltdistrictCodegt

ORG_UNIT_NO

FSP_STATUS_HISTORY TABLE

Source Destination FSP_STATUS_HISTORY_SEQ FSP_STATUS_HISTORY_ID ldquoSubmittedrdquo code from FSP_STATUS_CODE

FSP_STATUS_CODE

ldquoNew Submissionrdquo STATUS_COMMENT

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 23

FSP_ATTACHMENT TABLE

Source Destination ESF framework ATTACHMENT_DESCRIPTION ATTACHMENT_NAME ATTACHMENT_SIZE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

3412 UPDATE_EXISTING_PLAN

For ESF submissions only the FDU map spatial component ltFDUPropertygt can be submitted as an update Part of the validation is to ensure that no other data is included with the ESF submission file except ltfspIDgt and ltFDUPropertygt This may be an INSERT or an UPDATE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination ltfspIDgt FSP_ID FOREST_STEWARDSHIP_PLAN FSP_AMENDMENT_NUMBER

FSP_AMENDMENT_NUMBER

FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 24

3413 AMENDMENT_AUTO_APPROVE

This is to create an amendment that does not require approval It is in effect a new FSP submission that automatically goes to ldquoApprovedrdquo status and increments the FSP_AMENDMENT_NUMBER Processing depends on what the licensee has submitted It may be one or more of

headeradministrative information (such as adding a new licensee) or amending a plan term

a new legal FSP document a new GML map of all the FDUs (spatial data if amended must be

completely replaced) new stocking standards

Process the data as if it were a new submission (see above) with the following exceptions

Do an INSERT INTO FOREST_STEWARDSHIP_PLAN setting FSP_AMENDMENT_NUMBER = MAX(FSP_AMENDMENT_NUMBER) + 1

Copy all fields from FOREST_STEWARDSHIP_PLAN from the most recent amendment (or the original submission record if no amendments)

UPDATE any fields in FOREST_STEWARSHIP_PLAN for this new entry that are provided in the XML submission that is any of ltplanNamegt ltplanTermYearsgt ltplanTermCommencementgt ltlicenseeContactgt lttelephoneNumbergt ltemailAddressgt

Any attachments must be INSERTed into FSP_ATTACHMENT with the new FSP_AMENDMENT_NUMBER (also FSP_ATTACHMENT_CONTENT)

Set FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoAPPRrdquo for this new record

INSERT INTO FSP_STATUS_HISTORY (FSP_STATUS_HISTORY_ID FSP_ID FSP_AMENDMENT_NUMBER FSP_STATUS_CODE STATUS_COMMENT) VALUES (SEQNEXTVAL ltFSP_IDgt ltnew FSP_AMENDMENT_NUMBERgt ldquoAPPRrdquo ltamendmentCommentgt) Be sure to use the new FSP_AMENDMENT_NUMBER in INSERTing any STANDARDS_REGIME or FOREST_DEVELOPMENT_UNIT records

3414 AMENDMENT_TO_INBOX

This is to create an amendment that requires approval The FSP submission is put in ldquoSubmittedrdquo status so that it will show up in the relevant District Inboxes The FSP_AMENDMENT_NUMBER is incremented Proceed as above (AMENDMENT_AUTO_INCREMENT) except

SET FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoSUBMrdquo (for Submitted)

SET FSP_STATUS_HISTORYSTATUS_CODE = ldquoSUBMrdquo for new record

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 25

35 DOMAIN CODES

The following codes will be set up in the database in static code tables (all fields are VARCHAR2)

FSP_STATUS_CODE TABLE

FSP_STATUS_CODE DESCRIPTION SUBM Submitted DRFT Draft APPR Approved REJ Rejected OTBH Opportunity To Be Heard

FSP_REVIEW_MILESTONE_TYPE_CODE TABLE

FSP_REVIEW_MILESTONE_ TYPE_CODE

DESCRIPTION

FNR First Nations Review CampE Results amp Strategies reviewed by CampE TEN Objectives Results amp Strategies reviewed by

Tenures DDM Sent to DDM for Determination OTHR Other

FSP_ATTACHMENT_TYPE_CODE TABLE

FSP_ATTACHMENT_TYPE_CODE DESCRIPTION FSP FSP legal document MAP Map of FDUs SS Stocking Standards report AMDS Amendment Description DDMD DDM Decision Letter OTHR Other Attachment

FEATURE_CLASSES TABLE

FEATURE_CLASS_SKEY DESCRIPTION FEATURE_CLASS_KEY To be defined

36 REPORTING ERRORS

If an error is detected in a submission it must be reported back to the electronic submission framework The method for doing that is to post a message to a queue detailing the submission number and the error message The licensee will be able to check back to the Electronic Submission WebSite and view the error The Electronic Submission Framework will also send an email to the client detailing the message

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 26

The specification for how to report an error can be found in the ESF Queue Agent Best Practices Document The message content for FSP will be a concatenation of the ltFSP Submission IDgt ltDescriptiongt field and the message returned from the validation routines above To send a message about a submission you will need to supply the FSP submission ID for the submission The FSP submission ID is supplied with the message from ESF and stored in the FSP_ELECTRONIC_SUBMISSION table Refer to the Status Agent in the ESF Queue Agent Best Practices document for details on how to send a message to ESF The following code is provided as a sample only and the final syntax should be from the ESF Queue Agent Best Practices Document StatusAgent sa = new StatusAgent (ldquoFSP Business Agentrdquo) sasendStatus (ltForestStewardshipPlanSubmissionIDgt StatusMessageREJECTED ldquo100rdquo ltForestStewardshipPlangtlt083D02800509gt + ldquofailedrdquo + outMessage) saclose() Note Expectation is that outmessage will contain details as to what part of the FSP failed (eg Tenure Forest Development Unit or Stocking Standard) In the case of invalid data processing stops at this point for the FSP No data for this submission will be added to FSP database

361 ERROR MESSAGES

These error messages may be generated during the accumulation validation and processing phases They are referenced by number in the procedure documentation above

1 A legal FSP document must be attached to this submission Please attach a document containing your Forest Stewardship Plan

2 The attached file ltnamegt does not have a recognizable file extension Atachments must be one of MSWord (doc) Portable Document Format (pdf) MS Excel (xls) ZIP archive (zip) or JPEG graphic (jpg) Please resubmit with appropriate file attachments

3 You do not have the proper authority to submit an FSP via ESF Please contact the appropriate MoFR District office to obtain the necessary ldquoSubmitterrdquo authority role

4 The FSP submitted does not name any plan holders At least one holder of a major BC Forest license must be named in the plan

5 No forest license number was found for a named plan holder You must name all forest licenses which apply within the FSP

6 A plan holderrsquos license number could not be verified Please check the validity of the plan holder MoFR client codes

7 A forest license number listed is not owned by any of the plan holders of this FSP Please check the validity of the plan holder MoFR client codes and their licence numbers

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 27

8 At least one BC Forest District must be listed for this FSP Each District responsible for the area included in the FSP must be listed

9 The MoFR District Code is not recognized Please check the spelling of the District code(s) included or check with the appropriate District office for the proper code

10 More than one Forest Stewardship Plan (FSP) was included in this submission At the present time each ESF submission may contain only a single FSP

11 The submission must include the name of a contact person responsible for communicating with MoFR about this FSP submission

12 The submission must include the email address of a contact person responsible for communicating with MoFR about this FSP submission

13 The submission must include the telephone number of a contact person responsible for communicating with MoFR about this FSP submission

14 The submission must indicate whether or not this is an original FSP or an amendment to an existing FSP

15 The FSP must have a name 16 The FSP must include at least one Forest Development Unit (FDU) 17 The FSP must include at least one Stocking Standard 18 This submission refers to an FSP that does not exist in the Ministryrsquos

database Please check the FSP ID number provided after your original submission

19 An FSP with the same FSP ID number already exists in the Ministryrsquos database yet you have not indicated that this is an amendment If the intention is to amend an existing FSP please include the correct FSP ID and make sure the ltamendmentIndgt flag is set to ldquotruerdquo

20 The FSP you are trying to amend has been rejected You cannot amend or replace a rejected FSP You must make a brand new submission When doing so do not include an FSP ID number

21 The submission appears to be a new FSP yet the amendment indicator is set to true (ltamendmentIndgt = ldquotruerdquo) Either provide an FSP ID to amend an existing FSP or set the amendment indicator to ldquofalserdquo

22 The FSP plan term has been set to greater than 5 years FSPs are valid for a maximum of 5 years unless an extension is approved

23 The plan commencement date provided is not valid 24 A value for ltamendmentIndgt must be provided it must be set to either ldquotruerdquo or ldquofalserdquo

25 The submission appears to be for an FSP amendment (ltamendmentIndgt = ldquotruerdquo) however no FSP is referenced Please be sure to include the FSP ID number provided with the original submission

26 You cannot amend an FSP that is not approved Ensure you have provided the correct FSP ID number issued with the original submission and confirm that the FSP is approved

27 An FSP with the same FSP ID number already exists in the database Before you can update this FSP it must be placed in Draft status by the District Manager

28 The submission appears to be an amendment to an existing FSP However you have not stated whether or not this amendment requires Ministry approval Please ensure that the ltamendmentApprovalRequiredIndgt is set to one of ldquotruerdquo or ldquofalserdquo

29 A Forest development Unit (FDU) was submitted without a name A name must be provided for each FDU

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 28

30 The same name has been provided for more than one Forest Development Unit (FDU) Each FDU in a submission must have a unique name

31 A Forest Development Unit (FDU) was submitted that did not list a forest licence number that applies Each FDU must have at least one license number applied

32 A forest license number was supplied that does not appear to be owned by any of the plan holders for this FSP Each Forest Development Unit (FDU) must be listed with at least one forest license owned by one of the plan holders for this FSP

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting

Page 11: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 11

33 SUBMISSION PROCESSING

All the data for a Forest Stewardship Plan is required in order to validate it To address this all the data for an FSP is ldquoaccumulatedrdquo in temporary database tables Once the data is accumulated validation can occur Accumulation is done by calling functions in the FSP_XML_SUBMISSION package Validation functions are implemented in the FSP_VALIDATION package General Note 1 All procedures have at least one ldquoOUTrdquo parameter This is a string that will

contain any error messages that occur during the operation Other ldquoOUTrdquo parameters will be database identifying values for that object that are required for future processes (ie other agents) and so must be stored

2 For the initial FSP submission (amendment 0) the submitter must submit at least

one document as an attachment a a legal FSP document (MSWord or PDF) (Error 1) b The submitter may also include other supporting documentation as

attached files c The files must have approved extension (doc pdf xls zip jpg) (Error

2)

The pseudo code to validate a Forest Stewardship Plan is as follows

Begin Transaction

Call FSP_XML_SUBMISSIONUSER_SUBMISSION_DATA once

Call FSP_XML_SUBMISSIONVALID_FSP once

Call FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER for each ltplanHoldergt

For each OrgUnit element

Call FSP_XML_SUBMISSIONACCUMULATE_ORG_UNIT

For each PlanHolder element

Call FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER

For each ForestDevelopmentUnit Call FSP_XML_SUBMISSIONACCUMULATE_FDU

For each StockingStandard element

Call FSP_XML_SUBMISSIONACCUMULATE_STANDARD

For each StandardLayer element

Call FSP_XML_SUBMISSIONACCUMULATE_LAYER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 12

For each StandardLayerSpecies

Call FSP_XML_SUBMISSIONACCUMULATE_SPECIES

Call FSP_VALIDATE_XMLFSP_VALIDATION

If errors then

ROLLBACK the transaction

Note If system erros then return false to base agent so job is left on queue If validation errors then return true to remove job from queue and error messages are sent back to the client

Else

Call FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

COMMIT

34 DATA VALIDATION - DAO INTERFACE SPECIFICATIONS

This section details the interface between the Java business agent and the Oracle packages that implement amalgamation validation and processing It can be used in conjunction with the previous sections to define the detailed package interface

341 FSP_XML_SUBMISSIONUSER_SUBMISSION_DATA

Capture the submission metadata coming from ESF Confirm that the individual making the FSP submission has valid authority

to submit via ESF (Error 3)

PROCEDURE USER_SUBMISSION_DATA( P_FSP_SUBMISSION_ID IN NUMBER

P_SUBMITTED_BY IN VARCHAR2 P_CLIENT_NUMBER IN VARCHAR2 P_CLIENT_LOCN_CODE IN VARCHAR2 P_ORG_UNIT_NO IN NUMBER P_SUBMISSION_TIMESTAMP IN DATE P_USER_FILENAME IN VARCHAR2 P_USER_AUTHORITY IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_SUBMISSION_ID Comes from file message from ESF

P_SUBMITTED_BY Comes from file message from ESF

P_CLIENT_NUMBER Comes from file message from ESF

P_CLIENT_LOCN_CODE Comes from file message from ESF

P_ADMIN_DISTRICT_NO orgUnitNo from submission metadata ltdistrictCodegt value

P_SUBMISSION_TIMESTAMP Comes from file message from ESF

P_USER_FILENAME Comes from file message from ESF

P_USER_AUTHORITY Set to lsquoACrsquo

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 13

342 FSP_XML_SUBMISSIONACCUMULATE_FSP

Call once for the ltForestStewardshipPlangt entity Ensure only one such entity is included If no errors are returned then proceed If FSP already exists (this is an amendment) return the FSP_ID PROCEDURE VALID_FSP (P_FSP_ID IN OUT NUMBER

P_PLAN_NAME IN VARCHAR2 P_PLAN_TERM_YEARS IN NUMBER P_PLAN_TERM_COMMENCEMENT IN DATE P_ACTION_CODE IN VARCHAR2 P_SUBMITTER_NAME IN VARCHAR2 P_SUBMITTER_EMAIL IN VARCHAR2 P_SUBMITTER_TELEPHONE IN VARCHAR2 P_AMENDMENT_IND IN VARCHAR2 P_AMENDMENT_COMMENT IN VARCHAR2 P_AMENDMENT_APPROVAL_IND IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_OPENING_ID ltfspIDgt or from previous procedure call

P_PLAN_NAME ltplanNamegt

P_PLAN_TERM_YEARS ltplanTermYearsgt

P_PLAN_TERM_COMMENCEMENT ltplanTermCommencementgt

P_ACTION_CODE ltactionCodegt

P_SUBMITTER_NAME ltlicenseeContactgt

P_SUBMITTER_EMAIL ltemailAddressgt

P_SUBMITTER_TELEPHONE lttelphoneNumbergt

P_AMENDMENT_IND ltamendmentIndgt

P_AMENDMENT_COMMENT ltamendmentCommentgt

P_AMENDMENT_APPROVAL_IND ltadmendmentApprovalRequiredgt

343 FSP_XML_SUBMISSIONACCUMULATE_ORG_UNIT

Call once for each ltdistrictCodePropertygt in ltForestStewardshipPlangt PROCEDURE ACCUMULATE_PLAN_HOLDER(

P_FSP_ID IN NUMBER P_DISTRICT_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_DISTRICT_CODE ltdistrictCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 14

344 FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER

Call once for each ltPlanHoldergt in the FSP PROCEDURE ACCUMULATE_PLAN_HOLDER(

P_FSP_ID IN NUMBER P_CLIENT_NUMBER IN VARCHAR2 P_CLIENT_LICENSE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_CLIENT_NUMBER Comes from file message from ESF

P_CLIENT_LICENCE Comes from file message from ESF

345 FSP_XML_SUBMISSIONACCUMULATE_FDU

Call once for each ltFDUgt in the FSP PROCEDURE ACCUMULATE_FDU(

P_FSP_ID IN NUMBER P_FDU_NAME IN VARCHAR2 P_CLIENT_LICENCES IN VARRAY OF VARCHAR2 P_GEOMETRY IN MDSYSSDO_GEOMETRY P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_FDU_NAME ltfduNamegt

P_CLIENT_LICENCES ltFDUgtltlicenseNumbergt

P_GEOMETRY FDU ltextentOfgt as SDO_GEOMETRY

346 FSP_XML_SUBMISSIONACCUMULATE_STANDARD

Call once for each ltStockingStandardgt in the FSP

PROCEDURE ACCUMULATE_STANDARD( P_STANDARDS_REGIME_ID IN OUT NUMBER P_STANDARDS_REGIME_NAME IN VARCHAR2 P_STANDARDS_OBJECTIVE IN VARCHAR2 P_REGEN_DELAY_OFFSET_YRS IN NUMBER P_REGEN_OBLIGATION_IND IN VARCHAR2 P_EARLY_OFFSET_YRS IN NUMBER P_LATE_OFFSET_YRS IN NUMBER P_GEOGRAPHIC_DESCRIPTION IN VARCHAR2 P_ADDITIONAL_STANDARDS IN VARCHAR2

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 15

P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt

P_STANDARDS_REGIME_NAME ltstandardsRegimeNamegt

P_STANDARDS_OBJECTIVE ltstandardsObjectivegt

P_REGEN_DELAY_OFFSET_YRS ltregenOffsetgt from regenObjectivesProperty

P_REGEN_OBLIGATION_IND ltregenObligationIndgt from regenObjectivesProperty

P_EARLY_OFFSET_YRS ltearlyOffsetgt from regenObjectivesProperty

P_LATE_OFFSET_YRS ltlateOffsetgt from regenObjectivesProperty

P_GEOGRAPHIC_DESCRIPTION ltgeographicDescriptiongt

P_ADDITIONAL_STANDARDS ltadditionalStandardsgt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 16

347 RESULTS_XML_SUBMISSIONACCUMULATE_STANDARDS_LAYER

For each StandardLayer within a Standards Regime call

PROCEDURE ACCUMULATE_STANDARDS_LAYER (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_STOCKING_LAYER_ID OUT NUMBER P_TARGET_STOCKING IN NUMBER P_RESIDUAL_BASAL_AREA IN NUMBER P_MIN_HORIZONTAL_DISTANCE IN NUMBER P_MIN_PREF_STOCKING_STANDARD IN NUMBER P_MIN_POST_SPACING IN NUMBER P_MIN_STOCKING_STANDARD IN NUMBER P_MAX_POST_SPACING IN NUMBER P_MAX_CONIFER IN NUMBER P_HGHT_RELATIVE_TO_COMP IN NUMBER P_HGHT_RELATIVE_COMP_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID From ltstandardsRegimeIdgt or previous procedure

P_STOCKING_LAYER_CODE ltstockingLayerCodegt

P_STOCKING_LAYER_ID This value is returned

P_TARGET_STOCKING ltwellSpacedgt

P_RESIDUAL_BASAL_AREA ltresidualBasalAreagt

P_MIN_HORIZONTAL_DISTANCE ltminHorizontalDistancegt

P_PREF_STOCKING_STANDARD ltminPrefWellSpacedgt

P_MIN_POST_SPACING ltminPostSpacinggt

P_MIN_STOCKING_STANDARD ltminStockingStandardgt

P_MAX_POST_SPACING ltmaxPostSpacinggt

P_MAX_CONIFER ltmaxConifergt

P_HGHT_RELATIVE_COMP ltheightRelativeToCompgt

P_HGHT_RELATIVE_COMP_CODE ltheightRelativeToCompCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 17

348 RESULTS_XML_SUBMISSIONACCUMULATE_SPECIES

Call once for each StandardLayerSpecies within a StandardLayer

PROCEDURE ACCUMULATE_SPECIES (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_SPECIES_CODE IN VARCHAR2 P_STOCKING_LAYER_ID IN NUMBER P_PREFERRED_IND IN VARCHAR2 P_MIN_HEIGHT IN NUMBER P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt or previous procedure

P_STOCKING_LAYER_CODE STOCKING_LAYER_CODE from StandardLayer

P_SPECIES_CODE ltspeciesCodegt

P_STOCKING_LAYER_ID STOCKING_LAYER_ID from StandardLayer

P_STOCKING_STANDARD_UNIT_ID STOCKING_STANDARD_UNIT_ID from StandardLayer

P_PREFERRED_IND ltpreferredSpeciesIndgt

P_MIN_HEIGHT ltminHeightgt

P_SUBMITTED_BY Comes from file message from ESF

349 FSP_VALIDATE_XMLFSP_VALIDATION

Call after the the submission has been accumulated and no errors were returned FSP_VALIDATION is a procedure that calls a chain of other procedures that validate parts of the submission data The overall results are returned

FSP_VALIDATE_XMLVALIDATE_PLAN_HOLDER

BUSINESS RULES

At least one named licensee (forest client) forest licence pair in ltPlanHoldergt (Error 4 5 6)

That each named licensee actually exists and owns the licence listed

(Error 7)

FSP_VALIDATE_XMLVALIDATE_ORG_UNITS

BUSINESS RULES

At least one ltdistrictCodegt named (Error 8) Code resolves to a valid existing MoFR Forest District (Error 9)

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 18

FSP_VALIDATE_XMLVALIDATE_FSP

BUSINESS RULES

Ensure only a single ltForestStewardshipPlangt entity is included (Error 10)

Submission metadata ltlicenseeContactgt(Error 11)

ltemailAddressgt(Error 12) and lttelephoneNumbergt (Error 13) provided (no nulls)

Is this an original submission or an amendment (ltamendmentIndicatorgt)

(Error 14)

If original submission confirm o Plan name provided (Error 15) o Required document attached

FSP legal plan document (Error 1) o At least one ltForestDevelopmentUnitgt included (Error 16) o At least one ltStockingStandardgt included (Error 17)

ltfspIDgt (conditional) this is amendment or update

o If provided ensure a matching FSP_ID already exists in the database (Error 18)

o If existing FSP_ID status = ldquoApprovedrdquo this must be an amendment ensure that ltamendmentIndgt = ldquoTrdquo (Error 19)

o If existing FSP_ID status = ldquoRejectedrdquo this is a mistaken attempt to re-submit the same FSP (Error 20)

o If existing FSP_ID status = ldquoDraftrdquo this is an update anything submitted will overwrite existing FSP_ID record

ltplanNamegt (conditional)

o If provided and no ltfspIDgt provided this is a new submission Ensure that ltamendmentIndgt = lsquoFrsquo (Error 21)

ltplanTermgt (optional) if included is less than or equal to 5 (Error 22) ltplanStartDategt (optional) if included is valid date (Error 23) ltactionCodegt

o if ldquoNrdquo (New) Must be new FSP ensure no matching FSP_ID

FSP_AMENDMENT_NUMBER primary key already exists o if ldquoUrdquo (Update)

Must be existing FSP ensure a match to FSP_ID and FSP_AMENDMENT_NUMBER key exists

Existing FSP must be in ldquoDraftrdquo status o if ldquoArdquo (Append)

Must an existing FSP in ldquoDraftrdquo status Explicitly designed for appending GML map data to an

existing FSP

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 19

Must not already by any FOREST_DEVELOPMENT_UNIT entries for this FSP

ltamendmentIndgt (mandatory)

o Must be one of ldquoTrdquo or ldquoFrdquo (Error 24) o If ldquoTrdquo ensure ltfspIDgt provided and matches an existing FSP_ID in

the database (error 25) also ensure that the status of the existing FSP_ID = ldquoApprovedrdquo (error 26)

o If ldquoFrdquo and no ltfspIDgt provided this is a new submission o If ldquoFrdquo and ltfspIDgt provided must be an update ensure it

matches an existing FSP_ID with status = ldquoDraftrdquo (Error 27) ltamendmentApprovalRequiredIndgt (conditional)

o If ltamendmentIndgt is ldquotruerdquo must be included and set to one of ldquoTrdquo or ldquoFrdquo (Error 28)

FSP_VALIDATE_XMLVALIDATE_FDUS

BUSINESS RULES

Validate Geometry o polygon area gt 0 o polygon boundary length gt 0 o Other

Validate Identifier o ltfduNamegt must exist and not be null (Error 29) o ltfduNamegt must be unique within the FSP (no duplicates) (Error

30)

Validate Licences o Each FDU must have at least one forest licence applying (Error 31) o Each licence must be owned by one of the licensees listed for this

FSP ltplanHoldergtltlicenceNumbergt (Error 32)

FSP_VALIDATE_XMLVALIDATE_STANDARDS

BUSINESS RULES

Stocking Standards o For FSPs the stocking standard is nearly identical to the

ltStandardsAmendmentTypegt in the RESULTS schema with the following exceptions

The following elements from RESULTS ltStandardsTypegt have been added

ltbgcZonegt ltbgcSubzonegt ltbgcVariantgt ltbgcPhasegt ltbgcSiteSeriesgt ltbgcSiteTypegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 20

ltbgcSeralgt ltmaximumAllowableSoilDisturbancegt

o Therefore the equivalent Validation procedures from Results 30 can be used here with minor amendments

o FSP Stocking Standards do not have a spatial component and are not linked to any piece of ground

3410 FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

Call if no errors returned in any of the steps above PROCEDURE PROCESS_XML_SUBMISSION(

P_POST IN VARCHAR2 P_RESULTS OUT ref_results)

Procedure parameter Data Value P_POST Validate only indicator from fsp

submission metadata

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 21

The following diagram shows the decision points on how to process the submission depending on input parameters The pre-defined states refer procedures defined below

ltfspIDgt

Y

ltplanNamegt

N Error must havePlan name

N

fspID ==FSP_ID

Error UnknownFSP

N

FSP_IDSTATUS

Y

Error cannotUpdate or amend

RejectedSubmitted

ltamendmentIndgt

Approved

Error amendment requiredF

AmendApproval

Ind

T

AmendmentTo

Inbox

T

AmendmentAuto

Approve

UpdateExisting

PlanDraft

Create NewFSP

Y

End

End

End

FSP with same FSP_ID exists in database

FSP Submission

Validate

ESF FSPSubmissionAccumulate

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 22

3411 CREATE_NEW_FSP

This procedure will create a new ForestStewardshipPlan and all related entities in the production database

FOREST_STEWARDSHIP_PLAN TABLE

Source Destination FSP_SEQNEXTVAL FSP_ID 0 FSP_AMENDMENT_NUMBER STATUS for ldquoSubmittedrdquo FSP_STATUS_CODE ltplanNamegt PLAN_NAME ltplanTermYearsgt PLAN_TERM_YEARS ltplanTermCommencementgt PLAN_START_DATE ltplanTermCommencementgt + ltplanTermYearsgt

PLAN_END_DATE

ESF submission date PLAN_SUBMISSION_DATE ltlicenseeContactgt CONTACT_NAME lttelphoneNumbergt TELEPHONE_NUMBER ltemailAddressgt EMAIL_ADDRESS

FSP_AGREEMENT_HOLDER TABLE

Source Destination ltPlanHoldergtltclientCodegt CLIENT_NUMBER

FSP_ORG_UNIT TABLE

Source Destination ORG_UNITORG_UNIT_NO for ltdistrictCodegt

ORG_UNIT_NO

FSP_STATUS_HISTORY TABLE

Source Destination FSP_STATUS_HISTORY_SEQ FSP_STATUS_HISTORY_ID ldquoSubmittedrdquo code from FSP_STATUS_CODE

FSP_STATUS_CODE

ldquoNew Submissionrdquo STATUS_COMMENT

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 23

FSP_ATTACHMENT TABLE

Source Destination ESF framework ATTACHMENT_DESCRIPTION ATTACHMENT_NAME ATTACHMENT_SIZE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

3412 UPDATE_EXISTING_PLAN

For ESF submissions only the FDU map spatial component ltFDUPropertygt can be submitted as an update Part of the validation is to ensure that no other data is included with the ESF submission file except ltfspIDgt and ltFDUPropertygt This may be an INSERT or an UPDATE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination ltfspIDgt FSP_ID FOREST_STEWARDSHIP_PLAN FSP_AMENDMENT_NUMBER

FSP_AMENDMENT_NUMBER

FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 24

3413 AMENDMENT_AUTO_APPROVE

This is to create an amendment that does not require approval It is in effect a new FSP submission that automatically goes to ldquoApprovedrdquo status and increments the FSP_AMENDMENT_NUMBER Processing depends on what the licensee has submitted It may be one or more of

headeradministrative information (such as adding a new licensee) or amending a plan term

a new legal FSP document a new GML map of all the FDUs (spatial data if amended must be

completely replaced) new stocking standards

Process the data as if it were a new submission (see above) with the following exceptions

Do an INSERT INTO FOREST_STEWARDSHIP_PLAN setting FSP_AMENDMENT_NUMBER = MAX(FSP_AMENDMENT_NUMBER) + 1

Copy all fields from FOREST_STEWARDSHIP_PLAN from the most recent amendment (or the original submission record if no amendments)

UPDATE any fields in FOREST_STEWARSHIP_PLAN for this new entry that are provided in the XML submission that is any of ltplanNamegt ltplanTermYearsgt ltplanTermCommencementgt ltlicenseeContactgt lttelephoneNumbergt ltemailAddressgt

Any attachments must be INSERTed into FSP_ATTACHMENT with the new FSP_AMENDMENT_NUMBER (also FSP_ATTACHMENT_CONTENT)

Set FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoAPPRrdquo for this new record

INSERT INTO FSP_STATUS_HISTORY (FSP_STATUS_HISTORY_ID FSP_ID FSP_AMENDMENT_NUMBER FSP_STATUS_CODE STATUS_COMMENT) VALUES (SEQNEXTVAL ltFSP_IDgt ltnew FSP_AMENDMENT_NUMBERgt ldquoAPPRrdquo ltamendmentCommentgt) Be sure to use the new FSP_AMENDMENT_NUMBER in INSERTing any STANDARDS_REGIME or FOREST_DEVELOPMENT_UNIT records

3414 AMENDMENT_TO_INBOX

This is to create an amendment that requires approval The FSP submission is put in ldquoSubmittedrdquo status so that it will show up in the relevant District Inboxes The FSP_AMENDMENT_NUMBER is incremented Proceed as above (AMENDMENT_AUTO_INCREMENT) except

SET FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoSUBMrdquo (for Submitted)

SET FSP_STATUS_HISTORYSTATUS_CODE = ldquoSUBMrdquo for new record

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 25

35 DOMAIN CODES

The following codes will be set up in the database in static code tables (all fields are VARCHAR2)

FSP_STATUS_CODE TABLE

FSP_STATUS_CODE DESCRIPTION SUBM Submitted DRFT Draft APPR Approved REJ Rejected OTBH Opportunity To Be Heard

FSP_REVIEW_MILESTONE_TYPE_CODE TABLE

FSP_REVIEW_MILESTONE_ TYPE_CODE

DESCRIPTION

FNR First Nations Review CampE Results amp Strategies reviewed by CampE TEN Objectives Results amp Strategies reviewed by

Tenures DDM Sent to DDM for Determination OTHR Other

FSP_ATTACHMENT_TYPE_CODE TABLE

FSP_ATTACHMENT_TYPE_CODE DESCRIPTION FSP FSP legal document MAP Map of FDUs SS Stocking Standards report AMDS Amendment Description DDMD DDM Decision Letter OTHR Other Attachment

FEATURE_CLASSES TABLE

FEATURE_CLASS_SKEY DESCRIPTION FEATURE_CLASS_KEY To be defined

36 REPORTING ERRORS

If an error is detected in a submission it must be reported back to the electronic submission framework The method for doing that is to post a message to a queue detailing the submission number and the error message The licensee will be able to check back to the Electronic Submission WebSite and view the error The Electronic Submission Framework will also send an email to the client detailing the message

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 26

The specification for how to report an error can be found in the ESF Queue Agent Best Practices Document The message content for FSP will be a concatenation of the ltFSP Submission IDgt ltDescriptiongt field and the message returned from the validation routines above To send a message about a submission you will need to supply the FSP submission ID for the submission The FSP submission ID is supplied with the message from ESF and stored in the FSP_ELECTRONIC_SUBMISSION table Refer to the Status Agent in the ESF Queue Agent Best Practices document for details on how to send a message to ESF The following code is provided as a sample only and the final syntax should be from the ESF Queue Agent Best Practices Document StatusAgent sa = new StatusAgent (ldquoFSP Business Agentrdquo) sasendStatus (ltForestStewardshipPlanSubmissionIDgt StatusMessageREJECTED ldquo100rdquo ltForestStewardshipPlangtlt083D02800509gt + ldquofailedrdquo + outMessage) saclose() Note Expectation is that outmessage will contain details as to what part of the FSP failed (eg Tenure Forest Development Unit or Stocking Standard) In the case of invalid data processing stops at this point for the FSP No data for this submission will be added to FSP database

361 ERROR MESSAGES

These error messages may be generated during the accumulation validation and processing phases They are referenced by number in the procedure documentation above

1 A legal FSP document must be attached to this submission Please attach a document containing your Forest Stewardship Plan

2 The attached file ltnamegt does not have a recognizable file extension Atachments must be one of MSWord (doc) Portable Document Format (pdf) MS Excel (xls) ZIP archive (zip) or JPEG graphic (jpg) Please resubmit with appropriate file attachments

3 You do not have the proper authority to submit an FSP via ESF Please contact the appropriate MoFR District office to obtain the necessary ldquoSubmitterrdquo authority role

4 The FSP submitted does not name any plan holders At least one holder of a major BC Forest license must be named in the plan

5 No forest license number was found for a named plan holder You must name all forest licenses which apply within the FSP

6 A plan holderrsquos license number could not be verified Please check the validity of the plan holder MoFR client codes

7 A forest license number listed is not owned by any of the plan holders of this FSP Please check the validity of the plan holder MoFR client codes and their licence numbers

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 27

8 At least one BC Forest District must be listed for this FSP Each District responsible for the area included in the FSP must be listed

9 The MoFR District Code is not recognized Please check the spelling of the District code(s) included or check with the appropriate District office for the proper code

10 More than one Forest Stewardship Plan (FSP) was included in this submission At the present time each ESF submission may contain only a single FSP

11 The submission must include the name of a contact person responsible for communicating with MoFR about this FSP submission

12 The submission must include the email address of a contact person responsible for communicating with MoFR about this FSP submission

13 The submission must include the telephone number of a contact person responsible for communicating with MoFR about this FSP submission

14 The submission must indicate whether or not this is an original FSP or an amendment to an existing FSP

15 The FSP must have a name 16 The FSP must include at least one Forest Development Unit (FDU) 17 The FSP must include at least one Stocking Standard 18 This submission refers to an FSP that does not exist in the Ministryrsquos

database Please check the FSP ID number provided after your original submission

19 An FSP with the same FSP ID number already exists in the Ministryrsquos database yet you have not indicated that this is an amendment If the intention is to amend an existing FSP please include the correct FSP ID and make sure the ltamendmentIndgt flag is set to ldquotruerdquo

20 The FSP you are trying to amend has been rejected You cannot amend or replace a rejected FSP You must make a brand new submission When doing so do not include an FSP ID number

21 The submission appears to be a new FSP yet the amendment indicator is set to true (ltamendmentIndgt = ldquotruerdquo) Either provide an FSP ID to amend an existing FSP or set the amendment indicator to ldquofalserdquo

22 The FSP plan term has been set to greater than 5 years FSPs are valid for a maximum of 5 years unless an extension is approved

23 The plan commencement date provided is not valid 24 A value for ltamendmentIndgt must be provided it must be set to either ldquotruerdquo or ldquofalserdquo

25 The submission appears to be for an FSP amendment (ltamendmentIndgt = ldquotruerdquo) however no FSP is referenced Please be sure to include the FSP ID number provided with the original submission

26 You cannot amend an FSP that is not approved Ensure you have provided the correct FSP ID number issued with the original submission and confirm that the FSP is approved

27 An FSP with the same FSP ID number already exists in the database Before you can update this FSP it must be placed in Draft status by the District Manager

28 The submission appears to be an amendment to an existing FSP However you have not stated whether or not this amendment requires Ministry approval Please ensure that the ltamendmentApprovalRequiredIndgt is set to one of ldquotruerdquo or ldquofalserdquo

29 A Forest development Unit (FDU) was submitted without a name A name must be provided for each FDU

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 28

30 The same name has been provided for more than one Forest Development Unit (FDU) Each FDU in a submission must have a unique name

31 A Forest Development Unit (FDU) was submitted that did not list a forest licence number that applies Each FDU must have at least one license number applied

32 A forest license number was supplied that does not appear to be owned by any of the plan holders for this FSP Each Forest Development Unit (FDU) must be listed with at least one forest license owned by one of the plan holders for this FSP

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting

Page 12: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 12

For each StandardLayerSpecies

Call FSP_XML_SUBMISSIONACCUMULATE_SPECIES

Call FSP_VALIDATE_XMLFSP_VALIDATION

If errors then

ROLLBACK the transaction

Note If system erros then return false to base agent so job is left on queue If validation errors then return true to remove job from queue and error messages are sent back to the client

Else

Call FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

COMMIT

34 DATA VALIDATION - DAO INTERFACE SPECIFICATIONS

This section details the interface between the Java business agent and the Oracle packages that implement amalgamation validation and processing It can be used in conjunction with the previous sections to define the detailed package interface

341 FSP_XML_SUBMISSIONUSER_SUBMISSION_DATA

Capture the submission metadata coming from ESF Confirm that the individual making the FSP submission has valid authority

to submit via ESF (Error 3)

PROCEDURE USER_SUBMISSION_DATA( P_FSP_SUBMISSION_ID IN NUMBER

P_SUBMITTED_BY IN VARCHAR2 P_CLIENT_NUMBER IN VARCHAR2 P_CLIENT_LOCN_CODE IN VARCHAR2 P_ORG_UNIT_NO IN NUMBER P_SUBMISSION_TIMESTAMP IN DATE P_USER_FILENAME IN VARCHAR2 P_USER_AUTHORITY IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_SUBMISSION_ID Comes from file message from ESF

P_SUBMITTED_BY Comes from file message from ESF

P_CLIENT_NUMBER Comes from file message from ESF

P_CLIENT_LOCN_CODE Comes from file message from ESF

P_ADMIN_DISTRICT_NO orgUnitNo from submission metadata ltdistrictCodegt value

P_SUBMISSION_TIMESTAMP Comes from file message from ESF

P_USER_FILENAME Comes from file message from ESF

P_USER_AUTHORITY Set to lsquoACrsquo

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 13

342 FSP_XML_SUBMISSIONACCUMULATE_FSP

Call once for the ltForestStewardshipPlangt entity Ensure only one such entity is included If no errors are returned then proceed If FSP already exists (this is an amendment) return the FSP_ID PROCEDURE VALID_FSP (P_FSP_ID IN OUT NUMBER

P_PLAN_NAME IN VARCHAR2 P_PLAN_TERM_YEARS IN NUMBER P_PLAN_TERM_COMMENCEMENT IN DATE P_ACTION_CODE IN VARCHAR2 P_SUBMITTER_NAME IN VARCHAR2 P_SUBMITTER_EMAIL IN VARCHAR2 P_SUBMITTER_TELEPHONE IN VARCHAR2 P_AMENDMENT_IND IN VARCHAR2 P_AMENDMENT_COMMENT IN VARCHAR2 P_AMENDMENT_APPROVAL_IND IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_OPENING_ID ltfspIDgt or from previous procedure call

P_PLAN_NAME ltplanNamegt

P_PLAN_TERM_YEARS ltplanTermYearsgt

P_PLAN_TERM_COMMENCEMENT ltplanTermCommencementgt

P_ACTION_CODE ltactionCodegt

P_SUBMITTER_NAME ltlicenseeContactgt

P_SUBMITTER_EMAIL ltemailAddressgt

P_SUBMITTER_TELEPHONE lttelphoneNumbergt

P_AMENDMENT_IND ltamendmentIndgt

P_AMENDMENT_COMMENT ltamendmentCommentgt

P_AMENDMENT_APPROVAL_IND ltadmendmentApprovalRequiredgt

343 FSP_XML_SUBMISSIONACCUMULATE_ORG_UNIT

Call once for each ltdistrictCodePropertygt in ltForestStewardshipPlangt PROCEDURE ACCUMULATE_PLAN_HOLDER(

P_FSP_ID IN NUMBER P_DISTRICT_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_DISTRICT_CODE ltdistrictCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 14

344 FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER

Call once for each ltPlanHoldergt in the FSP PROCEDURE ACCUMULATE_PLAN_HOLDER(

P_FSP_ID IN NUMBER P_CLIENT_NUMBER IN VARCHAR2 P_CLIENT_LICENSE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_CLIENT_NUMBER Comes from file message from ESF

P_CLIENT_LICENCE Comes from file message from ESF

345 FSP_XML_SUBMISSIONACCUMULATE_FDU

Call once for each ltFDUgt in the FSP PROCEDURE ACCUMULATE_FDU(

P_FSP_ID IN NUMBER P_FDU_NAME IN VARCHAR2 P_CLIENT_LICENCES IN VARRAY OF VARCHAR2 P_GEOMETRY IN MDSYSSDO_GEOMETRY P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_FDU_NAME ltfduNamegt

P_CLIENT_LICENCES ltFDUgtltlicenseNumbergt

P_GEOMETRY FDU ltextentOfgt as SDO_GEOMETRY

346 FSP_XML_SUBMISSIONACCUMULATE_STANDARD

Call once for each ltStockingStandardgt in the FSP

PROCEDURE ACCUMULATE_STANDARD( P_STANDARDS_REGIME_ID IN OUT NUMBER P_STANDARDS_REGIME_NAME IN VARCHAR2 P_STANDARDS_OBJECTIVE IN VARCHAR2 P_REGEN_DELAY_OFFSET_YRS IN NUMBER P_REGEN_OBLIGATION_IND IN VARCHAR2 P_EARLY_OFFSET_YRS IN NUMBER P_LATE_OFFSET_YRS IN NUMBER P_GEOGRAPHIC_DESCRIPTION IN VARCHAR2 P_ADDITIONAL_STANDARDS IN VARCHAR2

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 15

P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt

P_STANDARDS_REGIME_NAME ltstandardsRegimeNamegt

P_STANDARDS_OBJECTIVE ltstandardsObjectivegt

P_REGEN_DELAY_OFFSET_YRS ltregenOffsetgt from regenObjectivesProperty

P_REGEN_OBLIGATION_IND ltregenObligationIndgt from regenObjectivesProperty

P_EARLY_OFFSET_YRS ltearlyOffsetgt from regenObjectivesProperty

P_LATE_OFFSET_YRS ltlateOffsetgt from regenObjectivesProperty

P_GEOGRAPHIC_DESCRIPTION ltgeographicDescriptiongt

P_ADDITIONAL_STANDARDS ltadditionalStandardsgt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 16

347 RESULTS_XML_SUBMISSIONACCUMULATE_STANDARDS_LAYER

For each StandardLayer within a Standards Regime call

PROCEDURE ACCUMULATE_STANDARDS_LAYER (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_STOCKING_LAYER_ID OUT NUMBER P_TARGET_STOCKING IN NUMBER P_RESIDUAL_BASAL_AREA IN NUMBER P_MIN_HORIZONTAL_DISTANCE IN NUMBER P_MIN_PREF_STOCKING_STANDARD IN NUMBER P_MIN_POST_SPACING IN NUMBER P_MIN_STOCKING_STANDARD IN NUMBER P_MAX_POST_SPACING IN NUMBER P_MAX_CONIFER IN NUMBER P_HGHT_RELATIVE_TO_COMP IN NUMBER P_HGHT_RELATIVE_COMP_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID From ltstandardsRegimeIdgt or previous procedure

P_STOCKING_LAYER_CODE ltstockingLayerCodegt

P_STOCKING_LAYER_ID This value is returned

P_TARGET_STOCKING ltwellSpacedgt

P_RESIDUAL_BASAL_AREA ltresidualBasalAreagt

P_MIN_HORIZONTAL_DISTANCE ltminHorizontalDistancegt

P_PREF_STOCKING_STANDARD ltminPrefWellSpacedgt

P_MIN_POST_SPACING ltminPostSpacinggt

P_MIN_STOCKING_STANDARD ltminStockingStandardgt

P_MAX_POST_SPACING ltmaxPostSpacinggt

P_MAX_CONIFER ltmaxConifergt

P_HGHT_RELATIVE_COMP ltheightRelativeToCompgt

P_HGHT_RELATIVE_COMP_CODE ltheightRelativeToCompCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 17

348 RESULTS_XML_SUBMISSIONACCUMULATE_SPECIES

Call once for each StandardLayerSpecies within a StandardLayer

PROCEDURE ACCUMULATE_SPECIES (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_SPECIES_CODE IN VARCHAR2 P_STOCKING_LAYER_ID IN NUMBER P_PREFERRED_IND IN VARCHAR2 P_MIN_HEIGHT IN NUMBER P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt or previous procedure

P_STOCKING_LAYER_CODE STOCKING_LAYER_CODE from StandardLayer

P_SPECIES_CODE ltspeciesCodegt

P_STOCKING_LAYER_ID STOCKING_LAYER_ID from StandardLayer

P_STOCKING_STANDARD_UNIT_ID STOCKING_STANDARD_UNIT_ID from StandardLayer

P_PREFERRED_IND ltpreferredSpeciesIndgt

P_MIN_HEIGHT ltminHeightgt

P_SUBMITTED_BY Comes from file message from ESF

349 FSP_VALIDATE_XMLFSP_VALIDATION

Call after the the submission has been accumulated and no errors were returned FSP_VALIDATION is a procedure that calls a chain of other procedures that validate parts of the submission data The overall results are returned

FSP_VALIDATE_XMLVALIDATE_PLAN_HOLDER

BUSINESS RULES

At least one named licensee (forest client) forest licence pair in ltPlanHoldergt (Error 4 5 6)

That each named licensee actually exists and owns the licence listed

(Error 7)

FSP_VALIDATE_XMLVALIDATE_ORG_UNITS

BUSINESS RULES

At least one ltdistrictCodegt named (Error 8) Code resolves to a valid existing MoFR Forest District (Error 9)

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 18

FSP_VALIDATE_XMLVALIDATE_FSP

BUSINESS RULES

Ensure only a single ltForestStewardshipPlangt entity is included (Error 10)

Submission metadata ltlicenseeContactgt(Error 11)

ltemailAddressgt(Error 12) and lttelephoneNumbergt (Error 13) provided (no nulls)

Is this an original submission or an amendment (ltamendmentIndicatorgt)

(Error 14)

If original submission confirm o Plan name provided (Error 15) o Required document attached

FSP legal plan document (Error 1) o At least one ltForestDevelopmentUnitgt included (Error 16) o At least one ltStockingStandardgt included (Error 17)

ltfspIDgt (conditional) this is amendment or update

o If provided ensure a matching FSP_ID already exists in the database (Error 18)

o If existing FSP_ID status = ldquoApprovedrdquo this must be an amendment ensure that ltamendmentIndgt = ldquoTrdquo (Error 19)

o If existing FSP_ID status = ldquoRejectedrdquo this is a mistaken attempt to re-submit the same FSP (Error 20)

o If existing FSP_ID status = ldquoDraftrdquo this is an update anything submitted will overwrite existing FSP_ID record

ltplanNamegt (conditional)

o If provided and no ltfspIDgt provided this is a new submission Ensure that ltamendmentIndgt = lsquoFrsquo (Error 21)

ltplanTermgt (optional) if included is less than or equal to 5 (Error 22) ltplanStartDategt (optional) if included is valid date (Error 23) ltactionCodegt

o if ldquoNrdquo (New) Must be new FSP ensure no matching FSP_ID

FSP_AMENDMENT_NUMBER primary key already exists o if ldquoUrdquo (Update)

Must be existing FSP ensure a match to FSP_ID and FSP_AMENDMENT_NUMBER key exists

Existing FSP must be in ldquoDraftrdquo status o if ldquoArdquo (Append)

Must an existing FSP in ldquoDraftrdquo status Explicitly designed for appending GML map data to an

existing FSP

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 19

Must not already by any FOREST_DEVELOPMENT_UNIT entries for this FSP

ltamendmentIndgt (mandatory)

o Must be one of ldquoTrdquo or ldquoFrdquo (Error 24) o If ldquoTrdquo ensure ltfspIDgt provided and matches an existing FSP_ID in

the database (error 25) also ensure that the status of the existing FSP_ID = ldquoApprovedrdquo (error 26)

o If ldquoFrdquo and no ltfspIDgt provided this is a new submission o If ldquoFrdquo and ltfspIDgt provided must be an update ensure it

matches an existing FSP_ID with status = ldquoDraftrdquo (Error 27) ltamendmentApprovalRequiredIndgt (conditional)

o If ltamendmentIndgt is ldquotruerdquo must be included and set to one of ldquoTrdquo or ldquoFrdquo (Error 28)

FSP_VALIDATE_XMLVALIDATE_FDUS

BUSINESS RULES

Validate Geometry o polygon area gt 0 o polygon boundary length gt 0 o Other

Validate Identifier o ltfduNamegt must exist and not be null (Error 29) o ltfduNamegt must be unique within the FSP (no duplicates) (Error

30)

Validate Licences o Each FDU must have at least one forest licence applying (Error 31) o Each licence must be owned by one of the licensees listed for this

FSP ltplanHoldergtltlicenceNumbergt (Error 32)

FSP_VALIDATE_XMLVALIDATE_STANDARDS

BUSINESS RULES

Stocking Standards o For FSPs the stocking standard is nearly identical to the

ltStandardsAmendmentTypegt in the RESULTS schema with the following exceptions

The following elements from RESULTS ltStandardsTypegt have been added

ltbgcZonegt ltbgcSubzonegt ltbgcVariantgt ltbgcPhasegt ltbgcSiteSeriesgt ltbgcSiteTypegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 20

ltbgcSeralgt ltmaximumAllowableSoilDisturbancegt

o Therefore the equivalent Validation procedures from Results 30 can be used here with minor amendments

o FSP Stocking Standards do not have a spatial component and are not linked to any piece of ground

3410 FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

Call if no errors returned in any of the steps above PROCEDURE PROCESS_XML_SUBMISSION(

P_POST IN VARCHAR2 P_RESULTS OUT ref_results)

Procedure parameter Data Value P_POST Validate only indicator from fsp

submission metadata

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 21

The following diagram shows the decision points on how to process the submission depending on input parameters The pre-defined states refer procedures defined below

ltfspIDgt

Y

ltplanNamegt

N Error must havePlan name

N

fspID ==FSP_ID

Error UnknownFSP

N

FSP_IDSTATUS

Y

Error cannotUpdate or amend

RejectedSubmitted

ltamendmentIndgt

Approved

Error amendment requiredF

AmendApproval

Ind

T

AmendmentTo

Inbox

T

AmendmentAuto

Approve

UpdateExisting

PlanDraft

Create NewFSP

Y

End

End

End

FSP with same FSP_ID exists in database

FSP Submission

Validate

ESF FSPSubmissionAccumulate

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 22

3411 CREATE_NEW_FSP

This procedure will create a new ForestStewardshipPlan and all related entities in the production database

FOREST_STEWARDSHIP_PLAN TABLE

Source Destination FSP_SEQNEXTVAL FSP_ID 0 FSP_AMENDMENT_NUMBER STATUS for ldquoSubmittedrdquo FSP_STATUS_CODE ltplanNamegt PLAN_NAME ltplanTermYearsgt PLAN_TERM_YEARS ltplanTermCommencementgt PLAN_START_DATE ltplanTermCommencementgt + ltplanTermYearsgt

PLAN_END_DATE

ESF submission date PLAN_SUBMISSION_DATE ltlicenseeContactgt CONTACT_NAME lttelphoneNumbergt TELEPHONE_NUMBER ltemailAddressgt EMAIL_ADDRESS

FSP_AGREEMENT_HOLDER TABLE

Source Destination ltPlanHoldergtltclientCodegt CLIENT_NUMBER

FSP_ORG_UNIT TABLE

Source Destination ORG_UNITORG_UNIT_NO for ltdistrictCodegt

ORG_UNIT_NO

FSP_STATUS_HISTORY TABLE

Source Destination FSP_STATUS_HISTORY_SEQ FSP_STATUS_HISTORY_ID ldquoSubmittedrdquo code from FSP_STATUS_CODE

FSP_STATUS_CODE

ldquoNew Submissionrdquo STATUS_COMMENT

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 23

FSP_ATTACHMENT TABLE

Source Destination ESF framework ATTACHMENT_DESCRIPTION ATTACHMENT_NAME ATTACHMENT_SIZE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

3412 UPDATE_EXISTING_PLAN

For ESF submissions only the FDU map spatial component ltFDUPropertygt can be submitted as an update Part of the validation is to ensure that no other data is included with the ESF submission file except ltfspIDgt and ltFDUPropertygt This may be an INSERT or an UPDATE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination ltfspIDgt FSP_ID FOREST_STEWARDSHIP_PLAN FSP_AMENDMENT_NUMBER

FSP_AMENDMENT_NUMBER

FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 24

3413 AMENDMENT_AUTO_APPROVE

This is to create an amendment that does not require approval It is in effect a new FSP submission that automatically goes to ldquoApprovedrdquo status and increments the FSP_AMENDMENT_NUMBER Processing depends on what the licensee has submitted It may be one or more of

headeradministrative information (such as adding a new licensee) or amending a plan term

a new legal FSP document a new GML map of all the FDUs (spatial data if amended must be

completely replaced) new stocking standards

Process the data as if it were a new submission (see above) with the following exceptions

Do an INSERT INTO FOREST_STEWARDSHIP_PLAN setting FSP_AMENDMENT_NUMBER = MAX(FSP_AMENDMENT_NUMBER) + 1

Copy all fields from FOREST_STEWARDSHIP_PLAN from the most recent amendment (or the original submission record if no amendments)

UPDATE any fields in FOREST_STEWARSHIP_PLAN for this new entry that are provided in the XML submission that is any of ltplanNamegt ltplanTermYearsgt ltplanTermCommencementgt ltlicenseeContactgt lttelephoneNumbergt ltemailAddressgt

Any attachments must be INSERTed into FSP_ATTACHMENT with the new FSP_AMENDMENT_NUMBER (also FSP_ATTACHMENT_CONTENT)

Set FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoAPPRrdquo for this new record

INSERT INTO FSP_STATUS_HISTORY (FSP_STATUS_HISTORY_ID FSP_ID FSP_AMENDMENT_NUMBER FSP_STATUS_CODE STATUS_COMMENT) VALUES (SEQNEXTVAL ltFSP_IDgt ltnew FSP_AMENDMENT_NUMBERgt ldquoAPPRrdquo ltamendmentCommentgt) Be sure to use the new FSP_AMENDMENT_NUMBER in INSERTing any STANDARDS_REGIME or FOREST_DEVELOPMENT_UNIT records

3414 AMENDMENT_TO_INBOX

This is to create an amendment that requires approval The FSP submission is put in ldquoSubmittedrdquo status so that it will show up in the relevant District Inboxes The FSP_AMENDMENT_NUMBER is incremented Proceed as above (AMENDMENT_AUTO_INCREMENT) except

SET FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoSUBMrdquo (for Submitted)

SET FSP_STATUS_HISTORYSTATUS_CODE = ldquoSUBMrdquo for new record

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 25

35 DOMAIN CODES

The following codes will be set up in the database in static code tables (all fields are VARCHAR2)

FSP_STATUS_CODE TABLE

FSP_STATUS_CODE DESCRIPTION SUBM Submitted DRFT Draft APPR Approved REJ Rejected OTBH Opportunity To Be Heard

FSP_REVIEW_MILESTONE_TYPE_CODE TABLE

FSP_REVIEW_MILESTONE_ TYPE_CODE

DESCRIPTION

FNR First Nations Review CampE Results amp Strategies reviewed by CampE TEN Objectives Results amp Strategies reviewed by

Tenures DDM Sent to DDM for Determination OTHR Other

FSP_ATTACHMENT_TYPE_CODE TABLE

FSP_ATTACHMENT_TYPE_CODE DESCRIPTION FSP FSP legal document MAP Map of FDUs SS Stocking Standards report AMDS Amendment Description DDMD DDM Decision Letter OTHR Other Attachment

FEATURE_CLASSES TABLE

FEATURE_CLASS_SKEY DESCRIPTION FEATURE_CLASS_KEY To be defined

36 REPORTING ERRORS

If an error is detected in a submission it must be reported back to the electronic submission framework The method for doing that is to post a message to a queue detailing the submission number and the error message The licensee will be able to check back to the Electronic Submission WebSite and view the error The Electronic Submission Framework will also send an email to the client detailing the message

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 26

The specification for how to report an error can be found in the ESF Queue Agent Best Practices Document The message content for FSP will be a concatenation of the ltFSP Submission IDgt ltDescriptiongt field and the message returned from the validation routines above To send a message about a submission you will need to supply the FSP submission ID for the submission The FSP submission ID is supplied with the message from ESF and stored in the FSP_ELECTRONIC_SUBMISSION table Refer to the Status Agent in the ESF Queue Agent Best Practices document for details on how to send a message to ESF The following code is provided as a sample only and the final syntax should be from the ESF Queue Agent Best Practices Document StatusAgent sa = new StatusAgent (ldquoFSP Business Agentrdquo) sasendStatus (ltForestStewardshipPlanSubmissionIDgt StatusMessageREJECTED ldquo100rdquo ltForestStewardshipPlangtlt083D02800509gt + ldquofailedrdquo + outMessage) saclose() Note Expectation is that outmessage will contain details as to what part of the FSP failed (eg Tenure Forest Development Unit or Stocking Standard) In the case of invalid data processing stops at this point for the FSP No data for this submission will be added to FSP database

361 ERROR MESSAGES

These error messages may be generated during the accumulation validation and processing phases They are referenced by number in the procedure documentation above

1 A legal FSP document must be attached to this submission Please attach a document containing your Forest Stewardship Plan

2 The attached file ltnamegt does not have a recognizable file extension Atachments must be one of MSWord (doc) Portable Document Format (pdf) MS Excel (xls) ZIP archive (zip) or JPEG graphic (jpg) Please resubmit with appropriate file attachments

3 You do not have the proper authority to submit an FSP via ESF Please contact the appropriate MoFR District office to obtain the necessary ldquoSubmitterrdquo authority role

4 The FSP submitted does not name any plan holders At least one holder of a major BC Forest license must be named in the plan

5 No forest license number was found for a named plan holder You must name all forest licenses which apply within the FSP

6 A plan holderrsquos license number could not be verified Please check the validity of the plan holder MoFR client codes

7 A forest license number listed is not owned by any of the plan holders of this FSP Please check the validity of the plan holder MoFR client codes and their licence numbers

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 27

8 At least one BC Forest District must be listed for this FSP Each District responsible for the area included in the FSP must be listed

9 The MoFR District Code is not recognized Please check the spelling of the District code(s) included or check with the appropriate District office for the proper code

10 More than one Forest Stewardship Plan (FSP) was included in this submission At the present time each ESF submission may contain only a single FSP

11 The submission must include the name of a contact person responsible for communicating with MoFR about this FSP submission

12 The submission must include the email address of a contact person responsible for communicating with MoFR about this FSP submission

13 The submission must include the telephone number of a contact person responsible for communicating with MoFR about this FSP submission

14 The submission must indicate whether or not this is an original FSP or an amendment to an existing FSP

15 The FSP must have a name 16 The FSP must include at least one Forest Development Unit (FDU) 17 The FSP must include at least one Stocking Standard 18 This submission refers to an FSP that does not exist in the Ministryrsquos

database Please check the FSP ID number provided after your original submission

19 An FSP with the same FSP ID number already exists in the Ministryrsquos database yet you have not indicated that this is an amendment If the intention is to amend an existing FSP please include the correct FSP ID and make sure the ltamendmentIndgt flag is set to ldquotruerdquo

20 The FSP you are trying to amend has been rejected You cannot amend or replace a rejected FSP You must make a brand new submission When doing so do not include an FSP ID number

21 The submission appears to be a new FSP yet the amendment indicator is set to true (ltamendmentIndgt = ldquotruerdquo) Either provide an FSP ID to amend an existing FSP or set the amendment indicator to ldquofalserdquo

22 The FSP plan term has been set to greater than 5 years FSPs are valid for a maximum of 5 years unless an extension is approved

23 The plan commencement date provided is not valid 24 A value for ltamendmentIndgt must be provided it must be set to either ldquotruerdquo or ldquofalserdquo

25 The submission appears to be for an FSP amendment (ltamendmentIndgt = ldquotruerdquo) however no FSP is referenced Please be sure to include the FSP ID number provided with the original submission

26 You cannot amend an FSP that is not approved Ensure you have provided the correct FSP ID number issued with the original submission and confirm that the FSP is approved

27 An FSP with the same FSP ID number already exists in the database Before you can update this FSP it must be placed in Draft status by the District Manager

28 The submission appears to be an amendment to an existing FSP However you have not stated whether or not this amendment requires Ministry approval Please ensure that the ltamendmentApprovalRequiredIndgt is set to one of ldquotruerdquo or ldquofalserdquo

29 A Forest development Unit (FDU) was submitted without a name A name must be provided for each FDU

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 28

30 The same name has been provided for more than one Forest Development Unit (FDU) Each FDU in a submission must have a unique name

31 A Forest Development Unit (FDU) was submitted that did not list a forest licence number that applies Each FDU must have at least one license number applied

32 A forest license number was supplied that does not appear to be owned by any of the plan holders for this FSP Each Forest Development Unit (FDU) must be listed with at least one forest license owned by one of the plan holders for this FSP

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting

Page 13: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 13

342 FSP_XML_SUBMISSIONACCUMULATE_FSP

Call once for the ltForestStewardshipPlangt entity Ensure only one such entity is included If no errors are returned then proceed If FSP already exists (this is an amendment) return the FSP_ID PROCEDURE VALID_FSP (P_FSP_ID IN OUT NUMBER

P_PLAN_NAME IN VARCHAR2 P_PLAN_TERM_YEARS IN NUMBER P_PLAN_TERM_COMMENCEMENT IN DATE P_ACTION_CODE IN VARCHAR2 P_SUBMITTER_NAME IN VARCHAR2 P_SUBMITTER_EMAIL IN VARCHAR2 P_SUBMITTER_TELEPHONE IN VARCHAR2 P_AMENDMENT_IND IN VARCHAR2 P_AMENDMENT_COMMENT IN VARCHAR2 P_AMENDMENT_APPROVAL_IND IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_OPENING_ID ltfspIDgt or from previous procedure call

P_PLAN_NAME ltplanNamegt

P_PLAN_TERM_YEARS ltplanTermYearsgt

P_PLAN_TERM_COMMENCEMENT ltplanTermCommencementgt

P_ACTION_CODE ltactionCodegt

P_SUBMITTER_NAME ltlicenseeContactgt

P_SUBMITTER_EMAIL ltemailAddressgt

P_SUBMITTER_TELEPHONE lttelphoneNumbergt

P_AMENDMENT_IND ltamendmentIndgt

P_AMENDMENT_COMMENT ltamendmentCommentgt

P_AMENDMENT_APPROVAL_IND ltadmendmentApprovalRequiredgt

343 FSP_XML_SUBMISSIONACCUMULATE_ORG_UNIT

Call once for each ltdistrictCodePropertygt in ltForestStewardshipPlangt PROCEDURE ACCUMULATE_PLAN_HOLDER(

P_FSP_ID IN NUMBER P_DISTRICT_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_DISTRICT_CODE ltdistrictCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 14

344 FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER

Call once for each ltPlanHoldergt in the FSP PROCEDURE ACCUMULATE_PLAN_HOLDER(

P_FSP_ID IN NUMBER P_CLIENT_NUMBER IN VARCHAR2 P_CLIENT_LICENSE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_CLIENT_NUMBER Comes from file message from ESF

P_CLIENT_LICENCE Comes from file message from ESF

345 FSP_XML_SUBMISSIONACCUMULATE_FDU

Call once for each ltFDUgt in the FSP PROCEDURE ACCUMULATE_FDU(

P_FSP_ID IN NUMBER P_FDU_NAME IN VARCHAR2 P_CLIENT_LICENCES IN VARRAY OF VARCHAR2 P_GEOMETRY IN MDSYSSDO_GEOMETRY P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_FDU_NAME ltfduNamegt

P_CLIENT_LICENCES ltFDUgtltlicenseNumbergt

P_GEOMETRY FDU ltextentOfgt as SDO_GEOMETRY

346 FSP_XML_SUBMISSIONACCUMULATE_STANDARD

Call once for each ltStockingStandardgt in the FSP

PROCEDURE ACCUMULATE_STANDARD( P_STANDARDS_REGIME_ID IN OUT NUMBER P_STANDARDS_REGIME_NAME IN VARCHAR2 P_STANDARDS_OBJECTIVE IN VARCHAR2 P_REGEN_DELAY_OFFSET_YRS IN NUMBER P_REGEN_OBLIGATION_IND IN VARCHAR2 P_EARLY_OFFSET_YRS IN NUMBER P_LATE_OFFSET_YRS IN NUMBER P_GEOGRAPHIC_DESCRIPTION IN VARCHAR2 P_ADDITIONAL_STANDARDS IN VARCHAR2

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 15

P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt

P_STANDARDS_REGIME_NAME ltstandardsRegimeNamegt

P_STANDARDS_OBJECTIVE ltstandardsObjectivegt

P_REGEN_DELAY_OFFSET_YRS ltregenOffsetgt from regenObjectivesProperty

P_REGEN_OBLIGATION_IND ltregenObligationIndgt from regenObjectivesProperty

P_EARLY_OFFSET_YRS ltearlyOffsetgt from regenObjectivesProperty

P_LATE_OFFSET_YRS ltlateOffsetgt from regenObjectivesProperty

P_GEOGRAPHIC_DESCRIPTION ltgeographicDescriptiongt

P_ADDITIONAL_STANDARDS ltadditionalStandardsgt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 16

347 RESULTS_XML_SUBMISSIONACCUMULATE_STANDARDS_LAYER

For each StandardLayer within a Standards Regime call

PROCEDURE ACCUMULATE_STANDARDS_LAYER (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_STOCKING_LAYER_ID OUT NUMBER P_TARGET_STOCKING IN NUMBER P_RESIDUAL_BASAL_AREA IN NUMBER P_MIN_HORIZONTAL_DISTANCE IN NUMBER P_MIN_PREF_STOCKING_STANDARD IN NUMBER P_MIN_POST_SPACING IN NUMBER P_MIN_STOCKING_STANDARD IN NUMBER P_MAX_POST_SPACING IN NUMBER P_MAX_CONIFER IN NUMBER P_HGHT_RELATIVE_TO_COMP IN NUMBER P_HGHT_RELATIVE_COMP_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID From ltstandardsRegimeIdgt or previous procedure

P_STOCKING_LAYER_CODE ltstockingLayerCodegt

P_STOCKING_LAYER_ID This value is returned

P_TARGET_STOCKING ltwellSpacedgt

P_RESIDUAL_BASAL_AREA ltresidualBasalAreagt

P_MIN_HORIZONTAL_DISTANCE ltminHorizontalDistancegt

P_PREF_STOCKING_STANDARD ltminPrefWellSpacedgt

P_MIN_POST_SPACING ltminPostSpacinggt

P_MIN_STOCKING_STANDARD ltminStockingStandardgt

P_MAX_POST_SPACING ltmaxPostSpacinggt

P_MAX_CONIFER ltmaxConifergt

P_HGHT_RELATIVE_COMP ltheightRelativeToCompgt

P_HGHT_RELATIVE_COMP_CODE ltheightRelativeToCompCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 17

348 RESULTS_XML_SUBMISSIONACCUMULATE_SPECIES

Call once for each StandardLayerSpecies within a StandardLayer

PROCEDURE ACCUMULATE_SPECIES (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_SPECIES_CODE IN VARCHAR2 P_STOCKING_LAYER_ID IN NUMBER P_PREFERRED_IND IN VARCHAR2 P_MIN_HEIGHT IN NUMBER P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt or previous procedure

P_STOCKING_LAYER_CODE STOCKING_LAYER_CODE from StandardLayer

P_SPECIES_CODE ltspeciesCodegt

P_STOCKING_LAYER_ID STOCKING_LAYER_ID from StandardLayer

P_STOCKING_STANDARD_UNIT_ID STOCKING_STANDARD_UNIT_ID from StandardLayer

P_PREFERRED_IND ltpreferredSpeciesIndgt

P_MIN_HEIGHT ltminHeightgt

P_SUBMITTED_BY Comes from file message from ESF

349 FSP_VALIDATE_XMLFSP_VALIDATION

Call after the the submission has been accumulated and no errors were returned FSP_VALIDATION is a procedure that calls a chain of other procedures that validate parts of the submission data The overall results are returned

FSP_VALIDATE_XMLVALIDATE_PLAN_HOLDER

BUSINESS RULES

At least one named licensee (forest client) forest licence pair in ltPlanHoldergt (Error 4 5 6)

That each named licensee actually exists and owns the licence listed

(Error 7)

FSP_VALIDATE_XMLVALIDATE_ORG_UNITS

BUSINESS RULES

At least one ltdistrictCodegt named (Error 8) Code resolves to a valid existing MoFR Forest District (Error 9)

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 18

FSP_VALIDATE_XMLVALIDATE_FSP

BUSINESS RULES

Ensure only a single ltForestStewardshipPlangt entity is included (Error 10)

Submission metadata ltlicenseeContactgt(Error 11)

ltemailAddressgt(Error 12) and lttelephoneNumbergt (Error 13) provided (no nulls)

Is this an original submission or an amendment (ltamendmentIndicatorgt)

(Error 14)

If original submission confirm o Plan name provided (Error 15) o Required document attached

FSP legal plan document (Error 1) o At least one ltForestDevelopmentUnitgt included (Error 16) o At least one ltStockingStandardgt included (Error 17)

ltfspIDgt (conditional) this is amendment or update

o If provided ensure a matching FSP_ID already exists in the database (Error 18)

o If existing FSP_ID status = ldquoApprovedrdquo this must be an amendment ensure that ltamendmentIndgt = ldquoTrdquo (Error 19)

o If existing FSP_ID status = ldquoRejectedrdquo this is a mistaken attempt to re-submit the same FSP (Error 20)

o If existing FSP_ID status = ldquoDraftrdquo this is an update anything submitted will overwrite existing FSP_ID record

ltplanNamegt (conditional)

o If provided and no ltfspIDgt provided this is a new submission Ensure that ltamendmentIndgt = lsquoFrsquo (Error 21)

ltplanTermgt (optional) if included is less than or equal to 5 (Error 22) ltplanStartDategt (optional) if included is valid date (Error 23) ltactionCodegt

o if ldquoNrdquo (New) Must be new FSP ensure no matching FSP_ID

FSP_AMENDMENT_NUMBER primary key already exists o if ldquoUrdquo (Update)

Must be existing FSP ensure a match to FSP_ID and FSP_AMENDMENT_NUMBER key exists

Existing FSP must be in ldquoDraftrdquo status o if ldquoArdquo (Append)

Must an existing FSP in ldquoDraftrdquo status Explicitly designed for appending GML map data to an

existing FSP

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 19

Must not already by any FOREST_DEVELOPMENT_UNIT entries for this FSP

ltamendmentIndgt (mandatory)

o Must be one of ldquoTrdquo or ldquoFrdquo (Error 24) o If ldquoTrdquo ensure ltfspIDgt provided and matches an existing FSP_ID in

the database (error 25) also ensure that the status of the existing FSP_ID = ldquoApprovedrdquo (error 26)

o If ldquoFrdquo and no ltfspIDgt provided this is a new submission o If ldquoFrdquo and ltfspIDgt provided must be an update ensure it

matches an existing FSP_ID with status = ldquoDraftrdquo (Error 27) ltamendmentApprovalRequiredIndgt (conditional)

o If ltamendmentIndgt is ldquotruerdquo must be included and set to one of ldquoTrdquo or ldquoFrdquo (Error 28)

FSP_VALIDATE_XMLVALIDATE_FDUS

BUSINESS RULES

Validate Geometry o polygon area gt 0 o polygon boundary length gt 0 o Other

Validate Identifier o ltfduNamegt must exist and not be null (Error 29) o ltfduNamegt must be unique within the FSP (no duplicates) (Error

30)

Validate Licences o Each FDU must have at least one forest licence applying (Error 31) o Each licence must be owned by one of the licensees listed for this

FSP ltplanHoldergtltlicenceNumbergt (Error 32)

FSP_VALIDATE_XMLVALIDATE_STANDARDS

BUSINESS RULES

Stocking Standards o For FSPs the stocking standard is nearly identical to the

ltStandardsAmendmentTypegt in the RESULTS schema with the following exceptions

The following elements from RESULTS ltStandardsTypegt have been added

ltbgcZonegt ltbgcSubzonegt ltbgcVariantgt ltbgcPhasegt ltbgcSiteSeriesgt ltbgcSiteTypegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 20

ltbgcSeralgt ltmaximumAllowableSoilDisturbancegt

o Therefore the equivalent Validation procedures from Results 30 can be used here with minor amendments

o FSP Stocking Standards do not have a spatial component and are not linked to any piece of ground

3410 FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

Call if no errors returned in any of the steps above PROCEDURE PROCESS_XML_SUBMISSION(

P_POST IN VARCHAR2 P_RESULTS OUT ref_results)

Procedure parameter Data Value P_POST Validate only indicator from fsp

submission metadata

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 21

The following diagram shows the decision points on how to process the submission depending on input parameters The pre-defined states refer procedures defined below

ltfspIDgt

Y

ltplanNamegt

N Error must havePlan name

N

fspID ==FSP_ID

Error UnknownFSP

N

FSP_IDSTATUS

Y

Error cannotUpdate or amend

RejectedSubmitted

ltamendmentIndgt

Approved

Error amendment requiredF

AmendApproval

Ind

T

AmendmentTo

Inbox

T

AmendmentAuto

Approve

UpdateExisting

PlanDraft

Create NewFSP

Y

End

End

End

FSP with same FSP_ID exists in database

FSP Submission

Validate

ESF FSPSubmissionAccumulate

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 22

3411 CREATE_NEW_FSP

This procedure will create a new ForestStewardshipPlan and all related entities in the production database

FOREST_STEWARDSHIP_PLAN TABLE

Source Destination FSP_SEQNEXTVAL FSP_ID 0 FSP_AMENDMENT_NUMBER STATUS for ldquoSubmittedrdquo FSP_STATUS_CODE ltplanNamegt PLAN_NAME ltplanTermYearsgt PLAN_TERM_YEARS ltplanTermCommencementgt PLAN_START_DATE ltplanTermCommencementgt + ltplanTermYearsgt

PLAN_END_DATE

ESF submission date PLAN_SUBMISSION_DATE ltlicenseeContactgt CONTACT_NAME lttelphoneNumbergt TELEPHONE_NUMBER ltemailAddressgt EMAIL_ADDRESS

FSP_AGREEMENT_HOLDER TABLE

Source Destination ltPlanHoldergtltclientCodegt CLIENT_NUMBER

FSP_ORG_UNIT TABLE

Source Destination ORG_UNITORG_UNIT_NO for ltdistrictCodegt

ORG_UNIT_NO

FSP_STATUS_HISTORY TABLE

Source Destination FSP_STATUS_HISTORY_SEQ FSP_STATUS_HISTORY_ID ldquoSubmittedrdquo code from FSP_STATUS_CODE

FSP_STATUS_CODE

ldquoNew Submissionrdquo STATUS_COMMENT

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 23

FSP_ATTACHMENT TABLE

Source Destination ESF framework ATTACHMENT_DESCRIPTION ATTACHMENT_NAME ATTACHMENT_SIZE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

3412 UPDATE_EXISTING_PLAN

For ESF submissions only the FDU map spatial component ltFDUPropertygt can be submitted as an update Part of the validation is to ensure that no other data is included with the ESF submission file except ltfspIDgt and ltFDUPropertygt This may be an INSERT or an UPDATE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination ltfspIDgt FSP_ID FOREST_STEWARDSHIP_PLAN FSP_AMENDMENT_NUMBER

FSP_AMENDMENT_NUMBER

FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 24

3413 AMENDMENT_AUTO_APPROVE

This is to create an amendment that does not require approval It is in effect a new FSP submission that automatically goes to ldquoApprovedrdquo status and increments the FSP_AMENDMENT_NUMBER Processing depends on what the licensee has submitted It may be one or more of

headeradministrative information (such as adding a new licensee) or amending a plan term

a new legal FSP document a new GML map of all the FDUs (spatial data if amended must be

completely replaced) new stocking standards

Process the data as if it were a new submission (see above) with the following exceptions

Do an INSERT INTO FOREST_STEWARDSHIP_PLAN setting FSP_AMENDMENT_NUMBER = MAX(FSP_AMENDMENT_NUMBER) + 1

Copy all fields from FOREST_STEWARDSHIP_PLAN from the most recent amendment (or the original submission record if no amendments)

UPDATE any fields in FOREST_STEWARSHIP_PLAN for this new entry that are provided in the XML submission that is any of ltplanNamegt ltplanTermYearsgt ltplanTermCommencementgt ltlicenseeContactgt lttelephoneNumbergt ltemailAddressgt

Any attachments must be INSERTed into FSP_ATTACHMENT with the new FSP_AMENDMENT_NUMBER (also FSP_ATTACHMENT_CONTENT)

Set FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoAPPRrdquo for this new record

INSERT INTO FSP_STATUS_HISTORY (FSP_STATUS_HISTORY_ID FSP_ID FSP_AMENDMENT_NUMBER FSP_STATUS_CODE STATUS_COMMENT) VALUES (SEQNEXTVAL ltFSP_IDgt ltnew FSP_AMENDMENT_NUMBERgt ldquoAPPRrdquo ltamendmentCommentgt) Be sure to use the new FSP_AMENDMENT_NUMBER in INSERTing any STANDARDS_REGIME or FOREST_DEVELOPMENT_UNIT records

3414 AMENDMENT_TO_INBOX

This is to create an amendment that requires approval The FSP submission is put in ldquoSubmittedrdquo status so that it will show up in the relevant District Inboxes The FSP_AMENDMENT_NUMBER is incremented Proceed as above (AMENDMENT_AUTO_INCREMENT) except

SET FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoSUBMrdquo (for Submitted)

SET FSP_STATUS_HISTORYSTATUS_CODE = ldquoSUBMrdquo for new record

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 25

35 DOMAIN CODES

The following codes will be set up in the database in static code tables (all fields are VARCHAR2)

FSP_STATUS_CODE TABLE

FSP_STATUS_CODE DESCRIPTION SUBM Submitted DRFT Draft APPR Approved REJ Rejected OTBH Opportunity To Be Heard

FSP_REVIEW_MILESTONE_TYPE_CODE TABLE

FSP_REVIEW_MILESTONE_ TYPE_CODE

DESCRIPTION

FNR First Nations Review CampE Results amp Strategies reviewed by CampE TEN Objectives Results amp Strategies reviewed by

Tenures DDM Sent to DDM for Determination OTHR Other

FSP_ATTACHMENT_TYPE_CODE TABLE

FSP_ATTACHMENT_TYPE_CODE DESCRIPTION FSP FSP legal document MAP Map of FDUs SS Stocking Standards report AMDS Amendment Description DDMD DDM Decision Letter OTHR Other Attachment

FEATURE_CLASSES TABLE

FEATURE_CLASS_SKEY DESCRIPTION FEATURE_CLASS_KEY To be defined

36 REPORTING ERRORS

If an error is detected in a submission it must be reported back to the electronic submission framework The method for doing that is to post a message to a queue detailing the submission number and the error message The licensee will be able to check back to the Electronic Submission WebSite and view the error The Electronic Submission Framework will also send an email to the client detailing the message

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 26

The specification for how to report an error can be found in the ESF Queue Agent Best Practices Document The message content for FSP will be a concatenation of the ltFSP Submission IDgt ltDescriptiongt field and the message returned from the validation routines above To send a message about a submission you will need to supply the FSP submission ID for the submission The FSP submission ID is supplied with the message from ESF and stored in the FSP_ELECTRONIC_SUBMISSION table Refer to the Status Agent in the ESF Queue Agent Best Practices document for details on how to send a message to ESF The following code is provided as a sample only and the final syntax should be from the ESF Queue Agent Best Practices Document StatusAgent sa = new StatusAgent (ldquoFSP Business Agentrdquo) sasendStatus (ltForestStewardshipPlanSubmissionIDgt StatusMessageREJECTED ldquo100rdquo ltForestStewardshipPlangtlt083D02800509gt + ldquofailedrdquo + outMessage) saclose() Note Expectation is that outmessage will contain details as to what part of the FSP failed (eg Tenure Forest Development Unit or Stocking Standard) In the case of invalid data processing stops at this point for the FSP No data for this submission will be added to FSP database

361 ERROR MESSAGES

These error messages may be generated during the accumulation validation and processing phases They are referenced by number in the procedure documentation above

1 A legal FSP document must be attached to this submission Please attach a document containing your Forest Stewardship Plan

2 The attached file ltnamegt does not have a recognizable file extension Atachments must be one of MSWord (doc) Portable Document Format (pdf) MS Excel (xls) ZIP archive (zip) or JPEG graphic (jpg) Please resubmit with appropriate file attachments

3 You do not have the proper authority to submit an FSP via ESF Please contact the appropriate MoFR District office to obtain the necessary ldquoSubmitterrdquo authority role

4 The FSP submitted does not name any plan holders At least one holder of a major BC Forest license must be named in the plan

5 No forest license number was found for a named plan holder You must name all forest licenses which apply within the FSP

6 A plan holderrsquos license number could not be verified Please check the validity of the plan holder MoFR client codes

7 A forest license number listed is not owned by any of the plan holders of this FSP Please check the validity of the plan holder MoFR client codes and their licence numbers

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 27

8 At least one BC Forest District must be listed for this FSP Each District responsible for the area included in the FSP must be listed

9 The MoFR District Code is not recognized Please check the spelling of the District code(s) included or check with the appropriate District office for the proper code

10 More than one Forest Stewardship Plan (FSP) was included in this submission At the present time each ESF submission may contain only a single FSP

11 The submission must include the name of a contact person responsible for communicating with MoFR about this FSP submission

12 The submission must include the email address of a contact person responsible for communicating with MoFR about this FSP submission

13 The submission must include the telephone number of a contact person responsible for communicating with MoFR about this FSP submission

14 The submission must indicate whether or not this is an original FSP or an amendment to an existing FSP

15 The FSP must have a name 16 The FSP must include at least one Forest Development Unit (FDU) 17 The FSP must include at least one Stocking Standard 18 This submission refers to an FSP that does not exist in the Ministryrsquos

database Please check the FSP ID number provided after your original submission

19 An FSP with the same FSP ID number already exists in the Ministryrsquos database yet you have not indicated that this is an amendment If the intention is to amend an existing FSP please include the correct FSP ID and make sure the ltamendmentIndgt flag is set to ldquotruerdquo

20 The FSP you are trying to amend has been rejected You cannot amend or replace a rejected FSP You must make a brand new submission When doing so do not include an FSP ID number

21 The submission appears to be a new FSP yet the amendment indicator is set to true (ltamendmentIndgt = ldquotruerdquo) Either provide an FSP ID to amend an existing FSP or set the amendment indicator to ldquofalserdquo

22 The FSP plan term has been set to greater than 5 years FSPs are valid for a maximum of 5 years unless an extension is approved

23 The plan commencement date provided is not valid 24 A value for ltamendmentIndgt must be provided it must be set to either ldquotruerdquo or ldquofalserdquo

25 The submission appears to be for an FSP amendment (ltamendmentIndgt = ldquotruerdquo) however no FSP is referenced Please be sure to include the FSP ID number provided with the original submission

26 You cannot amend an FSP that is not approved Ensure you have provided the correct FSP ID number issued with the original submission and confirm that the FSP is approved

27 An FSP with the same FSP ID number already exists in the database Before you can update this FSP it must be placed in Draft status by the District Manager

28 The submission appears to be an amendment to an existing FSP However you have not stated whether or not this amendment requires Ministry approval Please ensure that the ltamendmentApprovalRequiredIndgt is set to one of ldquotruerdquo or ldquofalserdquo

29 A Forest development Unit (FDU) was submitted without a name A name must be provided for each FDU

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 28

30 The same name has been provided for more than one Forest Development Unit (FDU) Each FDU in a submission must have a unique name

31 A Forest Development Unit (FDU) was submitted that did not list a forest licence number that applies Each FDU must have at least one license number applied

32 A forest license number was supplied that does not appear to be owned by any of the plan holders for this FSP Each Forest Development Unit (FDU) must be listed with at least one forest license owned by one of the plan holders for this FSP

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting

Page 14: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 14

344 FSP_XML_SUBMISSIONACCUMULATE_PLAN_HOLDER

Call once for each ltPlanHoldergt in the FSP PROCEDURE ACCUMULATE_PLAN_HOLDER(

P_FSP_ID IN NUMBER P_CLIENT_NUMBER IN VARCHAR2 P_CLIENT_LICENSE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_CLIENT_NUMBER Comes from file message from ESF

P_CLIENT_LICENCE Comes from file message from ESF

345 FSP_XML_SUBMISSIONACCUMULATE_FDU

Call once for each ltFDUgt in the FSP PROCEDURE ACCUMULATE_FDU(

P_FSP_ID IN NUMBER P_FDU_NAME IN VARCHAR2 P_CLIENT_LICENCES IN VARRAY OF VARCHAR2 P_GEOMETRY IN MDSYSSDO_GEOMETRY P_ERROR_MESSAGE OUT VARCHAR2) Procedure parameter Data Value P_FSP_ID ltfspIDgt or previous procedure call

P_FDU_NAME ltfduNamegt

P_CLIENT_LICENCES ltFDUgtltlicenseNumbergt

P_GEOMETRY FDU ltextentOfgt as SDO_GEOMETRY

346 FSP_XML_SUBMISSIONACCUMULATE_STANDARD

Call once for each ltStockingStandardgt in the FSP

PROCEDURE ACCUMULATE_STANDARD( P_STANDARDS_REGIME_ID IN OUT NUMBER P_STANDARDS_REGIME_NAME IN VARCHAR2 P_STANDARDS_OBJECTIVE IN VARCHAR2 P_REGEN_DELAY_OFFSET_YRS IN NUMBER P_REGEN_OBLIGATION_IND IN VARCHAR2 P_EARLY_OFFSET_YRS IN NUMBER P_LATE_OFFSET_YRS IN NUMBER P_GEOGRAPHIC_DESCRIPTION IN VARCHAR2 P_ADDITIONAL_STANDARDS IN VARCHAR2

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 15

P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt

P_STANDARDS_REGIME_NAME ltstandardsRegimeNamegt

P_STANDARDS_OBJECTIVE ltstandardsObjectivegt

P_REGEN_DELAY_OFFSET_YRS ltregenOffsetgt from regenObjectivesProperty

P_REGEN_OBLIGATION_IND ltregenObligationIndgt from regenObjectivesProperty

P_EARLY_OFFSET_YRS ltearlyOffsetgt from regenObjectivesProperty

P_LATE_OFFSET_YRS ltlateOffsetgt from regenObjectivesProperty

P_GEOGRAPHIC_DESCRIPTION ltgeographicDescriptiongt

P_ADDITIONAL_STANDARDS ltadditionalStandardsgt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 16

347 RESULTS_XML_SUBMISSIONACCUMULATE_STANDARDS_LAYER

For each StandardLayer within a Standards Regime call

PROCEDURE ACCUMULATE_STANDARDS_LAYER (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_STOCKING_LAYER_ID OUT NUMBER P_TARGET_STOCKING IN NUMBER P_RESIDUAL_BASAL_AREA IN NUMBER P_MIN_HORIZONTAL_DISTANCE IN NUMBER P_MIN_PREF_STOCKING_STANDARD IN NUMBER P_MIN_POST_SPACING IN NUMBER P_MIN_STOCKING_STANDARD IN NUMBER P_MAX_POST_SPACING IN NUMBER P_MAX_CONIFER IN NUMBER P_HGHT_RELATIVE_TO_COMP IN NUMBER P_HGHT_RELATIVE_COMP_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID From ltstandardsRegimeIdgt or previous procedure

P_STOCKING_LAYER_CODE ltstockingLayerCodegt

P_STOCKING_LAYER_ID This value is returned

P_TARGET_STOCKING ltwellSpacedgt

P_RESIDUAL_BASAL_AREA ltresidualBasalAreagt

P_MIN_HORIZONTAL_DISTANCE ltminHorizontalDistancegt

P_PREF_STOCKING_STANDARD ltminPrefWellSpacedgt

P_MIN_POST_SPACING ltminPostSpacinggt

P_MIN_STOCKING_STANDARD ltminStockingStandardgt

P_MAX_POST_SPACING ltmaxPostSpacinggt

P_MAX_CONIFER ltmaxConifergt

P_HGHT_RELATIVE_COMP ltheightRelativeToCompgt

P_HGHT_RELATIVE_COMP_CODE ltheightRelativeToCompCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 17

348 RESULTS_XML_SUBMISSIONACCUMULATE_SPECIES

Call once for each StandardLayerSpecies within a StandardLayer

PROCEDURE ACCUMULATE_SPECIES (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_SPECIES_CODE IN VARCHAR2 P_STOCKING_LAYER_ID IN NUMBER P_PREFERRED_IND IN VARCHAR2 P_MIN_HEIGHT IN NUMBER P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt or previous procedure

P_STOCKING_LAYER_CODE STOCKING_LAYER_CODE from StandardLayer

P_SPECIES_CODE ltspeciesCodegt

P_STOCKING_LAYER_ID STOCKING_LAYER_ID from StandardLayer

P_STOCKING_STANDARD_UNIT_ID STOCKING_STANDARD_UNIT_ID from StandardLayer

P_PREFERRED_IND ltpreferredSpeciesIndgt

P_MIN_HEIGHT ltminHeightgt

P_SUBMITTED_BY Comes from file message from ESF

349 FSP_VALIDATE_XMLFSP_VALIDATION

Call after the the submission has been accumulated and no errors were returned FSP_VALIDATION is a procedure that calls a chain of other procedures that validate parts of the submission data The overall results are returned

FSP_VALIDATE_XMLVALIDATE_PLAN_HOLDER

BUSINESS RULES

At least one named licensee (forest client) forest licence pair in ltPlanHoldergt (Error 4 5 6)

That each named licensee actually exists and owns the licence listed

(Error 7)

FSP_VALIDATE_XMLVALIDATE_ORG_UNITS

BUSINESS RULES

At least one ltdistrictCodegt named (Error 8) Code resolves to a valid existing MoFR Forest District (Error 9)

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 18

FSP_VALIDATE_XMLVALIDATE_FSP

BUSINESS RULES

Ensure only a single ltForestStewardshipPlangt entity is included (Error 10)

Submission metadata ltlicenseeContactgt(Error 11)

ltemailAddressgt(Error 12) and lttelephoneNumbergt (Error 13) provided (no nulls)

Is this an original submission or an amendment (ltamendmentIndicatorgt)

(Error 14)

If original submission confirm o Plan name provided (Error 15) o Required document attached

FSP legal plan document (Error 1) o At least one ltForestDevelopmentUnitgt included (Error 16) o At least one ltStockingStandardgt included (Error 17)

ltfspIDgt (conditional) this is amendment or update

o If provided ensure a matching FSP_ID already exists in the database (Error 18)

o If existing FSP_ID status = ldquoApprovedrdquo this must be an amendment ensure that ltamendmentIndgt = ldquoTrdquo (Error 19)

o If existing FSP_ID status = ldquoRejectedrdquo this is a mistaken attempt to re-submit the same FSP (Error 20)

o If existing FSP_ID status = ldquoDraftrdquo this is an update anything submitted will overwrite existing FSP_ID record

ltplanNamegt (conditional)

o If provided and no ltfspIDgt provided this is a new submission Ensure that ltamendmentIndgt = lsquoFrsquo (Error 21)

ltplanTermgt (optional) if included is less than or equal to 5 (Error 22) ltplanStartDategt (optional) if included is valid date (Error 23) ltactionCodegt

o if ldquoNrdquo (New) Must be new FSP ensure no matching FSP_ID

FSP_AMENDMENT_NUMBER primary key already exists o if ldquoUrdquo (Update)

Must be existing FSP ensure a match to FSP_ID and FSP_AMENDMENT_NUMBER key exists

Existing FSP must be in ldquoDraftrdquo status o if ldquoArdquo (Append)

Must an existing FSP in ldquoDraftrdquo status Explicitly designed for appending GML map data to an

existing FSP

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 19

Must not already by any FOREST_DEVELOPMENT_UNIT entries for this FSP

ltamendmentIndgt (mandatory)

o Must be one of ldquoTrdquo or ldquoFrdquo (Error 24) o If ldquoTrdquo ensure ltfspIDgt provided and matches an existing FSP_ID in

the database (error 25) also ensure that the status of the existing FSP_ID = ldquoApprovedrdquo (error 26)

o If ldquoFrdquo and no ltfspIDgt provided this is a new submission o If ldquoFrdquo and ltfspIDgt provided must be an update ensure it

matches an existing FSP_ID with status = ldquoDraftrdquo (Error 27) ltamendmentApprovalRequiredIndgt (conditional)

o If ltamendmentIndgt is ldquotruerdquo must be included and set to one of ldquoTrdquo or ldquoFrdquo (Error 28)

FSP_VALIDATE_XMLVALIDATE_FDUS

BUSINESS RULES

Validate Geometry o polygon area gt 0 o polygon boundary length gt 0 o Other

Validate Identifier o ltfduNamegt must exist and not be null (Error 29) o ltfduNamegt must be unique within the FSP (no duplicates) (Error

30)

Validate Licences o Each FDU must have at least one forest licence applying (Error 31) o Each licence must be owned by one of the licensees listed for this

FSP ltplanHoldergtltlicenceNumbergt (Error 32)

FSP_VALIDATE_XMLVALIDATE_STANDARDS

BUSINESS RULES

Stocking Standards o For FSPs the stocking standard is nearly identical to the

ltStandardsAmendmentTypegt in the RESULTS schema with the following exceptions

The following elements from RESULTS ltStandardsTypegt have been added

ltbgcZonegt ltbgcSubzonegt ltbgcVariantgt ltbgcPhasegt ltbgcSiteSeriesgt ltbgcSiteTypegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 20

ltbgcSeralgt ltmaximumAllowableSoilDisturbancegt

o Therefore the equivalent Validation procedures from Results 30 can be used here with minor amendments

o FSP Stocking Standards do not have a spatial component and are not linked to any piece of ground

3410 FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

Call if no errors returned in any of the steps above PROCEDURE PROCESS_XML_SUBMISSION(

P_POST IN VARCHAR2 P_RESULTS OUT ref_results)

Procedure parameter Data Value P_POST Validate only indicator from fsp

submission metadata

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 21

The following diagram shows the decision points on how to process the submission depending on input parameters The pre-defined states refer procedures defined below

ltfspIDgt

Y

ltplanNamegt

N Error must havePlan name

N

fspID ==FSP_ID

Error UnknownFSP

N

FSP_IDSTATUS

Y

Error cannotUpdate or amend

RejectedSubmitted

ltamendmentIndgt

Approved

Error amendment requiredF

AmendApproval

Ind

T

AmendmentTo

Inbox

T

AmendmentAuto

Approve

UpdateExisting

PlanDraft

Create NewFSP

Y

End

End

End

FSP with same FSP_ID exists in database

FSP Submission

Validate

ESF FSPSubmissionAccumulate

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 22

3411 CREATE_NEW_FSP

This procedure will create a new ForestStewardshipPlan and all related entities in the production database

FOREST_STEWARDSHIP_PLAN TABLE

Source Destination FSP_SEQNEXTVAL FSP_ID 0 FSP_AMENDMENT_NUMBER STATUS for ldquoSubmittedrdquo FSP_STATUS_CODE ltplanNamegt PLAN_NAME ltplanTermYearsgt PLAN_TERM_YEARS ltplanTermCommencementgt PLAN_START_DATE ltplanTermCommencementgt + ltplanTermYearsgt

PLAN_END_DATE

ESF submission date PLAN_SUBMISSION_DATE ltlicenseeContactgt CONTACT_NAME lttelphoneNumbergt TELEPHONE_NUMBER ltemailAddressgt EMAIL_ADDRESS

FSP_AGREEMENT_HOLDER TABLE

Source Destination ltPlanHoldergtltclientCodegt CLIENT_NUMBER

FSP_ORG_UNIT TABLE

Source Destination ORG_UNITORG_UNIT_NO for ltdistrictCodegt

ORG_UNIT_NO

FSP_STATUS_HISTORY TABLE

Source Destination FSP_STATUS_HISTORY_SEQ FSP_STATUS_HISTORY_ID ldquoSubmittedrdquo code from FSP_STATUS_CODE

FSP_STATUS_CODE

ldquoNew Submissionrdquo STATUS_COMMENT

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 23

FSP_ATTACHMENT TABLE

Source Destination ESF framework ATTACHMENT_DESCRIPTION ATTACHMENT_NAME ATTACHMENT_SIZE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

3412 UPDATE_EXISTING_PLAN

For ESF submissions only the FDU map spatial component ltFDUPropertygt can be submitted as an update Part of the validation is to ensure that no other data is included with the ESF submission file except ltfspIDgt and ltFDUPropertygt This may be an INSERT or an UPDATE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination ltfspIDgt FSP_ID FOREST_STEWARDSHIP_PLAN FSP_AMENDMENT_NUMBER

FSP_AMENDMENT_NUMBER

FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 24

3413 AMENDMENT_AUTO_APPROVE

This is to create an amendment that does not require approval It is in effect a new FSP submission that automatically goes to ldquoApprovedrdquo status and increments the FSP_AMENDMENT_NUMBER Processing depends on what the licensee has submitted It may be one or more of

headeradministrative information (such as adding a new licensee) or amending a plan term

a new legal FSP document a new GML map of all the FDUs (spatial data if amended must be

completely replaced) new stocking standards

Process the data as if it were a new submission (see above) with the following exceptions

Do an INSERT INTO FOREST_STEWARDSHIP_PLAN setting FSP_AMENDMENT_NUMBER = MAX(FSP_AMENDMENT_NUMBER) + 1

Copy all fields from FOREST_STEWARDSHIP_PLAN from the most recent amendment (or the original submission record if no amendments)

UPDATE any fields in FOREST_STEWARSHIP_PLAN for this new entry that are provided in the XML submission that is any of ltplanNamegt ltplanTermYearsgt ltplanTermCommencementgt ltlicenseeContactgt lttelephoneNumbergt ltemailAddressgt

Any attachments must be INSERTed into FSP_ATTACHMENT with the new FSP_AMENDMENT_NUMBER (also FSP_ATTACHMENT_CONTENT)

Set FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoAPPRrdquo for this new record

INSERT INTO FSP_STATUS_HISTORY (FSP_STATUS_HISTORY_ID FSP_ID FSP_AMENDMENT_NUMBER FSP_STATUS_CODE STATUS_COMMENT) VALUES (SEQNEXTVAL ltFSP_IDgt ltnew FSP_AMENDMENT_NUMBERgt ldquoAPPRrdquo ltamendmentCommentgt) Be sure to use the new FSP_AMENDMENT_NUMBER in INSERTing any STANDARDS_REGIME or FOREST_DEVELOPMENT_UNIT records

3414 AMENDMENT_TO_INBOX

This is to create an amendment that requires approval The FSP submission is put in ldquoSubmittedrdquo status so that it will show up in the relevant District Inboxes The FSP_AMENDMENT_NUMBER is incremented Proceed as above (AMENDMENT_AUTO_INCREMENT) except

SET FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoSUBMrdquo (for Submitted)

SET FSP_STATUS_HISTORYSTATUS_CODE = ldquoSUBMrdquo for new record

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 25

35 DOMAIN CODES

The following codes will be set up in the database in static code tables (all fields are VARCHAR2)

FSP_STATUS_CODE TABLE

FSP_STATUS_CODE DESCRIPTION SUBM Submitted DRFT Draft APPR Approved REJ Rejected OTBH Opportunity To Be Heard

FSP_REVIEW_MILESTONE_TYPE_CODE TABLE

FSP_REVIEW_MILESTONE_ TYPE_CODE

DESCRIPTION

FNR First Nations Review CampE Results amp Strategies reviewed by CampE TEN Objectives Results amp Strategies reviewed by

Tenures DDM Sent to DDM for Determination OTHR Other

FSP_ATTACHMENT_TYPE_CODE TABLE

FSP_ATTACHMENT_TYPE_CODE DESCRIPTION FSP FSP legal document MAP Map of FDUs SS Stocking Standards report AMDS Amendment Description DDMD DDM Decision Letter OTHR Other Attachment

FEATURE_CLASSES TABLE

FEATURE_CLASS_SKEY DESCRIPTION FEATURE_CLASS_KEY To be defined

36 REPORTING ERRORS

If an error is detected in a submission it must be reported back to the electronic submission framework The method for doing that is to post a message to a queue detailing the submission number and the error message The licensee will be able to check back to the Electronic Submission WebSite and view the error The Electronic Submission Framework will also send an email to the client detailing the message

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 26

The specification for how to report an error can be found in the ESF Queue Agent Best Practices Document The message content for FSP will be a concatenation of the ltFSP Submission IDgt ltDescriptiongt field and the message returned from the validation routines above To send a message about a submission you will need to supply the FSP submission ID for the submission The FSP submission ID is supplied with the message from ESF and stored in the FSP_ELECTRONIC_SUBMISSION table Refer to the Status Agent in the ESF Queue Agent Best Practices document for details on how to send a message to ESF The following code is provided as a sample only and the final syntax should be from the ESF Queue Agent Best Practices Document StatusAgent sa = new StatusAgent (ldquoFSP Business Agentrdquo) sasendStatus (ltForestStewardshipPlanSubmissionIDgt StatusMessageREJECTED ldquo100rdquo ltForestStewardshipPlangtlt083D02800509gt + ldquofailedrdquo + outMessage) saclose() Note Expectation is that outmessage will contain details as to what part of the FSP failed (eg Tenure Forest Development Unit or Stocking Standard) In the case of invalid data processing stops at this point for the FSP No data for this submission will be added to FSP database

361 ERROR MESSAGES

These error messages may be generated during the accumulation validation and processing phases They are referenced by number in the procedure documentation above

1 A legal FSP document must be attached to this submission Please attach a document containing your Forest Stewardship Plan

2 The attached file ltnamegt does not have a recognizable file extension Atachments must be one of MSWord (doc) Portable Document Format (pdf) MS Excel (xls) ZIP archive (zip) or JPEG graphic (jpg) Please resubmit with appropriate file attachments

3 You do not have the proper authority to submit an FSP via ESF Please contact the appropriate MoFR District office to obtain the necessary ldquoSubmitterrdquo authority role

4 The FSP submitted does not name any plan holders At least one holder of a major BC Forest license must be named in the plan

5 No forest license number was found for a named plan holder You must name all forest licenses which apply within the FSP

6 A plan holderrsquos license number could not be verified Please check the validity of the plan holder MoFR client codes

7 A forest license number listed is not owned by any of the plan holders of this FSP Please check the validity of the plan holder MoFR client codes and their licence numbers

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 27

8 At least one BC Forest District must be listed for this FSP Each District responsible for the area included in the FSP must be listed

9 The MoFR District Code is not recognized Please check the spelling of the District code(s) included or check with the appropriate District office for the proper code

10 More than one Forest Stewardship Plan (FSP) was included in this submission At the present time each ESF submission may contain only a single FSP

11 The submission must include the name of a contact person responsible for communicating with MoFR about this FSP submission

12 The submission must include the email address of a contact person responsible for communicating with MoFR about this FSP submission

13 The submission must include the telephone number of a contact person responsible for communicating with MoFR about this FSP submission

14 The submission must indicate whether or not this is an original FSP or an amendment to an existing FSP

15 The FSP must have a name 16 The FSP must include at least one Forest Development Unit (FDU) 17 The FSP must include at least one Stocking Standard 18 This submission refers to an FSP that does not exist in the Ministryrsquos

database Please check the FSP ID number provided after your original submission

19 An FSP with the same FSP ID number already exists in the Ministryrsquos database yet you have not indicated that this is an amendment If the intention is to amend an existing FSP please include the correct FSP ID and make sure the ltamendmentIndgt flag is set to ldquotruerdquo

20 The FSP you are trying to amend has been rejected You cannot amend or replace a rejected FSP You must make a brand new submission When doing so do not include an FSP ID number

21 The submission appears to be a new FSP yet the amendment indicator is set to true (ltamendmentIndgt = ldquotruerdquo) Either provide an FSP ID to amend an existing FSP or set the amendment indicator to ldquofalserdquo

22 The FSP plan term has been set to greater than 5 years FSPs are valid for a maximum of 5 years unless an extension is approved

23 The plan commencement date provided is not valid 24 A value for ltamendmentIndgt must be provided it must be set to either ldquotruerdquo or ldquofalserdquo

25 The submission appears to be for an FSP amendment (ltamendmentIndgt = ldquotruerdquo) however no FSP is referenced Please be sure to include the FSP ID number provided with the original submission

26 You cannot amend an FSP that is not approved Ensure you have provided the correct FSP ID number issued with the original submission and confirm that the FSP is approved

27 An FSP with the same FSP ID number already exists in the database Before you can update this FSP it must be placed in Draft status by the District Manager

28 The submission appears to be an amendment to an existing FSP However you have not stated whether or not this amendment requires Ministry approval Please ensure that the ltamendmentApprovalRequiredIndgt is set to one of ldquotruerdquo or ldquofalserdquo

29 A Forest development Unit (FDU) was submitted without a name A name must be provided for each FDU

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 28

30 The same name has been provided for more than one Forest Development Unit (FDU) Each FDU in a submission must have a unique name

31 A Forest Development Unit (FDU) was submitted that did not list a forest licence number that applies Each FDU must have at least one license number applied

32 A forest license number was supplied that does not appear to be owned by any of the plan holders for this FSP Each Forest Development Unit (FDU) must be listed with at least one forest license owned by one of the plan holders for this FSP

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting

Page 15: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 15

P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt

P_STANDARDS_REGIME_NAME ltstandardsRegimeNamegt

P_STANDARDS_OBJECTIVE ltstandardsObjectivegt

P_REGEN_DELAY_OFFSET_YRS ltregenOffsetgt from regenObjectivesProperty

P_REGEN_OBLIGATION_IND ltregenObligationIndgt from regenObjectivesProperty

P_EARLY_OFFSET_YRS ltearlyOffsetgt from regenObjectivesProperty

P_LATE_OFFSET_YRS ltlateOffsetgt from regenObjectivesProperty

P_GEOGRAPHIC_DESCRIPTION ltgeographicDescriptiongt

P_ADDITIONAL_STANDARDS ltadditionalStandardsgt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 16

347 RESULTS_XML_SUBMISSIONACCUMULATE_STANDARDS_LAYER

For each StandardLayer within a Standards Regime call

PROCEDURE ACCUMULATE_STANDARDS_LAYER (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_STOCKING_LAYER_ID OUT NUMBER P_TARGET_STOCKING IN NUMBER P_RESIDUAL_BASAL_AREA IN NUMBER P_MIN_HORIZONTAL_DISTANCE IN NUMBER P_MIN_PREF_STOCKING_STANDARD IN NUMBER P_MIN_POST_SPACING IN NUMBER P_MIN_STOCKING_STANDARD IN NUMBER P_MAX_POST_SPACING IN NUMBER P_MAX_CONIFER IN NUMBER P_HGHT_RELATIVE_TO_COMP IN NUMBER P_HGHT_RELATIVE_COMP_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID From ltstandardsRegimeIdgt or previous procedure

P_STOCKING_LAYER_CODE ltstockingLayerCodegt

P_STOCKING_LAYER_ID This value is returned

P_TARGET_STOCKING ltwellSpacedgt

P_RESIDUAL_BASAL_AREA ltresidualBasalAreagt

P_MIN_HORIZONTAL_DISTANCE ltminHorizontalDistancegt

P_PREF_STOCKING_STANDARD ltminPrefWellSpacedgt

P_MIN_POST_SPACING ltminPostSpacinggt

P_MIN_STOCKING_STANDARD ltminStockingStandardgt

P_MAX_POST_SPACING ltmaxPostSpacinggt

P_MAX_CONIFER ltmaxConifergt

P_HGHT_RELATIVE_COMP ltheightRelativeToCompgt

P_HGHT_RELATIVE_COMP_CODE ltheightRelativeToCompCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 17

348 RESULTS_XML_SUBMISSIONACCUMULATE_SPECIES

Call once for each StandardLayerSpecies within a StandardLayer

PROCEDURE ACCUMULATE_SPECIES (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_SPECIES_CODE IN VARCHAR2 P_STOCKING_LAYER_ID IN NUMBER P_PREFERRED_IND IN VARCHAR2 P_MIN_HEIGHT IN NUMBER P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt or previous procedure

P_STOCKING_LAYER_CODE STOCKING_LAYER_CODE from StandardLayer

P_SPECIES_CODE ltspeciesCodegt

P_STOCKING_LAYER_ID STOCKING_LAYER_ID from StandardLayer

P_STOCKING_STANDARD_UNIT_ID STOCKING_STANDARD_UNIT_ID from StandardLayer

P_PREFERRED_IND ltpreferredSpeciesIndgt

P_MIN_HEIGHT ltminHeightgt

P_SUBMITTED_BY Comes from file message from ESF

349 FSP_VALIDATE_XMLFSP_VALIDATION

Call after the the submission has been accumulated and no errors were returned FSP_VALIDATION is a procedure that calls a chain of other procedures that validate parts of the submission data The overall results are returned

FSP_VALIDATE_XMLVALIDATE_PLAN_HOLDER

BUSINESS RULES

At least one named licensee (forest client) forest licence pair in ltPlanHoldergt (Error 4 5 6)

That each named licensee actually exists and owns the licence listed

(Error 7)

FSP_VALIDATE_XMLVALIDATE_ORG_UNITS

BUSINESS RULES

At least one ltdistrictCodegt named (Error 8) Code resolves to a valid existing MoFR Forest District (Error 9)

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 18

FSP_VALIDATE_XMLVALIDATE_FSP

BUSINESS RULES

Ensure only a single ltForestStewardshipPlangt entity is included (Error 10)

Submission metadata ltlicenseeContactgt(Error 11)

ltemailAddressgt(Error 12) and lttelephoneNumbergt (Error 13) provided (no nulls)

Is this an original submission or an amendment (ltamendmentIndicatorgt)

(Error 14)

If original submission confirm o Plan name provided (Error 15) o Required document attached

FSP legal plan document (Error 1) o At least one ltForestDevelopmentUnitgt included (Error 16) o At least one ltStockingStandardgt included (Error 17)

ltfspIDgt (conditional) this is amendment or update

o If provided ensure a matching FSP_ID already exists in the database (Error 18)

o If existing FSP_ID status = ldquoApprovedrdquo this must be an amendment ensure that ltamendmentIndgt = ldquoTrdquo (Error 19)

o If existing FSP_ID status = ldquoRejectedrdquo this is a mistaken attempt to re-submit the same FSP (Error 20)

o If existing FSP_ID status = ldquoDraftrdquo this is an update anything submitted will overwrite existing FSP_ID record

ltplanNamegt (conditional)

o If provided and no ltfspIDgt provided this is a new submission Ensure that ltamendmentIndgt = lsquoFrsquo (Error 21)

ltplanTermgt (optional) if included is less than or equal to 5 (Error 22) ltplanStartDategt (optional) if included is valid date (Error 23) ltactionCodegt

o if ldquoNrdquo (New) Must be new FSP ensure no matching FSP_ID

FSP_AMENDMENT_NUMBER primary key already exists o if ldquoUrdquo (Update)

Must be existing FSP ensure a match to FSP_ID and FSP_AMENDMENT_NUMBER key exists

Existing FSP must be in ldquoDraftrdquo status o if ldquoArdquo (Append)

Must an existing FSP in ldquoDraftrdquo status Explicitly designed for appending GML map data to an

existing FSP

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 19

Must not already by any FOREST_DEVELOPMENT_UNIT entries for this FSP

ltamendmentIndgt (mandatory)

o Must be one of ldquoTrdquo or ldquoFrdquo (Error 24) o If ldquoTrdquo ensure ltfspIDgt provided and matches an existing FSP_ID in

the database (error 25) also ensure that the status of the existing FSP_ID = ldquoApprovedrdquo (error 26)

o If ldquoFrdquo and no ltfspIDgt provided this is a new submission o If ldquoFrdquo and ltfspIDgt provided must be an update ensure it

matches an existing FSP_ID with status = ldquoDraftrdquo (Error 27) ltamendmentApprovalRequiredIndgt (conditional)

o If ltamendmentIndgt is ldquotruerdquo must be included and set to one of ldquoTrdquo or ldquoFrdquo (Error 28)

FSP_VALIDATE_XMLVALIDATE_FDUS

BUSINESS RULES

Validate Geometry o polygon area gt 0 o polygon boundary length gt 0 o Other

Validate Identifier o ltfduNamegt must exist and not be null (Error 29) o ltfduNamegt must be unique within the FSP (no duplicates) (Error

30)

Validate Licences o Each FDU must have at least one forest licence applying (Error 31) o Each licence must be owned by one of the licensees listed for this

FSP ltplanHoldergtltlicenceNumbergt (Error 32)

FSP_VALIDATE_XMLVALIDATE_STANDARDS

BUSINESS RULES

Stocking Standards o For FSPs the stocking standard is nearly identical to the

ltStandardsAmendmentTypegt in the RESULTS schema with the following exceptions

The following elements from RESULTS ltStandardsTypegt have been added

ltbgcZonegt ltbgcSubzonegt ltbgcVariantgt ltbgcPhasegt ltbgcSiteSeriesgt ltbgcSiteTypegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 20

ltbgcSeralgt ltmaximumAllowableSoilDisturbancegt

o Therefore the equivalent Validation procedures from Results 30 can be used here with minor amendments

o FSP Stocking Standards do not have a spatial component and are not linked to any piece of ground

3410 FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

Call if no errors returned in any of the steps above PROCEDURE PROCESS_XML_SUBMISSION(

P_POST IN VARCHAR2 P_RESULTS OUT ref_results)

Procedure parameter Data Value P_POST Validate only indicator from fsp

submission metadata

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 21

The following diagram shows the decision points on how to process the submission depending on input parameters The pre-defined states refer procedures defined below

ltfspIDgt

Y

ltplanNamegt

N Error must havePlan name

N

fspID ==FSP_ID

Error UnknownFSP

N

FSP_IDSTATUS

Y

Error cannotUpdate or amend

RejectedSubmitted

ltamendmentIndgt

Approved

Error amendment requiredF

AmendApproval

Ind

T

AmendmentTo

Inbox

T

AmendmentAuto

Approve

UpdateExisting

PlanDraft

Create NewFSP

Y

End

End

End

FSP with same FSP_ID exists in database

FSP Submission

Validate

ESF FSPSubmissionAccumulate

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 22

3411 CREATE_NEW_FSP

This procedure will create a new ForestStewardshipPlan and all related entities in the production database

FOREST_STEWARDSHIP_PLAN TABLE

Source Destination FSP_SEQNEXTVAL FSP_ID 0 FSP_AMENDMENT_NUMBER STATUS for ldquoSubmittedrdquo FSP_STATUS_CODE ltplanNamegt PLAN_NAME ltplanTermYearsgt PLAN_TERM_YEARS ltplanTermCommencementgt PLAN_START_DATE ltplanTermCommencementgt + ltplanTermYearsgt

PLAN_END_DATE

ESF submission date PLAN_SUBMISSION_DATE ltlicenseeContactgt CONTACT_NAME lttelphoneNumbergt TELEPHONE_NUMBER ltemailAddressgt EMAIL_ADDRESS

FSP_AGREEMENT_HOLDER TABLE

Source Destination ltPlanHoldergtltclientCodegt CLIENT_NUMBER

FSP_ORG_UNIT TABLE

Source Destination ORG_UNITORG_UNIT_NO for ltdistrictCodegt

ORG_UNIT_NO

FSP_STATUS_HISTORY TABLE

Source Destination FSP_STATUS_HISTORY_SEQ FSP_STATUS_HISTORY_ID ldquoSubmittedrdquo code from FSP_STATUS_CODE

FSP_STATUS_CODE

ldquoNew Submissionrdquo STATUS_COMMENT

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 23

FSP_ATTACHMENT TABLE

Source Destination ESF framework ATTACHMENT_DESCRIPTION ATTACHMENT_NAME ATTACHMENT_SIZE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

3412 UPDATE_EXISTING_PLAN

For ESF submissions only the FDU map spatial component ltFDUPropertygt can be submitted as an update Part of the validation is to ensure that no other data is included with the ESF submission file except ltfspIDgt and ltFDUPropertygt This may be an INSERT or an UPDATE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination ltfspIDgt FSP_ID FOREST_STEWARDSHIP_PLAN FSP_AMENDMENT_NUMBER

FSP_AMENDMENT_NUMBER

FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 24

3413 AMENDMENT_AUTO_APPROVE

This is to create an amendment that does not require approval It is in effect a new FSP submission that automatically goes to ldquoApprovedrdquo status and increments the FSP_AMENDMENT_NUMBER Processing depends on what the licensee has submitted It may be one or more of

headeradministrative information (such as adding a new licensee) or amending a plan term

a new legal FSP document a new GML map of all the FDUs (spatial data if amended must be

completely replaced) new stocking standards

Process the data as if it were a new submission (see above) with the following exceptions

Do an INSERT INTO FOREST_STEWARDSHIP_PLAN setting FSP_AMENDMENT_NUMBER = MAX(FSP_AMENDMENT_NUMBER) + 1

Copy all fields from FOREST_STEWARDSHIP_PLAN from the most recent amendment (or the original submission record if no amendments)

UPDATE any fields in FOREST_STEWARSHIP_PLAN for this new entry that are provided in the XML submission that is any of ltplanNamegt ltplanTermYearsgt ltplanTermCommencementgt ltlicenseeContactgt lttelephoneNumbergt ltemailAddressgt

Any attachments must be INSERTed into FSP_ATTACHMENT with the new FSP_AMENDMENT_NUMBER (also FSP_ATTACHMENT_CONTENT)

Set FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoAPPRrdquo for this new record

INSERT INTO FSP_STATUS_HISTORY (FSP_STATUS_HISTORY_ID FSP_ID FSP_AMENDMENT_NUMBER FSP_STATUS_CODE STATUS_COMMENT) VALUES (SEQNEXTVAL ltFSP_IDgt ltnew FSP_AMENDMENT_NUMBERgt ldquoAPPRrdquo ltamendmentCommentgt) Be sure to use the new FSP_AMENDMENT_NUMBER in INSERTing any STANDARDS_REGIME or FOREST_DEVELOPMENT_UNIT records

3414 AMENDMENT_TO_INBOX

This is to create an amendment that requires approval The FSP submission is put in ldquoSubmittedrdquo status so that it will show up in the relevant District Inboxes The FSP_AMENDMENT_NUMBER is incremented Proceed as above (AMENDMENT_AUTO_INCREMENT) except

SET FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoSUBMrdquo (for Submitted)

SET FSP_STATUS_HISTORYSTATUS_CODE = ldquoSUBMrdquo for new record

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 25

35 DOMAIN CODES

The following codes will be set up in the database in static code tables (all fields are VARCHAR2)

FSP_STATUS_CODE TABLE

FSP_STATUS_CODE DESCRIPTION SUBM Submitted DRFT Draft APPR Approved REJ Rejected OTBH Opportunity To Be Heard

FSP_REVIEW_MILESTONE_TYPE_CODE TABLE

FSP_REVIEW_MILESTONE_ TYPE_CODE

DESCRIPTION

FNR First Nations Review CampE Results amp Strategies reviewed by CampE TEN Objectives Results amp Strategies reviewed by

Tenures DDM Sent to DDM for Determination OTHR Other

FSP_ATTACHMENT_TYPE_CODE TABLE

FSP_ATTACHMENT_TYPE_CODE DESCRIPTION FSP FSP legal document MAP Map of FDUs SS Stocking Standards report AMDS Amendment Description DDMD DDM Decision Letter OTHR Other Attachment

FEATURE_CLASSES TABLE

FEATURE_CLASS_SKEY DESCRIPTION FEATURE_CLASS_KEY To be defined

36 REPORTING ERRORS

If an error is detected in a submission it must be reported back to the electronic submission framework The method for doing that is to post a message to a queue detailing the submission number and the error message The licensee will be able to check back to the Electronic Submission WebSite and view the error The Electronic Submission Framework will also send an email to the client detailing the message

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 26

The specification for how to report an error can be found in the ESF Queue Agent Best Practices Document The message content for FSP will be a concatenation of the ltFSP Submission IDgt ltDescriptiongt field and the message returned from the validation routines above To send a message about a submission you will need to supply the FSP submission ID for the submission The FSP submission ID is supplied with the message from ESF and stored in the FSP_ELECTRONIC_SUBMISSION table Refer to the Status Agent in the ESF Queue Agent Best Practices document for details on how to send a message to ESF The following code is provided as a sample only and the final syntax should be from the ESF Queue Agent Best Practices Document StatusAgent sa = new StatusAgent (ldquoFSP Business Agentrdquo) sasendStatus (ltForestStewardshipPlanSubmissionIDgt StatusMessageREJECTED ldquo100rdquo ltForestStewardshipPlangtlt083D02800509gt + ldquofailedrdquo + outMessage) saclose() Note Expectation is that outmessage will contain details as to what part of the FSP failed (eg Tenure Forest Development Unit or Stocking Standard) In the case of invalid data processing stops at this point for the FSP No data for this submission will be added to FSP database

361 ERROR MESSAGES

These error messages may be generated during the accumulation validation and processing phases They are referenced by number in the procedure documentation above

1 A legal FSP document must be attached to this submission Please attach a document containing your Forest Stewardship Plan

2 The attached file ltnamegt does not have a recognizable file extension Atachments must be one of MSWord (doc) Portable Document Format (pdf) MS Excel (xls) ZIP archive (zip) or JPEG graphic (jpg) Please resubmit with appropriate file attachments

3 You do not have the proper authority to submit an FSP via ESF Please contact the appropriate MoFR District office to obtain the necessary ldquoSubmitterrdquo authority role

4 The FSP submitted does not name any plan holders At least one holder of a major BC Forest license must be named in the plan

5 No forest license number was found for a named plan holder You must name all forest licenses which apply within the FSP

6 A plan holderrsquos license number could not be verified Please check the validity of the plan holder MoFR client codes

7 A forest license number listed is not owned by any of the plan holders of this FSP Please check the validity of the plan holder MoFR client codes and their licence numbers

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 27

8 At least one BC Forest District must be listed for this FSP Each District responsible for the area included in the FSP must be listed

9 The MoFR District Code is not recognized Please check the spelling of the District code(s) included or check with the appropriate District office for the proper code

10 More than one Forest Stewardship Plan (FSP) was included in this submission At the present time each ESF submission may contain only a single FSP

11 The submission must include the name of a contact person responsible for communicating with MoFR about this FSP submission

12 The submission must include the email address of a contact person responsible for communicating with MoFR about this FSP submission

13 The submission must include the telephone number of a contact person responsible for communicating with MoFR about this FSP submission

14 The submission must indicate whether or not this is an original FSP or an amendment to an existing FSP

15 The FSP must have a name 16 The FSP must include at least one Forest Development Unit (FDU) 17 The FSP must include at least one Stocking Standard 18 This submission refers to an FSP that does not exist in the Ministryrsquos

database Please check the FSP ID number provided after your original submission

19 An FSP with the same FSP ID number already exists in the Ministryrsquos database yet you have not indicated that this is an amendment If the intention is to amend an existing FSP please include the correct FSP ID and make sure the ltamendmentIndgt flag is set to ldquotruerdquo

20 The FSP you are trying to amend has been rejected You cannot amend or replace a rejected FSP You must make a brand new submission When doing so do not include an FSP ID number

21 The submission appears to be a new FSP yet the amendment indicator is set to true (ltamendmentIndgt = ldquotruerdquo) Either provide an FSP ID to amend an existing FSP or set the amendment indicator to ldquofalserdquo

22 The FSP plan term has been set to greater than 5 years FSPs are valid for a maximum of 5 years unless an extension is approved

23 The plan commencement date provided is not valid 24 A value for ltamendmentIndgt must be provided it must be set to either ldquotruerdquo or ldquofalserdquo

25 The submission appears to be for an FSP amendment (ltamendmentIndgt = ldquotruerdquo) however no FSP is referenced Please be sure to include the FSP ID number provided with the original submission

26 You cannot amend an FSP that is not approved Ensure you have provided the correct FSP ID number issued with the original submission and confirm that the FSP is approved

27 An FSP with the same FSP ID number already exists in the database Before you can update this FSP it must be placed in Draft status by the District Manager

28 The submission appears to be an amendment to an existing FSP However you have not stated whether or not this amendment requires Ministry approval Please ensure that the ltamendmentApprovalRequiredIndgt is set to one of ldquotruerdquo or ldquofalserdquo

29 A Forest development Unit (FDU) was submitted without a name A name must be provided for each FDU

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 28

30 The same name has been provided for more than one Forest Development Unit (FDU) Each FDU in a submission must have a unique name

31 A Forest Development Unit (FDU) was submitted that did not list a forest licence number that applies Each FDU must have at least one license number applied

32 A forest license number was supplied that does not appear to be owned by any of the plan holders for this FSP Each Forest Development Unit (FDU) must be listed with at least one forest license owned by one of the plan holders for this FSP

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting

Page 16: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 16

347 RESULTS_XML_SUBMISSIONACCUMULATE_STANDARDS_LAYER

For each StandardLayer within a Standards Regime call

PROCEDURE ACCUMULATE_STANDARDS_LAYER (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_STOCKING_LAYER_ID OUT NUMBER P_TARGET_STOCKING IN NUMBER P_RESIDUAL_BASAL_AREA IN NUMBER P_MIN_HORIZONTAL_DISTANCE IN NUMBER P_MIN_PREF_STOCKING_STANDARD IN NUMBER P_MIN_POST_SPACING IN NUMBER P_MIN_STOCKING_STANDARD IN NUMBER P_MAX_POST_SPACING IN NUMBER P_MAX_CONIFER IN NUMBER P_HGHT_RELATIVE_TO_COMP IN NUMBER P_HGHT_RELATIVE_COMP_CODE IN VARCHAR2 P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID From ltstandardsRegimeIdgt or previous procedure

P_STOCKING_LAYER_CODE ltstockingLayerCodegt

P_STOCKING_LAYER_ID This value is returned

P_TARGET_STOCKING ltwellSpacedgt

P_RESIDUAL_BASAL_AREA ltresidualBasalAreagt

P_MIN_HORIZONTAL_DISTANCE ltminHorizontalDistancegt

P_PREF_STOCKING_STANDARD ltminPrefWellSpacedgt

P_MIN_POST_SPACING ltminPostSpacinggt

P_MIN_STOCKING_STANDARD ltminStockingStandardgt

P_MAX_POST_SPACING ltmaxPostSpacinggt

P_MAX_CONIFER ltmaxConifergt

P_HGHT_RELATIVE_COMP ltheightRelativeToCompgt

P_HGHT_RELATIVE_COMP_CODE ltheightRelativeToCompCodegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 17

348 RESULTS_XML_SUBMISSIONACCUMULATE_SPECIES

Call once for each StandardLayerSpecies within a StandardLayer

PROCEDURE ACCUMULATE_SPECIES (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_SPECIES_CODE IN VARCHAR2 P_STOCKING_LAYER_ID IN NUMBER P_PREFERRED_IND IN VARCHAR2 P_MIN_HEIGHT IN NUMBER P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt or previous procedure

P_STOCKING_LAYER_CODE STOCKING_LAYER_CODE from StandardLayer

P_SPECIES_CODE ltspeciesCodegt

P_STOCKING_LAYER_ID STOCKING_LAYER_ID from StandardLayer

P_STOCKING_STANDARD_UNIT_ID STOCKING_STANDARD_UNIT_ID from StandardLayer

P_PREFERRED_IND ltpreferredSpeciesIndgt

P_MIN_HEIGHT ltminHeightgt

P_SUBMITTED_BY Comes from file message from ESF

349 FSP_VALIDATE_XMLFSP_VALIDATION

Call after the the submission has been accumulated and no errors were returned FSP_VALIDATION is a procedure that calls a chain of other procedures that validate parts of the submission data The overall results are returned

FSP_VALIDATE_XMLVALIDATE_PLAN_HOLDER

BUSINESS RULES

At least one named licensee (forest client) forest licence pair in ltPlanHoldergt (Error 4 5 6)

That each named licensee actually exists and owns the licence listed

(Error 7)

FSP_VALIDATE_XMLVALIDATE_ORG_UNITS

BUSINESS RULES

At least one ltdistrictCodegt named (Error 8) Code resolves to a valid existing MoFR Forest District (Error 9)

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 18

FSP_VALIDATE_XMLVALIDATE_FSP

BUSINESS RULES

Ensure only a single ltForestStewardshipPlangt entity is included (Error 10)

Submission metadata ltlicenseeContactgt(Error 11)

ltemailAddressgt(Error 12) and lttelephoneNumbergt (Error 13) provided (no nulls)

Is this an original submission or an amendment (ltamendmentIndicatorgt)

(Error 14)

If original submission confirm o Plan name provided (Error 15) o Required document attached

FSP legal plan document (Error 1) o At least one ltForestDevelopmentUnitgt included (Error 16) o At least one ltStockingStandardgt included (Error 17)

ltfspIDgt (conditional) this is amendment or update

o If provided ensure a matching FSP_ID already exists in the database (Error 18)

o If existing FSP_ID status = ldquoApprovedrdquo this must be an amendment ensure that ltamendmentIndgt = ldquoTrdquo (Error 19)

o If existing FSP_ID status = ldquoRejectedrdquo this is a mistaken attempt to re-submit the same FSP (Error 20)

o If existing FSP_ID status = ldquoDraftrdquo this is an update anything submitted will overwrite existing FSP_ID record

ltplanNamegt (conditional)

o If provided and no ltfspIDgt provided this is a new submission Ensure that ltamendmentIndgt = lsquoFrsquo (Error 21)

ltplanTermgt (optional) if included is less than or equal to 5 (Error 22) ltplanStartDategt (optional) if included is valid date (Error 23) ltactionCodegt

o if ldquoNrdquo (New) Must be new FSP ensure no matching FSP_ID

FSP_AMENDMENT_NUMBER primary key already exists o if ldquoUrdquo (Update)

Must be existing FSP ensure a match to FSP_ID and FSP_AMENDMENT_NUMBER key exists

Existing FSP must be in ldquoDraftrdquo status o if ldquoArdquo (Append)

Must an existing FSP in ldquoDraftrdquo status Explicitly designed for appending GML map data to an

existing FSP

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 19

Must not already by any FOREST_DEVELOPMENT_UNIT entries for this FSP

ltamendmentIndgt (mandatory)

o Must be one of ldquoTrdquo or ldquoFrdquo (Error 24) o If ldquoTrdquo ensure ltfspIDgt provided and matches an existing FSP_ID in

the database (error 25) also ensure that the status of the existing FSP_ID = ldquoApprovedrdquo (error 26)

o If ldquoFrdquo and no ltfspIDgt provided this is a new submission o If ldquoFrdquo and ltfspIDgt provided must be an update ensure it

matches an existing FSP_ID with status = ldquoDraftrdquo (Error 27) ltamendmentApprovalRequiredIndgt (conditional)

o If ltamendmentIndgt is ldquotruerdquo must be included and set to one of ldquoTrdquo or ldquoFrdquo (Error 28)

FSP_VALIDATE_XMLVALIDATE_FDUS

BUSINESS RULES

Validate Geometry o polygon area gt 0 o polygon boundary length gt 0 o Other

Validate Identifier o ltfduNamegt must exist and not be null (Error 29) o ltfduNamegt must be unique within the FSP (no duplicates) (Error

30)

Validate Licences o Each FDU must have at least one forest licence applying (Error 31) o Each licence must be owned by one of the licensees listed for this

FSP ltplanHoldergtltlicenceNumbergt (Error 32)

FSP_VALIDATE_XMLVALIDATE_STANDARDS

BUSINESS RULES

Stocking Standards o For FSPs the stocking standard is nearly identical to the

ltStandardsAmendmentTypegt in the RESULTS schema with the following exceptions

The following elements from RESULTS ltStandardsTypegt have been added

ltbgcZonegt ltbgcSubzonegt ltbgcVariantgt ltbgcPhasegt ltbgcSiteSeriesgt ltbgcSiteTypegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 20

ltbgcSeralgt ltmaximumAllowableSoilDisturbancegt

o Therefore the equivalent Validation procedures from Results 30 can be used here with minor amendments

o FSP Stocking Standards do not have a spatial component and are not linked to any piece of ground

3410 FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

Call if no errors returned in any of the steps above PROCEDURE PROCESS_XML_SUBMISSION(

P_POST IN VARCHAR2 P_RESULTS OUT ref_results)

Procedure parameter Data Value P_POST Validate only indicator from fsp

submission metadata

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 21

The following diagram shows the decision points on how to process the submission depending on input parameters The pre-defined states refer procedures defined below

ltfspIDgt

Y

ltplanNamegt

N Error must havePlan name

N

fspID ==FSP_ID

Error UnknownFSP

N

FSP_IDSTATUS

Y

Error cannotUpdate or amend

RejectedSubmitted

ltamendmentIndgt

Approved

Error amendment requiredF

AmendApproval

Ind

T

AmendmentTo

Inbox

T

AmendmentAuto

Approve

UpdateExisting

PlanDraft

Create NewFSP

Y

End

End

End

FSP with same FSP_ID exists in database

FSP Submission

Validate

ESF FSPSubmissionAccumulate

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 22

3411 CREATE_NEW_FSP

This procedure will create a new ForestStewardshipPlan and all related entities in the production database

FOREST_STEWARDSHIP_PLAN TABLE

Source Destination FSP_SEQNEXTVAL FSP_ID 0 FSP_AMENDMENT_NUMBER STATUS for ldquoSubmittedrdquo FSP_STATUS_CODE ltplanNamegt PLAN_NAME ltplanTermYearsgt PLAN_TERM_YEARS ltplanTermCommencementgt PLAN_START_DATE ltplanTermCommencementgt + ltplanTermYearsgt

PLAN_END_DATE

ESF submission date PLAN_SUBMISSION_DATE ltlicenseeContactgt CONTACT_NAME lttelphoneNumbergt TELEPHONE_NUMBER ltemailAddressgt EMAIL_ADDRESS

FSP_AGREEMENT_HOLDER TABLE

Source Destination ltPlanHoldergtltclientCodegt CLIENT_NUMBER

FSP_ORG_UNIT TABLE

Source Destination ORG_UNITORG_UNIT_NO for ltdistrictCodegt

ORG_UNIT_NO

FSP_STATUS_HISTORY TABLE

Source Destination FSP_STATUS_HISTORY_SEQ FSP_STATUS_HISTORY_ID ldquoSubmittedrdquo code from FSP_STATUS_CODE

FSP_STATUS_CODE

ldquoNew Submissionrdquo STATUS_COMMENT

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 23

FSP_ATTACHMENT TABLE

Source Destination ESF framework ATTACHMENT_DESCRIPTION ATTACHMENT_NAME ATTACHMENT_SIZE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

3412 UPDATE_EXISTING_PLAN

For ESF submissions only the FDU map spatial component ltFDUPropertygt can be submitted as an update Part of the validation is to ensure that no other data is included with the ESF submission file except ltfspIDgt and ltFDUPropertygt This may be an INSERT or an UPDATE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination ltfspIDgt FSP_ID FOREST_STEWARDSHIP_PLAN FSP_AMENDMENT_NUMBER

FSP_AMENDMENT_NUMBER

FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 24

3413 AMENDMENT_AUTO_APPROVE

This is to create an amendment that does not require approval It is in effect a new FSP submission that automatically goes to ldquoApprovedrdquo status and increments the FSP_AMENDMENT_NUMBER Processing depends on what the licensee has submitted It may be one or more of

headeradministrative information (such as adding a new licensee) or amending a plan term

a new legal FSP document a new GML map of all the FDUs (spatial data if amended must be

completely replaced) new stocking standards

Process the data as if it were a new submission (see above) with the following exceptions

Do an INSERT INTO FOREST_STEWARDSHIP_PLAN setting FSP_AMENDMENT_NUMBER = MAX(FSP_AMENDMENT_NUMBER) + 1

Copy all fields from FOREST_STEWARDSHIP_PLAN from the most recent amendment (or the original submission record if no amendments)

UPDATE any fields in FOREST_STEWARSHIP_PLAN for this new entry that are provided in the XML submission that is any of ltplanNamegt ltplanTermYearsgt ltplanTermCommencementgt ltlicenseeContactgt lttelephoneNumbergt ltemailAddressgt

Any attachments must be INSERTed into FSP_ATTACHMENT with the new FSP_AMENDMENT_NUMBER (also FSP_ATTACHMENT_CONTENT)

Set FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoAPPRrdquo for this new record

INSERT INTO FSP_STATUS_HISTORY (FSP_STATUS_HISTORY_ID FSP_ID FSP_AMENDMENT_NUMBER FSP_STATUS_CODE STATUS_COMMENT) VALUES (SEQNEXTVAL ltFSP_IDgt ltnew FSP_AMENDMENT_NUMBERgt ldquoAPPRrdquo ltamendmentCommentgt) Be sure to use the new FSP_AMENDMENT_NUMBER in INSERTing any STANDARDS_REGIME or FOREST_DEVELOPMENT_UNIT records

3414 AMENDMENT_TO_INBOX

This is to create an amendment that requires approval The FSP submission is put in ldquoSubmittedrdquo status so that it will show up in the relevant District Inboxes The FSP_AMENDMENT_NUMBER is incremented Proceed as above (AMENDMENT_AUTO_INCREMENT) except

SET FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoSUBMrdquo (for Submitted)

SET FSP_STATUS_HISTORYSTATUS_CODE = ldquoSUBMrdquo for new record

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 25

35 DOMAIN CODES

The following codes will be set up in the database in static code tables (all fields are VARCHAR2)

FSP_STATUS_CODE TABLE

FSP_STATUS_CODE DESCRIPTION SUBM Submitted DRFT Draft APPR Approved REJ Rejected OTBH Opportunity To Be Heard

FSP_REVIEW_MILESTONE_TYPE_CODE TABLE

FSP_REVIEW_MILESTONE_ TYPE_CODE

DESCRIPTION

FNR First Nations Review CampE Results amp Strategies reviewed by CampE TEN Objectives Results amp Strategies reviewed by

Tenures DDM Sent to DDM for Determination OTHR Other

FSP_ATTACHMENT_TYPE_CODE TABLE

FSP_ATTACHMENT_TYPE_CODE DESCRIPTION FSP FSP legal document MAP Map of FDUs SS Stocking Standards report AMDS Amendment Description DDMD DDM Decision Letter OTHR Other Attachment

FEATURE_CLASSES TABLE

FEATURE_CLASS_SKEY DESCRIPTION FEATURE_CLASS_KEY To be defined

36 REPORTING ERRORS

If an error is detected in a submission it must be reported back to the electronic submission framework The method for doing that is to post a message to a queue detailing the submission number and the error message The licensee will be able to check back to the Electronic Submission WebSite and view the error The Electronic Submission Framework will also send an email to the client detailing the message

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 26

The specification for how to report an error can be found in the ESF Queue Agent Best Practices Document The message content for FSP will be a concatenation of the ltFSP Submission IDgt ltDescriptiongt field and the message returned from the validation routines above To send a message about a submission you will need to supply the FSP submission ID for the submission The FSP submission ID is supplied with the message from ESF and stored in the FSP_ELECTRONIC_SUBMISSION table Refer to the Status Agent in the ESF Queue Agent Best Practices document for details on how to send a message to ESF The following code is provided as a sample only and the final syntax should be from the ESF Queue Agent Best Practices Document StatusAgent sa = new StatusAgent (ldquoFSP Business Agentrdquo) sasendStatus (ltForestStewardshipPlanSubmissionIDgt StatusMessageREJECTED ldquo100rdquo ltForestStewardshipPlangtlt083D02800509gt + ldquofailedrdquo + outMessage) saclose() Note Expectation is that outmessage will contain details as to what part of the FSP failed (eg Tenure Forest Development Unit or Stocking Standard) In the case of invalid data processing stops at this point for the FSP No data for this submission will be added to FSP database

361 ERROR MESSAGES

These error messages may be generated during the accumulation validation and processing phases They are referenced by number in the procedure documentation above

1 A legal FSP document must be attached to this submission Please attach a document containing your Forest Stewardship Plan

2 The attached file ltnamegt does not have a recognizable file extension Atachments must be one of MSWord (doc) Portable Document Format (pdf) MS Excel (xls) ZIP archive (zip) or JPEG graphic (jpg) Please resubmit with appropriate file attachments

3 You do not have the proper authority to submit an FSP via ESF Please contact the appropriate MoFR District office to obtain the necessary ldquoSubmitterrdquo authority role

4 The FSP submitted does not name any plan holders At least one holder of a major BC Forest license must be named in the plan

5 No forest license number was found for a named plan holder You must name all forest licenses which apply within the FSP

6 A plan holderrsquos license number could not be verified Please check the validity of the plan holder MoFR client codes

7 A forest license number listed is not owned by any of the plan holders of this FSP Please check the validity of the plan holder MoFR client codes and their licence numbers

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 27

8 At least one BC Forest District must be listed for this FSP Each District responsible for the area included in the FSP must be listed

9 The MoFR District Code is not recognized Please check the spelling of the District code(s) included or check with the appropriate District office for the proper code

10 More than one Forest Stewardship Plan (FSP) was included in this submission At the present time each ESF submission may contain only a single FSP

11 The submission must include the name of a contact person responsible for communicating with MoFR about this FSP submission

12 The submission must include the email address of a contact person responsible for communicating with MoFR about this FSP submission

13 The submission must include the telephone number of a contact person responsible for communicating with MoFR about this FSP submission

14 The submission must indicate whether or not this is an original FSP or an amendment to an existing FSP

15 The FSP must have a name 16 The FSP must include at least one Forest Development Unit (FDU) 17 The FSP must include at least one Stocking Standard 18 This submission refers to an FSP that does not exist in the Ministryrsquos

database Please check the FSP ID number provided after your original submission

19 An FSP with the same FSP ID number already exists in the Ministryrsquos database yet you have not indicated that this is an amendment If the intention is to amend an existing FSP please include the correct FSP ID and make sure the ltamendmentIndgt flag is set to ldquotruerdquo

20 The FSP you are trying to amend has been rejected You cannot amend or replace a rejected FSP You must make a brand new submission When doing so do not include an FSP ID number

21 The submission appears to be a new FSP yet the amendment indicator is set to true (ltamendmentIndgt = ldquotruerdquo) Either provide an FSP ID to amend an existing FSP or set the amendment indicator to ldquofalserdquo

22 The FSP plan term has been set to greater than 5 years FSPs are valid for a maximum of 5 years unless an extension is approved

23 The plan commencement date provided is not valid 24 A value for ltamendmentIndgt must be provided it must be set to either ldquotruerdquo or ldquofalserdquo

25 The submission appears to be for an FSP amendment (ltamendmentIndgt = ldquotruerdquo) however no FSP is referenced Please be sure to include the FSP ID number provided with the original submission

26 You cannot amend an FSP that is not approved Ensure you have provided the correct FSP ID number issued with the original submission and confirm that the FSP is approved

27 An FSP with the same FSP ID number already exists in the database Before you can update this FSP it must be placed in Draft status by the District Manager

28 The submission appears to be an amendment to an existing FSP However you have not stated whether or not this amendment requires Ministry approval Please ensure that the ltamendmentApprovalRequiredIndgt is set to one of ldquotruerdquo or ldquofalserdquo

29 A Forest development Unit (FDU) was submitted without a name A name must be provided for each FDU

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 28

30 The same name has been provided for more than one Forest Development Unit (FDU) Each FDU in a submission must have a unique name

31 A Forest Development Unit (FDU) was submitted that did not list a forest licence number that applies Each FDU must have at least one license number applied

32 A forest license number was supplied that does not appear to be owned by any of the plan holders for this FSP Each Forest Development Unit (FDU) must be listed with at least one forest license owned by one of the plan holders for this FSP

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting

Page 17: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 17

348 RESULTS_XML_SUBMISSIONACCUMULATE_SPECIES

Call once for each StandardLayerSpecies within a StandardLayer

PROCEDURE ACCUMULATE_SPECIES (P_STANDARDS_REGIME_ID IN NUMBER P_STOCKING_LAYER_CODE IN VARCHAR2 P_SPECIES_CODE IN VARCHAR2 P_STOCKING_LAYER_ID IN NUMBER P_PREFERRED_IND IN VARCHAR2 P_MIN_HEIGHT IN NUMBER P_ERROR_MESSAGE OUT VARCHAR2)

Procedure parameter Data Value P_STANDARDS_REGIME_ID ltstandardsRegimeIDgt or previous procedure

P_STOCKING_LAYER_CODE STOCKING_LAYER_CODE from StandardLayer

P_SPECIES_CODE ltspeciesCodegt

P_STOCKING_LAYER_ID STOCKING_LAYER_ID from StandardLayer

P_STOCKING_STANDARD_UNIT_ID STOCKING_STANDARD_UNIT_ID from StandardLayer

P_PREFERRED_IND ltpreferredSpeciesIndgt

P_MIN_HEIGHT ltminHeightgt

P_SUBMITTED_BY Comes from file message from ESF

349 FSP_VALIDATE_XMLFSP_VALIDATION

Call after the the submission has been accumulated and no errors were returned FSP_VALIDATION is a procedure that calls a chain of other procedures that validate parts of the submission data The overall results are returned

FSP_VALIDATE_XMLVALIDATE_PLAN_HOLDER

BUSINESS RULES

At least one named licensee (forest client) forest licence pair in ltPlanHoldergt (Error 4 5 6)

That each named licensee actually exists and owns the licence listed

(Error 7)

FSP_VALIDATE_XMLVALIDATE_ORG_UNITS

BUSINESS RULES

At least one ltdistrictCodegt named (Error 8) Code resolves to a valid existing MoFR Forest District (Error 9)

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 18

FSP_VALIDATE_XMLVALIDATE_FSP

BUSINESS RULES

Ensure only a single ltForestStewardshipPlangt entity is included (Error 10)

Submission metadata ltlicenseeContactgt(Error 11)

ltemailAddressgt(Error 12) and lttelephoneNumbergt (Error 13) provided (no nulls)

Is this an original submission or an amendment (ltamendmentIndicatorgt)

(Error 14)

If original submission confirm o Plan name provided (Error 15) o Required document attached

FSP legal plan document (Error 1) o At least one ltForestDevelopmentUnitgt included (Error 16) o At least one ltStockingStandardgt included (Error 17)

ltfspIDgt (conditional) this is amendment or update

o If provided ensure a matching FSP_ID already exists in the database (Error 18)

o If existing FSP_ID status = ldquoApprovedrdquo this must be an amendment ensure that ltamendmentIndgt = ldquoTrdquo (Error 19)

o If existing FSP_ID status = ldquoRejectedrdquo this is a mistaken attempt to re-submit the same FSP (Error 20)

o If existing FSP_ID status = ldquoDraftrdquo this is an update anything submitted will overwrite existing FSP_ID record

ltplanNamegt (conditional)

o If provided and no ltfspIDgt provided this is a new submission Ensure that ltamendmentIndgt = lsquoFrsquo (Error 21)

ltplanTermgt (optional) if included is less than or equal to 5 (Error 22) ltplanStartDategt (optional) if included is valid date (Error 23) ltactionCodegt

o if ldquoNrdquo (New) Must be new FSP ensure no matching FSP_ID

FSP_AMENDMENT_NUMBER primary key already exists o if ldquoUrdquo (Update)

Must be existing FSP ensure a match to FSP_ID and FSP_AMENDMENT_NUMBER key exists

Existing FSP must be in ldquoDraftrdquo status o if ldquoArdquo (Append)

Must an existing FSP in ldquoDraftrdquo status Explicitly designed for appending GML map data to an

existing FSP

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 19

Must not already by any FOREST_DEVELOPMENT_UNIT entries for this FSP

ltamendmentIndgt (mandatory)

o Must be one of ldquoTrdquo or ldquoFrdquo (Error 24) o If ldquoTrdquo ensure ltfspIDgt provided and matches an existing FSP_ID in

the database (error 25) also ensure that the status of the existing FSP_ID = ldquoApprovedrdquo (error 26)

o If ldquoFrdquo and no ltfspIDgt provided this is a new submission o If ldquoFrdquo and ltfspIDgt provided must be an update ensure it

matches an existing FSP_ID with status = ldquoDraftrdquo (Error 27) ltamendmentApprovalRequiredIndgt (conditional)

o If ltamendmentIndgt is ldquotruerdquo must be included and set to one of ldquoTrdquo or ldquoFrdquo (Error 28)

FSP_VALIDATE_XMLVALIDATE_FDUS

BUSINESS RULES

Validate Geometry o polygon area gt 0 o polygon boundary length gt 0 o Other

Validate Identifier o ltfduNamegt must exist and not be null (Error 29) o ltfduNamegt must be unique within the FSP (no duplicates) (Error

30)

Validate Licences o Each FDU must have at least one forest licence applying (Error 31) o Each licence must be owned by one of the licensees listed for this

FSP ltplanHoldergtltlicenceNumbergt (Error 32)

FSP_VALIDATE_XMLVALIDATE_STANDARDS

BUSINESS RULES

Stocking Standards o For FSPs the stocking standard is nearly identical to the

ltStandardsAmendmentTypegt in the RESULTS schema with the following exceptions

The following elements from RESULTS ltStandardsTypegt have been added

ltbgcZonegt ltbgcSubzonegt ltbgcVariantgt ltbgcPhasegt ltbgcSiteSeriesgt ltbgcSiteTypegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 20

ltbgcSeralgt ltmaximumAllowableSoilDisturbancegt

o Therefore the equivalent Validation procedures from Results 30 can be used here with minor amendments

o FSP Stocking Standards do not have a spatial component and are not linked to any piece of ground

3410 FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

Call if no errors returned in any of the steps above PROCEDURE PROCESS_XML_SUBMISSION(

P_POST IN VARCHAR2 P_RESULTS OUT ref_results)

Procedure parameter Data Value P_POST Validate only indicator from fsp

submission metadata

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 21

The following diagram shows the decision points on how to process the submission depending on input parameters The pre-defined states refer procedures defined below

ltfspIDgt

Y

ltplanNamegt

N Error must havePlan name

N

fspID ==FSP_ID

Error UnknownFSP

N

FSP_IDSTATUS

Y

Error cannotUpdate or amend

RejectedSubmitted

ltamendmentIndgt

Approved

Error amendment requiredF

AmendApproval

Ind

T

AmendmentTo

Inbox

T

AmendmentAuto

Approve

UpdateExisting

PlanDraft

Create NewFSP

Y

End

End

End

FSP with same FSP_ID exists in database

FSP Submission

Validate

ESF FSPSubmissionAccumulate

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 22

3411 CREATE_NEW_FSP

This procedure will create a new ForestStewardshipPlan and all related entities in the production database

FOREST_STEWARDSHIP_PLAN TABLE

Source Destination FSP_SEQNEXTVAL FSP_ID 0 FSP_AMENDMENT_NUMBER STATUS for ldquoSubmittedrdquo FSP_STATUS_CODE ltplanNamegt PLAN_NAME ltplanTermYearsgt PLAN_TERM_YEARS ltplanTermCommencementgt PLAN_START_DATE ltplanTermCommencementgt + ltplanTermYearsgt

PLAN_END_DATE

ESF submission date PLAN_SUBMISSION_DATE ltlicenseeContactgt CONTACT_NAME lttelphoneNumbergt TELEPHONE_NUMBER ltemailAddressgt EMAIL_ADDRESS

FSP_AGREEMENT_HOLDER TABLE

Source Destination ltPlanHoldergtltclientCodegt CLIENT_NUMBER

FSP_ORG_UNIT TABLE

Source Destination ORG_UNITORG_UNIT_NO for ltdistrictCodegt

ORG_UNIT_NO

FSP_STATUS_HISTORY TABLE

Source Destination FSP_STATUS_HISTORY_SEQ FSP_STATUS_HISTORY_ID ldquoSubmittedrdquo code from FSP_STATUS_CODE

FSP_STATUS_CODE

ldquoNew Submissionrdquo STATUS_COMMENT

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 23

FSP_ATTACHMENT TABLE

Source Destination ESF framework ATTACHMENT_DESCRIPTION ATTACHMENT_NAME ATTACHMENT_SIZE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

3412 UPDATE_EXISTING_PLAN

For ESF submissions only the FDU map spatial component ltFDUPropertygt can be submitted as an update Part of the validation is to ensure that no other data is included with the ESF submission file except ltfspIDgt and ltFDUPropertygt This may be an INSERT or an UPDATE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination ltfspIDgt FSP_ID FOREST_STEWARDSHIP_PLAN FSP_AMENDMENT_NUMBER

FSP_AMENDMENT_NUMBER

FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 24

3413 AMENDMENT_AUTO_APPROVE

This is to create an amendment that does not require approval It is in effect a new FSP submission that automatically goes to ldquoApprovedrdquo status and increments the FSP_AMENDMENT_NUMBER Processing depends on what the licensee has submitted It may be one or more of

headeradministrative information (such as adding a new licensee) or amending a plan term

a new legal FSP document a new GML map of all the FDUs (spatial data if amended must be

completely replaced) new stocking standards

Process the data as if it were a new submission (see above) with the following exceptions

Do an INSERT INTO FOREST_STEWARDSHIP_PLAN setting FSP_AMENDMENT_NUMBER = MAX(FSP_AMENDMENT_NUMBER) + 1

Copy all fields from FOREST_STEWARDSHIP_PLAN from the most recent amendment (or the original submission record if no amendments)

UPDATE any fields in FOREST_STEWARSHIP_PLAN for this new entry that are provided in the XML submission that is any of ltplanNamegt ltplanTermYearsgt ltplanTermCommencementgt ltlicenseeContactgt lttelephoneNumbergt ltemailAddressgt

Any attachments must be INSERTed into FSP_ATTACHMENT with the new FSP_AMENDMENT_NUMBER (also FSP_ATTACHMENT_CONTENT)

Set FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoAPPRrdquo for this new record

INSERT INTO FSP_STATUS_HISTORY (FSP_STATUS_HISTORY_ID FSP_ID FSP_AMENDMENT_NUMBER FSP_STATUS_CODE STATUS_COMMENT) VALUES (SEQNEXTVAL ltFSP_IDgt ltnew FSP_AMENDMENT_NUMBERgt ldquoAPPRrdquo ltamendmentCommentgt) Be sure to use the new FSP_AMENDMENT_NUMBER in INSERTing any STANDARDS_REGIME or FOREST_DEVELOPMENT_UNIT records

3414 AMENDMENT_TO_INBOX

This is to create an amendment that requires approval The FSP submission is put in ldquoSubmittedrdquo status so that it will show up in the relevant District Inboxes The FSP_AMENDMENT_NUMBER is incremented Proceed as above (AMENDMENT_AUTO_INCREMENT) except

SET FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoSUBMrdquo (for Submitted)

SET FSP_STATUS_HISTORYSTATUS_CODE = ldquoSUBMrdquo for new record

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 25

35 DOMAIN CODES

The following codes will be set up in the database in static code tables (all fields are VARCHAR2)

FSP_STATUS_CODE TABLE

FSP_STATUS_CODE DESCRIPTION SUBM Submitted DRFT Draft APPR Approved REJ Rejected OTBH Opportunity To Be Heard

FSP_REVIEW_MILESTONE_TYPE_CODE TABLE

FSP_REVIEW_MILESTONE_ TYPE_CODE

DESCRIPTION

FNR First Nations Review CampE Results amp Strategies reviewed by CampE TEN Objectives Results amp Strategies reviewed by

Tenures DDM Sent to DDM for Determination OTHR Other

FSP_ATTACHMENT_TYPE_CODE TABLE

FSP_ATTACHMENT_TYPE_CODE DESCRIPTION FSP FSP legal document MAP Map of FDUs SS Stocking Standards report AMDS Amendment Description DDMD DDM Decision Letter OTHR Other Attachment

FEATURE_CLASSES TABLE

FEATURE_CLASS_SKEY DESCRIPTION FEATURE_CLASS_KEY To be defined

36 REPORTING ERRORS

If an error is detected in a submission it must be reported back to the electronic submission framework The method for doing that is to post a message to a queue detailing the submission number and the error message The licensee will be able to check back to the Electronic Submission WebSite and view the error The Electronic Submission Framework will also send an email to the client detailing the message

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 26

The specification for how to report an error can be found in the ESF Queue Agent Best Practices Document The message content for FSP will be a concatenation of the ltFSP Submission IDgt ltDescriptiongt field and the message returned from the validation routines above To send a message about a submission you will need to supply the FSP submission ID for the submission The FSP submission ID is supplied with the message from ESF and stored in the FSP_ELECTRONIC_SUBMISSION table Refer to the Status Agent in the ESF Queue Agent Best Practices document for details on how to send a message to ESF The following code is provided as a sample only and the final syntax should be from the ESF Queue Agent Best Practices Document StatusAgent sa = new StatusAgent (ldquoFSP Business Agentrdquo) sasendStatus (ltForestStewardshipPlanSubmissionIDgt StatusMessageREJECTED ldquo100rdquo ltForestStewardshipPlangtlt083D02800509gt + ldquofailedrdquo + outMessage) saclose() Note Expectation is that outmessage will contain details as to what part of the FSP failed (eg Tenure Forest Development Unit or Stocking Standard) In the case of invalid data processing stops at this point for the FSP No data for this submission will be added to FSP database

361 ERROR MESSAGES

These error messages may be generated during the accumulation validation and processing phases They are referenced by number in the procedure documentation above

1 A legal FSP document must be attached to this submission Please attach a document containing your Forest Stewardship Plan

2 The attached file ltnamegt does not have a recognizable file extension Atachments must be one of MSWord (doc) Portable Document Format (pdf) MS Excel (xls) ZIP archive (zip) or JPEG graphic (jpg) Please resubmit with appropriate file attachments

3 You do not have the proper authority to submit an FSP via ESF Please contact the appropriate MoFR District office to obtain the necessary ldquoSubmitterrdquo authority role

4 The FSP submitted does not name any plan holders At least one holder of a major BC Forest license must be named in the plan

5 No forest license number was found for a named plan holder You must name all forest licenses which apply within the FSP

6 A plan holderrsquos license number could not be verified Please check the validity of the plan holder MoFR client codes

7 A forest license number listed is not owned by any of the plan holders of this FSP Please check the validity of the plan holder MoFR client codes and their licence numbers

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 27

8 At least one BC Forest District must be listed for this FSP Each District responsible for the area included in the FSP must be listed

9 The MoFR District Code is not recognized Please check the spelling of the District code(s) included or check with the appropriate District office for the proper code

10 More than one Forest Stewardship Plan (FSP) was included in this submission At the present time each ESF submission may contain only a single FSP

11 The submission must include the name of a contact person responsible for communicating with MoFR about this FSP submission

12 The submission must include the email address of a contact person responsible for communicating with MoFR about this FSP submission

13 The submission must include the telephone number of a contact person responsible for communicating with MoFR about this FSP submission

14 The submission must indicate whether or not this is an original FSP or an amendment to an existing FSP

15 The FSP must have a name 16 The FSP must include at least one Forest Development Unit (FDU) 17 The FSP must include at least one Stocking Standard 18 This submission refers to an FSP that does not exist in the Ministryrsquos

database Please check the FSP ID number provided after your original submission

19 An FSP with the same FSP ID number already exists in the Ministryrsquos database yet you have not indicated that this is an amendment If the intention is to amend an existing FSP please include the correct FSP ID and make sure the ltamendmentIndgt flag is set to ldquotruerdquo

20 The FSP you are trying to amend has been rejected You cannot amend or replace a rejected FSP You must make a brand new submission When doing so do not include an FSP ID number

21 The submission appears to be a new FSP yet the amendment indicator is set to true (ltamendmentIndgt = ldquotruerdquo) Either provide an FSP ID to amend an existing FSP or set the amendment indicator to ldquofalserdquo

22 The FSP plan term has been set to greater than 5 years FSPs are valid for a maximum of 5 years unless an extension is approved

23 The plan commencement date provided is not valid 24 A value for ltamendmentIndgt must be provided it must be set to either ldquotruerdquo or ldquofalserdquo

25 The submission appears to be for an FSP amendment (ltamendmentIndgt = ldquotruerdquo) however no FSP is referenced Please be sure to include the FSP ID number provided with the original submission

26 You cannot amend an FSP that is not approved Ensure you have provided the correct FSP ID number issued with the original submission and confirm that the FSP is approved

27 An FSP with the same FSP ID number already exists in the database Before you can update this FSP it must be placed in Draft status by the District Manager

28 The submission appears to be an amendment to an existing FSP However you have not stated whether or not this amendment requires Ministry approval Please ensure that the ltamendmentApprovalRequiredIndgt is set to one of ldquotruerdquo or ldquofalserdquo

29 A Forest development Unit (FDU) was submitted without a name A name must be provided for each FDU

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 28

30 The same name has been provided for more than one Forest Development Unit (FDU) Each FDU in a submission must have a unique name

31 A Forest Development Unit (FDU) was submitted that did not list a forest licence number that applies Each FDU must have at least one license number applied

32 A forest license number was supplied that does not appear to be owned by any of the plan holders for this FSP Each Forest Development Unit (FDU) must be listed with at least one forest license owned by one of the plan holders for this FSP

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting

Page 18: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 18

FSP_VALIDATE_XMLVALIDATE_FSP

BUSINESS RULES

Ensure only a single ltForestStewardshipPlangt entity is included (Error 10)

Submission metadata ltlicenseeContactgt(Error 11)

ltemailAddressgt(Error 12) and lttelephoneNumbergt (Error 13) provided (no nulls)

Is this an original submission or an amendment (ltamendmentIndicatorgt)

(Error 14)

If original submission confirm o Plan name provided (Error 15) o Required document attached

FSP legal plan document (Error 1) o At least one ltForestDevelopmentUnitgt included (Error 16) o At least one ltStockingStandardgt included (Error 17)

ltfspIDgt (conditional) this is amendment or update

o If provided ensure a matching FSP_ID already exists in the database (Error 18)

o If existing FSP_ID status = ldquoApprovedrdquo this must be an amendment ensure that ltamendmentIndgt = ldquoTrdquo (Error 19)

o If existing FSP_ID status = ldquoRejectedrdquo this is a mistaken attempt to re-submit the same FSP (Error 20)

o If existing FSP_ID status = ldquoDraftrdquo this is an update anything submitted will overwrite existing FSP_ID record

ltplanNamegt (conditional)

o If provided and no ltfspIDgt provided this is a new submission Ensure that ltamendmentIndgt = lsquoFrsquo (Error 21)

ltplanTermgt (optional) if included is less than or equal to 5 (Error 22) ltplanStartDategt (optional) if included is valid date (Error 23) ltactionCodegt

o if ldquoNrdquo (New) Must be new FSP ensure no matching FSP_ID

FSP_AMENDMENT_NUMBER primary key already exists o if ldquoUrdquo (Update)

Must be existing FSP ensure a match to FSP_ID and FSP_AMENDMENT_NUMBER key exists

Existing FSP must be in ldquoDraftrdquo status o if ldquoArdquo (Append)

Must an existing FSP in ldquoDraftrdquo status Explicitly designed for appending GML map data to an

existing FSP

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 19

Must not already by any FOREST_DEVELOPMENT_UNIT entries for this FSP

ltamendmentIndgt (mandatory)

o Must be one of ldquoTrdquo or ldquoFrdquo (Error 24) o If ldquoTrdquo ensure ltfspIDgt provided and matches an existing FSP_ID in

the database (error 25) also ensure that the status of the existing FSP_ID = ldquoApprovedrdquo (error 26)

o If ldquoFrdquo and no ltfspIDgt provided this is a new submission o If ldquoFrdquo and ltfspIDgt provided must be an update ensure it

matches an existing FSP_ID with status = ldquoDraftrdquo (Error 27) ltamendmentApprovalRequiredIndgt (conditional)

o If ltamendmentIndgt is ldquotruerdquo must be included and set to one of ldquoTrdquo or ldquoFrdquo (Error 28)

FSP_VALIDATE_XMLVALIDATE_FDUS

BUSINESS RULES

Validate Geometry o polygon area gt 0 o polygon boundary length gt 0 o Other

Validate Identifier o ltfduNamegt must exist and not be null (Error 29) o ltfduNamegt must be unique within the FSP (no duplicates) (Error

30)

Validate Licences o Each FDU must have at least one forest licence applying (Error 31) o Each licence must be owned by one of the licensees listed for this

FSP ltplanHoldergtltlicenceNumbergt (Error 32)

FSP_VALIDATE_XMLVALIDATE_STANDARDS

BUSINESS RULES

Stocking Standards o For FSPs the stocking standard is nearly identical to the

ltStandardsAmendmentTypegt in the RESULTS schema with the following exceptions

The following elements from RESULTS ltStandardsTypegt have been added

ltbgcZonegt ltbgcSubzonegt ltbgcVariantgt ltbgcPhasegt ltbgcSiteSeriesgt ltbgcSiteTypegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 20

ltbgcSeralgt ltmaximumAllowableSoilDisturbancegt

o Therefore the equivalent Validation procedures from Results 30 can be used here with minor amendments

o FSP Stocking Standards do not have a spatial component and are not linked to any piece of ground

3410 FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

Call if no errors returned in any of the steps above PROCEDURE PROCESS_XML_SUBMISSION(

P_POST IN VARCHAR2 P_RESULTS OUT ref_results)

Procedure parameter Data Value P_POST Validate only indicator from fsp

submission metadata

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 21

The following diagram shows the decision points on how to process the submission depending on input parameters The pre-defined states refer procedures defined below

ltfspIDgt

Y

ltplanNamegt

N Error must havePlan name

N

fspID ==FSP_ID

Error UnknownFSP

N

FSP_IDSTATUS

Y

Error cannotUpdate or amend

RejectedSubmitted

ltamendmentIndgt

Approved

Error amendment requiredF

AmendApproval

Ind

T

AmendmentTo

Inbox

T

AmendmentAuto

Approve

UpdateExisting

PlanDraft

Create NewFSP

Y

End

End

End

FSP with same FSP_ID exists in database

FSP Submission

Validate

ESF FSPSubmissionAccumulate

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 22

3411 CREATE_NEW_FSP

This procedure will create a new ForestStewardshipPlan and all related entities in the production database

FOREST_STEWARDSHIP_PLAN TABLE

Source Destination FSP_SEQNEXTVAL FSP_ID 0 FSP_AMENDMENT_NUMBER STATUS for ldquoSubmittedrdquo FSP_STATUS_CODE ltplanNamegt PLAN_NAME ltplanTermYearsgt PLAN_TERM_YEARS ltplanTermCommencementgt PLAN_START_DATE ltplanTermCommencementgt + ltplanTermYearsgt

PLAN_END_DATE

ESF submission date PLAN_SUBMISSION_DATE ltlicenseeContactgt CONTACT_NAME lttelphoneNumbergt TELEPHONE_NUMBER ltemailAddressgt EMAIL_ADDRESS

FSP_AGREEMENT_HOLDER TABLE

Source Destination ltPlanHoldergtltclientCodegt CLIENT_NUMBER

FSP_ORG_UNIT TABLE

Source Destination ORG_UNITORG_UNIT_NO for ltdistrictCodegt

ORG_UNIT_NO

FSP_STATUS_HISTORY TABLE

Source Destination FSP_STATUS_HISTORY_SEQ FSP_STATUS_HISTORY_ID ldquoSubmittedrdquo code from FSP_STATUS_CODE

FSP_STATUS_CODE

ldquoNew Submissionrdquo STATUS_COMMENT

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 23

FSP_ATTACHMENT TABLE

Source Destination ESF framework ATTACHMENT_DESCRIPTION ATTACHMENT_NAME ATTACHMENT_SIZE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

3412 UPDATE_EXISTING_PLAN

For ESF submissions only the FDU map spatial component ltFDUPropertygt can be submitted as an update Part of the validation is to ensure that no other data is included with the ESF submission file except ltfspIDgt and ltFDUPropertygt This may be an INSERT or an UPDATE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination ltfspIDgt FSP_ID FOREST_STEWARDSHIP_PLAN FSP_AMENDMENT_NUMBER

FSP_AMENDMENT_NUMBER

FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 24

3413 AMENDMENT_AUTO_APPROVE

This is to create an amendment that does not require approval It is in effect a new FSP submission that automatically goes to ldquoApprovedrdquo status and increments the FSP_AMENDMENT_NUMBER Processing depends on what the licensee has submitted It may be one or more of

headeradministrative information (such as adding a new licensee) or amending a plan term

a new legal FSP document a new GML map of all the FDUs (spatial data if amended must be

completely replaced) new stocking standards

Process the data as if it were a new submission (see above) with the following exceptions

Do an INSERT INTO FOREST_STEWARDSHIP_PLAN setting FSP_AMENDMENT_NUMBER = MAX(FSP_AMENDMENT_NUMBER) + 1

Copy all fields from FOREST_STEWARDSHIP_PLAN from the most recent amendment (or the original submission record if no amendments)

UPDATE any fields in FOREST_STEWARSHIP_PLAN for this new entry that are provided in the XML submission that is any of ltplanNamegt ltplanTermYearsgt ltplanTermCommencementgt ltlicenseeContactgt lttelephoneNumbergt ltemailAddressgt

Any attachments must be INSERTed into FSP_ATTACHMENT with the new FSP_AMENDMENT_NUMBER (also FSP_ATTACHMENT_CONTENT)

Set FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoAPPRrdquo for this new record

INSERT INTO FSP_STATUS_HISTORY (FSP_STATUS_HISTORY_ID FSP_ID FSP_AMENDMENT_NUMBER FSP_STATUS_CODE STATUS_COMMENT) VALUES (SEQNEXTVAL ltFSP_IDgt ltnew FSP_AMENDMENT_NUMBERgt ldquoAPPRrdquo ltamendmentCommentgt) Be sure to use the new FSP_AMENDMENT_NUMBER in INSERTing any STANDARDS_REGIME or FOREST_DEVELOPMENT_UNIT records

3414 AMENDMENT_TO_INBOX

This is to create an amendment that requires approval The FSP submission is put in ldquoSubmittedrdquo status so that it will show up in the relevant District Inboxes The FSP_AMENDMENT_NUMBER is incremented Proceed as above (AMENDMENT_AUTO_INCREMENT) except

SET FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoSUBMrdquo (for Submitted)

SET FSP_STATUS_HISTORYSTATUS_CODE = ldquoSUBMrdquo for new record

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 25

35 DOMAIN CODES

The following codes will be set up in the database in static code tables (all fields are VARCHAR2)

FSP_STATUS_CODE TABLE

FSP_STATUS_CODE DESCRIPTION SUBM Submitted DRFT Draft APPR Approved REJ Rejected OTBH Opportunity To Be Heard

FSP_REVIEW_MILESTONE_TYPE_CODE TABLE

FSP_REVIEW_MILESTONE_ TYPE_CODE

DESCRIPTION

FNR First Nations Review CampE Results amp Strategies reviewed by CampE TEN Objectives Results amp Strategies reviewed by

Tenures DDM Sent to DDM for Determination OTHR Other

FSP_ATTACHMENT_TYPE_CODE TABLE

FSP_ATTACHMENT_TYPE_CODE DESCRIPTION FSP FSP legal document MAP Map of FDUs SS Stocking Standards report AMDS Amendment Description DDMD DDM Decision Letter OTHR Other Attachment

FEATURE_CLASSES TABLE

FEATURE_CLASS_SKEY DESCRIPTION FEATURE_CLASS_KEY To be defined

36 REPORTING ERRORS

If an error is detected in a submission it must be reported back to the electronic submission framework The method for doing that is to post a message to a queue detailing the submission number and the error message The licensee will be able to check back to the Electronic Submission WebSite and view the error The Electronic Submission Framework will also send an email to the client detailing the message

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 26

The specification for how to report an error can be found in the ESF Queue Agent Best Practices Document The message content for FSP will be a concatenation of the ltFSP Submission IDgt ltDescriptiongt field and the message returned from the validation routines above To send a message about a submission you will need to supply the FSP submission ID for the submission The FSP submission ID is supplied with the message from ESF and stored in the FSP_ELECTRONIC_SUBMISSION table Refer to the Status Agent in the ESF Queue Agent Best Practices document for details on how to send a message to ESF The following code is provided as a sample only and the final syntax should be from the ESF Queue Agent Best Practices Document StatusAgent sa = new StatusAgent (ldquoFSP Business Agentrdquo) sasendStatus (ltForestStewardshipPlanSubmissionIDgt StatusMessageREJECTED ldquo100rdquo ltForestStewardshipPlangtlt083D02800509gt + ldquofailedrdquo + outMessage) saclose() Note Expectation is that outmessage will contain details as to what part of the FSP failed (eg Tenure Forest Development Unit or Stocking Standard) In the case of invalid data processing stops at this point for the FSP No data for this submission will be added to FSP database

361 ERROR MESSAGES

These error messages may be generated during the accumulation validation and processing phases They are referenced by number in the procedure documentation above

1 A legal FSP document must be attached to this submission Please attach a document containing your Forest Stewardship Plan

2 The attached file ltnamegt does not have a recognizable file extension Atachments must be one of MSWord (doc) Portable Document Format (pdf) MS Excel (xls) ZIP archive (zip) or JPEG graphic (jpg) Please resubmit with appropriate file attachments

3 You do not have the proper authority to submit an FSP via ESF Please contact the appropriate MoFR District office to obtain the necessary ldquoSubmitterrdquo authority role

4 The FSP submitted does not name any plan holders At least one holder of a major BC Forest license must be named in the plan

5 No forest license number was found for a named plan holder You must name all forest licenses which apply within the FSP

6 A plan holderrsquos license number could not be verified Please check the validity of the plan holder MoFR client codes

7 A forest license number listed is not owned by any of the plan holders of this FSP Please check the validity of the plan holder MoFR client codes and their licence numbers

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 27

8 At least one BC Forest District must be listed for this FSP Each District responsible for the area included in the FSP must be listed

9 The MoFR District Code is not recognized Please check the spelling of the District code(s) included or check with the appropriate District office for the proper code

10 More than one Forest Stewardship Plan (FSP) was included in this submission At the present time each ESF submission may contain only a single FSP

11 The submission must include the name of a contact person responsible for communicating with MoFR about this FSP submission

12 The submission must include the email address of a contact person responsible for communicating with MoFR about this FSP submission

13 The submission must include the telephone number of a contact person responsible for communicating with MoFR about this FSP submission

14 The submission must indicate whether or not this is an original FSP or an amendment to an existing FSP

15 The FSP must have a name 16 The FSP must include at least one Forest Development Unit (FDU) 17 The FSP must include at least one Stocking Standard 18 This submission refers to an FSP that does not exist in the Ministryrsquos

database Please check the FSP ID number provided after your original submission

19 An FSP with the same FSP ID number already exists in the Ministryrsquos database yet you have not indicated that this is an amendment If the intention is to amend an existing FSP please include the correct FSP ID and make sure the ltamendmentIndgt flag is set to ldquotruerdquo

20 The FSP you are trying to amend has been rejected You cannot amend or replace a rejected FSP You must make a brand new submission When doing so do not include an FSP ID number

21 The submission appears to be a new FSP yet the amendment indicator is set to true (ltamendmentIndgt = ldquotruerdquo) Either provide an FSP ID to amend an existing FSP or set the amendment indicator to ldquofalserdquo

22 The FSP plan term has been set to greater than 5 years FSPs are valid for a maximum of 5 years unless an extension is approved

23 The plan commencement date provided is not valid 24 A value for ltamendmentIndgt must be provided it must be set to either ldquotruerdquo or ldquofalserdquo

25 The submission appears to be for an FSP amendment (ltamendmentIndgt = ldquotruerdquo) however no FSP is referenced Please be sure to include the FSP ID number provided with the original submission

26 You cannot amend an FSP that is not approved Ensure you have provided the correct FSP ID number issued with the original submission and confirm that the FSP is approved

27 An FSP with the same FSP ID number already exists in the database Before you can update this FSP it must be placed in Draft status by the District Manager

28 The submission appears to be an amendment to an existing FSP However you have not stated whether or not this amendment requires Ministry approval Please ensure that the ltamendmentApprovalRequiredIndgt is set to one of ldquotruerdquo or ldquofalserdquo

29 A Forest development Unit (FDU) was submitted without a name A name must be provided for each FDU

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 28

30 The same name has been provided for more than one Forest Development Unit (FDU) Each FDU in a submission must have a unique name

31 A Forest Development Unit (FDU) was submitted that did not list a forest licence number that applies Each FDU must have at least one license number applied

32 A forest license number was supplied that does not appear to be owned by any of the plan holders for this FSP Each Forest Development Unit (FDU) must be listed with at least one forest license owned by one of the plan holders for this FSP

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting

Page 19: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 19

Must not already by any FOREST_DEVELOPMENT_UNIT entries for this FSP

ltamendmentIndgt (mandatory)

o Must be one of ldquoTrdquo or ldquoFrdquo (Error 24) o If ldquoTrdquo ensure ltfspIDgt provided and matches an existing FSP_ID in

the database (error 25) also ensure that the status of the existing FSP_ID = ldquoApprovedrdquo (error 26)

o If ldquoFrdquo and no ltfspIDgt provided this is a new submission o If ldquoFrdquo and ltfspIDgt provided must be an update ensure it

matches an existing FSP_ID with status = ldquoDraftrdquo (Error 27) ltamendmentApprovalRequiredIndgt (conditional)

o If ltamendmentIndgt is ldquotruerdquo must be included and set to one of ldquoTrdquo or ldquoFrdquo (Error 28)

FSP_VALIDATE_XMLVALIDATE_FDUS

BUSINESS RULES

Validate Geometry o polygon area gt 0 o polygon boundary length gt 0 o Other

Validate Identifier o ltfduNamegt must exist and not be null (Error 29) o ltfduNamegt must be unique within the FSP (no duplicates) (Error

30)

Validate Licences o Each FDU must have at least one forest licence applying (Error 31) o Each licence must be owned by one of the licensees listed for this

FSP ltplanHoldergtltlicenceNumbergt (Error 32)

FSP_VALIDATE_XMLVALIDATE_STANDARDS

BUSINESS RULES

Stocking Standards o For FSPs the stocking standard is nearly identical to the

ltStandardsAmendmentTypegt in the RESULTS schema with the following exceptions

The following elements from RESULTS ltStandardsTypegt have been added

ltbgcZonegt ltbgcSubzonegt ltbgcVariantgt ltbgcPhasegt ltbgcSiteSeriesgt ltbgcSiteTypegt

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 20

ltbgcSeralgt ltmaximumAllowableSoilDisturbancegt

o Therefore the equivalent Validation procedures from Results 30 can be used here with minor amendments

o FSP Stocking Standards do not have a spatial component and are not linked to any piece of ground

3410 FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

Call if no errors returned in any of the steps above PROCEDURE PROCESS_XML_SUBMISSION(

P_POST IN VARCHAR2 P_RESULTS OUT ref_results)

Procedure parameter Data Value P_POST Validate only indicator from fsp

submission metadata

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 21

The following diagram shows the decision points on how to process the submission depending on input parameters The pre-defined states refer procedures defined below

ltfspIDgt

Y

ltplanNamegt

N Error must havePlan name

N

fspID ==FSP_ID

Error UnknownFSP

N

FSP_IDSTATUS

Y

Error cannotUpdate or amend

RejectedSubmitted

ltamendmentIndgt

Approved

Error amendment requiredF

AmendApproval

Ind

T

AmendmentTo

Inbox

T

AmendmentAuto

Approve

UpdateExisting

PlanDraft

Create NewFSP

Y

End

End

End

FSP with same FSP_ID exists in database

FSP Submission

Validate

ESF FSPSubmissionAccumulate

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 22

3411 CREATE_NEW_FSP

This procedure will create a new ForestStewardshipPlan and all related entities in the production database

FOREST_STEWARDSHIP_PLAN TABLE

Source Destination FSP_SEQNEXTVAL FSP_ID 0 FSP_AMENDMENT_NUMBER STATUS for ldquoSubmittedrdquo FSP_STATUS_CODE ltplanNamegt PLAN_NAME ltplanTermYearsgt PLAN_TERM_YEARS ltplanTermCommencementgt PLAN_START_DATE ltplanTermCommencementgt + ltplanTermYearsgt

PLAN_END_DATE

ESF submission date PLAN_SUBMISSION_DATE ltlicenseeContactgt CONTACT_NAME lttelphoneNumbergt TELEPHONE_NUMBER ltemailAddressgt EMAIL_ADDRESS

FSP_AGREEMENT_HOLDER TABLE

Source Destination ltPlanHoldergtltclientCodegt CLIENT_NUMBER

FSP_ORG_UNIT TABLE

Source Destination ORG_UNITORG_UNIT_NO for ltdistrictCodegt

ORG_UNIT_NO

FSP_STATUS_HISTORY TABLE

Source Destination FSP_STATUS_HISTORY_SEQ FSP_STATUS_HISTORY_ID ldquoSubmittedrdquo code from FSP_STATUS_CODE

FSP_STATUS_CODE

ldquoNew Submissionrdquo STATUS_COMMENT

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 23

FSP_ATTACHMENT TABLE

Source Destination ESF framework ATTACHMENT_DESCRIPTION ATTACHMENT_NAME ATTACHMENT_SIZE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

3412 UPDATE_EXISTING_PLAN

For ESF submissions only the FDU map spatial component ltFDUPropertygt can be submitted as an update Part of the validation is to ensure that no other data is included with the ESF submission file except ltfspIDgt and ltFDUPropertygt This may be an INSERT or an UPDATE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination ltfspIDgt FSP_ID FOREST_STEWARDSHIP_PLAN FSP_AMENDMENT_NUMBER

FSP_AMENDMENT_NUMBER

FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 24

3413 AMENDMENT_AUTO_APPROVE

This is to create an amendment that does not require approval It is in effect a new FSP submission that automatically goes to ldquoApprovedrdquo status and increments the FSP_AMENDMENT_NUMBER Processing depends on what the licensee has submitted It may be one or more of

headeradministrative information (such as adding a new licensee) or amending a plan term

a new legal FSP document a new GML map of all the FDUs (spatial data if amended must be

completely replaced) new stocking standards

Process the data as if it were a new submission (see above) with the following exceptions

Do an INSERT INTO FOREST_STEWARDSHIP_PLAN setting FSP_AMENDMENT_NUMBER = MAX(FSP_AMENDMENT_NUMBER) + 1

Copy all fields from FOREST_STEWARDSHIP_PLAN from the most recent amendment (or the original submission record if no amendments)

UPDATE any fields in FOREST_STEWARSHIP_PLAN for this new entry that are provided in the XML submission that is any of ltplanNamegt ltplanTermYearsgt ltplanTermCommencementgt ltlicenseeContactgt lttelephoneNumbergt ltemailAddressgt

Any attachments must be INSERTed into FSP_ATTACHMENT with the new FSP_AMENDMENT_NUMBER (also FSP_ATTACHMENT_CONTENT)

Set FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoAPPRrdquo for this new record

INSERT INTO FSP_STATUS_HISTORY (FSP_STATUS_HISTORY_ID FSP_ID FSP_AMENDMENT_NUMBER FSP_STATUS_CODE STATUS_COMMENT) VALUES (SEQNEXTVAL ltFSP_IDgt ltnew FSP_AMENDMENT_NUMBERgt ldquoAPPRrdquo ltamendmentCommentgt) Be sure to use the new FSP_AMENDMENT_NUMBER in INSERTing any STANDARDS_REGIME or FOREST_DEVELOPMENT_UNIT records

3414 AMENDMENT_TO_INBOX

This is to create an amendment that requires approval The FSP submission is put in ldquoSubmittedrdquo status so that it will show up in the relevant District Inboxes The FSP_AMENDMENT_NUMBER is incremented Proceed as above (AMENDMENT_AUTO_INCREMENT) except

SET FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoSUBMrdquo (for Submitted)

SET FSP_STATUS_HISTORYSTATUS_CODE = ldquoSUBMrdquo for new record

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 25

35 DOMAIN CODES

The following codes will be set up in the database in static code tables (all fields are VARCHAR2)

FSP_STATUS_CODE TABLE

FSP_STATUS_CODE DESCRIPTION SUBM Submitted DRFT Draft APPR Approved REJ Rejected OTBH Opportunity To Be Heard

FSP_REVIEW_MILESTONE_TYPE_CODE TABLE

FSP_REVIEW_MILESTONE_ TYPE_CODE

DESCRIPTION

FNR First Nations Review CampE Results amp Strategies reviewed by CampE TEN Objectives Results amp Strategies reviewed by

Tenures DDM Sent to DDM for Determination OTHR Other

FSP_ATTACHMENT_TYPE_CODE TABLE

FSP_ATTACHMENT_TYPE_CODE DESCRIPTION FSP FSP legal document MAP Map of FDUs SS Stocking Standards report AMDS Amendment Description DDMD DDM Decision Letter OTHR Other Attachment

FEATURE_CLASSES TABLE

FEATURE_CLASS_SKEY DESCRIPTION FEATURE_CLASS_KEY To be defined

36 REPORTING ERRORS

If an error is detected in a submission it must be reported back to the electronic submission framework The method for doing that is to post a message to a queue detailing the submission number and the error message The licensee will be able to check back to the Electronic Submission WebSite and view the error The Electronic Submission Framework will also send an email to the client detailing the message

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 26

The specification for how to report an error can be found in the ESF Queue Agent Best Practices Document The message content for FSP will be a concatenation of the ltFSP Submission IDgt ltDescriptiongt field and the message returned from the validation routines above To send a message about a submission you will need to supply the FSP submission ID for the submission The FSP submission ID is supplied with the message from ESF and stored in the FSP_ELECTRONIC_SUBMISSION table Refer to the Status Agent in the ESF Queue Agent Best Practices document for details on how to send a message to ESF The following code is provided as a sample only and the final syntax should be from the ESF Queue Agent Best Practices Document StatusAgent sa = new StatusAgent (ldquoFSP Business Agentrdquo) sasendStatus (ltForestStewardshipPlanSubmissionIDgt StatusMessageREJECTED ldquo100rdquo ltForestStewardshipPlangtlt083D02800509gt + ldquofailedrdquo + outMessage) saclose() Note Expectation is that outmessage will contain details as to what part of the FSP failed (eg Tenure Forest Development Unit or Stocking Standard) In the case of invalid data processing stops at this point for the FSP No data for this submission will be added to FSP database

361 ERROR MESSAGES

These error messages may be generated during the accumulation validation and processing phases They are referenced by number in the procedure documentation above

1 A legal FSP document must be attached to this submission Please attach a document containing your Forest Stewardship Plan

2 The attached file ltnamegt does not have a recognizable file extension Atachments must be one of MSWord (doc) Portable Document Format (pdf) MS Excel (xls) ZIP archive (zip) or JPEG graphic (jpg) Please resubmit with appropriate file attachments

3 You do not have the proper authority to submit an FSP via ESF Please contact the appropriate MoFR District office to obtain the necessary ldquoSubmitterrdquo authority role

4 The FSP submitted does not name any plan holders At least one holder of a major BC Forest license must be named in the plan

5 No forest license number was found for a named plan holder You must name all forest licenses which apply within the FSP

6 A plan holderrsquos license number could not be verified Please check the validity of the plan holder MoFR client codes

7 A forest license number listed is not owned by any of the plan holders of this FSP Please check the validity of the plan holder MoFR client codes and their licence numbers

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 27

8 At least one BC Forest District must be listed for this FSP Each District responsible for the area included in the FSP must be listed

9 The MoFR District Code is not recognized Please check the spelling of the District code(s) included or check with the appropriate District office for the proper code

10 More than one Forest Stewardship Plan (FSP) was included in this submission At the present time each ESF submission may contain only a single FSP

11 The submission must include the name of a contact person responsible for communicating with MoFR about this FSP submission

12 The submission must include the email address of a contact person responsible for communicating with MoFR about this FSP submission

13 The submission must include the telephone number of a contact person responsible for communicating with MoFR about this FSP submission

14 The submission must indicate whether or not this is an original FSP or an amendment to an existing FSP

15 The FSP must have a name 16 The FSP must include at least one Forest Development Unit (FDU) 17 The FSP must include at least one Stocking Standard 18 This submission refers to an FSP that does not exist in the Ministryrsquos

database Please check the FSP ID number provided after your original submission

19 An FSP with the same FSP ID number already exists in the Ministryrsquos database yet you have not indicated that this is an amendment If the intention is to amend an existing FSP please include the correct FSP ID and make sure the ltamendmentIndgt flag is set to ldquotruerdquo

20 The FSP you are trying to amend has been rejected You cannot amend or replace a rejected FSP You must make a brand new submission When doing so do not include an FSP ID number

21 The submission appears to be a new FSP yet the amendment indicator is set to true (ltamendmentIndgt = ldquotruerdquo) Either provide an FSP ID to amend an existing FSP or set the amendment indicator to ldquofalserdquo

22 The FSP plan term has been set to greater than 5 years FSPs are valid for a maximum of 5 years unless an extension is approved

23 The plan commencement date provided is not valid 24 A value for ltamendmentIndgt must be provided it must be set to either ldquotruerdquo or ldquofalserdquo

25 The submission appears to be for an FSP amendment (ltamendmentIndgt = ldquotruerdquo) however no FSP is referenced Please be sure to include the FSP ID number provided with the original submission

26 You cannot amend an FSP that is not approved Ensure you have provided the correct FSP ID number issued with the original submission and confirm that the FSP is approved

27 An FSP with the same FSP ID number already exists in the database Before you can update this FSP it must be placed in Draft status by the District Manager

28 The submission appears to be an amendment to an existing FSP However you have not stated whether or not this amendment requires Ministry approval Please ensure that the ltamendmentApprovalRequiredIndgt is set to one of ldquotruerdquo or ldquofalserdquo

29 A Forest development Unit (FDU) was submitted without a name A name must be provided for each FDU

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 28

30 The same name has been provided for more than one Forest Development Unit (FDU) Each FDU in a submission must have a unique name

31 A Forest Development Unit (FDU) was submitted that did not list a forest licence number that applies Each FDU must have at least one license number applied

32 A forest license number was supplied that does not appear to be owned by any of the plan holders for this FSP Each Forest Development Unit (FDU) must be listed with at least one forest license owned by one of the plan holders for this FSP

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting

Page 20: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 20

ltbgcSeralgt ltmaximumAllowableSoilDisturbancegt

o Therefore the equivalent Validation procedures from Results 30 can be used here with minor amendments

o FSP Stocking Standards do not have a spatial component and are not linked to any piece of ground

3410 FSP_PROCESS_XMLPROCESS_XML_SUBMISSION

Call if no errors returned in any of the steps above PROCEDURE PROCESS_XML_SUBMISSION(

P_POST IN VARCHAR2 P_RESULTS OUT ref_results)

Procedure parameter Data Value P_POST Validate only indicator from fsp

submission metadata

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 21

The following diagram shows the decision points on how to process the submission depending on input parameters The pre-defined states refer procedures defined below

ltfspIDgt

Y

ltplanNamegt

N Error must havePlan name

N

fspID ==FSP_ID

Error UnknownFSP

N

FSP_IDSTATUS

Y

Error cannotUpdate or amend

RejectedSubmitted

ltamendmentIndgt

Approved

Error amendment requiredF

AmendApproval

Ind

T

AmendmentTo

Inbox

T

AmendmentAuto

Approve

UpdateExisting

PlanDraft

Create NewFSP

Y

End

End

End

FSP with same FSP_ID exists in database

FSP Submission

Validate

ESF FSPSubmissionAccumulate

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 22

3411 CREATE_NEW_FSP

This procedure will create a new ForestStewardshipPlan and all related entities in the production database

FOREST_STEWARDSHIP_PLAN TABLE

Source Destination FSP_SEQNEXTVAL FSP_ID 0 FSP_AMENDMENT_NUMBER STATUS for ldquoSubmittedrdquo FSP_STATUS_CODE ltplanNamegt PLAN_NAME ltplanTermYearsgt PLAN_TERM_YEARS ltplanTermCommencementgt PLAN_START_DATE ltplanTermCommencementgt + ltplanTermYearsgt

PLAN_END_DATE

ESF submission date PLAN_SUBMISSION_DATE ltlicenseeContactgt CONTACT_NAME lttelphoneNumbergt TELEPHONE_NUMBER ltemailAddressgt EMAIL_ADDRESS

FSP_AGREEMENT_HOLDER TABLE

Source Destination ltPlanHoldergtltclientCodegt CLIENT_NUMBER

FSP_ORG_UNIT TABLE

Source Destination ORG_UNITORG_UNIT_NO for ltdistrictCodegt

ORG_UNIT_NO

FSP_STATUS_HISTORY TABLE

Source Destination FSP_STATUS_HISTORY_SEQ FSP_STATUS_HISTORY_ID ldquoSubmittedrdquo code from FSP_STATUS_CODE

FSP_STATUS_CODE

ldquoNew Submissionrdquo STATUS_COMMENT

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 23

FSP_ATTACHMENT TABLE

Source Destination ESF framework ATTACHMENT_DESCRIPTION ATTACHMENT_NAME ATTACHMENT_SIZE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

3412 UPDATE_EXISTING_PLAN

For ESF submissions only the FDU map spatial component ltFDUPropertygt can be submitted as an update Part of the validation is to ensure that no other data is included with the ESF submission file except ltfspIDgt and ltFDUPropertygt This may be an INSERT or an UPDATE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination ltfspIDgt FSP_ID FOREST_STEWARDSHIP_PLAN FSP_AMENDMENT_NUMBER

FSP_AMENDMENT_NUMBER

FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 24

3413 AMENDMENT_AUTO_APPROVE

This is to create an amendment that does not require approval It is in effect a new FSP submission that automatically goes to ldquoApprovedrdquo status and increments the FSP_AMENDMENT_NUMBER Processing depends on what the licensee has submitted It may be one or more of

headeradministrative information (such as adding a new licensee) or amending a plan term

a new legal FSP document a new GML map of all the FDUs (spatial data if amended must be

completely replaced) new stocking standards

Process the data as if it were a new submission (see above) with the following exceptions

Do an INSERT INTO FOREST_STEWARDSHIP_PLAN setting FSP_AMENDMENT_NUMBER = MAX(FSP_AMENDMENT_NUMBER) + 1

Copy all fields from FOREST_STEWARDSHIP_PLAN from the most recent amendment (or the original submission record if no amendments)

UPDATE any fields in FOREST_STEWARSHIP_PLAN for this new entry that are provided in the XML submission that is any of ltplanNamegt ltplanTermYearsgt ltplanTermCommencementgt ltlicenseeContactgt lttelephoneNumbergt ltemailAddressgt

Any attachments must be INSERTed into FSP_ATTACHMENT with the new FSP_AMENDMENT_NUMBER (also FSP_ATTACHMENT_CONTENT)

Set FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoAPPRrdquo for this new record

INSERT INTO FSP_STATUS_HISTORY (FSP_STATUS_HISTORY_ID FSP_ID FSP_AMENDMENT_NUMBER FSP_STATUS_CODE STATUS_COMMENT) VALUES (SEQNEXTVAL ltFSP_IDgt ltnew FSP_AMENDMENT_NUMBERgt ldquoAPPRrdquo ltamendmentCommentgt) Be sure to use the new FSP_AMENDMENT_NUMBER in INSERTing any STANDARDS_REGIME or FOREST_DEVELOPMENT_UNIT records

3414 AMENDMENT_TO_INBOX

This is to create an amendment that requires approval The FSP submission is put in ldquoSubmittedrdquo status so that it will show up in the relevant District Inboxes The FSP_AMENDMENT_NUMBER is incremented Proceed as above (AMENDMENT_AUTO_INCREMENT) except

SET FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoSUBMrdquo (for Submitted)

SET FSP_STATUS_HISTORYSTATUS_CODE = ldquoSUBMrdquo for new record

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 25

35 DOMAIN CODES

The following codes will be set up in the database in static code tables (all fields are VARCHAR2)

FSP_STATUS_CODE TABLE

FSP_STATUS_CODE DESCRIPTION SUBM Submitted DRFT Draft APPR Approved REJ Rejected OTBH Opportunity To Be Heard

FSP_REVIEW_MILESTONE_TYPE_CODE TABLE

FSP_REVIEW_MILESTONE_ TYPE_CODE

DESCRIPTION

FNR First Nations Review CampE Results amp Strategies reviewed by CampE TEN Objectives Results amp Strategies reviewed by

Tenures DDM Sent to DDM for Determination OTHR Other

FSP_ATTACHMENT_TYPE_CODE TABLE

FSP_ATTACHMENT_TYPE_CODE DESCRIPTION FSP FSP legal document MAP Map of FDUs SS Stocking Standards report AMDS Amendment Description DDMD DDM Decision Letter OTHR Other Attachment

FEATURE_CLASSES TABLE

FEATURE_CLASS_SKEY DESCRIPTION FEATURE_CLASS_KEY To be defined

36 REPORTING ERRORS

If an error is detected in a submission it must be reported back to the electronic submission framework The method for doing that is to post a message to a queue detailing the submission number and the error message The licensee will be able to check back to the Electronic Submission WebSite and view the error The Electronic Submission Framework will also send an email to the client detailing the message

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 26

The specification for how to report an error can be found in the ESF Queue Agent Best Practices Document The message content for FSP will be a concatenation of the ltFSP Submission IDgt ltDescriptiongt field and the message returned from the validation routines above To send a message about a submission you will need to supply the FSP submission ID for the submission The FSP submission ID is supplied with the message from ESF and stored in the FSP_ELECTRONIC_SUBMISSION table Refer to the Status Agent in the ESF Queue Agent Best Practices document for details on how to send a message to ESF The following code is provided as a sample only and the final syntax should be from the ESF Queue Agent Best Practices Document StatusAgent sa = new StatusAgent (ldquoFSP Business Agentrdquo) sasendStatus (ltForestStewardshipPlanSubmissionIDgt StatusMessageREJECTED ldquo100rdquo ltForestStewardshipPlangtlt083D02800509gt + ldquofailedrdquo + outMessage) saclose() Note Expectation is that outmessage will contain details as to what part of the FSP failed (eg Tenure Forest Development Unit or Stocking Standard) In the case of invalid data processing stops at this point for the FSP No data for this submission will be added to FSP database

361 ERROR MESSAGES

These error messages may be generated during the accumulation validation and processing phases They are referenced by number in the procedure documentation above

1 A legal FSP document must be attached to this submission Please attach a document containing your Forest Stewardship Plan

2 The attached file ltnamegt does not have a recognizable file extension Atachments must be one of MSWord (doc) Portable Document Format (pdf) MS Excel (xls) ZIP archive (zip) or JPEG graphic (jpg) Please resubmit with appropriate file attachments

3 You do not have the proper authority to submit an FSP via ESF Please contact the appropriate MoFR District office to obtain the necessary ldquoSubmitterrdquo authority role

4 The FSP submitted does not name any plan holders At least one holder of a major BC Forest license must be named in the plan

5 No forest license number was found for a named plan holder You must name all forest licenses which apply within the FSP

6 A plan holderrsquos license number could not be verified Please check the validity of the plan holder MoFR client codes

7 A forest license number listed is not owned by any of the plan holders of this FSP Please check the validity of the plan holder MoFR client codes and their licence numbers

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 27

8 At least one BC Forest District must be listed for this FSP Each District responsible for the area included in the FSP must be listed

9 The MoFR District Code is not recognized Please check the spelling of the District code(s) included or check with the appropriate District office for the proper code

10 More than one Forest Stewardship Plan (FSP) was included in this submission At the present time each ESF submission may contain only a single FSP

11 The submission must include the name of a contact person responsible for communicating with MoFR about this FSP submission

12 The submission must include the email address of a contact person responsible for communicating with MoFR about this FSP submission

13 The submission must include the telephone number of a contact person responsible for communicating with MoFR about this FSP submission

14 The submission must indicate whether or not this is an original FSP or an amendment to an existing FSP

15 The FSP must have a name 16 The FSP must include at least one Forest Development Unit (FDU) 17 The FSP must include at least one Stocking Standard 18 This submission refers to an FSP that does not exist in the Ministryrsquos

database Please check the FSP ID number provided after your original submission

19 An FSP with the same FSP ID number already exists in the Ministryrsquos database yet you have not indicated that this is an amendment If the intention is to amend an existing FSP please include the correct FSP ID and make sure the ltamendmentIndgt flag is set to ldquotruerdquo

20 The FSP you are trying to amend has been rejected You cannot amend or replace a rejected FSP You must make a brand new submission When doing so do not include an FSP ID number

21 The submission appears to be a new FSP yet the amendment indicator is set to true (ltamendmentIndgt = ldquotruerdquo) Either provide an FSP ID to amend an existing FSP or set the amendment indicator to ldquofalserdquo

22 The FSP plan term has been set to greater than 5 years FSPs are valid for a maximum of 5 years unless an extension is approved

23 The plan commencement date provided is not valid 24 A value for ltamendmentIndgt must be provided it must be set to either ldquotruerdquo or ldquofalserdquo

25 The submission appears to be for an FSP amendment (ltamendmentIndgt = ldquotruerdquo) however no FSP is referenced Please be sure to include the FSP ID number provided with the original submission

26 You cannot amend an FSP that is not approved Ensure you have provided the correct FSP ID number issued with the original submission and confirm that the FSP is approved

27 An FSP with the same FSP ID number already exists in the database Before you can update this FSP it must be placed in Draft status by the District Manager

28 The submission appears to be an amendment to an existing FSP However you have not stated whether or not this amendment requires Ministry approval Please ensure that the ltamendmentApprovalRequiredIndgt is set to one of ldquotruerdquo or ldquofalserdquo

29 A Forest development Unit (FDU) was submitted without a name A name must be provided for each FDU

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 28

30 The same name has been provided for more than one Forest Development Unit (FDU) Each FDU in a submission must have a unique name

31 A Forest Development Unit (FDU) was submitted that did not list a forest licence number that applies Each FDU must have at least one license number applied

32 A forest license number was supplied that does not appear to be owned by any of the plan holders for this FSP Each Forest Development Unit (FDU) must be listed with at least one forest license owned by one of the plan holders for this FSP

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting

Page 21: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 21

The following diagram shows the decision points on how to process the submission depending on input parameters The pre-defined states refer procedures defined below

ltfspIDgt

Y

ltplanNamegt

N Error must havePlan name

N

fspID ==FSP_ID

Error UnknownFSP

N

FSP_IDSTATUS

Y

Error cannotUpdate or amend

RejectedSubmitted

ltamendmentIndgt

Approved

Error amendment requiredF

AmendApproval

Ind

T

AmendmentTo

Inbox

T

AmendmentAuto

Approve

UpdateExisting

PlanDraft

Create NewFSP

Y

End

End

End

FSP with same FSP_ID exists in database

FSP Submission

Validate

ESF FSPSubmissionAccumulate

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 22

3411 CREATE_NEW_FSP

This procedure will create a new ForestStewardshipPlan and all related entities in the production database

FOREST_STEWARDSHIP_PLAN TABLE

Source Destination FSP_SEQNEXTVAL FSP_ID 0 FSP_AMENDMENT_NUMBER STATUS for ldquoSubmittedrdquo FSP_STATUS_CODE ltplanNamegt PLAN_NAME ltplanTermYearsgt PLAN_TERM_YEARS ltplanTermCommencementgt PLAN_START_DATE ltplanTermCommencementgt + ltplanTermYearsgt

PLAN_END_DATE

ESF submission date PLAN_SUBMISSION_DATE ltlicenseeContactgt CONTACT_NAME lttelphoneNumbergt TELEPHONE_NUMBER ltemailAddressgt EMAIL_ADDRESS

FSP_AGREEMENT_HOLDER TABLE

Source Destination ltPlanHoldergtltclientCodegt CLIENT_NUMBER

FSP_ORG_UNIT TABLE

Source Destination ORG_UNITORG_UNIT_NO for ltdistrictCodegt

ORG_UNIT_NO

FSP_STATUS_HISTORY TABLE

Source Destination FSP_STATUS_HISTORY_SEQ FSP_STATUS_HISTORY_ID ldquoSubmittedrdquo code from FSP_STATUS_CODE

FSP_STATUS_CODE

ldquoNew Submissionrdquo STATUS_COMMENT

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 23

FSP_ATTACHMENT TABLE

Source Destination ESF framework ATTACHMENT_DESCRIPTION ATTACHMENT_NAME ATTACHMENT_SIZE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

3412 UPDATE_EXISTING_PLAN

For ESF submissions only the FDU map spatial component ltFDUPropertygt can be submitted as an update Part of the validation is to ensure that no other data is included with the ESF submission file except ltfspIDgt and ltFDUPropertygt This may be an INSERT or an UPDATE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination ltfspIDgt FSP_ID FOREST_STEWARDSHIP_PLAN FSP_AMENDMENT_NUMBER

FSP_AMENDMENT_NUMBER

FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 24

3413 AMENDMENT_AUTO_APPROVE

This is to create an amendment that does not require approval It is in effect a new FSP submission that automatically goes to ldquoApprovedrdquo status and increments the FSP_AMENDMENT_NUMBER Processing depends on what the licensee has submitted It may be one or more of

headeradministrative information (such as adding a new licensee) or amending a plan term

a new legal FSP document a new GML map of all the FDUs (spatial data if amended must be

completely replaced) new stocking standards

Process the data as if it were a new submission (see above) with the following exceptions

Do an INSERT INTO FOREST_STEWARDSHIP_PLAN setting FSP_AMENDMENT_NUMBER = MAX(FSP_AMENDMENT_NUMBER) + 1

Copy all fields from FOREST_STEWARDSHIP_PLAN from the most recent amendment (or the original submission record if no amendments)

UPDATE any fields in FOREST_STEWARSHIP_PLAN for this new entry that are provided in the XML submission that is any of ltplanNamegt ltplanTermYearsgt ltplanTermCommencementgt ltlicenseeContactgt lttelephoneNumbergt ltemailAddressgt

Any attachments must be INSERTed into FSP_ATTACHMENT with the new FSP_AMENDMENT_NUMBER (also FSP_ATTACHMENT_CONTENT)

Set FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoAPPRrdquo for this new record

INSERT INTO FSP_STATUS_HISTORY (FSP_STATUS_HISTORY_ID FSP_ID FSP_AMENDMENT_NUMBER FSP_STATUS_CODE STATUS_COMMENT) VALUES (SEQNEXTVAL ltFSP_IDgt ltnew FSP_AMENDMENT_NUMBERgt ldquoAPPRrdquo ltamendmentCommentgt) Be sure to use the new FSP_AMENDMENT_NUMBER in INSERTing any STANDARDS_REGIME or FOREST_DEVELOPMENT_UNIT records

3414 AMENDMENT_TO_INBOX

This is to create an amendment that requires approval The FSP submission is put in ldquoSubmittedrdquo status so that it will show up in the relevant District Inboxes The FSP_AMENDMENT_NUMBER is incremented Proceed as above (AMENDMENT_AUTO_INCREMENT) except

SET FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoSUBMrdquo (for Submitted)

SET FSP_STATUS_HISTORYSTATUS_CODE = ldquoSUBMrdquo for new record

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 25

35 DOMAIN CODES

The following codes will be set up in the database in static code tables (all fields are VARCHAR2)

FSP_STATUS_CODE TABLE

FSP_STATUS_CODE DESCRIPTION SUBM Submitted DRFT Draft APPR Approved REJ Rejected OTBH Opportunity To Be Heard

FSP_REVIEW_MILESTONE_TYPE_CODE TABLE

FSP_REVIEW_MILESTONE_ TYPE_CODE

DESCRIPTION

FNR First Nations Review CampE Results amp Strategies reviewed by CampE TEN Objectives Results amp Strategies reviewed by

Tenures DDM Sent to DDM for Determination OTHR Other

FSP_ATTACHMENT_TYPE_CODE TABLE

FSP_ATTACHMENT_TYPE_CODE DESCRIPTION FSP FSP legal document MAP Map of FDUs SS Stocking Standards report AMDS Amendment Description DDMD DDM Decision Letter OTHR Other Attachment

FEATURE_CLASSES TABLE

FEATURE_CLASS_SKEY DESCRIPTION FEATURE_CLASS_KEY To be defined

36 REPORTING ERRORS

If an error is detected in a submission it must be reported back to the electronic submission framework The method for doing that is to post a message to a queue detailing the submission number and the error message The licensee will be able to check back to the Electronic Submission WebSite and view the error The Electronic Submission Framework will also send an email to the client detailing the message

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 26

The specification for how to report an error can be found in the ESF Queue Agent Best Practices Document The message content for FSP will be a concatenation of the ltFSP Submission IDgt ltDescriptiongt field and the message returned from the validation routines above To send a message about a submission you will need to supply the FSP submission ID for the submission The FSP submission ID is supplied with the message from ESF and stored in the FSP_ELECTRONIC_SUBMISSION table Refer to the Status Agent in the ESF Queue Agent Best Practices document for details on how to send a message to ESF The following code is provided as a sample only and the final syntax should be from the ESF Queue Agent Best Practices Document StatusAgent sa = new StatusAgent (ldquoFSP Business Agentrdquo) sasendStatus (ltForestStewardshipPlanSubmissionIDgt StatusMessageREJECTED ldquo100rdquo ltForestStewardshipPlangtlt083D02800509gt + ldquofailedrdquo + outMessage) saclose() Note Expectation is that outmessage will contain details as to what part of the FSP failed (eg Tenure Forest Development Unit or Stocking Standard) In the case of invalid data processing stops at this point for the FSP No data for this submission will be added to FSP database

361 ERROR MESSAGES

These error messages may be generated during the accumulation validation and processing phases They are referenced by number in the procedure documentation above

1 A legal FSP document must be attached to this submission Please attach a document containing your Forest Stewardship Plan

2 The attached file ltnamegt does not have a recognizable file extension Atachments must be one of MSWord (doc) Portable Document Format (pdf) MS Excel (xls) ZIP archive (zip) or JPEG graphic (jpg) Please resubmit with appropriate file attachments

3 You do not have the proper authority to submit an FSP via ESF Please contact the appropriate MoFR District office to obtain the necessary ldquoSubmitterrdquo authority role

4 The FSP submitted does not name any plan holders At least one holder of a major BC Forest license must be named in the plan

5 No forest license number was found for a named plan holder You must name all forest licenses which apply within the FSP

6 A plan holderrsquos license number could not be verified Please check the validity of the plan holder MoFR client codes

7 A forest license number listed is not owned by any of the plan holders of this FSP Please check the validity of the plan holder MoFR client codes and their licence numbers

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 27

8 At least one BC Forest District must be listed for this FSP Each District responsible for the area included in the FSP must be listed

9 The MoFR District Code is not recognized Please check the spelling of the District code(s) included or check with the appropriate District office for the proper code

10 More than one Forest Stewardship Plan (FSP) was included in this submission At the present time each ESF submission may contain only a single FSP

11 The submission must include the name of a contact person responsible for communicating with MoFR about this FSP submission

12 The submission must include the email address of a contact person responsible for communicating with MoFR about this FSP submission

13 The submission must include the telephone number of a contact person responsible for communicating with MoFR about this FSP submission

14 The submission must indicate whether or not this is an original FSP or an amendment to an existing FSP

15 The FSP must have a name 16 The FSP must include at least one Forest Development Unit (FDU) 17 The FSP must include at least one Stocking Standard 18 This submission refers to an FSP that does not exist in the Ministryrsquos

database Please check the FSP ID number provided after your original submission

19 An FSP with the same FSP ID number already exists in the Ministryrsquos database yet you have not indicated that this is an amendment If the intention is to amend an existing FSP please include the correct FSP ID and make sure the ltamendmentIndgt flag is set to ldquotruerdquo

20 The FSP you are trying to amend has been rejected You cannot amend or replace a rejected FSP You must make a brand new submission When doing so do not include an FSP ID number

21 The submission appears to be a new FSP yet the amendment indicator is set to true (ltamendmentIndgt = ldquotruerdquo) Either provide an FSP ID to amend an existing FSP or set the amendment indicator to ldquofalserdquo

22 The FSP plan term has been set to greater than 5 years FSPs are valid for a maximum of 5 years unless an extension is approved

23 The plan commencement date provided is not valid 24 A value for ltamendmentIndgt must be provided it must be set to either ldquotruerdquo or ldquofalserdquo

25 The submission appears to be for an FSP amendment (ltamendmentIndgt = ldquotruerdquo) however no FSP is referenced Please be sure to include the FSP ID number provided with the original submission

26 You cannot amend an FSP that is not approved Ensure you have provided the correct FSP ID number issued with the original submission and confirm that the FSP is approved

27 An FSP with the same FSP ID number already exists in the database Before you can update this FSP it must be placed in Draft status by the District Manager

28 The submission appears to be an amendment to an existing FSP However you have not stated whether or not this amendment requires Ministry approval Please ensure that the ltamendmentApprovalRequiredIndgt is set to one of ldquotruerdquo or ldquofalserdquo

29 A Forest development Unit (FDU) was submitted without a name A name must be provided for each FDU

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 28

30 The same name has been provided for more than one Forest Development Unit (FDU) Each FDU in a submission must have a unique name

31 A Forest Development Unit (FDU) was submitted that did not list a forest licence number that applies Each FDU must have at least one license number applied

32 A forest license number was supplied that does not appear to be owned by any of the plan holders for this FSP Each Forest Development Unit (FDU) must be listed with at least one forest license owned by one of the plan holders for this FSP

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting

Page 22: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 22

3411 CREATE_NEW_FSP

This procedure will create a new ForestStewardshipPlan and all related entities in the production database

FOREST_STEWARDSHIP_PLAN TABLE

Source Destination FSP_SEQNEXTVAL FSP_ID 0 FSP_AMENDMENT_NUMBER STATUS for ldquoSubmittedrdquo FSP_STATUS_CODE ltplanNamegt PLAN_NAME ltplanTermYearsgt PLAN_TERM_YEARS ltplanTermCommencementgt PLAN_START_DATE ltplanTermCommencementgt + ltplanTermYearsgt

PLAN_END_DATE

ESF submission date PLAN_SUBMISSION_DATE ltlicenseeContactgt CONTACT_NAME lttelphoneNumbergt TELEPHONE_NUMBER ltemailAddressgt EMAIL_ADDRESS

FSP_AGREEMENT_HOLDER TABLE

Source Destination ltPlanHoldergtltclientCodegt CLIENT_NUMBER

FSP_ORG_UNIT TABLE

Source Destination ORG_UNITORG_UNIT_NO for ltdistrictCodegt

ORG_UNIT_NO

FSP_STATUS_HISTORY TABLE

Source Destination FSP_STATUS_HISTORY_SEQ FSP_STATUS_HISTORY_ID ldquoSubmittedrdquo code from FSP_STATUS_CODE

FSP_STATUS_CODE

ldquoNew Submissionrdquo STATUS_COMMENT

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 23

FSP_ATTACHMENT TABLE

Source Destination ESF framework ATTACHMENT_DESCRIPTION ATTACHMENT_NAME ATTACHMENT_SIZE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

3412 UPDATE_EXISTING_PLAN

For ESF submissions only the FDU map spatial component ltFDUPropertygt can be submitted as an update Part of the validation is to ensure that no other data is included with the ESF submission file except ltfspIDgt and ltFDUPropertygt This may be an INSERT or an UPDATE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination ltfspIDgt FSP_ID FOREST_STEWARDSHIP_PLAN FSP_AMENDMENT_NUMBER

FSP_AMENDMENT_NUMBER

FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 24

3413 AMENDMENT_AUTO_APPROVE

This is to create an amendment that does not require approval It is in effect a new FSP submission that automatically goes to ldquoApprovedrdquo status and increments the FSP_AMENDMENT_NUMBER Processing depends on what the licensee has submitted It may be one or more of

headeradministrative information (such as adding a new licensee) or amending a plan term

a new legal FSP document a new GML map of all the FDUs (spatial data if amended must be

completely replaced) new stocking standards

Process the data as if it were a new submission (see above) with the following exceptions

Do an INSERT INTO FOREST_STEWARDSHIP_PLAN setting FSP_AMENDMENT_NUMBER = MAX(FSP_AMENDMENT_NUMBER) + 1

Copy all fields from FOREST_STEWARDSHIP_PLAN from the most recent amendment (or the original submission record if no amendments)

UPDATE any fields in FOREST_STEWARSHIP_PLAN for this new entry that are provided in the XML submission that is any of ltplanNamegt ltplanTermYearsgt ltplanTermCommencementgt ltlicenseeContactgt lttelephoneNumbergt ltemailAddressgt

Any attachments must be INSERTed into FSP_ATTACHMENT with the new FSP_AMENDMENT_NUMBER (also FSP_ATTACHMENT_CONTENT)

Set FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoAPPRrdquo for this new record

INSERT INTO FSP_STATUS_HISTORY (FSP_STATUS_HISTORY_ID FSP_ID FSP_AMENDMENT_NUMBER FSP_STATUS_CODE STATUS_COMMENT) VALUES (SEQNEXTVAL ltFSP_IDgt ltnew FSP_AMENDMENT_NUMBERgt ldquoAPPRrdquo ltamendmentCommentgt) Be sure to use the new FSP_AMENDMENT_NUMBER in INSERTing any STANDARDS_REGIME or FOREST_DEVELOPMENT_UNIT records

3414 AMENDMENT_TO_INBOX

This is to create an amendment that requires approval The FSP submission is put in ldquoSubmittedrdquo status so that it will show up in the relevant District Inboxes The FSP_AMENDMENT_NUMBER is incremented Proceed as above (AMENDMENT_AUTO_INCREMENT) except

SET FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoSUBMrdquo (for Submitted)

SET FSP_STATUS_HISTORYSTATUS_CODE = ldquoSUBMrdquo for new record

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 25

35 DOMAIN CODES

The following codes will be set up in the database in static code tables (all fields are VARCHAR2)

FSP_STATUS_CODE TABLE

FSP_STATUS_CODE DESCRIPTION SUBM Submitted DRFT Draft APPR Approved REJ Rejected OTBH Opportunity To Be Heard

FSP_REVIEW_MILESTONE_TYPE_CODE TABLE

FSP_REVIEW_MILESTONE_ TYPE_CODE

DESCRIPTION

FNR First Nations Review CampE Results amp Strategies reviewed by CampE TEN Objectives Results amp Strategies reviewed by

Tenures DDM Sent to DDM for Determination OTHR Other

FSP_ATTACHMENT_TYPE_CODE TABLE

FSP_ATTACHMENT_TYPE_CODE DESCRIPTION FSP FSP legal document MAP Map of FDUs SS Stocking Standards report AMDS Amendment Description DDMD DDM Decision Letter OTHR Other Attachment

FEATURE_CLASSES TABLE

FEATURE_CLASS_SKEY DESCRIPTION FEATURE_CLASS_KEY To be defined

36 REPORTING ERRORS

If an error is detected in a submission it must be reported back to the electronic submission framework The method for doing that is to post a message to a queue detailing the submission number and the error message The licensee will be able to check back to the Electronic Submission WebSite and view the error The Electronic Submission Framework will also send an email to the client detailing the message

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 26

The specification for how to report an error can be found in the ESF Queue Agent Best Practices Document The message content for FSP will be a concatenation of the ltFSP Submission IDgt ltDescriptiongt field and the message returned from the validation routines above To send a message about a submission you will need to supply the FSP submission ID for the submission The FSP submission ID is supplied with the message from ESF and stored in the FSP_ELECTRONIC_SUBMISSION table Refer to the Status Agent in the ESF Queue Agent Best Practices document for details on how to send a message to ESF The following code is provided as a sample only and the final syntax should be from the ESF Queue Agent Best Practices Document StatusAgent sa = new StatusAgent (ldquoFSP Business Agentrdquo) sasendStatus (ltForestStewardshipPlanSubmissionIDgt StatusMessageREJECTED ldquo100rdquo ltForestStewardshipPlangtlt083D02800509gt + ldquofailedrdquo + outMessage) saclose() Note Expectation is that outmessage will contain details as to what part of the FSP failed (eg Tenure Forest Development Unit or Stocking Standard) In the case of invalid data processing stops at this point for the FSP No data for this submission will be added to FSP database

361 ERROR MESSAGES

These error messages may be generated during the accumulation validation and processing phases They are referenced by number in the procedure documentation above

1 A legal FSP document must be attached to this submission Please attach a document containing your Forest Stewardship Plan

2 The attached file ltnamegt does not have a recognizable file extension Atachments must be one of MSWord (doc) Portable Document Format (pdf) MS Excel (xls) ZIP archive (zip) or JPEG graphic (jpg) Please resubmit with appropriate file attachments

3 You do not have the proper authority to submit an FSP via ESF Please contact the appropriate MoFR District office to obtain the necessary ldquoSubmitterrdquo authority role

4 The FSP submitted does not name any plan holders At least one holder of a major BC Forest license must be named in the plan

5 No forest license number was found for a named plan holder You must name all forest licenses which apply within the FSP

6 A plan holderrsquos license number could not be verified Please check the validity of the plan holder MoFR client codes

7 A forest license number listed is not owned by any of the plan holders of this FSP Please check the validity of the plan holder MoFR client codes and their licence numbers

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 27

8 At least one BC Forest District must be listed for this FSP Each District responsible for the area included in the FSP must be listed

9 The MoFR District Code is not recognized Please check the spelling of the District code(s) included or check with the appropriate District office for the proper code

10 More than one Forest Stewardship Plan (FSP) was included in this submission At the present time each ESF submission may contain only a single FSP

11 The submission must include the name of a contact person responsible for communicating with MoFR about this FSP submission

12 The submission must include the email address of a contact person responsible for communicating with MoFR about this FSP submission

13 The submission must include the telephone number of a contact person responsible for communicating with MoFR about this FSP submission

14 The submission must indicate whether or not this is an original FSP or an amendment to an existing FSP

15 The FSP must have a name 16 The FSP must include at least one Forest Development Unit (FDU) 17 The FSP must include at least one Stocking Standard 18 This submission refers to an FSP that does not exist in the Ministryrsquos

database Please check the FSP ID number provided after your original submission

19 An FSP with the same FSP ID number already exists in the Ministryrsquos database yet you have not indicated that this is an amendment If the intention is to amend an existing FSP please include the correct FSP ID and make sure the ltamendmentIndgt flag is set to ldquotruerdquo

20 The FSP you are trying to amend has been rejected You cannot amend or replace a rejected FSP You must make a brand new submission When doing so do not include an FSP ID number

21 The submission appears to be a new FSP yet the amendment indicator is set to true (ltamendmentIndgt = ldquotruerdquo) Either provide an FSP ID to amend an existing FSP or set the amendment indicator to ldquofalserdquo

22 The FSP plan term has been set to greater than 5 years FSPs are valid for a maximum of 5 years unless an extension is approved

23 The plan commencement date provided is not valid 24 A value for ltamendmentIndgt must be provided it must be set to either ldquotruerdquo or ldquofalserdquo

25 The submission appears to be for an FSP amendment (ltamendmentIndgt = ldquotruerdquo) however no FSP is referenced Please be sure to include the FSP ID number provided with the original submission

26 You cannot amend an FSP that is not approved Ensure you have provided the correct FSP ID number issued with the original submission and confirm that the FSP is approved

27 An FSP with the same FSP ID number already exists in the database Before you can update this FSP it must be placed in Draft status by the District Manager

28 The submission appears to be an amendment to an existing FSP However you have not stated whether or not this amendment requires Ministry approval Please ensure that the ltamendmentApprovalRequiredIndgt is set to one of ldquotruerdquo or ldquofalserdquo

29 A Forest development Unit (FDU) was submitted without a name A name must be provided for each FDU

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 28

30 The same name has been provided for more than one Forest Development Unit (FDU) Each FDU in a submission must have a unique name

31 A Forest Development Unit (FDU) was submitted that did not list a forest licence number that applies Each FDU must have at least one license number applied

32 A forest license number was supplied that does not appear to be owned by any of the plan holders for this FSP Each Forest Development Unit (FDU) must be listed with at least one forest license owned by one of the plan holders for this FSP

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting

Page 23: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 23

FSP_ATTACHMENT TABLE

Source Destination ESF framework ATTACHMENT_DESCRIPTION ATTACHMENT_NAME ATTACHMENT_SIZE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

3412 UPDATE_EXISTING_PLAN

For ESF submissions only the FDU map spatial component ltFDUPropertygt can be submitted as an update Part of the validation is to ensure that no other data is included with the ESF submission file except ltfspIDgt and ltFDUPropertygt This may be an INSERT or an UPDATE

FOREST_DEVELOPMENT_UNIT TABLE

Source Destination ltfspIDgt FSP_ID FOREST_STEWARDSHIP_PLAN FSP_AMENDMENT_NUMBER

FSP_AMENDMENT_NUMBER

FDU_SEQNEXTVAL FDU_ID ltFDUgtltfduNamegt FDU_NAME

FOREST_DEVELOPMENT_UNIT_GEOM TABLE

Source Destination FOREST_DEVELOPMENT_UNITFDU_ID FDU_ID ltFDUgtltextentOfgt GEOMETRY SDO_GEOMETRYGET_FEATURE_AREA FEATURE_AREA SDO_GEOMETRYGET_FEATURE_PERIMETER FEATURE_PERIMETER

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 24

3413 AMENDMENT_AUTO_APPROVE

This is to create an amendment that does not require approval It is in effect a new FSP submission that automatically goes to ldquoApprovedrdquo status and increments the FSP_AMENDMENT_NUMBER Processing depends on what the licensee has submitted It may be one or more of

headeradministrative information (such as adding a new licensee) or amending a plan term

a new legal FSP document a new GML map of all the FDUs (spatial data if amended must be

completely replaced) new stocking standards

Process the data as if it were a new submission (see above) with the following exceptions

Do an INSERT INTO FOREST_STEWARDSHIP_PLAN setting FSP_AMENDMENT_NUMBER = MAX(FSP_AMENDMENT_NUMBER) + 1

Copy all fields from FOREST_STEWARDSHIP_PLAN from the most recent amendment (or the original submission record if no amendments)

UPDATE any fields in FOREST_STEWARSHIP_PLAN for this new entry that are provided in the XML submission that is any of ltplanNamegt ltplanTermYearsgt ltplanTermCommencementgt ltlicenseeContactgt lttelephoneNumbergt ltemailAddressgt

Any attachments must be INSERTed into FSP_ATTACHMENT with the new FSP_AMENDMENT_NUMBER (also FSP_ATTACHMENT_CONTENT)

Set FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoAPPRrdquo for this new record

INSERT INTO FSP_STATUS_HISTORY (FSP_STATUS_HISTORY_ID FSP_ID FSP_AMENDMENT_NUMBER FSP_STATUS_CODE STATUS_COMMENT) VALUES (SEQNEXTVAL ltFSP_IDgt ltnew FSP_AMENDMENT_NUMBERgt ldquoAPPRrdquo ltamendmentCommentgt) Be sure to use the new FSP_AMENDMENT_NUMBER in INSERTing any STANDARDS_REGIME or FOREST_DEVELOPMENT_UNIT records

3414 AMENDMENT_TO_INBOX

This is to create an amendment that requires approval The FSP submission is put in ldquoSubmittedrdquo status so that it will show up in the relevant District Inboxes The FSP_AMENDMENT_NUMBER is incremented Proceed as above (AMENDMENT_AUTO_INCREMENT) except

SET FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoSUBMrdquo (for Submitted)

SET FSP_STATUS_HISTORYSTATUS_CODE = ldquoSUBMrdquo for new record

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 25

35 DOMAIN CODES

The following codes will be set up in the database in static code tables (all fields are VARCHAR2)

FSP_STATUS_CODE TABLE

FSP_STATUS_CODE DESCRIPTION SUBM Submitted DRFT Draft APPR Approved REJ Rejected OTBH Opportunity To Be Heard

FSP_REVIEW_MILESTONE_TYPE_CODE TABLE

FSP_REVIEW_MILESTONE_ TYPE_CODE

DESCRIPTION

FNR First Nations Review CampE Results amp Strategies reviewed by CampE TEN Objectives Results amp Strategies reviewed by

Tenures DDM Sent to DDM for Determination OTHR Other

FSP_ATTACHMENT_TYPE_CODE TABLE

FSP_ATTACHMENT_TYPE_CODE DESCRIPTION FSP FSP legal document MAP Map of FDUs SS Stocking Standards report AMDS Amendment Description DDMD DDM Decision Letter OTHR Other Attachment

FEATURE_CLASSES TABLE

FEATURE_CLASS_SKEY DESCRIPTION FEATURE_CLASS_KEY To be defined

36 REPORTING ERRORS

If an error is detected in a submission it must be reported back to the electronic submission framework The method for doing that is to post a message to a queue detailing the submission number and the error message The licensee will be able to check back to the Electronic Submission WebSite and view the error The Electronic Submission Framework will also send an email to the client detailing the message

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 26

The specification for how to report an error can be found in the ESF Queue Agent Best Practices Document The message content for FSP will be a concatenation of the ltFSP Submission IDgt ltDescriptiongt field and the message returned from the validation routines above To send a message about a submission you will need to supply the FSP submission ID for the submission The FSP submission ID is supplied with the message from ESF and stored in the FSP_ELECTRONIC_SUBMISSION table Refer to the Status Agent in the ESF Queue Agent Best Practices document for details on how to send a message to ESF The following code is provided as a sample only and the final syntax should be from the ESF Queue Agent Best Practices Document StatusAgent sa = new StatusAgent (ldquoFSP Business Agentrdquo) sasendStatus (ltForestStewardshipPlanSubmissionIDgt StatusMessageREJECTED ldquo100rdquo ltForestStewardshipPlangtlt083D02800509gt + ldquofailedrdquo + outMessage) saclose() Note Expectation is that outmessage will contain details as to what part of the FSP failed (eg Tenure Forest Development Unit or Stocking Standard) In the case of invalid data processing stops at this point for the FSP No data for this submission will be added to FSP database

361 ERROR MESSAGES

These error messages may be generated during the accumulation validation and processing phases They are referenced by number in the procedure documentation above

1 A legal FSP document must be attached to this submission Please attach a document containing your Forest Stewardship Plan

2 The attached file ltnamegt does not have a recognizable file extension Atachments must be one of MSWord (doc) Portable Document Format (pdf) MS Excel (xls) ZIP archive (zip) or JPEG graphic (jpg) Please resubmit with appropriate file attachments

3 You do not have the proper authority to submit an FSP via ESF Please contact the appropriate MoFR District office to obtain the necessary ldquoSubmitterrdquo authority role

4 The FSP submitted does not name any plan holders At least one holder of a major BC Forest license must be named in the plan

5 No forest license number was found for a named plan holder You must name all forest licenses which apply within the FSP

6 A plan holderrsquos license number could not be verified Please check the validity of the plan holder MoFR client codes

7 A forest license number listed is not owned by any of the plan holders of this FSP Please check the validity of the plan holder MoFR client codes and their licence numbers

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 27

8 At least one BC Forest District must be listed for this FSP Each District responsible for the area included in the FSP must be listed

9 The MoFR District Code is not recognized Please check the spelling of the District code(s) included or check with the appropriate District office for the proper code

10 More than one Forest Stewardship Plan (FSP) was included in this submission At the present time each ESF submission may contain only a single FSP

11 The submission must include the name of a contact person responsible for communicating with MoFR about this FSP submission

12 The submission must include the email address of a contact person responsible for communicating with MoFR about this FSP submission

13 The submission must include the telephone number of a contact person responsible for communicating with MoFR about this FSP submission

14 The submission must indicate whether or not this is an original FSP or an amendment to an existing FSP

15 The FSP must have a name 16 The FSP must include at least one Forest Development Unit (FDU) 17 The FSP must include at least one Stocking Standard 18 This submission refers to an FSP that does not exist in the Ministryrsquos

database Please check the FSP ID number provided after your original submission

19 An FSP with the same FSP ID number already exists in the Ministryrsquos database yet you have not indicated that this is an amendment If the intention is to amend an existing FSP please include the correct FSP ID and make sure the ltamendmentIndgt flag is set to ldquotruerdquo

20 The FSP you are trying to amend has been rejected You cannot amend or replace a rejected FSP You must make a brand new submission When doing so do not include an FSP ID number

21 The submission appears to be a new FSP yet the amendment indicator is set to true (ltamendmentIndgt = ldquotruerdquo) Either provide an FSP ID to amend an existing FSP or set the amendment indicator to ldquofalserdquo

22 The FSP plan term has been set to greater than 5 years FSPs are valid for a maximum of 5 years unless an extension is approved

23 The plan commencement date provided is not valid 24 A value for ltamendmentIndgt must be provided it must be set to either ldquotruerdquo or ldquofalserdquo

25 The submission appears to be for an FSP amendment (ltamendmentIndgt = ldquotruerdquo) however no FSP is referenced Please be sure to include the FSP ID number provided with the original submission

26 You cannot amend an FSP that is not approved Ensure you have provided the correct FSP ID number issued with the original submission and confirm that the FSP is approved

27 An FSP with the same FSP ID number already exists in the database Before you can update this FSP it must be placed in Draft status by the District Manager

28 The submission appears to be an amendment to an existing FSP However you have not stated whether or not this amendment requires Ministry approval Please ensure that the ltamendmentApprovalRequiredIndgt is set to one of ldquotruerdquo or ldquofalserdquo

29 A Forest development Unit (FDU) was submitted without a name A name must be provided for each FDU

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 28

30 The same name has been provided for more than one Forest Development Unit (FDU) Each FDU in a submission must have a unique name

31 A Forest Development Unit (FDU) was submitted that did not list a forest licence number that applies Each FDU must have at least one license number applied

32 A forest license number was supplied that does not appear to be owned by any of the plan holders for this FSP Each Forest Development Unit (FDU) must be listed with at least one forest license owned by one of the plan holders for this FSP

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting

Page 24: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 24

3413 AMENDMENT_AUTO_APPROVE

This is to create an amendment that does not require approval It is in effect a new FSP submission that automatically goes to ldquoApprovedrdquo status and increments the FSP_AMENDMENT_NUMBER Processing depends on what the licensee has submitted It may be one or more of

headeradministrative information (such as adding a new licensee) or amending a plan term

a new legal FSP document a new GML map of all the FDUs (spatial data if amended must be

completely replaced) new stocking standards

Process the data as if it were a new submission (see above) with the following exceptions

Do an INSERT INTO FOREST_STEWARDSHIP_PLAN setting FSP_AMENDMENT_NUMBER = MAX(FSP_AMENDMENT_NUMBER) + 1

Copy all fields from FOREST_STEWARDSHIP_PLAN from the most recent amendment (or the original submission record if no amendments)

UPDATE any fields in FOREST_STEWARSHIP_PLAN for this new entry that are provided in the XML submission that is any of ltplanNamegt ltplanTermYearsgt ltplanTermCommencementgt ltlicenseeContactgt lttelephoneNumbergt ltemailAddressgt

Any attachments must be INSERTed into FSP_ATTACHMENT with the new FSP_AMENDMENT_NUMBER (also FSP_ATTACHMENT_CONTENT)

Set FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoAPPRrdquo for this new record

INSERT INTO FSP_STATUS_HISTORY (FSP_STATUS_HISTORY_ID FSP_ID FSP_AMENDMENT_NUMBER FSP_STATUS_CODE STATUS_COMMENT) VALUES (SEQNEXTVAL ltFSP_IDgt ltnew FSP_AMENDMENT_NUMBERgt ldquoAPPRrdquo ltamendmentCommentgt) Be sure to use the new FSP_AMENDMENT_NUMBER in INSERTing any STANDARDS_REGIME or FOREST_DEVELOPMENT_UNIT records

3414 AMENDMENT_TO_INBOX

This is to create an amendment that requires approval The FSP submission is put in ldquoSubmittedrdquo status so that it will show up in the relevant District Inboxes The FSP_AMENDMENT_NUMBER is incremented Proceed as above (AMENDMENT_AUTO_INCREMENT) except

SET FOREST_STEWARDSHIP_PLANFSP_STATUS_CODE = ldquoSUBMrdquo (for Submitted)

SET FSP_STATUS_HISTORYSTATUS_CODE = ldquoSUBMrdquo for new record

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 25

35 DOMAIN CODES

The following codes will be set up in the database in static code tables (all fields are VARCHAR2)

FSP_STATUS_CODE TABLE

FSP_STATUS_CODE DESCRIPTION SUBM Submitted DRFT Draft APPR Approved REJ Rejected OTBH Opportunity To Be Heard

FSP_REVIEW_MILESTONE_TYPE_CODE TABLE

FSP_REVIEW_MILESTONE_ TYPE_CODE

DESCRIPTION

FNR First Nations Review CampE Results amp Strategies reviewed by CampE TEN Objectives Results amp Strategies reviewed by

Tenures DDM Sent to DDM for Determination OTHR Other

FSP_ATTACHMENT_TYPE_CODE TABLE

FSP_ATTACHMENT_TYPE_CODE DESCRIPTION FSP FSP legal document MAP Map of FDUs SS Stocking Standards report AMDS Amendment Description DDMD DDM Decision Letter OTHR Other Attachment

FEATURE_CLASSES TABLE

FEATURE_CLASS_SKEY DESCRIPTION FEATURE_CLASS_KEY To be defined

36 REPORTING ERRORS

If an error is detected in a submission it must be reported back to the electronic submission framework The method for doing that is to post a message to a queue detailing the submission number and the error message The licensee will be able to check back to the Electronic Submission WebSite and view the error The Electronic Submission Framework will also send an email to the client detailing the message

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 26

The specification for how to report an error can be found in the ESF Queue Agent Best Practices Document The message content for FSP will be a concatenation of the ltFSP Submission IDgt ltDescriptiongt field and the message returned from the validation routines above To send a message about a submission you will need to supply the FSP submission ID for the submission The FSP submission ID is supplied with the message from ESF and stored in the FSP_ELECTRONIC_SUBMISSION table Refer to the Status Agent in the ESF Queue Agent Best Practices document for details on how to send a message to ESF The following code is provided as a sample only and the final syntax should be from the ESF Queue Agent Best Practices Document StatusAgent sa = new StatusAgent (ldquoFSP Business Agentrdquo) sasendStatus (ltForestStewardshipPlanSubmissionIDgt StatusMessageREJECTED ldquo100rdquo ltForestStewardshipPlangtlt083D02800509gt + ldquofailedrdquo + outMessage) saclose() Note Expectation is that outmessage will contain details as to what part of the FSP failed (eg Tenure Forest Development Unit or Stocking Standard) In the case of invalid data processing stops at this point for the FSP No data for this submission will be added to FSP database

361 ERROR MESSAGES

These error messages may be generated during the accumulation validation and processing phases They are referenced by number in the procedure documentation above

1 A legal FSP document must be attached to this submission Please attach a document containing your Forest Stewardship Plan

2 The attached file ltnamegt does not have a recognizable file extension Atachments must be one of MSWord (doc) Portable Document Format (pdf) MS Excel (xls) ZIP archive (zip) or JPEG graphic (jpg) Please resubmit with appropriate file attachments

3 You do not have the proper authority to submit an FSP via ESF Please contact the appropriate MoFR District office to obtain the necessary ldquoSubmitterrdquo authority role

4 The FSP submitted does not name any plan holders At least one holder of a major BC Forest license must be named in the plan

5 No forest license number was found for a named plan holder You must name all forest licenses which apply within the FSP

6 A plan holderrsquos license number could not be verified Please check the validity of the plan holder MoFR client codes

7 A forest license number listed is not owned by any of the plan holders of this FSP Please check the validity of the plan holder MoFR client codes and their licence numbers

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 27

8 At least one BC Forest District must be listed for this FSP Each District responsible for the area included in the FSP must be listed

9 The MoFR District Code is not recognized Please check the spelling of the District code(s) included or check with the appropriate District office for the proper code

10 More than one Forest Stewardship Plan (FSP) was included in this submission At the present time each ESF submission may contain only a single FSP

11 The submission must include the name of a contact person responsible for communicating with MoFR about this FSP submission

12 The submission must include the email address of a contact person responsible for communicating with MoFR about this FSP submission

13 The submission must include the telephone number of a contact person responsible for communicating with MoFR about this FSP submission

14 The submission must indicate whether or not this is an original FSP or an amendment to an existing FSP

15 The FSP must have a name 16 The FSP must include at least one Forest Development Unit (FDU) 17 The FSP must include at least one Stocking Standard 18 This submission refers to an FSP that does not exist in the Ministryrsquos

database Please check the FSP ID number provided after your original submission

19 An FSP with the same FSP ID number already exists in the Ministryrsquos database yet you have not indicated that this is an amendment If the intention is to amend an existing FSP please include the correct FSP ID and make sure the ltamendmentIndgt flag is set to ldquotruerdquo

20 The FSP you are trying to amend has been rejected You cannot amend or replace a rejected FSP You must make a brand new submission When doing so do not include an FSP ID number

21 The submission appears to be a new FSP yet the amendment indicator is set to true (ltamendmentIndgt = ldquotruerdquo) Either provide an FSP ID to amend an existing FSP or set the amendment indicator to ldquofalserdquo

22 The FSP plan term has been set to greater than 5 years FSPs are valid for a maximum of 5 years unless an extension is approved

23 The plan commencement date provided is not valid 24 A value for ltamendmentIndgt must be provided it must be set to either ldquotruerdquo or ldquofalserdquo

25 The submission appears to be for an FSP amendment (ltamendmentIndgt = ldquotruerdquo) however no FSP is referenced Please be sure to include the FSP ID number provided with the original submission

26 You cannot amend an FSP that is not approved Ensure you have provided the correct FSP ID number issued with the original submission and confirm that the FSP is approved

27 An FSP with the same FSP ID number already exists in the database Before you can update this FSP it must be placed in Draft status by the District Manager

28 The submission appears to be an amendment to an existing FSP However you have not stated whether or not this amendment requires Ministry approval Please ensure that the ltamendmentApprovalRequiredIndgt is set to one of ldquotruerdquo or ldquofalserdquo

29 A Forest development Unit (FDU) was submitted without a name A name must be provided for each FDU

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 28

30 The same name has been provided for more than one Forest Development Unit (FDU) Each FDU in a submission must have a unique name

31 A Forest Development Unit (FDU) was submitted that did not list a forest licence number that applies Each FDU must have at least one license number applied

32 A forest license number was supplied that does not appear to be owned by any of the plan holders for this FSP Each Forest Development Unit (FDU) must be listed with at least one forest license owned by one of the plan holders for this FSP

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting

Page 25: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 25

35 DOMAIN CODES

The following codes will be set up in the database in static code tables (all fields are VARCHAR2)

FSP_STATUS_CODE TABLE

FSP_STATUS_CODE DESCRIPTION SUBM Submitted DRFT Draft APPR Approved REJ Rejected OTBH Opportunity To Be Heard

FSP_REVIEW_MILESTONE_TYPE_CODE TABLE

FSP_REVIEW_MILESTONE_ TYPE_CODE

DESCRIPTION

FNR First Nations Review CampE Results amp Strategies reviewed by CampE TEN Objectives Results amp Strategies reviewed by

Tenures DDM Sent to DDM for Determination OTHR Other

FSP_ATTACHMENT_TYPE_CODE TABLE

FSP_ATTACHMENT_TYPE_CODE DESCRIPTION FSP FSP legal document MAP Map of FDUs SS Stocking Standards report AMDS Amendment Description DDMD DDM Decision Letter OTHR Other Attachment

FEATURE_CLASSES TABLE

FEATURE_CLASS_SKEY DESCRIPTION FEATURE_CLASS_KEY To be defined

36 REPORTING ERRORS

If an error is detected in a submission it must be reported back to the electronic submission framework The method for doing that is to post a message to a queue detailing the submission number and the error message The licensee will be able to check back to the Electronic Submission WebSite and view the error The Electronic Submission Framework will also send an email to the client detailing the message

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 26

The specification for how to report an error can be found in the ESF Queue Agent Best Practices Document The message content for FSP will be a concatenation of the ltFSP Submission IDgt ltDescriptiongt field and the message returned from the validation routines above To send a message about a submission you will need to supply the FSP submission ID for the submission The FSP submission ID is supplied with the message from ESF and stored in the FSP_ELECTRONIC_SUBMISSION table Refer to the Status Agent in the ESF Queue Agent Best Practices document for details on how to send a message to ESF The following code is provided as a sample only and the final syntax should be from the ESF Queue Agent Best Practices Document StatusAgent sa = new StatusAgent (ldquoFSP Business Agentrdquo) sasendStatus (ltForestStewardshipPlanSubmissionIDgt StatusMessageREJECTED ldquo100rdquo ltForestStewardshipPlangtlt083D02800509gt + ldquofailedrdquo + outMessage) saclose() Note Expectation is that outmessage will contain details as to what part of the FSP failed (eg Tenure Forest Development Unit or Stocking Standard) In the case of invalid data processing stops at this point for the FSP No data for this submission will be added to FSP database

361 ERROR MESSAGES

These error messages may be generated during the accumulation validation and processing phases They are referenced by number in the procedure documentation above

1 A legal FSP document must be attached to this submission Please attach a document containing your Forest Stewardship Plan

2 The attached file ltnamegt does not have a recognizable file extension Atachments must be one of MSWord (doc) Portable Document Format (pdf) MS Excel (xls) ZIP archive (zip) or JPEG graphic (jpg) Please resubmit with appropriate file attachments

3 You do not have the proper authority to submit an FSP via ESF Please contact the appropriate MoFR District office to obtain the necessary ldquoSubmitterrdquo authority role

4 The FSP submitted does not name any plan holders At least one holder of a major BC Forest license must be named in the plan

5 No forest license number was found for a named plan holder You must name all forest licenses which apply within the FSP

6 A plan holderrsquos license number could not be verified Please check the validity of the plan holder MoFR client codes

7 A forest license number listed is not owned by any of the plan holders of this FSP Please check the validity of the plan holder MoFR client codes and their licence numbers

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 27

8 At least one BC Forest District must be listed for this FSP Each District responsible for the area included in the FSP must be listed

9 The MoFR District Code is not recognized Please check the spelling of the District code(s) included or check with the appropriate District office for the proper code

10 More than one Forest Stewardship Plan (FSP) was included in this submission At the present time each ESF submission may contain only a single FSP

11 The submission must include the name of a contact person responsible for communicating with MoFR about this FSP submission

12 The submission must include the email address of a contact person responsible for communicating with MoFR about this FSP submission

13 The submission must include the telephone number of a contact person responsible for communicating with MoFR about this FSP submission

14 The submission must indicate whether or not this is an original FSP or an amendment to an existing FSP

15 The FSP must have a name 16 The FSP must include at least one Forest Development Unit (FDU) 17 The FSP must include at least one Stocking Standard 18 This submission refers to an FSP that does not exist in the Ministryrsquos

database Please check the FSP ID number provided after your original submission

19 An FSP with the same FSP ID number already exists in the Ministryrsquos database yet you have not indicated that this is an amendment If the intention is to amend an existing FSP please include the correct FSP ID and make sure the ltamendmentIndgt flag is set to ldquotruerdquo

20 The FSP you are trying to amend has been rejected You cannot amend or replace a rejected FSP You must make a brand new submission When doing so do not include an FSP ID number

21 The submission appears to be a new FSP yet the amendment indicator is set to true (ltamendmentIndgt = ldquotruerdquo) Either provide an FSP ID to amend an existing FSP or set the amendment indicator to ldquofalserdquo

22 The FSP plan term has been set to greater than 5 years FSPs are valid for a maximum of 5 years unless an extension is approved

23 The plan commencement date provided is not valid 24 A value for ltamendmentIndgt must be provided it must be set to either ldquotruerdquo or ldquofalserdquo

25 The submission appears to be for an FSP amendment (ltamendmentIndgt = ldquotruerdquo) however no FSP is referenced Please be sure to include the FSP ID number provided with the original submission

26 You cannot amend an FSP that is not approved Ensure you have provided the correct FSP ID number issued with the original submission and confirm that the FSP is approved

27 An FSP with the same FSP ID number already exists in the database Before you can update this FSP it must be placed in Draft status by the District Manager

28 The submission appears to be an amendment to an existing FSP However you have not stated whether or not this amendment requires Ministry approval Please ensure that the ltamendmentApprovalRequiredIndgt is set to one of ldquotruerdquo or ldquofalserdquo

29 A Forest development Unit (FDU) was submitted without a name A name must be provided for each FDU

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 28

30 The same name has been provided for more than one Forest Development Unit (FDU) Each FDU in a submission must have a unique name

31 A Forest Development Unit (FDU) was submitted that did not list a forest licence number that applies Each FDU must have at least one license number applied

32 A forest license number was supplied that does not appear to be owned by any of the plan holders for this FSP Each Forest Development Unit (FDU) must be listed with at least one forest license owned by one of the plan holders for this FSP

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting

Page 26: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 26

The specification for how to report an error can be found in the ESF Queue Agent Best Practices Document The message content for FSP will be a concatenation of the ltFSP Submission IDgt ltDescriptiongt field and the message returned from the validation routines above To send a message about a submission you will need to supply the FSP submission ID for the submission The FSP submission ID is supplied with the message from ESF and stored in the FSP_ELECTRONIC_SUBMISSION table Refer to the Status Agent in the ESF Queue Agent Best Practices document for details on how to send a message to ESF The following code is provided as a sample only and the final syntax should be from the ESF Queue Agent Best Practices Document StatusAgent sa = new StatusAgent (ldquoFSP Business Agentrdquo) sasendStatus (ltForestStewardshipPlanSubmissionIDgt StatusMessageREJECTED ldquo100rdquo ltForestStewardshipPlangtlt083D02800509gt + ldquofailedrdquo + outMessage) saclose() Note Expectation is that outmessage will contain details as to what part of the FSP failed (eg Tenure Forest Development Unit or Stocking Standard) In the case of invalid data processing stops at this point for the FSP No data for this submission will be added to FSP database

361 ERROR MESSAGES

These error messages may be generated during the accumulation validation and processing phases They are referenced by number in the procedure documentation above

1 A legal FSP document must be attached to this submission Please attach a document containing your Forest Stewardship Plan

2 The attached file ltnamegt does not have a recognizable file extension Atachments must be one of MSWord (doc) Portable Document Format (pdf) MS Excel (xls) ZIP archive (zip) or JPEG graphic (jpg) Please resubmit with appropriate file attachments

3 You do not have the proper authority to submit an FSP via ESF Please contact the appropriate MoFR District office to obtain the necessary ldquoSubmitterrdquo authority role

4 The FSP submitted does not name any plan holders At least one holder of a major BC Forest license must be named in the plan

5 No forest license number was found for a named plan holder You must name all forest licenses which apply within the FSP

6 A plan holderrsquos license number could not be verified Please check the validity of the plan holder MoFR client codes

7 A forest license number listed is not owned by any of the plan holders of this FSP Please check the validity of the plan holder MoFR client codes and their licence numbers

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 27

8 At least one BC Forest District must be listed for this FSP Each District responsible for the area included in the FSP must be listed

9 The MoFR District Code is not recognized Please check the spelling of the District code(s) included or check with the appropriate District office for the proper code

10 More than one Forest Stewardship Plan (FSP) was included in this submission At the present time each ESF submission may contain only a single FSP

11 The submission must include the name of a contact person responsible for communicating with MoFR about this FSP submission

12 The submission must include the email address of a contact person responsible for communicating with MoFR about this FSP submission

13 The submission must include the telephone number of a contact person responsible for communicating with MoFR about this FSP submission

14 The submission must indicate whether or not this is an original FSP or an amendment to an existing FSP

15 The FSP must have a name 16 The FSP must include at least one Forest Development Unit (FDU) 17 The FSP must include at least one Stocking Standard 18 This submission refers to an FSP that does not exist in the Ministryrsquos

database Please check the FSP ID number provided after your original submission

19 An FSP with the same FSP ID number already exists in the Ministryrsquos database yet you have not indicated that this is an amendment If the intention is to amend an existing FSP please include the correct FSP ID and make sure the ltamendmentIndgt flag is set to ldquotruerdquo

20 The FSP you are trying to amend has been rejected You cannot amend or replace a rejected FSP You must make a brand new submission When doing so do not include an FSP ID number

21 The submission appears to be a new FSP yet the amendment indicator is set to true (ltamendmentIndgt = ldquotruerdquo) Either provide an FSP ID to amend an existing FSP or set the amendment indicator to ldquofalserdquo

22 The FSP plan term has been set to greater than 5 years FSPs are valid for a maximum of 5 years unless an extension is approved

23 The plan commencement date provided is not valid 24 A value for ltamendmentIndgt must be provided it must be set to either ldquotruerdquo or ldquofalserdquo

25 The submission appears to be for an FSP amendment (ltamendmentIndgt = ldquotruerdquo) however no FSP is referenced Please be sure to include the FSP ID number provided with the original submission

26 You cannot amend an FSP that is not approved Ensure you have provided the correct FSP ID number issued with the original submission and confirm that the FSP is approved

27 An FSP with the same FSP ID number already exists in the database Before you can update this FSP it must be placed in Draft status by the District Manager

28 The submission appears to be an amendment to an existing FSP However you have not stated whether or not this amendment requires Ministry approval Please ensure that the ltamendmentApprovalRequiredIndgt is set to one of ldquotruerdquo or ldquofalserdquo

29 A Forest development Unit (FDU) was submitted without a name A name must be provided for each FDU

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 28

30 The same name has been provided for more than one Forest Development Unit (FDU) Each FDU in a submission must have a unique name

31 A Forest Development Unit (FDU) was submitted that did not list a forest licence number that applies Each FDU must have at least one license number applied

32 A forest license number was supplied that does not appear to be owned by any of the plan holders for this FSP Each Forest Development Unit (FDU) must be listed with at least one forest license owned by one of the plan holders for this FSP

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting

Page 27: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 27

8 At least one BC Forest District must be listed for this FSP Each District responsible for the area included in the FSP must be listed

9 The MoFR District Code is not recognized Please check the spelling of the District code(s) included or check with the appropriate District office for the proper code

10 More than one Forest Stewardship Plan (FSP) was included in this submission At the present time each ESF submission may contain only a single FSP

11 The submission must include the name of a contact person responsible for communicating with MoFR about this FSP submission

12 The submission must include the email address of a contact person responsible for communicating with MoFR about this FSP submission

13 The submission must include the telephone number of a contact person responsible for communicating with MoFR about this FSP submission

14 The submission must indicate whether or not this is an original FSP or an amendment to an existing FSP

15 The FSP must have a name 16 The FSP must include at least one Forest Development Unit (FDU) 17 The FSP must include at least one Stocking Standard 18 This submission refers to an FSP that does not exist in the Ministryrsquos

database Please check the FSP ID number provided after your original submission

19 An FSP with the same FSP ID number already exists in the Ministryrsquos database yet you have not indicated that this is an amendment If the intention is to amend an existing FSP please include the correct FSP ID and make sure the ltamendmentIndgt flag is set to ldquotruerdquo

20 The FSP you are trying to amend has been rejected You cannot amend or replace a rejected FSP You must make a brand new submission When doing so do not include an FSP ID number

21 The submission appears to be a new FSP yet the amendment indicator is set to true (ltamendmentIndgt = ldquotruerdquo) Either provide an FSP ID to amend an existing FSP or set the amendment indicator to ldquofalserdquo

22 The FSP plan term has been set to greater than 5 years FSPs are valid for a maximum of 5 years unless an extension is approved

23 The plan commencement date provided is not valid 24 A value for ltamendmentIndgt must be provided it must be set to either ldquotruerdquo or ldquofalserdquo

25 The submission appears to be for an FSP amendment (ltamendmentIndgt = ldquotruerdquo) however no FSP is referenced Please be sure to include the FSP ID number provided with the original submission

26 You cannot amend an FSP that is not approved Ensure you have provided the correct FSP ID number issued with the original submission and confirm that the FSP is approved

27 An FSP with the same FSP ID number already exists in the database Before you can update this FSP it must be placed in Draft status by the District Manager

28 The submission appears to be an amendment to an existing FSP However you have not stated whether or not this amendment requires Ministry approval Please ensure that the ltamendmentApprovalRequiredIndgt is set to one of ldquotruerdquo or ldquofalserdquo

29 A Forest development Unit (FDU) was submitted without a name A name must be provided for each FDU

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 28

30 The same name has been provided for more than one Forest Development Unit (FDU) Each FDU in a submission must have a unique name

31 A Forest Development Unit (FDU) was submitted that did not list a forest licence number that applies Each FDU must have at least one license number applied

32 A forest license number was supplied that does not appear to be owned by any of the plan holders for this FSP Each Forest Development Unit (FDU) must be listed with at least one forest license owned by one of the plan holders for this FSP

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting

Page 28: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

Ministry of Forests FSP Business Agent Design

5-Dec-2006 Page 28

30 The same name has been provided for more than one Forest Development Unit (FDU) Each FDU in a submission must have a unique name

31 A Forest Development Unit (FDU) was submitted that did not list a forest licence number that applies Each FDU must have at least one license number applied

32 A forest license number was supplied that does not appear to be owned by any of the plan holders for this FSP Each Forest Development Unit (FDU) must be listed with at least one forest license owned by one of the plan holders for this FSP

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting

Page 29: FSP Tracking System 1.0 FSP Business Agent Design ......0.1 June 6, 2006 Vivid Solutions First version of the document for internal review. Ministry of Forests FSP Business Agent Design

Ministry of Forests Forest Tenure AdministrationFTA Business Agent Design Document

5-Dec-2006 Page 29

4 SPATIAL PROCESSING

There are several spatial processes that can be performed using Oracle Spatial now that the spatial data is moving to the operational database The functions include

get_feature_area (feature) area

feature SDO_GEOMETRY

area area in hecatares

Calculates the area of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the area of each FDU in the geometry tables for fast reporting

get_feature_perimeter (feature) perimeter

feature SDO_GEOMETRY

perimiter perimeter in meters

Calculates the perimeter of a feature This is a helper function to isolate spatial functions in one package FSP 10 data model statically stores the perimeter of each FDU in the geometry tables for fast reporting