use of com.helger.phoss.smp.domain.businesscard.ISMPBusinessCardManager in project phoss-smp by phax.
the class PageSecureBusinessCard method getSelectedObject.
@Override
@Nullable
protected ISMPBusinessCard getSelectedObject(@Nonnull final WebPageExecutionContext aWPEC, @Nullable final String sID) {
final ISMPBusinessCardManager aBusinessCardMgr = SMPMetaManager.getBusinessCardMgr();
final IIdentifierFactory aIdentifierFactory = SMPMetaManager.getIdentifierFactory();
return aBusinessCardMgr.getSMPBusinessCardOfID(aIdentifierFactory.parseParticipantIdentifier(sID));
}
use of com.helger.phoss.smp.domain.businesscard.ISMPBusinessCardManager in project phoss-smp by phax.
the class PageSecureBusinessCard method validateAndSaveInputParameters.
@Override
protected void validateAndSaveInputParameters(@Nonnull final WebPageExecutionContext aWPEC, @Nullable final ISMPBusinessCard aSelectedObject, @Nonnull final FormErrorList aFormErrors, @Nonnull final EWebPageFormAction eFormAction) {
final Locale aDisplayLocale = aWPEC.getDisplayLocale();
final boolean bEdit = eFormAction.isEdit();
final IIdentifierFactory aIdentifierFactory = SMPMetaManager.getIdentifierFactory();
final ISMPServiceGroupManager aServiceGroupManager = SMPMetaManager.getServiceGroupMgr();
final ISMPBusinessCardManager aBusinessCardMgr = SMPMetaManager.getBusinessCardMgr();
final String sServiceGroupID = bEdit ? aSelectedObject.getID() : aWPEC.params().getAsString(FIELD_SERVICE_GROUP_ID);
ISMPServiceGroup aServiceGroup = null;
final ICommonsList<SMPBusinessCardEntity> aSMPEntities = new CommonsArrayList<>();
// validations
if (StringHelper.hasNoText(sServiceGroupID))
aFormErrors.addFieldError(FIELD_SERVICE_GROUP_ID, "A Service Group must be selected!");
else {
aServiceGroup = aServiceGroupManager.getSMPServiceGroupOfID(aIdentifierFactory.parseParticipantIdentifier(sServiceGroupID));
if (aServiceGroup == null)
aFormErrors.addFieldError(FIELD_SERVICE_GROUP_ID, "The provided Service Group does not exist!");
else if (!bEdit) {
final ISMPBusinessCard aExistingBusinessCard = aBusinessCardMgr.getSMPBusinessCardOfID(aServiceGroup.getParticipantIdentifier());
if (aExistingBusinessCard != null)
aFormErrors.addFieldError(FIELD_SERVICE_GROUP_ID, "The selected Service Group already has a Business Card assigned!");
}
}
final IRequestParamMap aEntities = aWPEC.getRequestParamMap().getMap(PREFIX_ENTITY);
if (aEntities != null)
for (final String sEntityRowID : aEntities.keySet()) {
final ICommonsMap<String, String> aEntityRow = aEntities.getValueMap(sEntityRowID);
final int nErrors = aFormErrors.size();
// Entity name
final String sFieldName = RequestParamMap.getFieldName(PREFIX_ENTITY, sEntityRowID, SUFFIX_NAME);
final String sEntityName = aEntityRow.get(SUFFIX_NAME);
if (StringHelper.hasNoText(sEntityName))
aFormErrors.addFieldError(sFieldName, "The Name of the Entity must be provided!");
// Entity country code
final String sFieldCountryCode = RequestParamMap.getFieldName(PREFIX_ENTITY, sEntityRowID, SUFFIX_COUNTRY_CODE);
final String sCountryCode = aEntityRow.get(SUFFIX_COUNTRY_CODE);
if (StringHelper.hasNoText(sCountryCode))
aFormErrors.addFieldError(sFieldCountryCode, "The Country Code of the Entity must be provided!");
// Entity Geographical Information
final String sGeoInfo = aEntityRow.get(SUFFIX_GEO_INFO);
// Entity Identifiers
final ICommonsList<SMPBusinessCardIdentifier> aSMPIdentifiers = new CommonsArrayList<>();
final IRequestParamMap aIdentifiers = aEntities.getMap(sEntityRowID, PREFIX_IDENTIFIER);
if (aIdentifiers != null)
for (final String sIdentifierRowID : aIdentifiers.keySet()) {
final ICommonsMap<String, String> aIdentifierRow = aIdentifiers.getValueMap(sIdentifierRowID);
final int nErrors2 = aFormErrors.size();
// Scheme
final String sFieldScheme = RequestParamMap.getFieldName(PREFIX_ENTITY, sEntityRowID, PREFIX_IDENTIFIER, sIdentifierRowID, SUFFIX_SCHEME);
final String sScheme = aIdentifierRow.get(SUFFIX_SCHEME);
if (StringHelper.hasNoText(sScheme))
aFormErrors.addFieldError(sFieldScheme, "The Scheme of the Identifier must be provided!");
// Value
final String sFieldValue = RequestParamMap.getFieldName(PREFIX_ENTITY, sEntityRowID, PREFIX_IDENTIFIER, sIdentifierRowID, SUFFIX_VALUE);
final String sValue = aIdentifierRow.get(SUFFIX_VALUE);
if (StringHelper.hasNoText(sValue))
aFormErrors.addFieldError(sFieldValue, "The Value of the Identifier must be provided!");
if (aFormErrors.size() == nErrors2) {
final boolean bIsNewIdentifier = sIdentifierRowID.startsWith(TMP_ID_PREFIX);
aSMPIdentifiers.add(bIsNewIdentifier ? new SMPBusinessCardIdentifier(sScheme, sValue) : new SMPBusinessCardIdentifier(sIdentifierRowID, sScheme, sValue));
}
}
aSMPIdentifiers.sort((o1, o2) -> {
int ret = o1.getScheme().compareToIgnoreCase(o2.getScheme());
if (ret == 0)
ret = o1.getValue().compareToIgnoreCase(o2.getValue());
return ret;
});
// Entity Website URIs
final String sFieldWebsiteURIs = RequestParamMap.getFieldName(PREFIX_ENTITY, sEntityRowID, SUFFIX_WEBSITE_URIS);
final String sWebsiteURIs = aEntityRow.get(SUFFIX_WEBSITE_URIS);
final ICommonsList<String> aWebsiteURIs = new CommonsArrayList<>();
for (final String sWebsiteURI : RegExHelper.getSplitToArray(sWebsiteURIs, "\\n")) {
final String sRealWebsiteURI = sWebsiteURI.trim();
if (sRealWebsiteURI.length() > 0)
if (URLValidator.isValid(sRealWebsiteURI))
aWebsiteURIs.add(sRealWebsiteURI);
else
aFormErrors.addFieldError(sFieldWebsiteURIs, "The website URI '" + sRealWebsiteURI + "' is invalid!");
}
// Entity Contacts
final ICommonsList<SMPBusinessCardContact> aSMPContacts = new CommonsArrayList<>();
final IRequestParamMap aContacts = aEntities.getMap(sEntityRowID, PREFIX_CONTACT);
if (aContacts != null)
for (final String sContactRowID : aContacts.keySet()) {
final ICommonsMap<String, String> aContactRow = aContacts.getValueMap(sContactRowID);
final int nErrors2 = aFormErrors.size();
final String sType = aContactRow.get(SUFFIX_TYPE);
final String sName = aContactRow.get(SUFFIX_NAME);
final String sPhoneNumber = aContactRow.get(SUFFIX_PHONE);
final String sFieldEmail = RequestParamMap.getFieldName(PREFIX_ENTITY, sEntityRowID, PREFIX_CONTACT, sContactRowID, SUFFIX_EMAIL);
final String sEmail = aContactRow.get(SUFFIX_EMAIL);
if (StringHelper.hasText(sEmail))
if (!EmailAddressValidator.isValid(sEmail))
aFormErrors.addFieldError(sFieldEmail, "The provided email address is invalid!");
final boolean bIsAnySet = StringHelper.hasText(sType) || StringHelper.hasText(sName) || StringHelper.hasText(sPhoneNumber) || StringHelper.hasText(sEmail);
if (aFormErrors.size() == nErrors2 && bIsAnySet) {
final boolean bIsNewContact = sContactRowID.startsWith(TMP_ID_PREFIX);
aSMPContacts.add(bIsNewContact ? new SMPBusinessCardContact(sType, sName, sPhoneNumber, sEmail) : new SMPBusinessCardContact(sContactRowID, sType, sName, sPhoneNumber, sEmail));
}
}
aSMPContacts.sort((o1, o2) -> {
int ret = CompareHelper.compareIgnoreCase(o1.getType(), o2.getType());
if (ret == 0) {
ret = CompareHelper.compareIgnoreCase(o1.getName(), o2.getName());
if (ret == 0) {
ret = CompareHelper.compareIgnoreCase(o1.getPhoneNumber(), o2.getPhoneNumber());
if (ret == 0)
ret = CompareHelper.compareIgnoreCase(o1.getEmail(), o2.getEmail());
}
}
return ret;
});
// Entity Additional Information
final String sAdditionalInfo = aEntityRow.get(SUFFIX_ADDITIONAL_INFO);
// Entity Registration Date
final String sFieldRegDate = RequestParamMap.getFieldName(PREFIX_ENTITY, sEntityRowID, SUFFIX_REG_DATE);
final String sRegDate = aEntityRow.get(SUFFIX_REG_DATE);
final LocalDate aRegDate = PDTFromString.getLocalDateFromString(sRegDate, aDisplayLocale);
if (aRegDate == null && StringHelper.hasText(sRegDate))
aFormErrors.addFieldError(sFieldRegDate, "The entered registration date is invalid!");
if (aFormErrors.size() == nErrors) {
// Add to list
final boolean bIsNewEntity = sEntityRowID.startsWith(TMP_ID_PREFIX);
final SMPBusinessCardEntity aEntity = bIsNewEntity ? new SMPBusinessCardEntity() : new SMPBusinessCardEntity(sEntityRowID);
aEntity.names().add(new SMPBusinessCardName(sEntityName, null));
aEntity.setCountryCode(sCountryCode);
aEntity.setGeographicalInformation(sGeoInfo);
aEntity.identifiers().setAll(aSMPIdentifiers);
aEntity.websiteURIs().setAll(aWebsiteURIs);
aEntity.contacts().setAll(aSMPContacts);
aEntity.setAdditionalInformation(sAdditionalInfo);
aEntity.setRegistrationDate(aRegDate);
aSMPEntities.add(aEntity);
}
}
if (aSMPEntities.isEmpty())
if (aFormErrors.isEmpty())
aFormErrors.addFieldError(FIELD_SERVICE_GROUP_ID, "At least one entity must be provided.");
if (aFormErrors.isEmpty()) {
// Store in a consistent manner
aSMPEntities.sort((o1, o2) -> o1.names().getFirst().getName().compareToIgnoreCase(o2.names().getFirst().getName()));
if (aBusinessCardMgr.createOrUpdateSMPBusinessCard(aServiceGroup.getParticipantIdentifier(), aSMPEntities) != null) {
final ISMPSettings aSettings = SMPMetaManager.getSettings();
aWPEC.postRedirectGetInternal(success("The Business Card for Service Group '" + aServiceGroup.getID() + "' was successfully saved." + (aSettings.isDirectoryIntegrationEnabled() && aSettings.isDirectoryIntegrationAutoUpdate() ? " " + SMPWebAppConfiguration.getDirectoryName() + " server should have been updated." : "")));
} else
aWPEC.postRedirectGetInternal(error("Error creating the Business Card for Service Group '" + aServiceGroup.getID() + "'"));
}
}
use of com.helger.phoss.smp.domain.businesscard.ISMPBusinessCardManager in project phoss-smp by phax.
the class PageSecureServiceGroup method showListOfExistingObjects.
@Override
protected void showListOfExistingObjects(@Nonnull final WebPageExecutionContext aWPEC) {
final Locale aDisplayLocale = aWPEC.getDisplayLocale();
final HCNodeList aNodeList = aWPEC.getNodeList();
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 (aSettings.isSMLRequired() || aSettings.isSMLEnabled()) {
// 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(aSettings.getSMLDNSZone() == null || aAllServiceGroups.isEmpty() || !aSettings.isSMLEnabled());
}
aNodeList.addChild(aToolbar);
final boolean bShowDetails = aAllServiceGroups.size() <= 1000;
final HCTable aTable = new HCTable(new DTCol("Participant ID").setInitialSorting(ESortOrder.ASCENDING), new DTCol("Owner"), bShowBusinessCardName ? new DTCol("Business Card Name") : null, new DTCol(span(bShowExtensionDetails ? "Ext" : "Ext?").setTitle("Is an Extension present?")), bShowDetails ? new DTCol(span("Docs").setTitle("Number of assigned document types")).setDisplayType(EDTColType.INT, aDisplayLocale) : null, bShowDetails ? new DTCol(span("Procs").setTitle("Number of assigned processes")).setDisplayType(EDTColType.INT, aDisplayLocale) : null, bShowDetails ? new DTCol(span("EPs").setTitle("Number of assigned endpoints")).setDisplayType(EDTColType.INT, aDisplayLocale) : null, new BootstrapDTColAction(aDisplayLocale)).setID(getID());
for (final ISMPServiceGroup aCurObject : aAllServiceGroups) {
final ISimpleURL aViewLink = createViewURL(aWPEC, aCurObject);
final String sDisplayName = aCurObject.getParticipantIdentifier().getURIEncoded();
final HCRow aRow = aTable.addBodyRow();
aRow.addCell(new HCA(aViewLink).addChild(sDisplayName));
aRow.addCell(SMPCommonUI.getOwnerName(aCurObject.getOwnerID()));
if (bShowBusinessCardName) {
IHCNode aName = null;
final ISMPBusinessCard aBC = aBCMgr.getSMPBusinessCardOfServiceGroup(aCurObject);
if (aBC != null) {
final SMPBusinessCardEntity aEntity = aBC.getEntityAtIndex(0);
if (aEntity != null && aEntity.names().isNotEmpty())
aName = HCTextNode.createOnDemand(aEntity.names().getFirst().getName());
}
aRow.addCell(aName);
}
if (bShowExtensionDetails) {
if (aCurObject.extensions().isNotEmpty())
aRow.addCell(new HCCode().addChildren(HCExtHelper.nl2divList(aCurObject.getFirstExtensionXML())));
else
aRow.addCell();
} else {
aRow.addCell(EPhotonCoreText.getYesOrNo(aCurObject.extensions().isNotEmpty(), aDisplayLocale));
}
if (bShowDetails) {
int nProcesses = 0;
int nEndpoints = 0;
final ICommonsList<ISMPServiceInformation> aSIs = aServiceInfoMgr.getAllSMPServiceInformationOfServiceGroup(aCurObject);
for (final ISMPServiceInformation aSI : aSIs) {
nProcesses += aSI.getProcessCount();
nEndpoints += aSI.getTotalEndpointCount();
}
aRow.addCell(Integer.toString(aSIs.size()));
aRow.addCell(Integer.toString(nProcesses));
aRow.addCell(Integer.toString(nEndpoints));
}
final HCNodeList aActions = new HCNodeList();
aActions.addChildren(createEditLink(aWPEC, aCurObject, "Edit " + sDisplayName), new HCTextNode(" "), createCopyLink(aWPEC, aCurObject, "Copy " + sDisplayName), new HCTextNode(" "), createDeleteLink(aWPEC, aCurObject, "Delete " + sDisplayName), new HCTextNode(" "), new HCA(LinkHelper.getURLWithServerAndContext(aCurObject.getParticipantIdentifier().getURIPercentEncoded())).setTitle("Perform SMP query on " + sDisplayName).setTargetBlank().addChild(EFamFamIcon.SCRIPT_GO.getAsNode()));
if (eRESTType.isCompleteServiceGroupSupported()) {
aActions.addChildren(new HCTextNode(" "), new HCA(LinkHelper.getURLWithServerAndContext("complete/" + aCurObject.getParticipantIdentifier().getURIPercentEncoded())).setTitle("Perform complete SMP query on " + sDisplayName).setTargetBlank().addChild(EFamFamIcon.SCRIPT_LINK.getAsNode()));
}
aRow.addCell(aActions);
}
final DataTables aDataTables = BootstrapDataTables.createDefaultDataTables(aWPEC, aTable);
aNodeList.addChild(aTable).addChild(aDataTables);
}
use of com.helger.phoss.smp.domain.businesscard.ISMPBusinessCardManager in project phoss-smp by phax.
the class PageSecureServiceGroup method showSelectedObject.
@Override
protected void showSelectedObject(@Nonnull final WebPageExecutionContext aWPEC, @Nonnull final ISMPServiceGroup aSelectedObject) {
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() + "'"));
final BootstrapViewForm aForm = new BootstrapViewForm();
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Participant ID").setCtrl(aSelectedObject.getParticipantIdentifier().getURIEncoded()));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Owning user").setCtrl(SMPCommonUI.getOwnerName(aSelectedObject.getOwnerID())));
if (aSelectedObject.extensions().isNotEmpty())
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Extension").setCtrl(SMPCommonUI.getExtensionDisplay(aSelectedObject)));
if (bShowBusinessCard) {
aForm.addChild(getUIHandler().createDataGroupHeader("Business Card Details"));
final ISMPBusinessCardManager aBCMgr = SMPMetaManager.getBusinessCardMgr();
final ISMPBusinessCard aBC = aBCMgr.getSMPBusinessCardOfServiceGroup(aSelectedObject);
if (aBC != null) {
int nIndex = 0;
for (final SMPBusinessCardEntity aEntity : aBC.getAllEntities()) {
++nIndex;
aForm.addChild(PageSecureBusinessCard.showBusinessCardEntity(aEntity, nIndex, aDisplayLocale));
}
}
}
aNodeList.addChild(aForm);
}
use of com.helger.phoss.smp.domain.businesscard.ISMPBusinessCardManager in project phoss-smp by phax.
the class PageSecureServiceGroupImport method fillContent.
@Override
protected void fillContent(@Nonnull final WebPageExecutionContext aWPEC) {
final HCNodeList aNodeList = aWPEC.getNodeList();
final Locale aDisplayLocale = aWPEC.getDisplayLocale();
final ISMPSettings aSettings = SMPMetaManager.getSettings();
final ISMPServiceGroupManager aServiceGroupMgr = SMPMetaManager.getServiceGroupMgr();
final ISMPBusinessCardManager aBusinessCardMgr = SMPMetaManager.getBusinessCardMgr();
final IUserManager aUserMgr = PhotonSecurityManager.getUserMgr();
final ICommonsSet<String> aAllServiceGroupIDs = aServiceGroupMgr.getAllSMPServiceGroupIDs();
final ICommonsSet<String> aAllBusinessCardIDs = aBusinessCardMgr.getAllSMPBusinessCardIDs();
final FormErrorList aFormErrors = new FormErrorList();
final HCUL aImportResultUL = new HCUL();
if (aWPEC.hasAction(CPageParam.ACTION_PERFORM)) {
// Start import
final IFileItem aImportFile = aWPEC.params().getAsFileItem(FIELD_IMPORT_FILE);
final boolean bOverwriteExisting = aWPEC.params().isCheckBoxChecked(FIELD_OVERWRITE_EXISTING, DEFAULT_OVERWRITE_EXISTING);
final String sDefaultOwnerID = aWPEC.params().getAsString(FIELD_DEFAULT_OWNER);
final IUser aDefaultOwner = aUserMgr.getActiveUserOfID(sDefaultOwnerID);
if (aImportFile == null || aImportFile.getSize() == 0)
aFormErrors.addFieldError(FIELD_IMPORT_FILE, "A file to import must be selected!");
if (StringHelper.hasNoText(sDefaultOwnerID))
aFormErrors.addFieldError(FIELD_DEFAULT_OWNER, "A default owner must be selected!");
else if (aDefaultOwner == null)
aFormErrors.addFieldError(FIELD_DEFAULT_OWNER, "A valid default owner must be selected!");
if (aFormErrors.isEmpty()) {
final SAXReaderSettings aSRS = new SAXReaderSettings();
final IMicroDocument aDoc = MicroReader.readMicroXML(aImportFile, aSRS);
if (aDoc == null || aDoc.getDocumentElement() == null)
aFormErrors.addFieldError(FIELD_IMPORT_FILE, "The provided file is not a valid XML file!");
else {
// Start interpreting
final String sVersion = aDoc.getDocumentElement().getAttributeValue(CSMPExchange.ATTR_VERSION);
if (CSMPExchange.VERSION_10.equals(sVersion)) {
// Version 1.0
final ICommonsList<ImportActionItem> aActionList = new CommonsArrayList<>();
final ImportSummary aImportSummary = new ImportSummary();
ServiceGroupImport.importXMLVer10(aDoc.getDocumentElement(), bOverwriteExisting, aDefaultOwner, aAllServiceGroupIDs, aAllBusinessCardIDs, aActionList, aImportSummary);
for (final ImportActionItem aAction : aActionList) {
final IErrorLevel aErrorLevel = aAction.getErrorLevel();
final EBootstrapBadgeType eBadgeType;
if (aErrorLevel.isGE(EErrorLevel.ERROR))
eBadgeType = EBootstrapBadgeType.DANGER;
else if (aErrorLevel.isGE(EErrorLevel.WARN))
eBadgeType = EBootstrapBadgeType.WARNING;
else if (aErrorLevel.isGE(EErrorLevel.INFO))
eBadgeType = EBootstrapBadgeType.INFO;
else
eBadgeType = EBootstrapBadgeType.SUCCESS;
// By default is is centered
aImportResultUL.addItem(new BootstrapBadge(eBadgeType).addChild((aAction.hasParticipantID() ? "[" + aAction.getParticipantID() + "] " : "") + aAction.getMessage()).addChild(SMPCommonUI.getTechnicalDetailsUI(aAction.getLinkedException())).addClass(CBootstrapCSS.TEXT_LEFT));
}
} else {
// Unsupported or no version present
if (sVersion == null)
aFormErrors.addFieldError(FIELD_IMPORT_FILE, "The provided file cannot be imported because it has the wrong layout.");
else
aFormErrors.addFieldError(FIELD_IMPORT_FILE, "The provided file contains the unsupported version '" + sVersion + "'.");
}
}
}
}
final boolean bHandleBusinessCards = aSettings.isDirectoryIntegrationEnabled();
if (aImportResultUL.hasChildren()) {
final BootstrapCard aPanel = new BootstrapCard();
aPanel.createAndAddHeader().addChild("Import results");
aPanel.createAndAddBody().addChild(aImportResultUL);
aNodeList.addChild(aPanel);
}
aNodeList.addChild(info("Import service groups incl. all endpoints" + (bHandleBusinessCards ? " and business cards" : "") + " from a file."));
final BootstrapForm aForm = aNodeList.addAndReturnChild(getUIHandler().createFormFileUploadSelf(aWPEC));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("File to import").setCtrl(new BootstrapFileUpload(FIELD_IMPORT_FILE, aDisplayLocale)).setErrorList(aFormErrors.getListOfField(FIELD_IMPORT_FILE)));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Overwrite existing elements").setCtrl(new HCCheckBox(new RequestFieldBoolean(FIELD_OVERWRITE_EXISTING, DEFAULT_OVERWRITE_EXISTING))).setHelpText("If this box is checked, all existing endpoints etc. of a service group are deleted and new endpoints are created! If the " + SMPWebAppConfiguration.getDirectoryName() + " integration is enabled, existing business cards contained in the import are also overwritten!").setErrorList(aFormErrors.getListOfField(FIELD_OVERWRITE_EXISTING)));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Owner of the new service groups").setCtrl(new HCUserSelect(new RequestField(FIELD_DEFAULT_OWNER), aDisplayLocale)).setHelpText("This owner is only selected, if the owner contained in the import file is unknown.").setErrorList(aFormErrors.getListOfField(FIELD_DEFAULT_OWNER)));
final BootstrapButtonToolbar aToolbar = aForm.addAndReturnChild(getUIHandler().createToolbar(aWPEC));
aToolbar.addHiddenField(CPageParam.PARAM_ACTION, CPageParam.ACTION_PERFORM);
aToolbar.addChild(new BootstrapSubmitButton().addChild("Import Service Groups").setIcon(EDefaultIcon.ADD));
}
Aggregations