Skip to content

Commit 64b2fa8

Browse files
author
Łukasz Lewczyński
committed
MOTECH-993: Split the mds module into mds and mds-web modules
Change-Id: Ie88b6a94a2e84eccf77ba656829564db711849e7
1 parent 26387b6 commit 64b2fa8

File tree

162 files changed

+878
-355
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+878
-355
lines changed

.tx/generate-config.sh

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ if [ ${NAME} == 'tasks' ]; then
3939
NAME="tasks-bundle"
4040
elif [ ${NAME} == 'http-bundle-archetype' ]; then
4141
NAME="minimal-bundle-archetype"
42+
elif [ ${NAME} == 'mds-web' ]; then
43+
NAME="mds"
4244
elif [ ${NAME} == 'web-security' ] && [ ${EXT} == 'webapp' ]; then
4345
NAME="web-security-bundle"
4446
fi

platform/mds/mds-web/pom.xml

+238
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2+
<parent>
3+
<artifactId>motech</artifactId>
4+
<groupId>org.motechproject</groupId>
5+
<version>0.24-SNAPSHOT</version>
6+
<relativePath>../../../</relativePath>
7+
</parent>
8+
<modelVersion>4.0.0</modelVersion>
9+
10+
<artifactId>motech-platform-dataservices-web</artifactId>
11+
<version>0.24-SNAPSHOT</version>
12+
<packaging>bundle</packaging>
13+
<name>MOTECH Platform Data Services Web</name>
14+
<properties>
15+
<modules.root.dir>${basedir}/../../..</modules.root.dir>
16+
</properties>
17+
<dependencies>
18+
<dependency>
19+
<groupId>${project.groupId}</groupId>
20+
<artifactId>motech-platform-osgi-web-util</artifactId>
21+
<version>${project.version}</version>
22+
</dependency>
23+
<dependency>
24+
<groupId>${project.groupId}</groupId>
25+
<artifactId>motech-platform-dataservices</artifactId>
26+
<version>${project.version}</version>
27+
</dependency>
28+
<dependency>
29+
<groupId>${project.groupId}</groupId>
30+
<artifactId>motech-platform-web-security</artifactId>
31+
<version>${project.version}</version>
32+
</dependency>
33+
<dependency>
34+
<groupId>${project.groupId}</groupId>
35+
<artifactId>motech-testing-utils</artifactId>
36+
<version>${project.version}</version>
37+
<scope>test</scope>
38+
</dependency>
39+
<dependency>
40+
<groupId>org.eclipse.gemini.blueprint</groupId>
41+
<artifactId>org.motechproject.gemini-blueprint-test</artifactId>
42+
<scope>test</scope>
43+
</dependency>
44+
</dependencies>
45+
<build>
46+
<testResources>
47+
<testResource>
48+
<directory>src/test/resources</directory>
49+
<filtering>true</filtering>
50+
</testResource>
51+
</testResources>
52+
<plugins>
53+
<plugin>
54+
<groupId>org.apache.felix</groupId>
55+
<artifactId>maven-bundle-plugin</artifactId>
56+
<version>2.3.4</version>
57+
<extensions>true</extensions>
58+
<configuration>
59+
<instructions>
60+
<Context-Path>mds</Context-Path>
61+
<Resource-Path>mds/resources</Resource-Path>
62+
<Blueprint-Enabled>true</Blueprint-Enabled>
63+
<Import-Package>
64+
org.aopalliance.aop,
65+
org.eclipse.gemini.blueprint.config,
66+
org.motechproject.mds.javassist,
67+
org.motechproject.mds.service,
68+
org.motechproject.osgi.web,
69+
org.motechproject.security.annotations,
70+
org.motechproject.security.model,
71+
org.motechproject.security.service,
72+
org.springframework.aop,
73+
org.springframework.aop.aspectj.annotation,
74+
org.springframework.aop.framework,
75+
org.springframework.beans.factory.config,
76+
org.springframework.beans.factory.xml,
77+
org.springframework.context.config,
78+
org.springframework.context.support,
79+
org.springframework.security.config,
80+
org.springframework.web.context,
81+
org.springframework.web.context.support,
82+
org.springframework.web.multipart.commons,
83+
org.springframework.web.servlet,
84+
org.springframework.web.servlet.config,
85+
org.springframework.web.servlet.mvc,
86+
org.springframework.web.servlet.support,
87+
org.springframework.web.servlet.view,
88+
*
89+
</Import-Package>
90+
</instructions>
91+
</configuration>
92+
</plugin>
93+
<plugin>
94+
<groupId>org.apache.maven.plugins</groupId>
95+
<artifactId>maven-dependency-plugin</artifactId>
96+
</plugin>
97+
<plugin>
98+
<groupId>org.apache.maven.plugins</groupId>
99+
<artifactId>maven-resources-plugin</artifactId>
100+
<executions>
101+
<execution>
102+
<id>copy-bundles</id>
103+
<phase>package</phase>
104+
<goals>
105+
<goal>copy-resources</goal>
106+
</goals>
107+
<configuration>
108+
<outputDirectory>${user.home}/.motech/bundles</outputDirectory>
109+
<resources>
110+
<resource>
111+
<directory>target</directory>
112+
<includes>
113+
<include>*.jar</include>
114+
</includes>
115+
</resource>
116+
</resources>
117+
</configuration>
118+
</execution>
119+
<execution>
120+
<id>copy-module-js</id>
121+
<phase>process-test-resources</phase>
122+
<goals>
123+
<goal>copy-resources</goal>
124+
</goals>
125+
<configuration>
126+
<outputDirectory>
127+
${project.build.directory}/jasmine/js
128+
</outputDirectory>
129+
<resources>
130+
<resource>
131+
<directory>src/main/resources/webapp/js</directory>
132+
</resource>
133+
</resources>
134+
</configuration>
135+
</execution>
136+
<execution>
137+
<id>copy-platform-js</id>
138+
<phase>process-test-resources</phase>
139+
<goals>
140+
<goal>copy-resources</goal>
141+
</goals>
142+
<configuration>
143+
<outputDirectory>
144+
${project.build.directory}/jasmine/js/core
145+
</outputDirectory>
146+
<resources>
147+
<resource>
148+
<directory>
149+
${modules.root.dir}/platform/server-bundle/src/main/resources/webapp/lib
150+
</directory>
151+
</resource>
152+
<resource>
153+
<directory>
154+
${modules.root.dir}/platform/server-bundle/src/main/resources/webapp/js
155+
</directory>
156+
</resource>
157+
</resources>
158+
</configuration>
159+
</execution>
160+
<execution>
161+
<id>copy-jasmine-spec-lib</id>
162+
<phase>process-test-resources</phase>
163+
<goals>
164+
<goal>copy-resources</goal>
165+
</goals>
166+
<configuration>
167+
<outputDirectory>
168+
${project.build.directory}/jasmine/spec/lib
169+
</outputDirectory>
170+
<resources>
171+
<resource>
172+
<directory>
173+
${modules.root.dir}/platform/server-bundle/src/main/resources/webapp/lib/angular
174+
</directory>
175+
<includes>
176+
<inlude>angular.min.js</inlude>
177+
</includes>
178+
</resource>
179+
<resource>
180+
<directory>
181+
${modules.root.dir}/platform/server-bundle/src/test/resources/lib
182+
</directory>
183+
<includes>
184+
<include>angular-mocks.js</include>
185+
</includes>
186+
</resource>
187+
</resources>
188+
</configuration>
189+
</execution>
190+
<execution>
191+
<id>copy-jasmine-spec</id>
192+
<phase>process-test-resources</phase>
193+
<goals>
194+
<goal>copy-resources</goal>
195+
</goals>
196+
<configuration>
197+
<outputDirectory>
198+
${project.build.directory}/jasmine/spec/spec
199+
</outputDirectory>
200+
<resources>
201+
<resource>
202+
<directory>src/test/resources/jasmine</directory>
203+
</resource>
204+
</resources>
205+
</configuration>
206+
</execution>
207+
</executions>
208+
</plugin>
209+
<plugin>
210+
<groupId>org.codehaus.mojo</groupId>
211+
<artifactId>jslint-maven-plugin</artifactId>
212+
<version>1.0.1</version>
213+
<executions>
214+
<execution>
215+
<goals>
216+
<goal>jslint</goal>
217+
</goals>
218+
<configuration>
219+
<sourceJsFolder>${basedir}/src/main/resources/webapp/js</sourceJsFolder>
220+
<disallowIncrAndDecr>true</disallowIncrAndDecr>
221+
<requireUseStrict>true</requireUseStrict>
222+
<predefinedVars>
223+
_, $, angular, angularHandler, isBlank, handleResponse, blockUI, FileReader,
224+
motechAlert, unblockUI, motechConfirm, cloneArray, arraysEqual,
225+
cloneObj, alertHandler, window, defaultLayout, innerLayout, moment
226+
</predefinedVars>
227+
<failOnIssues>${jslint.enable}</failOnIssues>
228+
</configuration>
229+
</execution>
230+
</executions>
231+
</plugin>
232+
<plugin>
233+
<groupId>com.github.searls</groupId>
234+
<artifactId>jasmine-maven-plugin</artifactId>
235+
</plugin>
236+
</plugins>
237+
</build>
238+
</project>

