bug 1633 fixed
This commit is contained in:
parent
17ef953a86
commit
7531b75ac0
4 changed files with 17 additions and 11 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -10,6 +10,10 @@ ganttzk/target
|
|||
.project
|
||||
.settings/
|
||||
|
||||
# ignore IDEA configuration files
|
||||
.idea
|
||||
*.iml
|
||||
|
||||
#ignore patches files
|
||||
*.patch
|
||||
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ public abstract class IntegrationEntity extends BaseEntity {
|
|||
* with the same code. This method is a Template method that calls on
|
||||
* the private method <code>findIntegrationEntityDAO</code>, which in turn
|
||||
* calls on the abstract method <code>getIntegrationEntityDAO()</code>.
|
||||
* Code of entity looks like: "WORK_REPORT_0001"
|
||||
*/
|
||||
@AssertTrue(message="code is already used")
|
||||
public boolean isUniqueCodeConstraint() {
|
||||
|
|
|
|||
|
|
@ -110,16 +110,13 @@ public class EntitySequenceDAO extends
|
|||
for (int i = 0; i < 5; i++) {
|
||||
try {
|
||||
String code;
|
||||
Integer cont = 0;
|
||||
EntitySequence entitySequence = getActiveEntitySequence(entityName);
|
||||
|
||||
do {
|
||||
entitySequence.incrementLastValue();
|
||||
code = entitySequence.getCode();
|
||||
cont++;
|
||||
} while (entityName.getIntegrationEntityDAO()
|
||||
.existsByCode(code)
|
||||
&& cont < 100);
|
||||
.existsByCode(code));
|
||||
|
||||
save(entitySequence);
|
||||
return code;
|
||||
|
|
|
|||
|
|
@ -440,19 +440,23 @@ public class WorkReport extends IntegrationEntity implements
|
|||
|
||||
public void generateWorkReportLineCodes(int numberOfDigits) {
|
||||
for (WorkReportLine line : this.getWorkReportLines()) {
|
||||
if ((line.getCode() == null) || (line.getCode().isEmpty())
|
||||
|| (!line.getCode().startsWith(this.getCode()))) {
|
||||
|
||||
if ((line.getCode() == null) || (line.getCode().isEmpty()) ||
|
||||
(!line.getCode().startsWith(this.getCode()))) {
|
||||
|
||||
this.incrementLastWorkReportLineSequenceCode();
|
||||
String lineCode = EntitySequence.formatValue(numberOfDigits,
|
||||
this.getLastWorkReportLineSequenceCode());
|
||||
line.setCode(this.getCode()
|
||||
+ EntitySequence.CODE_SEPARATOR_CHILDREN + lineCode);
|
||||
|
||||
String lineCode = EntitySequence.formatValue(
|
||||
numberOfDigits, this.getLastWorkReportLineSequenceCode());
|
||||
|
||||
line.setCode(this.getCode() +
|
||||
EntitySequence.CODE_SEPARATOR_CHILDREN + lineCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void incrementLastWorkReportLineSequenceCode() {
|
||||
if(lastWorkReportLineSequenceCode==null){
|
||||
if(lastWorkReportLineSequenceCode == null){
|
||||
lastWorkReportLineSequenceCode = 0;
|
||||
}
|
||||
lastWorkReportLineSequenceCode++;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue