I find that the problem statement is not precise enough. See my questions inline.<br><br><div class="gmail_quote">2011/1/13 dc tech <span dir="ltr"><<a href="mailto:dctech1000@gmail.com">dctech1000@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><span style="border-collapse: collapse; font-family: arial,sans-serif; font-size: 13px;"><br>
<div><b>BACKGROUND</b></div><div>We have departments setup in a hierarchical structure (i.e. parent departments) </div><div>An employee can belong to one and only one department.</div></span></blockquote><div><br>"can belong"? Should be "belongs", I think.<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><span style="border-collapse: collapse; font-family: arial,sans-serif; font-size: 13px;"><div>
An employee can be the manager of one or more departments; a manager may or not belong to that department.</div>
<div>A department can have many employees and many managers.</div></span></blockquote><div> </div><div>I assume that higher level departments may also have employees, not just managers. <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<span style="border-collapse: collapse; font-family: arial,sans-serif; font-size: 13px;"><div><br></div><div><b>PROBLEM</b></div><div>Find the approver for an employee's expenses.</div><div>An approver is a 'higher level' manager relative to employee in the organizational hierarchy.</div>
<div>Note that since the manager is employee as well, this includes the problem of finding the manager of a manager.</div><div><br></div><div><b>RULES</b></div><div>1. The approver the nearest manager to the employee (traversing up the department hierarchy)</div>
<div>Typical cases then are:</div><div>- for a non-manager employee, the approver is the manager of the employee's department</div><div>- for a manager who manages a single department and belongs to that department, the approver is the manager of the parent unit </div>
<div><br></div><div>2. The approver for a manager cannot the manager himself or a peer manager (in the same department).</div></span></blockquote><div><br>Is this a correct interpretation: "peer manager" is another manager *of* the same department; being *in* the same dptmt does not matter. More precisely, a "peer manager" of X is one from the union of all managers managing any of the departments managed by X.<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><span style="border-collapse: collapse; font-family: arial,sans-serif; font-size: 13px;"><div>
<br></div><div>3. An approver cannot report to the employee </div><div>This sometimes happens when the manager is an employee in one department but manager for a department a few levels up in the hierarchy</div>
<div><br></div><div>3a. An approver cannot be the peer to someone who reports to the manager</div></span></blockquote><div><br>I don't see "who is who" in this sentence. "peer" in the sense it was used before?<br>
<br>-W<br><br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><span style="border-collapse: collapse; font-family: arial,sans-serif; font-size: 13px;"><div>
<br></div><div><br></div><div><br></div><div><b>SAMPLE DATA</b></div><div>A (manager Hillary) </div>
<div> A1 (manager John and Jane ) </div><div> A11 </div><div> A12 (manager Mike; employees John and Mike)</div><div> A13</div><div> A2 (manager Kate)</div><div><div>
A21 (manager Jessica, employee Janet)</div></div><div> A22 (manager Erica, employee Jane)</div><div><div><br></div></div><div>1. Approver for Janet is Jessica</div><div>2. Approver for Jessica is Kate</div>
<div>3.Approver for John is Hillary (cannot be Mike, John himself or Jane)</div><div>4. Approver for Jane is Erica via A22 (no reporting relationship).</div><div><br></div><div><b>ALGORITHMIC SOLUTION</b></div><div>Define the department reporting vector starting from the employee department</div>
<div> e.g. for (1) it would be A21 -> A2 -> A and </div><div> for (3) it would be A12 -> A1 -> A</div><div>Then for each, define managers and then employees</div><div> (1) : A21( jessica/ janet ) -> A2: ( Kate) -> A( Hillary)</div>
<div> (2): A12 (Mike/ John, Mike) -> A1 (John, Jane) -> A (Hillary)</div><div>Then starting from the top (i.e. A), move down looking for the employee (in manager or employee list)</div><div>If the employee is found in the manager list, approver is the manager of the parent department</div>
<div>If the employee is found in the employee list, the approver is the manager of this unit (not the parent)</div><div>(I may have missed a few rules in the algorithmic solution)</div><div><br></div><div><br></div><div>
<b>RULE BASED SOLUTION?</b></div>
<div>Is this a good problem for rule bases solution?</div><div>I started to model this and will post my solution if I can come up with something useful but would absolutely welcome your inputs.</div><div><br></div><div><br>
</div><div><br></div><div><br></div></span>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br>