platform/mds/mds/src/main/java/org/motechproject/mds/web/ExampleData.java platform/mds/mds-web/src/main/java/org/motechproject/mds/web/ExampleData.java

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import org.codehaus.jackson.map.ObjectMapper;
66
import org.motechproject.mds.dto.AdvancedSettingsDto;
77
import org.motechproject.mds.dto.BrowsingSettingsDto;
8+
import org.motechproject.mds.dto.DraftData;
89
import org.motechproject.mds.dto.EntityDto;
910
import org.motechproject.mds.dto.FieldBasicDto;
1011
import org.motechproject.mds.dto.FieldDto;

platform/mds/mds/src/main/java/org/motechproject/mds/web/controller/EntityController.java platform/mds/mds-web/src/main/java/org/motechproject/mds/web/controller/EntityController.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import org.motechproject.mds.ex.EntityNotFoundException;
99
import org.motechproject.mds.service.EntityService;
1010
import org.motechproject.mds.service.JarGeneratorService;
11-
import org.motechproject.mds.web.DraftData;
11+
import org.motechproject.mds.dto.DraftData;
1212
import org.motechproject.mds.web.SelectData;
1313
import org.motechproject.mds.web.SelectResult;
1414
import org.motechproject.mds.web.comparator.EntityNameComparator;

