1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.codelibs.fess.opensearch.config.exentity;
17
18 import org.apache.logging.log4j.LogManager;
19 import org.apache.logging.log4j.Logger;
20 import org.codelibs.fess.app.service.FileConfigService;
21 import org.codelibs.fess.opensearch.config.bsentity.BsFileAuthentication;
22 import org.codelibs.fess.util.ComponentUtil;
23
24
25
26
27 public class FileAuthentication extends BsFileAuthentication {
28
29 private static final long serialVersionUID = 1L;
30
31 private static final Logger logger = LogManager.getLogger(FileAuthentication.class);
32
33 private FileConfig fileConfig;
34
35 public String getId() {
36 return asDocMeta().id();
37 }
38
39 public void setId(final String id) {
40 asDocMeta().id(id);
41 }
42
43 public Long getVersionNo() {
44 return asDocMeta().version();
45 }
46
47 public void setVersionNo(final Long version) {
48 asDocMeta().version(version);
49 }
50
51 public FileConfig getFileConfig() {
52 if (fileConfig == null) {
53 final FileConfigService fileConfigService = ComponentUtil.getComponent(FileConfigService.class);
54 try {
55 fileConfig = fileConfigService.getFileConfig(getFileConfigId()).get();
56 } catch (final Exception e) {
57 logger.warn("File Config {} does not exist.", getFileConfigId(), e);
58 }
59 }
60 return fileConfig;
61 }
62
63 @Override
64 public String toString() {
65 return "FileAuthentication [fileConfig=" + fileConfig + ", createdBy=" + createdBy + ", createdTime=" + createdTime
66 + ", fileConfigId=" + fileConfigId + ", hostname=" + hostname + ", parameters=" + parameters + ", port=" + port
67 + ", protocolScheme=" + protocolScheme + ", updatedBy=" + updatedBy + ", updatedTime=" + updatedTime + ", username="
68 + username + ", docMeta=" + docMeta + "]";
69 }
70 }