This case study starts from a requirements document to construct a UML model and to implement it in Java EE.
Interview between the New York City Penitentiary (NYCP) director (Director) and a Business Analyst (BA).
Director: When a new prisoner enters the penitentiary, administration creates a prison file peculiar to this prisoner. This file includes the following information:
- an internal number, by which the prisoner can be identified inside the penitentiary,
- the prisoner’s full name, with date and place of birth,
- the legal case number, which identifies the case among other jurisdictional cases,
- the name of the case’s original jurisdiction, a name which perfectly identifies the jurisdiction,
- the date when the criminal act was committed,
- the motive of the case,
- and the date of incarceration.
BA: What exactly do you mean by a “new prisoner”? Would someone who “legally” left the prison three years ago, and who comes back, be considered a “new prisoner”?
BA: So, a new prison file would be created?
Director: Yes. Moreover, I must point out why we have a prison file number. It is the only way to perfectly identify a prisoner.
BA: Can two prisoners, who are currently in a prison in the USA, have the same prison file number?
Director: Yes, but not two prisoners within the NYCP.
BA: Can one prisoner enter the prison in relation with several criminal cases?
Director: A prisoner under remand can be put behind bars. If so, he has not been condemned yet. However, an incarceration decision has obviously been taken against him. This decision is related to a specific case. He might have been imprisoned because he had been convicted of a crime. He may also be imprisoned because he was condemned for several crimes.
BA: Do you register all the crimes for which the prisoner has been convicted?
BA: Do you also register the crimes that the prisoner may be convicted of, after being incarcerated?
Director: Yes, as long as he is an inmate of the NYCP.
BA: So, a prisoner can be newly convicted of other crimes?
Director: Yes, a person having participated in a crime and having been condemned to prison for it (and incarcerated in New York), may be newly convicted for another crime, which he participated in… before being incarcerated. However, since I’ve been director of this prison, there have been no more prison breaks!
BA: For a given criminal case, can you have several prisoners?
Director: Yes, but we try to avoid it. I must also tell you that we include all the judicial decisions related to the incarceration in the prison file, such as:
- the convictions,
- the shortened criminal sentences,
- and the final discharges of the prisoner (several discharges may be concerned with the same prisoner. We do not take into account here of how an “effective” liberation for this prisoner is computed and enforced).
Each of these judicial decisions is recorded in the prison file with their respective numbers (1, 2 or 3). Each decision has a date. The convictions include the length of imprisonment (in number of days) to be carried out. Shortened sentences include the amount of time the sentence is shortened by. The final discharge includes the date of discharge.
BA: For example, can a prisoner have multiple shortenings of his criminal sentence?
BA: You previously said that you registered the motive of the crime. Is it the motive for the conviction that the prisoner was sent to prison for?
Director: Yes, it is true that for the same crime there can be convicts condemned for different motives.
BA: Could you give me examples of some motives?
Director: Yes, for example:
- 01-theft and various misdemeanors,
- 02-assault and battery,
- 04-carrying of a weapon without a license,
- 05-drunk driving,
- 12-breach of trust,
- 15-procuring for prostitutes,
BA: For a given crime, there could possibly be several motives behind the conviction. Do you only record one?
Director: Yes, the main one.
BA: You also previously stated that you recorded the date when the criminal act was committed. However, is it possible that for a particular crime there may be several dates of crime? For example, a fraud may take place from a certain date to a certain date. So, for a specific crime, can there be several crime dates?
Director: We only record one crime date.
BA: Could you give me examples of some crime dates?
Director: Yes, for example, “during the month of April and May 1996” or “around December 6th, 1993”.
BA: I would like to go back to the judicial decisions related to the incarceration. Can several judicial decisions (for example, shortened sentences) be registered on the same date for the same prisoner?
Director: No. I understand what you are saying. You think that one prisoner can receive two judicial decisions on the same date. For example two shortened sentences, of the same length, could be decided; each decision being linked to a different crime for which the prisoner is in prison. What you mean to ask is: Can two judgments, of the same kind, concerning the same prisoner, be registered on the same day?
Director: The answer is no. However, the judge can decide the same day to shorten the sentence or to condemn the convict to prison. It rarely occurs.
BA: Would you register the fact that a particular judgment, linked to the incarceration of a given prisoner was made by a certain jurisdiction?
Director: No. It does not matter to us which jurisdictions make judgments for these crimes.
BA: But what about the main crime, for which the prisoner is incarcerated, don’t you record the original jurisdiction?
BA: Speaking of jurisdictions, can there be two of them with the same name?
BA: In your prison files, do you keep all the information on prisoners who have “legally” left the penitentiary?
Director: No. We only keep information on prisoners who are currently serving their prison sentence.
BA: Including prisoners under remand?
Director: Yes, of course.
BA: OK, I have got very interesting inputs about your information system. Now, what about your functional requirements?
Director: That is quite simple. I require the enforcement of law decisions, namely incarcerating a person. In such case, some information is created including a new prisoner record, its main criminal case, etc. The other kind of law decision to be enforced is when decisions are taken against existing prisoners, namely convictions, shortened sentences and final discharges. Finally, I must also be able to compute which prisoners are under remand. That is all for the moment.
BA: OK, thank you, I am going to build the UML model.
Under remanduse case
context Prisoner inv: Prisoner.allInstances()->select(self.judicial_decision)->select(self.oclIsTypeOf(Conviction))->isEmpty()
- JPQL (with
_convictionas Java private attribute and
get_convictionas Java public method)
SELECT p FROM Prisoner p WHERE p._conviction IS EMPTY