Java Code Examples for org.jivesoftware.smackx.xdata.packet.DataForm#getFormType()
The following examples show how to use
org.jivesoftware.smackx.xdata.packet.DataForm#getFormType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MamQueryIQ.java From Smack with Apache License 2.0 | 6 votes |
/** * MAM query IQ constructor. * * @param queryId TODO javadoc me please * @param node TODO javadoc me please * @param dataForm TODO javadoc me please */ public MamQueryIQ(String queryId, String node, DataForm dataForm) { super(ELEMENT, NAMESPACE); this.queryId = queryId; this.node = node; this.dataForm = dataForm; if (dataForm != null) { String formType = dataForm.getFormType(); if (formType == null) { throw new IllegalArgumentException("If a data form is given it must posses a hidden form type field"); } if (!formType.equals(MamElements.NAMESPACE)) { throw new IllegalArgumentException( "Value of the hidden form type field must be '" + MamElements.NAMESPACE + "'"); } addExtension(dataForm); } }
Example 2
Source File: SoftwareInfoForm.java From Smack with Apache License 2.0 | 6 votes |
/** * Include {@link DataForm} to be encapsulated under SoftwareInfoForm. * <br> * @param dataForm The dataform containing Software Information * @return Builder */ public Builder setDataForm(DataForm dataForm) { if (dataForm.getTitle() != null || !dataForm.getItems().isEmpty() || dataForm.getReportedData() != null || !dataForm.getInstructions().isEmpty()) { throw new IllegalArgumentException("Illegal Arguements for SoftwareInformation"); } String formTypeValue = dataForm.getFormType(); if (formTypeValue == null) { throw new IllegalArgumentException("FORM_TYPE Formfield missing"); } if (!formTypeValue.equals(SoftwareInfoForm.FORM_TYPE)) { throw new IllegalArgumentException("Malformed FORM_TYPE Formfield encountered"); } this.dataFormBuilder = dataForm.asBuilder(); return this; }
Example 3
Source File: ServiceDiscoveryManager.java From Smack with Apache License 2.0 | 6 votes |
/** * Registers extended discovery information of this XMPP entity. When this * client is queried for its information this data form will be returned as * specified by XEP-0128. * <p> * * Since no stanza is actually sent to the server it is safe to perform this * operation before logging to the server. In fact, you may want to * configure the extended info before logging to the server so that the * information is already available if it is required upon login. * * @param extendedInfo the data form that contains the extend service discovery information. * @return the old data form which got replaced (if any) * @since 4.4.0 */ public DataForm addExtendedInfo(DataForm extendedInfo) { String formType = extendedInfo.getFormType(); StringUtils.requireNotNullNorEmpty(formType, "The data form must have a form type set"); DataForm removedDataForm; synchronized (this) { removedDataForm = DataForm.remove(extendedInfos, formType); extendedInfos.add(extendedInfo); // Notify others of a state change of SDM. In order to keep the state consistent, this // method is synchronized renewEntityCapsVersion(); } return removedDataForm; }
Example 4
Source File: FilledForm.java From Smack with Apache License 2.0 | 5 votes |
public FilledForm(DataForm dataForm) { this.dataForm = Objects.requireNonNull(dataForm); String formType = dataForm.getFormType(); if (StringUtils.isNullOrEmpty(formType)) { throw new IllegalArgumentException("The provided data form has no hidden FROM_TYPE field."); } if (dataForm.getType() == Type.cancel) { throw new IllegalArgumentException("Forms of type 'cancel' are not filled nor fillable"); } formTypeFormField = dataForm.getHiddenFormTypeField(); }
Example 5
Source File: FilledForm.java From Smack with Apache License 2.0 | 5 votes |
protected static void ensureFormType(DataForm dataForm, String formType) { String dataFormType = dataForm.getFormType(); if (!formType.equals(dataFormType)) { throw new IllegalArgumentException("The provided data form must be of type '" + formType + "', this one was of type '" + dataFormType + '\''); } }