001//@formatter:off
002/*
003 * Staff member is the LEAF implementing the component interface 
004 * Code-Beispiel zum Buch Patterns Kompakt, Verlag Springer Vieweg
005 * Copyright 2014 Karl Eilebrecht
006 * 
007 * Licensed under the Apache License, Version 2.0 (the "License"):
008 * you may not use this file except in compliance with the License.
009 * You may obtain a copy of the License at
010 *
011 * http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing, software
014 * distributed under the License is distributed on an "AS IS" BASIS,
015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 */
019//@formatter:on
020package de.calamanari.pk.composite;
021
022/**
023 * Staff member is the LEAF implementing the component interface
024 * 
025 * @author <a href="mailto:Karl.Eilebrecht(a/t)calamanari.de">Karl Eilebrecht</a>
026 */
027public class StaffMember implements EnterpriseNode {
028
029    /**
030     * Person's first name
031     */
032    private String firstName = null;
033
034    /**
035     * Person's last name
036     */
037    private String lastName = null;
038
039    /**
040     * the unit this member works for
041     */
042    private AbstractEnterpriseUnit enterpriseUnit = null;
043
044    /**
045     * Job title of this staff member
046     */
047    private String jobTitle = null;
048
049    /**
050     * Creates new member using this given arguments
051     * 
052     * @param firstName first name
053     * @param lastName name
054     * @param jobTitle the job of the person
055     */
056    public StaffMember(String firstName, String lastName, String jobTitle) {
057        this.firstName = firstName;
058        this.lastName = lastName;
059        this.jobTitle = jobTitle;
060    }
061
062    /**
063     * Returns the first name
064     * 
065     * @return first name
066     */
067    public String getFirstName() {
068        return firstName;
069    }
070
071    /**
072     * sets the person's first name
073     * 
074     * @param firstName person's first name
075     */
076    public void setFirstName(String firstName) {
077        this.firstName = firstName;
078    }
079
080    /**
081     * Returns the person's last name.
082     * 
083     * @return last name
084     */
085    public String getLastName() {
086        return lastName;
087    }
088
089    /**
090     * Sets the person's last name
091     * 
092     * @param lastName person's last name
093     */
094    public void setLastName(String lastName) {
095        this.lastName = lastName;
096    }
097
098    /**
099     * Sets the enterprise unit this person works for
100     * 
101     * @param enterpriseUnit unit the member works for
102     */
103    public void setEnterpriseUnit(AbstractEnterpriseUnit enterpriseUnit) {
104        this.enterpriseUnit = enterpriseUnit;
105    }
106
107    /**
108     * Returns the job title of this staff member
109     * 
110     * @return job title
111     */
112    public String getJobTitle() {
113        return this.jobTitle;
114    }
115
116    /**
117     * Sets this staff member's job title
118     * 
119     * @param jobTitle person's job
120     */
121    public void setJobTitle(String jobTitle) {
122        this.jobTitle = jobTitle;
123    }
124
125    /**
126     * Returns the enterprise unit this person works for.
127     * 
128     * @return enterprise unit
129     */
130    public AbstractEnterpriseUnit getEnterpriseUnit() {
131        return this.enterpriseUnit;
132    }
133
134    @Override
135    public String getName() {
136        return firstName + " " + lastName;
137    }
138
139    @Override
140    public EnterpriseNode getParentNode() {
141        return this.enterpriseUnit;
142    }
143
144    @Override
145    public String getDescription() {
146        return this.getClass().getSimpleName() + "('" + this.getName() + "' - " + this.jobTitle + ")";
147    }
148}