platform/mds/mds/src/main/java/org/motechproject/mds/web/controller/InstanceController.java platform/mds/mds-web/src/main/java/org/motechproject/mds/web/controller/InstanceController.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import org.motechproject.mds.filter.Filter;
1313
import org.motechproject.mds.query.QueryParams;
1414
import org.motechproject.mds.service.EntityService;
15-
import org.motechproject.mds.service.InstanceService;
15+
import org.motechproject.mds.web.service.InstanceService;
1616
import org.motechproject.mds.util.Order;
1717
import org.motechproject.mds.web.domain.EntityRecord;
1818
import org.motechproject.mds.web.domain.FieldRecord;

platform/mds/mds/src/main/java/org/motechproject/mds/web/controller/SettingsController.java platform/mds/mds-web/src/main/java/org/motechproject/mds/web/controller/SettingsController.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.motechproject.mds.web.controller;
22

33
import org.motechproject.mds.config.ModuleSettings;
4-
import org.motechproject.mds.config.SettingsWrapper;
4+
import org.motechproject.mds.config.SettingsService;
55
import org.springframework.beans.factory.annotation.Autowired;
66
import org.springframework.http.HttpStatus;
77
import org.springframework.security.access.prepost.PreAuthorize;
@@ -20,7 +20,7 @@
2020
*/
2121
@Controller("mdsSettingsController")
2222
public class SettingsController {
23-
private SettingsWrapper settingsWrapper;
23+
private SettingsService settingsService;
2424

2525
@RequestMapping(value = "/settings/importFile", method = RequestMethod.POST)
2626
@ResponseStatus(HttpStatus.OK)
@@ -40,18 +40,18 @@ public void export(@RequestBody Object exportTable) {
4040
@ResponseStatus(HttpStatus.OK)
4141
@PreAuthorize(Roles.HAS_SETTINGS_ACCESS)
4242
public void saveSettings(@RequestBody ModuleSettings settings) {
43-
settingsWrapper.saveModuleSettings(settings);
43+
settingsService.saveModuleSettings(settings);
4444
}
4545

4646
@RequestMapping(value = "/settings/get", method = RequestMethod.GET)
4747
@ResponseBody
4848
@PreAuthorize(Roles.HAS_SETTINGS_ACCESS)
4949
public ModuleSettings getSettings() {
50-
return settingsWrapper.getModuleSettings();
50+
return settingsService.getModuleSettings();
5151
}
5252

5353
@Autowired
54-
public void setSettingsWrapper(SettingsWrapper settingsWrapper) {
55-
this.settingsWrapper = settingsWrapper;
54+
public void setSettingsService(SettingsService settingsService) {
55+
this.settingsService = settingsService;
5656
}
5757
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package org.motechproject.mds.web.domain;
2+
3+
import static org.apache.commons.lang.StringUtils.capitalize;
4+
5+
public class ComboboxHolder extends org.motechproject.mds.domain.ComboboxHolder {
6+
7+
public ComboboxHolder(Object instance, FieldRecord field) {
8+
super(
9+
field.getMetadata(), field.getSettings(),
10+
instance.getClass().getName() + capitalize(field.getName())
11+
);
12+
}
13+
14+
}

platform/mds/mds/src/main/java/org/motechproject/mds/service/InstanceService.java platform/mds/mds-web/src/main/java/org/motechproject/mds/web/service/InstanceService.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.motechproject.mds.service;
1+
package org.motechproject.mds.web.service;
22

33
import org.motechproject.mds.dto.FieldInstanceDto;
44
import org.motechproject.mds.filter.Filter;

platform/mds/mds/src/main/java/org/motechproject/mds/service/impl/InstanceServiceImpl.java platform/mds/mds-web/src/main/java/org/motechproject/mds/web/service/impl/InstanceServiceImpl.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.motechproject.mds.service.impl;
1+
package org.motechproject.mds.web.service.impl;
22

33
import org.apache.commons.lang.ArrayUtils;
44
import org.apache.commons.lang.StringUtils;
@@ -10,7 +10,7 @@
1010
import org.joda.time.format.DateTimeFormatter;
1111
import org.motechproject.commons.api.Range;
1212
import org.motechproject.commons.date.model.Time;
13-
import org.motechproject.mds.domain.ComboboxHolder;
13+
import org.motechproject.mds.web.domain.ComboboxHolder;
1414
import org.motechproject.mds.dto.EntityDto;
1515
import org.motechproject.mds.dto.FieldDto;
1616
import org.motechproject.mds.dto.FieldInstanceDto;
@@ -31,7 +31,6 @@
3131
import org.motechproject.mds.query.QueryParams;
3232
import org.motechproject.mds.service.EntityService;
3333
import org.motechproject.mds.service.HistoryService;
34-
import org.motechproject.mds.service.InstanceService;
3534
import org.motechproject.mds.service.MotechDataService;
3635
import org.motechproject.mds.service.TrashService;
3736
import org.motechproject.mds.util.Constants;
@@ -42,6 +41,7 @@
4241
import org.motechproject.mds.web.domain.EntityRecord;
4342
import org.motechproject.mds.web.domain.FieldRecord;
4443
import org.motechproject.mds.web.domain.HistoryRecord;
44+
import org.motechproject.mds.web.service.InstanceService;
4545
import org.motechproject.osgi.web.util.WebBundleUtil;
4646
import org.osgi.framework.Bundle;
4747
import org.osgi.framework.BundleContext;
@@ -70,7 +70,7 @@
7070
import static org.motechproject.mds.util.HistoryFieldUtil.schemaVersion;
7171

7272
/**
73-
* Default implementation of the {@link org.motechproject.mds.service.InstanceService} interface.
73+
* Default implementation of the {@link org.motechproject.mds.web.service.InstanceService} interface.
7474
*/
7575
@Service
7676
public class InstanceServiceImpl implements InstanceService {
@@ -147,7 +147,7 @@ public List<EntityRecord> getEntityRecords(Long entityId, QueryParams queryParam
147147

148148
@Override
149149
@Transactional
150-
public List<EntityRecord> getTrashRecords(Long entityId, QueryParams queryParams) {
150+
public List<EntityRecord> getTrashRecords(Long entityId, QueryParams queryParams) {
151151
EntityDto entity = getEntity(entityId);
152152
List<FieldDto> fields = entityService.getEntityFields(entityId);
153153
Collection collection = trashService.getInstancesFromTrash(entity.getClassName(), queryParams);
@@ -164,7 +164,6 @@ public long countTrashRecords(Long entityId) {
164164
}
165165

166166

167-
168167
@Override
169168
@Transactional
170169
public EntityRecord getSingleTrashRecord(Long entityId, Long instanceId) {

0 commit comments

Comments
 (0)