Skip to content

Commit 21383c1

Browse files
committed
fixing indentation
1 parent 5710fc6 commit 21383c1

File tree

2 files changed

+154
-153
lines changed

2 files changed

+154
-153
lines changed

quick-start/src/main/java/com/marklogic/hub/model/EntityModel.java

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,25 @@
77
public class EntityModel {
88

99
private String entityName;
10-
private List<FlowModel> inputFlows;
11-
private List<FlowModel> harmonizeFlows;
12-
private boolean isSynched;
13-
private RestModel inputRest;
14-
private RestModel harmonizeRest;
10+
private List<FlowModel> inputFlows;
11+
private List<FlowModel> harmonizeFlows;
12+
private boolean isSynched;
13+
private RestModel inputRest;
14+
private RestModel harmonizeRest;
1515

1616
public String getEntityName() {
1717
return entityName;
18-
}
18+
}
1919

2020
public void setEntityName(String entityName) {
2121
this.entityName = entityName;
22-
}
22+
}
2323

24-
public List<FlowModel> getInputFlows() {
25-
return inputFlows;
26-
}
24+
public List<FlowModel> getInputFlows() {
25+
return inputFlows;
26+
}
2727

28-
public Map<String, FlowModel> getInputFlowsAsMap() {
28+
public Map<String, FlowModel> getInputFlowsAsMap() {
2929
Map<String, FlowModel> flowModels = new HashMap<>();
3030

3131
if (inputFlows != null) {
@@ -37,47 +37,47 @@ public Map<String, FlowModel> getInputFlowsAsMap() {
3737
return flowModels;
3838
}
3939

40-
public void setInputFlows(List<FlowModel> inputFlows) {
41-
this.inputFlows = inputFlows;
42-
}
40+
public void setInputFlows(List<FlowModel> inputFlows) {
41+
this.inputFlows = inputFlows;
42+
}
4343

44-
public List<FlowModel> getHarmonizeFlows() {
45-
return harmonizeFlows;
46-
}
44+
public List<FlowModel> getHarmonizeFlows() {
45+
return harmonizeFlows;
46+
}
4747

48-
public Map<String, FlowModel> getHarmonizeFlowsAsMap() {
48+
public Map<String, FlowModel> getHarmonizeFlowsAsMap() {
4949
Map<String, FlowModel> flowModels = new HashMap<>();
5050

51-
if (harmonizeFlows != null) {
52-
for (FlowModel model : harmonizeFlows) {
53-
flowModels.put(model.getFlowName(), model);
54-
}
55-
}
51+
if (harmonizeFlows != null) {
52+
for (FlowModel model : harmonizeFlows) {
53+
flowModels.put(model.getFlowName(), model);
54+
}
55+
}
5656

57-
return flowModels;
58-
}
57+
return flowModels;
58+
}
5959

60-
public void setHarmonizeFlows(List<FlowModel> harmonizeFlows) {
61-
this.harmonizeFlows = harmonizeFlows;
62-
}
60+
public void setHarmonizeFlows(List<FlowModel> harmonizeFlows) {
61+
this.harmonizeFlows = harmonizeFlows;
62+
}
6363

64-
public boolean isSynched() {
65-
return isSynched;
66-
}
64+
public boolean isSynched() {
65+
return isSynched;
66+
}
6767

68-
public void setSynched(boolean isSynched) {
69-
this.isSynched = isSynched;
70-
}
68+
public void setSynched(boolean isSynched) {
69+
this.isSynched = isSynched;
70+
}
7171

72-
public void setInputFlowsSynched(boolean synched) {
73-
if (inputFlows != null) {
74-
for (FlowModel model : inputFlows) {
75-
model.setSynched(synched);
76-
}
77-
}
78-
}
72+
public void setInputFlowsSynched(boolean synched) {
73+
if (inputFlows != null) {
74+
for (FlowModel model : inputFlows) {
75+
model.setSynched(synched);
76+
}
77+
}
78+
}
7979

80-
public void setHarmonizeFlowsSynched(boolean synched) {
80+
public void setHarmonizeFlowsSynched(boolean synched) {
8181
if (harmonizeFlows != null) {
8282
for (FlowModel model : harmonizeFlows) {
8383
model.setSynched(synched);

quick-start/src/main/java/com/marklogic/hub/web/controller/api/EntityApiController.java

Lines changed: 112 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -34,115 +34,116 @@
3434
@Scope("session")
3535
public class EntityApiController implements InitializingBean, DisposableBean, FileSystemEventListener {
3636

37-
@Autowired
38-
private EnvironmentConfiguration environmentConfiguration;
39-
40-
@Autowired
41-
private DataHubService dataHubService;
42-
43-
@Autowired
44-
private EntityManagerService entityManagerService;
45-
46-
@Autowired
47-
private FileSystemWatcherService watcherService;
48-
49-
@Autowired
50-
private SyncStatusService syncStatusService;
51-
52-
@RequestMapping(method = RequestMethod.GET)
53-
@ResponseBody
54-
public List<EntityModel> getEntities(HttpSession session) {
55-
LoginForm loginForm = (LoginForm) session.getAttribute("loginForm");
56-
List<EntityModel> entities = entityManagerService.getEntities();
57-
loginForm.setEntities(entities);
58-
return entities;
59-
}
60-
61-
@RequestMapping(value = "display", method = RequestMethod.POST)
62-
@ResponseBody
63-
public EntityModel displayEntity(@RequestBody String entityName, HttpSession session) {
64-
LoginForm loginForm = (LoginForm) session.getAttribute("loginForm");
65-
loginForm.selectEntity(entityName);
66-
67-
return loginForm.getSelectedEntity();
68-
}
69-
70-
@RequestMapping(method = RequestMethod.POST, consumes = { MediaType.APPLICATION_JSON_UTF8_VALUE }, produces = {
71-
MediaType.APPLICATION_JSON_UTF8_VALUE })
72-
@ResponseBody
73-
public LoginForm saveEntity(@RequestBody EntityForm entityForm, BindingResult bindingResult, HttpSession session) {
74-
LoginForm loginForm = (LoginForm) session.getAttribute("loginForm");
75-
List<EntityModel> entities = loginForm.getEntities();
76-
77-
entityForm.validate(entities);
78-
79-
EntityModel entityModel = entityManagerService.createEntity(entityForm.getEntityName(),
80-
entityForm.getInputFlowName(), entityForm.getHarmonizeFlowName(), entityForm.getPluginFormat(),
81-
entityForm.getDataFormat());
82-
83-
entities.add(entityModel);
84-
loginForm.setSelectedEntity(entityModel);
85-
return loginForm;
86-
}
87-
88-
/**
89-
* Get a list of entities that has changed. This API does not return until a
90-
* change has occurred.
91-
*
92-
* @param session
93-
* @return
94-
*/
95-
@RequestMapping(value = "status-change", method = RequestMethod.GET)
96-
public LoginForm getStatusChange(HttpServletRequest request) {
97-
HttpSession session = request.getSession();
98-
99-
synchronized (syncStatusService) {
100-
try {
101-
syncStatusService.wait();
102-
} catch (InterruptedException e) {
103-
}
104-
105-
// refresh the list of entities saved in the session
106-
LoginForm loginForm = (LoginForm) session.getAttribute("loginForm");
107-
if (null == loginForm) {
108-
loginForm = new LoginForm();
109-
}
110-
111-
// add checking if data hub is installed and the server is
112-
// acceptable. Something may have changed the server or removed the
113-
// data hub outside the app
114-
loginForm.setInstalled(dataHubService.isInstalled());
115-
loginForm.setServerVersionAccepted(dataHubService.isServerAcceptable());
116-
if (loginForm.isInstalled()) {
117-
List<EntityModel> entities = entityManagerService.getEntities();
118-
loginForm.setEntities(entities);
119-
loginForm.refreshSelectedEntity();
120-
}
121-
122-
// refresh the session loginForm
123-
session.setAttribute("loginForm", loginForm);
124-
125-
return loginForm;
126-
}
127-
}
128-
129-
@Override
130-
public void afterPropertiesSet() throws Exception {
131-
String pluginDir = environmentConfiguration.getUserPluginDir();
132-
watcherService.watch(pluginDir, this);
133-
}
134-
135-
@Override
136-
public void destroy() throws Exception {
137-
synchronized (syncStatusService) {
138-
syncStatusService.notifyAll();
139-
}
140-
}
141-
142-
@Override
143-
public void onWatchEvent(Path path, WatchEvent<Path> event) {
144-
synchronized (syncStatusService) {
145-
syncStatusService.notifyAll();
146-
}
147-
}
37+
@Autowired
38+
private EnvironmentConfiguration environmentConfiguration;
39+
40+
@Autowired
41+
private DataHubService dataHubService;
42+
43+
@Autowired
44+
private EntityManagerService entityManagerService;
45+
46+
@Autowired
47+
private FileSystemWatcherService watcherService;
48+
49+
@Autowired
50+
private SyncStatusService syncStatusService;
51+
52+
@RequestMapping(method = RequestMethod.GET)
53+
@ResponseBody
54+
public List<EntityModel> getEntities(HttpSession session) {
55+
LoginForm loginForm = (LoginForm) session.getAttribute("loginForm");
56+
List<EntityModel> entities = entityManagerService.getEntities();
57+
loginForm.setEntities(entities);
58+
return entities;
59+
}
60+
61+
@RequestMapping(value = "display", method = RequestMethod.POST)
62+
@ResponseBody
63+
public EntityModel displayEntity(@RequestBody String entityName, HttpSession session) {
64+
LoginForm loginForm = (LoginForm) session.getAttribute("loginForm");
65+
loginForm.selectEntity(entityName);
66+
67+
return loginForm.getSelectedEntity();
68+
}
69+
70+
@RequestMapping(method = RequestMethod.POST, consumes = { MediaType.APPLICATION_JSON_UTF8_VALUE }, produces = {
71+
MediaType.APPLICATION_JSON_UTF8_VALUE })
72+
@ResponseBody
73+
public LoginForm saveEntity(@RequestBody EntityForm entityForm, BindingResult bindingResult, HttpSession session) {
74+
LoginForm loginForm = (LoginForm) session.getAttribute("loginForm");
75+
List<EntityModel> entities = loginForm.getEntities();
76+
77+
entityForm.validate(entities);
78+
79+
EntityModel entityModel = entityManagerService.createEntity(entityForm.getEntityName(),
80+
entityForm.getInputFlowName(), entityForm.getHarmonizeFlowName(), entityForm.getPluginFormat(),
81+
entityForm.getDataFormat());
82+
83+
entities.add(entityModel);
84+
loginForm.setSelectedEntity(entityModel);
85+
return loginForm;
86+
}
87+
88+
/**
89+
* Get a list of entities that has changed. This API does not return until a
90+
* change has occurred.
91+
*
92+
* @param session
93+
* @return
94+
*/
95+
@RequestMapping(value = "status-change", method = RequestMethod.GET)
96+
public LoginForm getStatusChange(HttpServletRequest request) {
97+
HttpSession session = request.getSession();
98+
99+
synchronized (syncStatusService) {
100+
try {
101+
syncStatusService.wait();
102+
}
103+
catch (InterruptedException e) {
104+
}
105+
106+
// refresh the list of entities saved in the session
107+
LoginForm loginForm = (LoginForm) session.getAttribute("loginForm");
108+
if (null == loginForm) {
109+
loginForm = new LoginForm();
110+
}
111+
112+
// add checking if data hub is installed and the server is
113+
// acceptable. Something may have changed the server or removed the
114+
// data hub outside the app
115+
loginForm.setInstalled(dataHubService.isInstalled());
116+
loginForm.setServerVersionAccepted(dataHubService.isServerAcceptable());
117+
if (loginForm.isInstalled()) {
118+
List<EntityModel> entities = entityManagerService.getEntities();
119+
loginForm.setEntities(entities);
120+
loginForm.refreshSelectedEntity();
121+
}
122+
123+
// refresh the session loginForm
124+
session.setAttribute("loginForm", loginForm);
125+
126+
return loginForm;
127+
}
128+
}
129+
130+
@Override
131+
public void afterPropertiesSet() throws Exception {
132+
String pluginDir = environmentConfiguration.getUserPluginDir();
133+
watcherService.watch(pluginDir, this);
134+
}
135+
136+
@Override
137+
public void destroy() throws Exception {
138+
synchronized (syncStatusService) {
139+
syncStatusService.notifyAll();
140+
}
141+
}
142+
143+
@Override
144+
public void onWatchEvent(Path path, WatchEvent<Path> event) {
145+
synchronized (syncStatusService) {
146+
syncStatusService.notifyAll();
147+
}
148+
}
148149
}

0 commit comments

Comments
 (0)