📜 ⬆️ ⬇️

Vertex data normalization: getGenders

Since Habr is primarily devoted to IT, I think the following story has many fans.

Not so long ago, our team had to integrate with the external financial system through web services. Among other things, attention was attracted by the method with the secret name getGenders. The comment to the method sounded like " Sex reference book (sex). Strange, but there are two of them ... " (no kidding). The situation was aggravated by the fact that the method took a string parameter as input.

After several attempts to call the method with different values ​​of the parameter, the same answer was obtained:
')
    id |  name |  vid
 ----------------------
 500001 |  MALE |  "one"
 500012 |  FEMALE |  "one"

Probably not only in my language “It was really strange, but why are there two of them?” Because everyone fell under the table.

Suspiciously long identifiers could be explained by the fact that often web services are generated based on the results of database queries, and it could use some kind of common sequence for several tables. But the vId parameter did not give us rest ...

Quest to clarify this important issue from representatives of the fin. The institution was assigned to the most serious person of the team. Everything turned out to be ugly simply: vId is the version number of the system.

Why we need this so plainly and did not explain, limiting ourselves to a dry “something for migration”. But I don’t give up hope, even in the distant future, to talk with the database designer, since I have no doubt for a minute that he used at least 2 tables to present the floor guide with the version in mind ...

If someone is not interested, here is the interface code (anonymized):

 / **
   * Directory of sexes (sex).  Strange, but there are two ...
   *                        
   * @param vId
   * @return java.util.List <api.dictionary.soap.Genders>
   * /
 @WebMethod (action = "ns: getGenders")
 @WebResult (name = "genders", targetNamespace = "...")
 @RequestWrapper (localName = "getGenders", targetNamespace = "...", className = "api.dictionary.soap.GetGenders")
 @ResponseWrapper (localName = "gendersList", targetNamespace = "...", className = "api.dictionary.soap.GendersList")
 public List <Genders> getGenders (@WebParam (name = "vId", targetNamespace = "...") String vId);

Write in the comments, and what interesting and mysterious did you meet in your work.

Source: https://habr.com/ru/post/115129/


All Articles