forked from apache/incubator-kie-kogito-runtimes
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from rgdoliveira/sync_main
Sync main branch with Apache main branch
- Loading branch information
Showing
23 changed files
with
1,561 additions
and
772 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
612 changes: 317 additions & 295 deletions
612
jbpm/jbpm-flow/src/main/java/org/jbpm/process/core/timer/BusinessCalendarImpl.java
Large diffs are not rendered by default.
Oops, something went wrong.
399 changes: 399 additions & 0 deletions
399
jbpm/jbpm-flow/src/main/java/org/jbpm/process/core/timer/CalendarBean.java
Large diffs are not rendered by default.
Oops, something went wrong.
60 changes: 60 additions & 0 deletions
60
jbpm/jbpm-flow/src/main/java/org/jbpm/process/core/timer/CalendarBeanFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you 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 | ||
* | ||
* 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 org.jbpm.process.core.timer; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.net.URL; | ||
import java.util.Objects; | ||
import java.util.Properties; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import static org.jbpm.process.core.constants.CalendarConstants.BUSINESS_CALENDAR_PATH; | ||
|
||
public class CalendarBeanFactory { | ||
|
||
private static final Logger logger = LoggerFactory.getLogger(CalendarBeanFactory.class); | ||
|
||
public static CalendarBean createCalendarBean() { | ||
URL resource = Thread.currentThread().getContextClassLoader().getResource(BUSINESS_CALENDAR_PATH); | ||
if (Objects.nonNull(resource)) { | ||
logger.debug("URL resource: {}", resource); | ||
Properties calendarConfiguration = new Properties(); | ||
try (InputStream is = resource.openStream()) { | ||
calendarConfiguration.load(is); | ||
return new CalendarBean(calendarConfiguration); | ||
} catch (IOException e) { | ||
String errorMessage = "Error while loading properties for business calendar"; | ||
logger.error(errorMessage, e); | ||
throw new RuntimeException(errorMessage, e); | ||
} catch (IllegalArgumentException e) { | ||
String errorMessage = "Error while populating properties for business calendar"; | ||
logger.error(errorMessage, e); | ||
throw e; | ||
} | ||
} else { | ||
String errorMessage = String.format("Missing %s", BUSINESS_CALENDAR_PATH); | ||
logger.error(errorMessage); | ||
throw new RuntimeException(errorMessage); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.