Skip to content

Commit

Permalink
Depends on directory integration in general; #56
Browse files Browse the repository at this point in the history
  • Loading branch information
phax committed Oct 25, 2019
1 parent de27816 commit 2a640f2
Showing 1 changed file with 21 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.helger.commons.string.StringHelper;
import com.helger.commons.url.ISimpleURL;
import com.helger.commons.url.SimpleURL;
import com.helger.html.hc.IHCNode;
import com.helger.html.hc.ext.HCExtHelper;
import com.helger.html.hc.html.forms.HCEdit;
import com.helger.html.hc.html.forms.HCTextArea;
Expand Down Expand Up @@ -66,6 +67,7 @@
import com.helger.phoss.smp.domain.user.ISMPUser;
import com.helger.phoss.smp.domain.user.ISMPUserManager;
import com.helger.phoss.smp.exception.SMPServerException;
import com.helger.phoss.smp.settings.ISMPSettings;
import com.helger.phoss.smp.smlhook.IRegistrationHook;
import com.helger.phoss.smp.smlhook.RegistrationHookException;
import com.helger.phoss.smp.smlhook.RegistrationHookFactory;
Expand Down Expand Up @@ -191,6 +193,7 @@ public EShowList handleAction (@Nonnull final WebPageExecutionContext aWPEC,
final Locale aDisplayLocale = aWPEC.getDisplayLocale ();
final HCNodeList aNodeList = aWPEC.getNodeList ();
final ISMPServiceGroupManager aServiceGroupMgr = SMPMetaManager.getServiceGroupMgr ();
final ISMPSettings aSettings = SMPMetaManager.getSettings ();

aNodeList.addChild (getUIHandler ().createActionHeader ("Check DNS state of participants"));

Expand All @@ -213,7 +216,7 @@ public EShowList handleAction (@Nonnull final WebPageExecutionContext aWPEC,
aNodeList.addChild (new BootstrapInfoBox ().addChild ("Please note that some DNS changes need some time to propagate! All changes should usually be visible within 1 hour!"));
}

final String sSMLZoneName = SMPMetaManager.getSettings ().getSMLDNSZone ();
final String sSMLZoneName = aSettings.getSMLDNSZone ();
final IPeppolURLProvider aURLProvider = SMPMetaManager.getPeppolURLProvider ();

final HCTable aTable = new HCTable (new DTCol ("Service group").setInitialSorting (ESortOrder.ASCENDING),
Expand Down Expand Up @@ -276,8 +279,7 @@ public EShowList handleAction (@Nonnull final WebPageExecutionContext aWPEC,
.add (CPageParam.PARAM_OBJECT,
aServiceGroup.getID ()))
.setDisabled (bOffline ||
!SMPMetaManager.getSettings ()
.isSMLEnabled ()));
!aSettings.isSMLEnabled ()));
}
else
{
Expand All @@ -290,8 +292,7 @@ public EShowList handleAction (@Nonnull final WebPageExecutionContext aWPEC,
.add (CPageParam.PARAM_OBJECT,
aServiceGroup.getID ()))
.setDisabled (bOffline ||
!SMPMetaManager.getSettings ()
.isSMLEnabled ()));
!aSettings.isSMLEnabled ()));
}
}

