ItEr43S09ImplantacionAplicacionItEr42S13: [Bug #241] Fixing bug. Initializing labels when being retrieved.
The problem was that the data bindings were retrieving the labels before being initialized.
This commit is contained in:
parent
5b1ee5588c
commit
f2522839ad
3 changed files with 10 additions and 3 deletions
|
|
@ -123,6 +123,7 @@ public class OrderModel implements IOrderModel {
|
|||
private IOrderSequenceDAO orderSequenceDAO;
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public List<Label> getLabels() {
|
||||
return getLabelsOnConversation().getLabels();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,6 +180,7 @@ public abstract class AssignedLabelsModel<T> implements IAssignedLabelsModel<T>
|
|||
return false;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<Label> getAllLabels() {
|
||||
return getLabelsOnConversation();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,28 +37,32 @@ public class LabelsOnConversation {
|
|||
|
||||
private final ILabelDAO labelDAO;
|
||||
|
||||
private Set<Label> labels = new HashSet<Label>();
|
||||
private Set<Label> labels = null;
|
||||
|
||||
public LabelsOnConversation(ILabelDAO labelDAO) {
|
||||
this.labelDAO = labelDAO;
|
||||
}
|
||||
|
||||
public List<Label> getLabels() {
|
||||
if (labels == null) {
|
||||
initializeLabels();
|
||||
}
|
||||
return new ArrayList<Label>(labels);
|
||||
}
|
||||
|
||||
public void addLabel(Label label) {
|
||||
initializeLabels();
|
||||
Validate.notNull(label);
|
||||
labels.add(label);
|
||||
}
|
||||
|
||||
public void initializeLabels() {
|
||||
if (!labels.isEmpty()) {
|
||||
if (this.labels != null) {
|
||||
return;
|
||||
}
|
||||
final List<Label> labels = labelDAO.getAll();
|
||||
initializeLabels(labels);
|
||||
labels.addAll(labels);
|
||||
this.labels = new HashSet<Label>(labels);
|
||||
}
|
||||
|
||||
private void initializeLabels(Collection<Label> labels) {
|
||||
|
|
@ -73,6 +77,7 @@ public class LabelsOnConversation {
|
|||
}
|
||||
|
||||
public void reattachLabels() {
|
||||
initializeLabels();
|
||||
for (Label each : labels) {
|
||||
labelDAO.reattach(each);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue