Skip to content

Commit e1c43a7

Browse files
committed
follow application context - still issues versions
1 parent 738feb0 commit e1c43a7

File tree

8 files changed

+41
-22
lines changed

8 files changed

+41
-22
lines changed

klass-forvaltning/src/main/java/no/ssb/klass/designer/ClassificationFamilyView.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public ClassificationFamilyView(ClassificationFacade classificationFacade, UserC
5151
this.classificationFilter = VaadinUtil.getKlassState().getClassificationFilter();
5252
UI.getCurrent().getPage().addBrowserWindowResizeListener(event -> updateGrid(event.getWidth()));
5353
log.info("ClassificationFamilyView initialized with userContext: {} and classification facade {}", userContext, classificationFacade);
54+
log.info("ClassificationFamilyView initialized klass state: {}", VaadinUtil.getKlassState());
5455
}
5556

5657
private void updateGrid(int width) {

klass-forvaltning/src/main/java/no/ssb/klass/designer/ClassificationListView.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import no.ssb.klass.forvaltning.converting.xml.FullVersionExportService;
2424
import org.slf4j.Logger;
2525
import org.slf4j.LoggerFactory;
26+
import org.springframework.context.ApplicationContext;
2627

2728

2829
@PrototypeScope
@@ -37,24 +38,28 @@ public class ClassificationListView extends ClassificationListDesign implements
3738

3839
private UserContext userContext;
3940

41+
private ApplicationContext applicationContext;
42+
4043

4144
private final ClassificationFilter classificationFilter;
4245
private final SharedEscapeShortcutListener sharedEscapeShortcutListener;
4346

4447
private FullVersionExportService exportService;
4548

4649
@Autowired
47-
public ClassificationListView(UserContext userContext, ClassificationFacade classificationFacade, FullVersionExportService exportService) {
50+
public ClassificationListView(UserContext userContext, ClassificationFacade classificationFacade, FullVersionExportService exportService, ApplicationContext applicationContext) {
4851
this.userContext = userContext;
4952
this.classificationFacade = classificationFacade;
5053
this.exportService = exportService;
54+
this.applicationContext = applicationContext;
5155
log.info("User context list view {}", userContext);
56+
log.info("Application context list view {}", applicationContext);
5257
sharedEscapeShortcutListener = new SharedEscapeShortcutListener();
5358
this.classificationFilter = VaadinUtil.getKlassState().getClassificationFilter();
5459
backButton.addClickListener(e -> VaadinUtil.navigateTo(ClassificationFamilyView.NAME));
5560
classificationTable.init(versionTable, variantTable, userContext, classificationFacade);
56-
versionTable.init(classificationTable, variantTable, userContext, classificationFacade, exportService);
57-
variantTable.init(versionTable, userContext);
61+
versionTable.init(classificationTable, variantTable, userContext, classificationFacade, exportService, applicationContext);
62+
variantTable.init(versionTable, userContext, classificationFacade);
5863
classificationTable.addToSharedActionListener(sharedEscapeShortcutListener);
5964
versionTable.addToSharedActionListener(sharedEscapeShortcutListener);
6065
variantTable.addToSharedActionListener(sharedEscapeShortcutListener);

klass-forvaltning/src/main/java/no/ssb/klass/designer/classificationlist/VariantTable.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ public class VariantTable extends AbstractTable {
4242

4343
@Autowired
4444
private ApplicationContext applicationContext;
45-
@Autowired
45+
46+
4647
private ClassificationFacade classificationFacade;
4748

4849
private UserContext userContext;
@@ -53,8 +54,9 @@ public class VariantTable extends AbstractTable {
5354
private Button addVariantButton;
5455

5556
@Autowired
56-
public void init(VersionTable versionTable, UserContext userContext) {
57+
public void init(VersionTable versionTable, UserContext userContext, ClassificationFacade classificationFacade) {
5758
this.userContext = userContext;
59+
this.classificationFacade = classificationFacade;
5860
table = createTable(new VariantContainer(userContext, classificationFacade, versionTable));
5961
table.setColumnExpandRatio(AbstractPropertyContainer.NAME, 1);
6062
addCorrespondenceButton = createAddElementButton(NEW_CORRESPONDENCE_TABLE_TOOLTIP);

klass-forvaltning/src/main/java/no/ssb/klass/designer/classificationlist/VersionTable.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public class VersionTable extends AbstractTable {
5151
private final StreamResource streamResource = new StreamResource(this::generateExportData, "");
5252
private final FileDownloader fileDownloader = new FileDownloader(streamResource);
5353

54-
@Autowired
5554
private ApplicationContext applicationContext;
5655

5756
private ClassificationFacade classificationFacade;
@@ -68,10 +67,11 @@ public class VersionTable extends AbstractTable {
6867
private ClassificationVersionClickListener classificationVersionClickListener;
6968

7069
@Autowired
71-
public void init(ClassificationTable classificationTable, VariantTable variantTable, UserContext userContext, ClassificationFacade classificationFacade, FullVersionExportService exportService) {
70+
public void init(ClassificationTable classificationTable, VariantTable variantTable, UserContext userContext, ClassificationFacade classificationFacade, FullVersionExportService exportService, ApplicationContext applicationContext) {
7271
this.userContext = userContext;
7372
this.classificationFacade = classificationFacade;
7473
this.exportService = exportService;
74+
this.applicationContext = applicationContext;
7575
classificationVersionClickListener = new ClassificationVersionClickListener(userContext,
7676
classificationFacade, variantTable);
7777
table = createTable(new VersionContainer(userContext, classificationFacade),
@@ -133,7 +133,7 @@ private void copyVersion(ClassificationTable classificationTable) {
133133

134134
NewVersionWindow copyVersionWindow = applicationContext.getBean(NewVersionWindow.class);
135135
copyVersionWindow.init(classificationTable.getSelectedClassificationId(),
136-
classificationTable.getSelectedClassificationName());
136+
classificationTable.getSelectedClassificationName(), classificationFacade);
137137
UI.getCurrent().addWindow(copyVersionWindow);
138138
}
139139
}

klass-forvaltning/src/main/java/no/ssb/klass/designer/editing/version/CodeEditorView.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,32 @@
2323
import no.ssb.klass.designer.service.ClassificationFacade;
2424
import no.ssb.klass.designer.util.ComponentUtil;
2525
import no.ssb.klass.designer.windows.AutomaticTranslationWindow;
26+
import org.slf4j.Logger;
27+
import org.slf4j.LoggerFactory;
2628

2729
@SuppressWarnings("serial")
2830
@SpringComponent
2931
@PrototypeScope
3032
public class CodeEditorView extends CodeEditorDesign implements HasEditingState {
33+
private static final Logger log = LoggerFactory.getLogger(CodeEditorView.class);
3134

3235
private ImportExportComponent<ClassificationVersion> importExportComponent;
3336
private ClassificationVersion version;
3437
private final EventBus eventbus;
3538

36-
@Autowired
3739
private ApplicationContext context;
3840

39-
@Autowired
4041
private ClassificationFacade classificationFacade;
4142

42-
@Autowired
4343
private ClassificationVersionXmlService versionXmlService;
4444

4545
private SharedEscapeShortcutListener shortcutListener;
4646

47-
public CodeEditorView() {
47+
@Autowired
48+
public CodeEditorView(ApplicationContext context, ClassificationFacade classificationFacade, ClassificationVersionXmlService versionXmlService) {
49+
this.context = context;
50+
this.classificationFacade = classificationFacade;
51+
this.versionXmlService = versionXmlService;
4852
shortcutListener = new SharedEscapeShortcutListener();
4953
eventbus = new EventBus("code-editor");
5054
eventbus.register(primaryCodeTable);
@@ -58,7 +62,7 @@ public CodeEditorView() {
5862
translationCodeTable.init(eventbus, version, language);
5963
translationLevels.init(eventbus, version, language);
6064
});
61-
65+
log.info("Initializing CodeEditorView");
6266
}
6367

6468
@Override
@@ -100,7 +104,7 @@ private void deleteExistingItemsBeforeImport(ClassificationVersion version) thro
100104
}
101105
}
102106

103-
107+
// consider autowired
104108
public void init(ClassificationVersion version) {
105109
this.version = version;
106110
primaryCodeTable.init(eventbus, version, version.getPrimaryLanguage(), classificationFacade);
@@ -120,6 +124,7 @@ public void init(ClassificationVersion version) {
120124

121125
primaryCodeTable.addToSharedActionListener(shortcutListener);
122126
translationCodeTable.addToSharedActionListener(shortcutListener);
127+
log.info("Initializing CodeEditorView version {}", version);
123128

124129
}
125130

@@ -138,6 +143,7 @@ private void showTranslations(boolean show) {
138143
}
139144

140145
private void updatePrimaryLanguageLabel() {
146+
log.info("Updating primary language label ()", version);
141147
primaryLanguage.setValue(version.getPrimaryLanguage().getDisplayName());
142148
}
143149

klass-forvaltning/src/main/java/no/ssb/klass/designer/editing/version/CreateVersionView.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,18 @@ public class CreateVersionView extends VerticalLayout implements EditingView {
4242

4343
private boolean ignoreChanges = false;
4444

45-
@Autowired
45+
4646
private ClassificationFacade classificationFacade;
4747

48-
@Autowired
4948
private UserContext userContext;
5049

5150
private final VersionEditorView versionEditorView;
5251
private ClassificationVersion classificationVersion;
5352

54-
public CreateVersionView() {
53+
@Autowired
54+
public CreateVersionView( ClassificationFacade classificationFacade, UserContext userContext) {
55+
this.classificationFacade = classificationFacade;
56+
this.userContext = userContext;
5557
ConfirmOrCancelComponent actionButtons = new ConfirmOrCancelComponent();
5658
actionButtons.setConfirmText("Lagre");
5759
actionButtons.addConfirmClickListener(event -> save());

klass-forvaltning/src/main/java/no/ssb/klass/designer/editing/version/VersionMainView.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,22 @@
3131
@SuppressWarnings("serial")
3232
public class VersionMainView extends VersionMainEditor implements EditingView {
3333

34+
// error
3435
public static final String NAME = "editVersion";
3536
public static final String PARAM_VERSION_ID = "versionId";
3637

3738
private boolean ignoreChanges = false;
3839

39-
@Autowired
4040
private ClassificationFacade classificationFacade;
4141

42-
@Autowired
4342
private UserContext userContext;
4443

4544
private PublicationChoiceEditor publicationChoiceEditor;
4645

47-
public VersionMainView() {
46+
@Autowired
47+
public VersionMainView(ClassificationFacade classificationFacade, UserContext userContext) {
48+
this.classificationFacade = classificationFacade;
49+
this.userContext = userContext;
4850
publicationChoiceEditor = new PublicationChoiceEditor(new MarginInfo(true, false, true, true));
4951
actionButtons.addConfirmClickListener(event -> checkAndSaveVersion());
5052
actionButtons.addCancelClickListener(this::cancelClick);

klass-forvaltning/src/main/java/no/ssb/klass/designer/windows/NewVersionWindow.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public class NewVersionWindow extends Window {
4646
private static final String MONTH_PADDING = "mm";
4747
private static final String YEAR_PADDING = "åååå";
4848

49-
@Autowired
49+
// ?
5050
private ClassificationFacade classificationFacade;
5151

5252
private LocalDate validFrom;
@@ -59,7 +59,8 @@ public NewVersionWindow() {
5959
setModal(true);
6060
}
6161

62-
public void init(String classificationId, String versionName) {
62+
public void init(String classificationId, String versionName, ClassificationFacade classificationFacade) {
63+
this.classificationFacade = classificationFacade;
6364
classificationSeries = classificationFacade.getRequiredClassificationSeries(Long.parseLong(classificationId));
6465

6566
// Label headings part

0 commit comments

Comments
 (0)