Search in sources :

Example 21 with ISMPRedirect

use of com.helger.phoss.smp.domain.redirect.ISMPRedirect in project phoss-smp by phax.

the class PageSecureRedirect method showListOfExistingObjects.

@Override
protected void showListOfExistingObjects(@Nonnull final WebPageExecutionContext aWPEC) {
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    final HCNodeList aNodeList = aWPEC.getNodeList();
    final ISMPRedirectManager aRedirectMgr = SMPMetaManager.getRedirectMgr();
    final BootstrapButtonToolbar aToolbar = new BootstrapButtonToolbar(aWPEC);
    aToolbar.addButton("Create new Redirect", createCreateURL(aWPEC), EDefaultIcon.NEW);
    aNodeList.addChild(aToolbar);
    final HCTable aTable = new HCTable(new DTCol("Service Group").setDataSort(0, 1).setInitialSorting(ESortOrder.ASCENDING), new DTCol("Document type ID").setDataSort(1, 0), new DTCol("Target URL"), new BootstrapDTColAction(aDisplayLocale)).setID(getID());
    for (final ISMPRedirect aCurObject : aRedirectMgr.getAllSMPRedirects()) {
        final StringMap aParams = new StringMap();
        aParams.putIn(FIELD_SERVICE_GROUP_ID, aCurObject.getServiceGroupID());
        aParams.putIn(FIELD_DOCTYPE_ID, aCurObject.getDocumentTypeIdentifier().getURIEncoded());
        final ISimpleURL aViewLink = createViewURL(aWPEC, aCurObject, aParams);
        final String sDisplayName = aCurObject.getServiceGroupID();
        final HCRow aRow = aTable.addBodyRow();
        aRow.addCell(new HCA(aViewLink).addChild(sDisplayName));
        aRow.addCell(NiceNameUI.getDocumentTypeID(aCurObject.getDocumentTypeIdentifier(), false));
        aRow.addCell(aCurObject.getTargetHref());
        final ISimpleURL aEditURL = createEditURL(aWPEC, aCurObject).addAll(aParams);
        final ISimpleURL aCopyURL = createCopyURL(aWPEC, aCurObject).addAll(aParams);
        final ISimpleURL aDeleteURL = createDeleteURL(aWPEC, aCurObject).addAll(aParams);
        final ISimpleURL aPreviewURL = LinkHelper.getURLWithServerAndContext(aCurObject.getServiceGroup().getParticipantIdentifier().getURIPercentEncoded() + SMPRestFilter.PATH_SERVICES + aCurObject.getDocumentTypeIdentifier().getURIPercentEncoded());
        aRow.addCell(new HCA(aEditURL).setTitle("Edit " + sDisplayName).addChild(EDefaultIcon.EDIT.getAsNode()), new HCTextNode(" "), new HCA(aCopyURL).setTitle("Create a copy of " + sDisplayName).addChild(EDefaultIcon.COPY.getAsNode()), new HCTextNode(" "), new HCA(aDeleteURL).setTitle("Delete " + sDisplayName).addChild(EDefaultIcon.DELETE.getAsNode()), new HCTextNode(" "), new HCA(aPreviewURL).setTitle("Perform SMP query on " + sDisplayName).setTargetBlank().addChild(EFamFamIcon.SCRIPT_GO.getAsNode()));
    }
    final DataTables aDataTables = BootstrapDataTables.createDefaultDataTables(aWPEC, aTable);
    aNodeList.addChild(aTable).addChild(aDataTables);
}
Also used : Locale(java.util.Locale) StringMap(com.helger.commons.collection.attr.StringMap) HCNodeList(com.helger.html.hc.impl.HCNodeList) HCA(com.helger.html.hc.html.textlevel.HCA) HCRow(com.helger.html.hc.html.tabular.HCRow) ISMPRedirectManager(com.helger.phoss.smp.domain.redirect.ISMPRedirectManager) HCTable(com.helger.html.hc.html.tabular.HCTable) DTCol(com.helger.photon.uictrls.datatables.column.DTCol) ISMPRedirect(com.helger.phoss.smp.domain.redirect.ISMPRedirect) ISimpleURL(com.helger.commons.url.ISimpleURL) BootstrapDTColAction(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDTColAction) BootstrapButtonToolbar(com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar) HCTextNode(com.helger.html.hc.impl.HCTextNode) BootstrapDataTables(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDataTables) DataTables(com.helger.photon.uictrls.datatables.DataTables)

Aggregations

ISMPRedirect (com.helger.phoss.smp.domain.redirect.ISMPRedirect)21 IParticipantIdentifier (com.helger.peppolid.IParticipantIdentifier)13 ISMPRedirectManager (com.helger.phoss.smp.domain.redirect.ISMPRedirectManager)12 ISMPServiceGroup (com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroup)12 Nonnull (javax.annotation.Nonnull)11 IDocumentTypeIdentifier (com.helger.peppolid.IDocumentTypeIdentifier)8 IIdentifierFactory (com.helger.peppolid.factory.IIdentifierFactory)8 SMPRedirect (com.helger.phoss.smp.domain.redirect.SMPRedirect)7 ISMPServiceGroupManager (com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroupManager)7 ISMPServiceInformation (com.helger.phoss.smp.domain.serviceinfo.ISMPServiceInformation)7 ISMPServiceInformationManager (com.helger.phoss.smp.domain.serviceinfo.ISMPServiceInformationManager)7 IUser (com.helger.photon.security.user.IUser)7 SMPNotFoundException (com.helger.phoss.smp.exception.SMPNotFoundException)5 SMPServerException (com.helger.phoss.smp.exception.SMPServerException)5 ConstantPreparedStatementDataProvider (com.helger.db.jdbc.callback.ConstantPreparedStatementDataProvider)4 CommonsArrayList (com.helger.commons.collection.impl.CommonsArrayList)3 DBResultRow (com.helger.db.jdbc.executor.DBResultRow)3 Test (org.junit.Test)3 ReturnsMutableCopy (com.helger.commons.annotation.ReturnsMutableCopy)2 EChange (com.helger.commons.state.EChange)2