Expand Down Expand Up @@ -409,6 +410,8 @@ protected void showSelectedObject (@Nonnull final WebPageExecutionContext aWPEC,
{
final HCNodeList aNodeList = aWPEC.getNodeList ();
final Locale aDisplayLocale = aWPEC.getDisplayLocale ();
final ISMPSettings aSettings = SMPMetaManager.getSettings ();
final boolean bShowBusinessCard = CSMP.ENABLE_ISSUE_56 && aSettings.isDirectoryIntegrationEnabled ();

aNodeList.addChild (getUIHandler ().createActionHeader ("Show details of service group '" +
aSelectedObject.getID () +
Expand All @@ -424,9 +427,9 @@ protected void showSelectedObject (@Nonnull final WebPageExecutionContext aWPEC,
aForm.addFormGroup (new BootstrapFormGroup ().setLabel ("Extension")
.setCtrl (SMPCommonUI.getExtensionDisplay (aSelectedObject)));

if (CSMP.ENABLE_ISSUE_56)
if (bShowBusinessCard)
{
aForm.addChild (getUIHandler ().createDataGroupHeader ("Business Card Information"));
aForm.addChild (getUIHandler ().createDataGroupHeader ("Business Card Details"));

final ISMPBusinessCardManager aBCMgr = SMPMetaManager.getBusinessCardMgr ();
final ISMPBusinessCard aBC = aBCMgr.getSMPBusinessCardOfServiceGroup (aSelectedObject);
Expand Down Expand Up @@ -611,30 +614,32 @@ protected void showListOfExistingObjects (@Nonnull final WebPageExecutionContext
final ISMPServiceGroupManager aServiceGroupMgr = SMPMetaManager.getServiceGroupMgr ();
final ISMPServiceInformationManager aServiceInfoMgr = SMPMetaManager.getServiceInformationMgr ();
final ISMPBusinessCardManager aBCMgr = SMPMetaManager.getBusinessCardMgr ();
final ISMPSettings aSettings = SMPMetaManager.getSettings ();
final ESMPRESTType eRESTType = SMPServerConfiguration.getRESTType ();
final boolean bShowExtensionDetails = SMPWebAppConfiguration.isServiceGroupsExtensionsShow ();
final boolean bShowBusinessCardName = CSMP.ENABLE_ISSUE_56 && aSettings.isDirectoryIntegrationEnabled ();

final ICommonsList <ISMPServiceGroup> aAllServiceGroups = aServiceGroupMgr.getAllSMPServiceGroups ();

final BootstrapButtonToolbar aToolbar = new BootstrapButtonToolbar (aWPEC);
aToolbar.addButton ("Create new Service group", createCreateURL (aWPEC), EDefaultIcon.NEW);
aToolbar.addButton ("Refresh", aWPEC.getSelfHref (), EDefaultIcon.REFRESH);
if (SMPMetaManager.getSettings ().isSMLRequired ())
if (aSettings.isSMLRequired ())
{
// Disable button if no SML URL is configured
// Disable button if no service group is present
aToolbar.addAndReturnButton ("Check DNS state",
aWPEC.getSelfHref ().add (CPageParam.PARAM_ACTION, ACTION_CHECK_DNS),
EDefaultIcon.MAGNIFIER)
.setDisabled (SMPMetaManager.getSettings ().getSMLDNSZone () == null ||
.setDisabled (aSettings.getSMLDNSZone () == null ||
aAllServiceGroups.isEmpty () ||
!SMPMetaManager.getSettings ().isSMLEnabled ());
!aSettings.isSMLEnabled ());
}
aNodeList.addChild (aToolbar);

final HCTable aTable = new HCTable (new DTCol ("Participant ID").setInitialSorting (ESortOrder.ASCENDING),
new DTCol ("Owner"),
CSMP.ENABLE_ISSUE_56 ? new DTCol ("Business Card Name") : null,
bShowBusinessCardName ? new DTCol ("Business Card Name") : null,
new DTCol (new HCSpan ().addChild (bShowExtensionDetails ? "Ext" : "Ext?")
.setTitle ("Is an Extension present?")),
new DTCol (new HCSpan ().addChild ("Docs")
Expand Down Expand Up @@ -664,17 +669,17 @@ protected void showListOfExistingObjects (@Nonnull final WebPageExecutionContext
final HCRow aRow = aTable.addBodyRow ();
aRow.addCell (new HCA (aViewLink).addChild (sDisplayName));
aRow.addCell (SMPCommonUI.getOwnerName (aCurObject.getOwnerID ()));
if (CSMP.ENABLE_ISSUE_56)
if (bShowBusinessCardName)
{
String sName = null;
IHCNode aName = null;
final ISMPBusinessCard aBC = aBCMgr.getSMPBusinessCardOfServiceGroup (aCurObject);
if (aBC != null)
{
final SMPBusinessCardEntity aEntity = aBC.getEntityAtIndex (0);
if (aEntity != null)
sName = aEntity.names ().getFirst ().getName ();
if (aEntity != null && aEntity.names ().isNotEmpty ())
aName = HCTextNode.createOnDemand (aEntity.names ().getFirst ().getName ());
}
aRow.addCell (sName);
aRow.addCell (aName);
}
else
aRow.addCell ();
Expand Down

0 comments on commit 2a640f2

Please sign in to comment.