Skip to content

Commit

Permalink
some code cleansing
Browse files Browse the repository at this point in the history
  • Loading branch information
Tcharl committed Jan 16, 2022
1 parent ff4431e commit fbab2d2
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public interface <%= entityClass %>Service {
* @param pageable the pagination information.<% } %>
* @return the list of entities.
*/
<% if (paginationNo) { %><%= listOrFlux %><<%= instanceType %><% } else { %><%= pageOrFlux %><<%= instanceType %><% } %>> findAll(<% if (!paginationNo) { %>Pageable pageable<% } %>);
<% if (paginationNo) { %><%= listOrFlux %><% } else { %><%= pageOrFlux %><% } %><<%= instanceType %>> findAll(<% if (!paginationNo) { %>Pageable pageable<% } %>);
<%_ for (const relationship of relationships) { _%>
<%_ if (relationship.relationshipOneToOne && !relationship.ownerSide) { _%>
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public class <%= serviceClassName %><% if (serviceImpl) { %> implements <%= enti
<%_ if (databaseTypeSql) { _%>
@Transactional(readOnly = true)
<%_ } _%>
public <% if (paginationNo) { %><%= listOrFlux %><<%= instanceType %><% } else { %><%= pageOrFlux %><<%= instanceType %><% } %>> findAll(<% if (!paginationNo) { %>Pageable pageable<% } %>) {
public <% if (paginationNo) { %><%= listOrFlux %><% } else { %><%= pageOrFlux %><% } %><<%= instanceType %>> findAll(<% if (!paginationNo) { %>Pageable pageable<% } %>) {
log.debug("Request to get all <%= entityClassPlural %>");
<%_ if (paginationNo) { _%>
return <%= entityInstance %>Repository.<% if (relationshipsContainEagerLoad) { %>findAllWithEagerRelationships<% } else { %>findAll<% } %>()<% if (dtoMapstruct) { %><% if (!reactive) { %>.stream()<% } %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,13 @@ public class <%= entityClass %>Resource {
<%_ if (reactive) { _%>
.switchIfEmpty(Mono.error(new ResponseStatusException(HttpStatus.NOT_FOUND)))
.map(result -> ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert(applicationName, <%= enableTranslation %>, ENTITY_NAME, result.get<%= primaryKey.nameCapitalized %>()<% if (primaryKey.type !== 'String') { %>.toString()<% } %>))
.headers(HeaderUtil.createEntityUpdateAlert(applicationName, <%= enableTranslation %>, ENTITY_NAME, result.get<%= primaryKey.nameCapitalized %>()<% if (!primaryKey.typeString) { %>.toString()<% } %>))
.body(result)
);
});
<%_ } else { _%>
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert(applicationName, <%= enableTranslation %>, ENTITY_NAME, <%= instanceName %>.get<%= primaryKey.nameCapitalized %>()<% if (primaryKey.type !== 'String') { %>.toString()<% } %>))
.headers(HeaderUtil.createEntityUpdateAlert(applicationName, <%= enableTranslation %>, ENTITY_NAME, <%= instanceName %>.get<%= primaryKey.nameCapitalized %>()<% if (!primaryKey.typeString) { %>.toString()<% } %>))
.body(result);
<%_ } _%>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,11 +463,10 @@ if (field.fieldTypeString || field.blobContentTypeText) {
private EntityManager em;
<%_ } _%>

<%_ if (reactive) { _%>
@Autowired
<%_ if (reactive) { _%>
private WebTestClient webTestClient;
<%_ } else { _%>
@Autowired
private MockMvc rest<%= entityClass %>MockMvc;
<%_ } _%>

Expand Down Expand Up @@ -1370,7 +1369,7 @@ _%>
.exchange()
.expectStatus().isOk();
<%_ } else { _%>
rest<%= entityClass %>MockMvc.perform(put(ENTITY_API_URL_ID, <%= (dtoMapstruct ? asDto(entityInstance) : 'updated' + persistClass) %>.get<%= primaryKey.nameCapitalized %>())<% if (testsNeedCsrf) { %>.with(csrf())<% }%>
rest<%= entityClass %>MockMvc.perform(put(ENTITY_API_URL_ID, <%= (dtoMapstruct ? asDto(entityInstance) : 'updated' + persistClass) %>.get<%= primaryKey.nameCapitalized %>())<% if (testsNeedCsrf) { %>.with(csrf())<% } %>
.contentType(MediaType.APPLICATION_JSON)
.content(TestUtil.convertObjectToJsonBytes(<%= (dtoMapstruct ? asDto(entityInstance) : 'updated' + persistClass) %>)))
.andExpect(status().isOk());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ public @interface IntegrationTest {
<%_ if (reactive) { _%>
// 5s is the spring default https://github.com/spring-projects/spring-framework/blob/29185a3d28fa5e9c1b4821ffe519ef6f56b51962/spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultWebTestClient.java#L106
<%_ if (databaseTypeMongodb && reactive) { _%>
public static final String DEFAULT_TIMEOUT = "PT10S";
public static final String DEFAULT_ENTITY_TIMEOUT = "PT10S";
String DEFAULT_TIMEOUT = "PT10S";
String DEFAULT_ENTITY_TIMEOUT = "PT10S";
<%_ } else { _%>
public static final String DEFAULT_TIMEOUT = "PT5S";
public static final String DEFAULT_ENTITY_TIMEOUT = "PT5S";
String DEFAULT_TIMEOUT = "PT5S";
String DEFAULT_ENTITY_TIMEOUT = "PT5S";
<%_ } _%>
<%_ } _%>
}
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fbab2d2

Please sign in to comment.