Consistent code formatting

This commit is contained in:
Stéphane Nicoll
2025-03-14 12:04:11 +01:00
parent 6e26108195
commit 1383efe898
64 changed files with 720 additions and 299 deletions

View File

@@ -1,3 +1,19 @@
/*
* Copyright 2006-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mycompany.hr;
import org.springframework.boot.SpringApplication;
@@ -9,4 +25,5 @@ public class HrApplication {
public static void main(String[] args) {
SpringApplication.run(HrApplication.class, args);
}
}

View File

@@ -1,3 +1,19 @@
/*
* Copyright 2006-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mycompany.hr.config;
import org.springframework.context.annotation.Bean;
@@ -30,4 +46,5 @@ public class HRConfiguration {
collection.setInline(true);
return collection;
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2007 the original author or authors.
* Copyright 2006-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -19,20 +19,19 @@ package com.mycompany.hr.service;
import java.util.Date;
/**
* This interface defined the contract for a HR business service. It is used by the {@link
* com.mycompany.hr.ws.HolidayEndpoint}.
* This interface defined the contract for a HR business service. It is used by the
* {@link com.mycompany.hr.ws.HolidayEndpoint}.
*
* @author Arjen Poutsma
*/
public interface HumanResourceService {
/**
* Books a holiday.
*
* @param startDate the start date of the holiday
* @param endDate the end date of the holiday
* @param name the name of the person taking the holiday
*/
void bookHoliday(Date startDate, Date endDate, String name);
/**
* Books a holiday.
* @param startDate the start date of the holiday
* @param endDate the end date of the holiday
* @param name the name of the person taking the holiday
*/
void bookHoliday(Date startDate, Date endDate, String name);
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2006-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -24,16 +24,18 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Simple stub implementation of {@link HumanResourceService}, which does nothing but logging.
* Simple stub implementation of {@link HumanResourceService}, which does nothing but
* logging.
*
* @author Arjen Poutsma
*/
@Service
public class StubHumanResourceService implements HumanResourceService {
private static final Log logger = LogFactory.getLog(StubHumanResourceService.class);
private static final Log logger = LogFactory.getLog(StubHumanResourceService.class);
public void bookHoliday(Date startDate, Date endDate, String name) {
logger.info("Booking holiday for [" + startDate + "-" + endDate + "] for [" + name + "] ");
}
public void bookHoliday(Date startDate, Date endDate, String name) {
logger.info("Booking holiday for [" + startDate + "-" + endDate + "] for [" + name + "] ");
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2006-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -33,8 +33,9 @@ import org.springframework.ws.server.endpoint.annotation.RequestPayload;
import com.mycompany.hr.service.HumanResourceService;
/**
* This endpoint handles holiday requests. It uses a combination of JDOM and XPath to extract interesting pieces of XML
* from the incoming message, and invoked the injected {@link HumanResourceService} with those.
* This endpoint handles holiday requests. It uses a combination of JDOM and XPath to
* extract interesting pieces of XML from the incoming message, and invoked the injected
* {@link HumanResourceService} with those.
*
* @author Arjen Poutsma
*/
@@ -83,7 +84,8 @@ public class HolidayEndpoint {
if (result != null) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
return dateFormat.parse(result.getText());
} else {
}
else {
throw new IllegalArgumentException("Could not evaluate [" + expression + "] on [" + element + "]");
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2006-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -48,7 +48,8 @@ public class HolidayEndpointTest {
InputStream is = getClass().getResourceAsStream("holidayRequest.xml");
try {
holidayRequest = builder.build(is);
} finally {
}
finally {
is.close();
}
endpoint = new HolidayEndpoint(serviceMock);