Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<groupId>ucles.weblab</groupId>
<artifactId>weblab-api-schema</artifactId>
<packaging>pom</packaging>
<version>0.5-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>

<modules>
<module>weblab-cross-context</module>
Expand All @@ -17,8 +17,8 @@
</modules>

<properties>
<common-java.version>0.5-SNAPSHOT</common-java.version>
<spring-boot.version>1.5.3.RELEASE</spring-boot.version>
<common-java.version>2.0.0-SNAPSHOT</common-java.version>
<spring-boot.version>2.0.0.RELEASE</spring-boot.version>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
Expand Down
8 changes: 3 additions & 5 deletions shippable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ build:
ci:
- mkdir -p shippable/testresults
- mvn --batch-mode clean
# Only deploy master
- if [[ $BRANCH == "master" ]] && [[ $IS_PULL_REQUEST != true ]]; then mvn --batch-mode --update-snapshots -Pshippable deploy; fi
# Otherwise verify all other configs
- if [[ $BRANCH == "master" ]] && [[ $IS_PULL_REQUEST == true ]]; then mvn --batch-mode --update-snapshots -Pshippable verify; fi
- if [[ $BRANCH != "master" ]]; then mvn --batch-mode --update-snapshots -Pshippable verify; fi
# Only deploy for master & release-2.0.x, otherwise just verify for branches and PRs
- if [[ $BRANCH == "master" || $BRANCH == "release-2.0.x" ]] && [[ $IS_PULL_REQUEST != true ]]; then mvn --batch-mode --update-snapshots -Pshippable deploy; fi
- if [[ $BRANCH != "master" && $BRANCH != "release-2.0.x" ]] || [[ $IS_PULL_REQUEST != true ]]; then mvn --batch-mode --update-snapshots -Pshippable verify; fi

integrations:
notifications:
Expand Down
2 changes: 1 addition & 1 deletion weblab-cross-context/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>weblab-api-schema</artifactId>
<groupId>ucles.weblab</groupId>
<version>0.5-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ public URI toUrn(URI url) {
@Override
public URI toUrl(URI urn) {
return Optional.ofNullable(urnToHandlerMethodInvocation(urn))
.map(m -> MvcUriComponentsBuilder.fromMethod(m.getHandlerMethod().getMethod(), m.getArgs())
.map(m -> MvcUriComponentsBuilder.fromMethod(
m.getHandlerMethod().getMethod().getDeclaringClass(), m.getHandlerMethod().getMethod(), m.getArgs())
.build().toUri())
.orElse(null);
}
Expand Down
2 changes: 1 addition & 1 deletion weblab-forms/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>weblab-api-schema</artifactId>
<groupId>ucles.weblab</groupId>
<version>0.5-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ucles.weblab.common.forms.domain;

import java.util.List;
import java.util.Optional;

/**
*
Expand All @@ -12,9 +13,11 @@ public interface FormRepository {

List<? extends FormEntity> findAllByOrderByNameAsc();

<S extends FormEntity> S findOne(String id);
Optional<? extends FormEntity> findById(String id);

int deleteById(String id);
boolean existsById(String id);

void deleteById(String id);

List<? extends FormEntity> findByBusinessStreamsContainingAndApplicationName(String businessStream, String applicationName);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@
* @author Sukhraj
*/
public interface FormRepositoryMongo extends FormRepository, MongoRepository<FormEntityMongo, String> {

@Override
FormEntityMongo findOne(String id);

}
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,17 @@ public FormResource create(FormResource resource) {

public FormResource get(String id) {

FormEntity formEntity = formRepository.findOne(id);
if (formEntity == null) {
throw new ResourceNotFoundException(id);
}
FormEntity formEntity = formRepository.findById(id).orElseThrow(() -> new ResourceNotFoundException(id));
FormResource resource = toResource(formEntity);

return resource;
}

public void delete(String id) {
if (formRepository.deleteById(id) == 0) {
throw new ResourceNotFoundException(id);
if (formRepository.existsById(id)) {
formRepository.deleteById(id);
}
throw new ResourceNotFoundException(id);
}

public List<FormResource> list(String businessStream, String applicationName) {
Expand All @@ -97,28 +95,26 @@ public List<FormResource> list(String businessStream, String applicationName) {
}

public FormResource update(FormResource resource) {
FormEntity exisitingFormEntity = formRepository.findOne(resource.getFormId());
if (exisitingFormEntity == null) {
throw new ResourceNotFoundException(resource.getFormId());
}
String stringValue = null;
FormEntity existingEntity = formRepository.findById(resource.getFormId())
.orElseThrow(() -> new ResourceNotFoundException(resource.getFormId()));
String stringValue;
try {
stringValue = objectMapper.writeValueAsString(resource.getFormDefinition());
} catch (JsonProcessingException ex) {
log.error(CONVERSION_ERROR, ex);
throw new BadDataException(CONVERSION_ERROR, null, ex);
}

exisitingFormEntity.setDescription(resource.getDescription());
exisitingFormEntity.setName(resource.getName());
exisitingFormEntity.setApplicationName(resource.getApplicationName());
exisitingFormEntity.setBusinessStreams(resource.getBusinessStreams());
exisitingFormEntity.setDescription(resource.getDescription());
exisitingFormEntity.setSchema(stringValue);
exisitingFormEntity.setValidFrom(resource.getValidFrom());
exisitingFormEntity.setValidTo(resource.getValidTo());
existingEntity.setDescription(resource.getDescription());
existingEntity.setName(resource.getName());
existingEntity.setApplicationName(resource.getApplicationName());
existingEntity.setBusinessStreams(resource.getBusinessStreams());
existingEntity.setDescription(resource.getDescription());
existingEntity.setSchema(stringValue);
existingEntity.setValidFrom(resource.getValidFrom());
existingEntity.setValidTo(resource.getValidTo());

FormEntity saved = formRepository.save(exisitingFormEntity);
FormEntity saved = formRepository.save(existingEntity);
FormResource savedResource = toResource(saved);

return savedResource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.MessageSource;
Expand Down
2 changes: 1 addition & 1 deletion weblab-json-schema/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>weblab-api-schema</artifactId>
<groupId>ucles.weblab</groupId>
<version>0.5-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down