Skip to content

Commit

Permalink
Version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
phax committed Apr 2, 2024
1 parent 164fb34 commit 6bbf39f
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public final class PDStorageManager implements IPDStorageManager
private static final FieldType TYPE_GROUP_END = new FieldType ();
private static final String VALUE_GROUP_END = "x";
private static final IMutableStatisticsHandlerKeyedTimer STATS_QUERY_TIMER = StatisticsManager.getKeyedTimerHandler (PDStorageManager.class.getName () +
"$query");
"$query");

static
{
Expand Down Expand Up @@ -192,10 +192,10 @@ public ESuccess createOrUpdateEntry (@Nonnull final IParticipantIdentifier aPart

aDoc.add (PDField.PARTICIPANT_ID.getAsField (aParticipantID));
aSBAllFields.append (PDField.PARTICIPANT_ID.getAsStorageValue (aParticipantID)).append (' ');
if (aBusinessEntity.names ().size () == 1 && aBusinessEntity.names ().getFirst ().hasNoLanguageCode ())
if (aBusinessEntity.names ().size () == 1 && aBusinessEntity.names ().getFirstOrNull ().hasNoLanguageCode ())
{
// Single name without a language - legacy case
final String sName = aBusinessEntity.names ().getFirst ().getName ();
final String sName = aBusinessEntity.names ().getFirstOrNull ().getName ();
aDoc.add (PDField.NAME.getAsField (sName));
aSBAllFields.append (sName).append (' ');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public static IMicroElement getAsSearchResultMicroElement (@Nonnull @Nonempty fi
{
ValueEnforcer.notEmptyNoNullValue (aDocs, "Docs");

final PDStoredBusinessEntity aFirst = aDocs.getFirst ();
final PDStoredBusinessEntity aFirst = aDocs.getFirstOrNull ();

final IMicroElement aMatch = new MicroElement ("match");
aMatch.appendElement ("participantID")
Expand All @@ -261,7 +261,9 @@ public static IMicroElement getAsSearchResultMicroElement (@Nonnull @Nonempty fi
// Add all document type IDs
for (final IDocumentTypeIdentifier aDocTypeID : aFirst.m_aDocumentTypeIDs)
{
aMatch.appendElement ("docTypeID").setAttribute ("scheme", aDocTypeID.getScheme ()).appendText (aDocTypeID.getValue ());
aMatch.appendElement ("docTypeID")
.setAttribute ("scheme", aDocTypeID.getScheme ())
.appendText (aDocTypeID.getValue ());
}

// Add all entities
Expand All @@ -270,7 +272,9 @@ public static IMicroElement getAsSearchResultMicroElement (@Nonnull @Nonempty fi
final IMicroElement aEntity = aMatch.appendElement ("entity");

for (final PDStoredMLName aName : aDoc.m_aNames)
aEntity.appendElement ("name").setAttribute ("language", aName.getLanguageCode ()).appendText (aName.getName ());
aEntity.appendElement ("name")
.setAttribute ("language", aName.getLanguageCode ())
.appendText (aName.getName ());

aEntity.appendElement ("countryCode").appendText (aDoc.m_sCountryCode);

Expand Down Expand Up @@ -316,10 +320,11 @@ public static IJsonObject getAsSearchResultJsonObject (@Nonnull @Nonempty final
{
ValueEnforcer.notEmptyNoNullValue (aDocs, "Docs");

final PDStoredBusinessEntity aFirst = aDocs.getFirst ();
final PDStoredBusinessEntity aFirst = aDocs.getFirstOrNull ();

final IJsonObject ret = new JsonObject ();
ret.addJson ("participantID", _getIDAsJson (aFirst.m_aParticipantID.getScheme (), aFirst.m_aParticipantID.getValue ()));
ret.addJson ("participantID",
_getIDAsJson (aFirst.m_aParticipantID.getScheme (), aFirst.m_aParticipantID.getValue ()));

// Add the items retrieved from SMP as well
final IJsonArray aDocTypes = new JsonArray ();
Expand Down Expand Up @@ -475,7 +480,8 @@ public static PDStoredBusinessEntity create (@Nonnull final Document aDoc)
if (aBCTypes.size () != aBCEmail.size ())
throw new IllegalStateException ("Different number of business contact types and emails");
for (int i = 0; i < aBCTypes.size (); ++i)
ret.contacts ().add (new PDStoredContact (aBCTypes.get (i), aBCName.get (i), aBCPhone.get (i), aBCEmail.get (i)));
ret.contacts ()
.add (new PDStoredContact (aBCTypes.get (i), aBCName.get (i), aBCPhone.get (i), aBCEmail.get (i)));
}

{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ protected HCNodeList createParticipantDetails (@Nonnull final Locale aDisplayLoc
":"));

HCOL aDocTypeOL = null;
final ICommonsList <IDocumentTypeIdentifier> aDocTypeIDs = aResultDocs.getFirst ()
final ICommonsList <IDocumentTypeIdentifier> aDocTypeIDs = aResultDocs.getFirstOrNull ()
.documentTypeIDs ()
.getSorted (IDocumentTypeIdentifier.comparator ());
for (final IDocumentTypeIdentifier aDocTypeID : aDocTypeIDs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ private void _showResultList (@Nonnull final WebPageExecutionContext aWPEC,
else
{
aNodeList.addChild (div (badgeSuccess ("Found " +
(aGroupedBEs.size () == 1 ? "1 entity" : aGroupedBEs.size () +
" entities") +
(aGroupedBEs.size () == 1 ? "1 entity"
: aGroupedBEs.size () + " entities") +
" matching '" +
sQuery +
"'")));
Expand Down Expand Up @@ -261,12 +261,11 @@ private void _showResultList (@Nonnull final WebPageExecutionContext aWPEC,
.addCell ("Country:")
.addCell (new HCNodeList ().addChild (PDCommonUI.getFlagNode (sCountryCode))
.addChild (" ")
.addChild (span (aCountry != null ? aCountry.getDisplayCountry (
aDisplayLocale) +
.addChild (span (aCountry != null ? aCountry.getDisplayCountry (aDisplayLocale) +
" (" +
sCountryCode +
")" : sCountryCode).addClass (
CSS_CLASS_RESULT_DOC_COUNTRY_CODE)));
")"
: sCountryCode).addClass (CSS_CLASS_RESULT_DOC_COUNTRY_CODE)));
}

if (aStoredDoc.names ().isNotEmpty ())
Expand All @@ -277,7 +276,7 @@ private void _showResultList (@Nonnull final WebPageExecutionContext aWPEC,

IHCNode aNameCtrl;
if (aNames.size () == 1)
aNameCtrl = PDCommonUI.getMLNameNode (aNames.getFirst (), aDisplayLocale);
aNameCtrl = PDCommonUI.getMLNameNode (aNames.getFirstOrNull (), aDisplayLocale);
else
{
final HCUL aNameUL = new HCUL ();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ private ExportHelper ()
@Nonnull
private static IMicroElement _createMicroElement (@Nonnull final IDocumentTypeIdentifier aDocTypeID)
{
final IMicroElement eDocTypeID = new MicroElement (XML_EXPORT_NS_URI, "doctypeid").setAttribute ("scheme",
aDocTypeID.getScheme ())
.setAttribute ("value",
aDocTypeID.getValue ());
final IMicroElement eDocTypeID = new MicroElement (XML_EXPORT_NS_URI,
"doctypeid").setAttribute ("scheme", aDocTypeID.getScheme ())
.setAttribute ("value", aDocTypeID.getValue ());
final NiceNameEntry aNiceName = NiceNameHandler.getDocTypeNiceName (aDocTypeID.getURIEncoded ());
if (aNiceName == null)
eDocTypeID.setAttribute ("non-standard", true);
Expand Down Expand Up @@ -91,7 +90,7 @@ public static IMicroDocument getAsXML (@Nonnull final ICommonsOrderedMap <IParti

// New in v2 - add all Document types
if (bIncludeDocTypes && aEntry.getValue ().isNotEmpty ())
for (final IDocumentTypeIdentifier aDocTypeID : aEntry.getValue ().getFirst ().documentTypeIDs ())
for (final IDocumentTypeIdentifier aDocTypeID : aEntry.getValue ().getFirstOrNull ().documentTypeIDs ())
eBC.appendChild (_createMicroElement (aDocTypeID));

aRoot.appendChild (eBC);
Expand Down Expand Up @@ -183,7 +182,7 @@ public static IJsonObject getAsJSON (@Nonnull final ICommonsOrderedMap <IPartici
{
final IJsonArray aDocTypes = new JsonArray ();
if (aEntry.getValue ().isNotEmpty ())
for (final IDocumentTypeIdentifier aDocTypeID : aEntry.getValue ().getFirst ().documentTypeIDs ())
for (final IDocumentTypeIdentifier aDocTypeID : aEntry.getValue ().getFirstOrNull ().documentTypeIDs ())
aDocTypes.add (_createJsonObject (aDocTypeID));
aBC.add ("docTypes", aDocTypes);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,10 @@ public PublicSearchXServletHandler ()
public void handleRequest (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope,
@Nonnull final UnifiedResponse aUnifiedResponse) throws Exception
{
final BiConsumer <UnifiedResponse, String> applyError = (ur, msg) -> ur.setContentAndCharset (msg,
StandardCharsets.UTF_8)
.setMimeType (CMimeType.TEXT_PLAIN);
final BiConsumer <UnifiedResponse, String> applyError = (ur,
msg) -> ur.setContentAndCharset (msg,
StandardCharsets.UTF_8)
.setMimeType (CMimeType.TEXT_PLAIN);

if (SearchRateLimit.INSTANCE.rateLimiter () != null)
{
Expand Down Expand Up @@ -293,7 +294,7 @@ public void handleRequest (@Nonnull final IRequestWebScopeWithoutResponse aReque
final Query aLuceneQuery;
if (aQueries.size () == 1)
{
aLuceneQuery = aQueries.getFirst ();
aLuceneQuery = aQueries.getFirstOrNull ();
}
else
{
Expand Down Expand Up @@ -324,8 +325,7 @@ public void handleRequest (@Nonnull final IRequestWebScopeWithoutResponse aReque

// Filter by index/count
final int nEffectiveLastIndex = Math.min (nLastResultIndex, aResultDocs.size () - 1);
final List <PDStoredBusinessEntity> aResultView = nFirstResultIndex >= aResultDocs.size () ? Collections
.emptyList ()
final List <PDStoredBusinessEntity> aResultView = nFirstResultIndex >= aResultDocs.size () ? Collections.emptyList ()
: aResultDocs.subList (nFirstResultIndex,
nEffectiveLastIndex +
1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ public static ICommonsList <PDStoredMLName> getUIFilteredNames (@Nonnull final I
@Nonnull final Locale aDisplayLocale)
{
final String sDisplayLanguage = LocaleHelper.getValidLanguageCode (aDisplayLocale.getLanguage ());
ICommonsList <PDStoredMLName> ret = CommonsArrayList.createFiltered (aNames, x -> x.hasLanguageCode (sDisplayLanguage));
ICommonsList <PDStoredMLName> ret = CommonsArrayList.createFiltered (aNames,
x -> x.hasLanguageCode (sDisplayLanguage));
if (ret.isEmpty ())
{
// Filter matched no entry - take all names
Expand Down Expand Up @@ -141,7 +142,7 @@ public static BootstrapViewForm showBusinessInfoDetails (@Nonnull final PDStored

IHCNode aNameCtrl;
if (aNames.size () == 1)
aNameCtrl = getMLNameNode (aNames.getFirst (), aDisplayLocale);
aNameCtrl = getMLNameNode (aNames.getFirstOrNull (), aDisplayLocale);
else
{
final HCUL aNameUL = new HCUL ();
Expand Down Expand Up @@ -255,7 +256,7 @@ private static String _getPeriodString (final int nYears,
aSB.append (", ");
aSB.append (aParts.get (i));
}
return aSB.append (" and ").append (aParts.getLast ()).toString ();
return aSB.append (" and ").append (aParts.getLastOrNull ()).toString ();
}

@Nonnull
Expand All @@ -281,7 +282,8 @@ public static BootstrapTable createCertificateDetailsTable (@Nonnull final X509C
.addCell (new HCTextNode (PDTToString.getAsString (aNotAfter, aDisplayLocale)),
aNowLDT.isAfter (aNotAfter) ? new HCStrong ().addChild (" !!!NO LONGER VALID!!!")
: new HCDiv ().addChild ("Valid for: " +
PDTDisplayHelper.getPeriodTextEN (aNowLDT, aNotAfter)));
PDTDisplayHelper.getPeriodTextEN (aNowLDT,
aNotAfter)));

if (aPublicKey instanceof RSAPublicKey)
{
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
</developers>

<properties>
<!-- Don't go beyond v7, otherwise the backwards compatibility is lost -->
<!-- Peppol Directory runs on Lucene v8 -->
<lucene.version>8.11.2</lucene.version>
<jersey.version>3.1.5</jersey.version>
<log4j.version>2.23.1</log4j.version>
Expand Down Expand Up @@ -235,7 +235,7 @@
<plugin>
<groupId>com.helger.maven</groupId>
<artifactId>ph-csscompress-maven-plugin</artifactId>
<version>7.0.1</version>
<version>7.0.2</version>
</plugin>
</plugins>
</pluginManagement>
Expand Down

0 comments on commit 6bbf39f

Please sign in to comment.