This repository has been archived by the owner on May 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 387
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
1,731 additions
and
1,578 deletions.
There are no files selected for viewing
3,114 changes: 1,574 additions & 1,540 deletions
3,114
...in/java/app/coronawarn/server/services/distribution/config/DistributionServiceConfig.java
Large diffs are not rendered by default.
Oops, something went wrong.
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
22 changes: 20 additions & 2 deletions
22
...oronawarn/server/services/distribution/statistics/keyfigurecard/KeyFigureCardFactory.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 |
---|---|---|
@@ -1,20 +1,38 @@ | ||
package app.coronawarn.server.services.distribution.statistics.keyfigurecard; | ||
|
||
import static app.coronawarn.server.services.distribution.statistics.keyfigurecard.Cards.getFactoryFor; | ||
import static app.coronawarn.server.services.distribution.statistics.keyfigurecard.Cards.values; | ||
|
||
import app.coronawarn.server.common.protocols.internal.stats.KeyFigureCard; | ||
import app.coronawarn.server.services.distribution.config.DistributionServiceConfig; | ||
import app.coronawarn.server.services.distribution.statistics.StatisticsJsonStringObject; | ||
import app.coronawarn.server.services.distribution.statistics.keyfigurecard.factory.EmptyCardFactory; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class KeyFigureCardFactory { | ||
|
||
private static final Logger logger = LoggerFactory.getLogger(KeyFigureCardFactory.class); | ||
|
||
@Autowired | ||
DistributionServiceConfig distributionServiceConfig; | ||
|
||
public KeyFigureCard createKeyFigureCard(StatisticsJsonStringObject stats, int cardId) { | ||
return getFactoryFor(cardId, this.distributionServiceConfig).makeKeyFigureCard(stats); | ||
/** | ||
* Creates a new statistics card, based upon the given ordinal. | ||
* | ||
* @param stats data for the card. | ||
* @param cardId ordinal number of {@link Cards}. | ||
* @return a new {@link KeyFigureCard}. | ||
*/ | ||
public KeyFigureCard createKeyFigureCard(final StatisticsJsonStringObject stats, final int cardId) { | ||
try { | ||
return getFactoryFor(values()[cardId], distributionServiceConfig).makeKeyFigureCard(stats); | ||
} catch (final IndexOutOfBoundsException e) { | ||
logger.error(Cards.class + " doesn't contain value for: " + cardId, e); | ||
return new EmptyCardFactory(distributionServiceConfig).makeKeyFigureCard(stats); | ||
} | ||
} | ||
} |
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
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
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
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.