All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mitre.cybox.objects.SMSMessage Maven / Gradle / Ivy

The newest version!
/**
 * Copyright (c) 2015, The MITRE Corporation. All rights reserved.
 * See LICENSE for complete terms.
 */

//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2 
// See http://java.sun.com/xml/jaxb 
// Any modifications to this file will be lost upon recompilation of the source schema. 
// Generated on: 2015.07.01 at 03:19:53 PM EDT 
//

package org.mitre.cybox.objects;

import java.io.StringReader;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.namespace.QName;
import javax.xml.transform.stream.StreamSource;
import org.jvnet.jaxb2_commons.lang.Equals;
import org.jvnet.jaxb2_commons.lang.EqualsStrategy;
import org.jvnet.jaxb2_commons.lang.HashCode;
import org.jvnet.jaxb2_commons.lang.HashCodeStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy;
import org.jvnet.jaxb2_commons.lang.ToString;
import org.jvnet.jaxb2_commons.lang.ToStringStrategy;
import org.jvnet.jaxb2_commons.locator.ObjectLocator;
import org.jvnet.jaxb2_commons.locator.util.LocatorUtils;
import org.mitre.cybox.common_2.CustomPropertiesType;
import org.mitre.cybox.common_2.DateTimeObjectPropertyType;
import org.mitre.cybox.common_2.HexBinaryObjectPropertyType;
import org.mitre.cybox.common_2.IntegerObjectPropertyType;
import org.mitre.cybox.common_2.ObjectPropertiesType;
import org.mitre.cybox.common_2.PositiveIntegerObjectPropertyType;
import org.mitre.cybox.common_2.StringObjectPropertyType;
import org.mitre.stix.DocumentUtilities;
import org.mitre.stix.STIXSchema;
import org.mitre.stix.ValidationEventHandler;
import org.xml.sax.SAXException;

/**
 * The SMSMessageObjectType is intended to characterize Short Message Service (SMS) messages.
 * 
 * 

Java class for SMSMessageObjectType complex type. * *

The following schema fragment specifies the expected content contained within this class. * *

 * <complexType name="SMSMessageObjectType">
 *   <complexContent>
 *     <extension base="{http://cybox.mitre.org/common-2}ObjectPropertiesType">
 *       <sequence>
 *         <element name="Sender_Phone_Number" type="{http://cybox.mitre.org/common-2}StringObjectPropertyType" minOccurs="0"/>
 *         <element name="Recipient_Phone_Number" type="{http://cybox.mitre.org/common-2}StringObjectPropertyType" minOccurs="0"/>
 *         <element name="Sent_DateTime" type="{http://cybox.mitre.org/common-2}DateTimeObjectPropertyType" minOccurs="0"/>
 *         <element name="Body" type="{http://cybox.mitre.org/common-2}StringObjectPropertyType" minOccurs="0"/>
 *         <element name="Length" type="{http://cybox.mitre.org/common-2}IntegerObjectPropertyType" minOccurs="0"/>
 *         <element name="Size" type="{http://cybox.mitre.org/common-2}IntegerObjectPropertyType" minOccurs="0"/>
 *         <element name="Encoding" type="{http://cybox.mitre.org/common-2}StringObjectPropertyType" minOccurs="0"/>
 *         <element name="Bits_Per_Character" type="{http://cybox.mitre.org/common-2}PositiveIntegerObjectPropertyType" minOccurs="0"/>
 *         <element name="User_Data_Header" type="{http://cybox.mitre.org/common-2}HexBinaryObjectPropertyType" minOccurs="0"/>
 *       </sequence>
 *       <attribute name="is_premium" type="{http://www.w3.org/2001/XMLSchema}boolean" />
 *     </extension>
 *   </complexContent>
 * </complexType>
 * 
* * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "SMSMessageObjectType", namespace = "http://cybox.mitre.org/objects#SMSMessageObject-1", propOrder = { "senderPhoneNumber", "recipientPhoneNumber", "sentDateTime", "body", "length", "size", "encoding", "bitsPerCharacter", "userDataHeader" }) @XmlRootElement(name = "SMS_Message", namespace = "http://cybox.mitre.org/objects#SMSMessageObject-1") public class SMSMessage extends ObjectPropertiesType implements Equals, HashCode, ToString { @XmlElement(name = "Sender_Phone_Number") protected StringObjectPropertyType senderPhoneNumber; @XmlElement(name = "Recipient_Phone_Number") protected StringObjectPropertyType recipientPhoneNumber; @XmlElement(name = "Sent_DateTime") protected DateTimeObjectPropertyType sentDateTime; @XmlElement(name = "Body") protected StringObjectPropertyType body; @XmlElement(name = "Length") protected IntegerObjectPropertyType length; @XmlElement(name = "Size") protected IntegerObjectPropertyType size; @XmlElement(name = "Encoding") protected StringObjectPropertyType encoding; @XmlElement(name = "Bits_Per_Character") protected PositiveIntegerObjectPropertyType bitsPerCharacter; @XmlElement(name = "User_Data_Header") protected HexBinaryObjectPropertyType userDataHeader; @XmlAttribute(name = "is_premium") protected Boolean isPremium; /** * Default no-arg constructor * */ public SMSMessage() { super(); } /** * Fully-initialising value constructor * */ public SMSMessage(final CustomPropertiesType customProperties, final QName objectReference, final StringObjectPropertyType senderPhoneNumber, final StringObjectPropertyType recipientPhoneNumber, final DateTimeObjectPropertyType sentDateTime, final StringObjectPropertyType body, final IntegerObjectPropertyType length, final IntegerObjectPropertyType size, final StringObjectPropertyType encoding, final PositiveIntegerObjectPropertyType bitsPerCharacter, final HexBinaryObjectPropertyType userDataHeader, final Boolean isPremium) { super(customProperties, objectReference); this.senderPhoneNumber = senderPhoneNumber; this.recipientPhoneNumber = recipientPhoneNumber; this.sentDateTime = sentDateTime; this.body = body; this.length = length; this.size = size; this.encoding = encoding; this.bitsPerCharacter = bitsPerCharacter; this.userDataHeader = userDataHeader; this.isPremium = isPremium; } /** * Gets the value of the senderPhoneNumber property. * * @return * possible object is * {@link StringObjectPropertyType } * */ public StringObjectPropertyType getSenderPhoneNumber() { return senderPhoneNumber; } /** * Sets the value of the senderPhoneNumber property. * * @param value * allowed object is * {@link StringObjectPropertyType } * */ public void setSenderPhoneNumber(StringObjectPropertyType value) { this.senderPhoneNumber = value; } /** * Gets the value of the recipientPhoneNumber property. * * @return * possible object is * {@link StringObjectPropertyType } * */ public StringObjectPropertyType getRecipientPhoneNumber() { return recipientPhoneNumber; } /** * Sets the value of the recipientPhoneNumber property. * * @param value * allowed object is * {@link StringObjectPropertyType } * */ public void setRecipientPhoneNumber(StringObjectPropertyType value) { this.recipientPhoneNumber = value; } /** * Gets the value of the sentDateTime property. * * @return * possible object is * {@link DateTimeObjectPropertyType } * */ public DateTimeObjectPropertyType getSentDateTime() { return sentDateTime; } /** * Sets the value of the sentDateTime property. * * @param value * allowed object is * {@link DateTimeObjectPropertyType } * */ public void setSentDateTime(DateTimeObjectPropertyType value) { this.sentDateTime = value; } /** * Gets the value of the body property. * * @return * possible object is * {@link StringObjectPropertyType } * */ public StringObjectPropertyType getBody() { return body; } /** * Sets the value of the body property. * * @param value * allowed object is * {@link StringObjectPropertyType } * */ public void setBody(StringObjectPropertyType value) { this.body = value; } /** * Gets the value of the length property. * * @return * possible object is * {@link IntegerObjectPropertyType } * */ public IntegerObjectPropertyType getLength() { return length; } /** * Sets the value of the length property. * * @param value * allowed object is * {@link IntegerObjectPropertyType } * */ public void setLength(IntegerObjectPropertyType value) { this.length = value; } /** * Gets the value of the size property. * * @return * possible object is * {@link IntegerObjectPropertyType } * */ public IntegerObjectPropertyType getSize() { return size; } /** * Sets the value of the size property. * * @param value * allowed object is * {@link IntegerObjectPropertyType } * */ public void setSize(IntegerObjectPropertyType value) { this.size = value; } /** * Gets the value of the encoding property. * * @return * possible object is * {@link StringObjectPropertyType } * */ public StringObjectPropertyType getEncoding() { return encoding; } /** * Sets the value of the encoding property. * * @param value * allowed object is * {@link StringObjectPropertyType } * */ public void setEncoding(StringObjectPropertyType value) { this.encoding = value; } /** * Gets the value of the bitsPerCharacter property. * * @return * possible object is * {@link PositiveIntegerObjectPropertyType } * */ public PositiveIntegerObjectPropertyType getBitsPerCharacter() { return bitsPerCharacter; } /** * Sets the value of the bitsPerCharacter property. * * @param value * allowed object is * {@link PositiveIntegerObjectPropertyType } * */ public void setBitsPerCharacter(PositiveIntegerObjectPropertyType value) { this.bitsPerCharacter = value; } /** * Gets the value of the userDataHeader property. * * @return * possible object is * {@link HexBinaryObjectPropertyType } * */ public HexBinaryObjectPropertyType getUserDataHeader() { return userDataHeader; } /** * Sets the value of the userDataHeader property. * * @param value * allowed object is * {@link HexBinaryObjectPropertyType } * */ public void setUserDataHeader(HexBinaryObjectPropertyType value) { this.userDataHeader = value; } /** * Gets the value of the isPremium property. * * @return * possible object is * {@link Boolean } * */ public Boolean isIsPremium() { return isPremium; } /** * Sets the value of the isPremium property. * * @param value * allowed object is * {@link Boolean } * */ public void setIsPremium(Boolean value) { this.isPremium = value; } public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) { if (!(object instanceof SMSMessage)) { return false; } if (this == object) { return true; } if (!super.equals(thisLocator, thatLocator, object, strategy)) { return false; } final SMSMessage that = ((SMSMessage) object); { StringObjectPropertyType lhsSenderPhoneNumber; lhsSenderPhoneNumber = this.getSenderPhoneNumber(); StringObjectPropertyType rhsSenderPhoneNumber; rhsSenderPhoneNumber = that.getSenderPhoneNumber(); if (!strategy.equals(LocatorUtils.property(thisLocator, "senderPhoneNumber", lhsSenderPhoneNumber), LocatorUtils .property(thatLocator, "senderPhoneNumber", rhsSenderPhoneNumber), lhsSenderPhoneNumber, rhsSenderPhoneNumber)) { return false; } } { StringObjectPropertyType lhsRecipientPhoneNumber; lhsRecipientPhoneNumber = this.getRecipientPhoneNumber(); StringObjectPropertyType rhsRecipientPhoneNumber; rhsRecipientPhoneNumber = that.getRecipientPhoneNumber(); if (!strategy.equals(LocatorUtils.property(thisLocator, "recipientPhoneNumber", lhsRecipientPhoneNumber), LocatorUtils.property(thatLocator, "recipientPhoneNumber", rhsRecipientPhoneNumber), lhsRecipientPhoneNumber, rhsRecipientPhoneNumber)) { return false; } } { DateTimeObjectPropertyType lhsSentDateTime; lhsSentDateTime = this.getSentDateTime(); DateTimeObjectPropertyType rhsSentDateTime; rhsSentDateTime = that.getSentDateTime(); if (!strategy.equals(LocatorUtils.property(thisLocator, "sentDateTime", lhsSentDateTime), LocatorUtils.property( thatLocator, "sentDateTime", rhsSentDateTime), lhsSentDateTime, rhsSentDateTime)) { return false; } } { StringObjectPropertyType lhsBody; lhsBody = this.getBody(); StringObjectPropertyType rhsBody; rhsBody = that.getBody(); if (!strategy.equals( LocatorUtils.property(thisLocator, "body", lhsBody), LocatorUtils.property(thatLocator, "body", rhsBody), lhsBody, rhsBody)) { return false; } } { IntegerObjectPropertyType lhsLength; lhsLength = this.getLength(); IntegerObjectPropertyType rhsLength; rhsLength = that.getLength(); if (!strategy.equals( LocatorUtils.property(thisLocator, "length", lhsLength), LocatorUtils.property(thatLocator, "length", rhsLength), lhsLength, rhsLength)) { return false; } } { IntegerObjectPropertyType lhsSize; lhsSize = this.getSize(); IntegerObjectPropertyType rhsSize; rhsSize = that.getSize(); if (!strategy.equals( LocatorUtils.property(thisLocator, "size", lhsSize), LocatorUtils.property(thatLocator, "size", rhsSize), lhsSize, rhsSize)) { return false; } } { StringObjectPropertyType lhsEncoding; lhsEncoding = this.getEncoding(); StringObjectPropertyType rhsEncoding; rhsEncoding = that.getEncoding(); if (!strategy .equals(LocatorUtils.property(thisLocator, "encoding", lhsEncoding), LocatorUtils.property(thatLocator, "encoding", rhsEncoding), lhsEncoding, rhsEncoding)) { return false; } } { PositiveIntegerObjectPropertyType lhsBitsPerCharacter; lhsBitsPerCharacter = this.getBitsPerCharacter(); PositiveIntegerObjectPropertyType rhsBitsPerCharacter; rhsBitsPerCharacter = that.getBitsPerCharacter(); if (!strategy.equals(LocatorUtils.property(thisLocator, "bitsPerCharacter", lhsBitsPerCharacter), LocatorUtils .property(thatLocator, "bitsPerCharacter", rhsBitsPerCharacter), lhsBitsPerCharacter, rhsBitsPerCharacter)) { return false; } } { HexBinaryObjectPropertyType lhsUserDataHeader; lhsUserDataHeader = this.getUserDataHeader(); HexBinaryObjectPropertyType rhsUserDataHeader; rhsUserDataHeader = that.getUserDataHeader(); if (!strategy.equals(LocatorUtils.property(thisLocator, "userDataHeader", lhsUserDataHeader), LocatorUtils.property(thatLocator, "userDataHeader", rhsUserDataHeader), lhsUserDataHeader, rhsUserDataHeader)) { return false; } } { Boolean lhsIsPremium; lhsIsPremium = this.isIsPremium(); Boolean rhsIsPremium; rhsIsPremium = that.isIsPremium(); if (!strategy.equals(LocatorUtils.property(thisLocator, "isPremium", lhsIsPremium), LocatorUtils.property( thatLocator, "isPremium", rhsIsPremium), lhsIsPremium, rhsIsPremium)) { return false; } } return true; } public boolean equals(Object object) { final EqualsStrategy strategy = JAXBEqualsStrategy.INSTANCE; return equals(null, null, object, strategy); } public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) { int currentHashCode = super.hashCode(locator, strategy); { StringObjectPropertyType theSenderPhoneNumber; theSenderPhoneNumber = this.getSenderPhoneNumber(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "senderPhoneNumber", theSenderPhoneNumber), currentHashCode, theSenderPhoneNumber); } { StringObjectPropertyType theRecipientPhoneNumber; theRecipientPhoneNumber = this.getRecipientPhoneNumber(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "recipientPhoneNumber", theRecipientPhoneNumber), currentHashCode, theRecipientPhoneNumber); } { DateTimeObjectPropertyType theSentDateTime; theSentDateTime = this.getSentDateTime(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "sentDateTime", theSentDateTime), currentHashCode, theSentDateTime); } { StringObjectPropertyType theBody; theBody = this.getBody(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "body", theBody), currentHashCode, theBody); } { IntegerObjectPropertyType theLength; theLength = this.getLength(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "length", theLength), currentHashCode, theLength); } { IntegerObjectPropertyType theSize; theSize = this.getSize(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "size", theSize), currentHashCode, theSize); } { StringObjectPropertyType theEncoding; theEncoding = this.getEncoding(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "encoding", theEncoding), currentHashCode, theEncoding); } { PositiveIntegerObjectPropertyType theBitsPerCharacter; theBitsPerCharacter = this.getBitsPerCharacter(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "bitsPerCharacter", theBitsPerCharacter), currentHashCode, theBitsPerCharacter); } { HexBinaryObjectPropertyType theUserDataHeader; theUserDataHeader = this.getUserDataHeader(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "userDataHeader", theUserDataHeader), currentHashCode, theUserDataHeader); } { Boolean theIsPremium; theIsPremium = this.isIsPremium(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "isPremium", theIsPremium), currentHashCode, theIsPremium); } return currentHashCode; } public int hashCode() { final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE; return this.hashCode(null, strategy); } public SMSMessage withSenderPhoneNumber(StringObjectPropertyType value) { setSenderPhoneNumber(value); return this; } public SMSMessage withRecipientPhoneNumber(StringObjectPropertyType value) { setRecipientPhoneNumber(value); return this; } public SMSMessage withSentDateTime(DateTimeObjectPropertyType value) { setSentDateTime(value); return this; } public SMSMessage withBody(StringObjectPropertyType value) { setBody(value); return this; } public SMSMessage withLength(IntegerObjectPropertyType value) { setLength(value); return this; } public SMSMessage withSize(IntegerObjectPropertyType value) { setSize(value); return this; } public SMSMessage withEncoding(StringObjectPropertyType value) { setEncoding(value); return this; } public SMSMessage withBitsPerCharacter( PositiveIntegerObjectPropertyType value) { setBitsPerCharacter(value); return this; } public SMSMessage withUserDataHeader(HexBinaryObjectPropertyType value) { setUserDataHeader(value); return this; } public SMSMessage withIsPremium(Boolean value) { setIsPremium(value); return this; } @Override public SMSMessage withCustomProperties(CustomPropertiesType value) { setCustomProperties(value); return this; } @Override public SMSMessage withObjectReference(QName value) { setObjectReference(value); return this; } public String toString() { final ToStringStrategy strategy = JAXBToStringStrategy.INSTANCE; final StringBuilder buffer = new StringBuilder(); append(null, buffer, strategy); return buffer.toString(); } public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) { strategy.appendStart(locator, this, buffer); appendFields(locator, buffer, strategy); strategy.appendEnd(locator, this, buffer); return buffer; } public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) { super.appendFields(locator, buffer, strategy); { StringObjectPropertyType theSenderPhoneNumber; theSenderPhoneNumber = this.getSenderPhoneNumber(); strategy.appendField(locator, this, "senderPhoneNumber", buffer, theSenderPhoneNumber); } { StringObjectPropertyType theRecipientPhoneNumber; theRecipientPhoneNumber = this.getRecipientPhoneNumber(); strategy.appendField(locator, this, "recipientPhoneNumber", buffer, theRecipientPhoneNumber); } { DateTimeObjectPropertyType theSentDateTime; theSentDateTime = this.getSentDateTime(); strategy.appendField(locator, this, "sentDateTime", buffer, theSentDateTime); } { StringObjectPropertyType theBody; theBody = this.getBody(); strategy.appendField(locator, this, "body", buffer, theBody); } { IntegerObjectPropertyType theLength; theLength = this.getLength(); strategy.appendField(locator, this, "length", buffer, theLength); } { IntegerObjectPropertyType theSize; theSize = this.getSize(); strategy.appendField(locator, this, "size", buffer, theSize); } { StringObjectPropertyType theEncoding; theEncoding = this.getEncoding(); strategy.appendField(locator, this, "encoding", buffer, theEncoding); } { PositiveIntegerObjectPropertyType theBitsPerCharacter; theBitsPerCharacter = this.getBitsPerCharacter(); strategy.appendField(locator, this, "bitsPerCharacter", buffer, theBitsPerCharacter); } { HexBinaryObjectPropertyType theUserDataHeader; theUserDataHeader = this.getUserDataHeader(); strategy.appendField(locator, this, "userDataHeader", buffer, theUserDataHeader); } { Boolean theIsPremium; theIsPremium = this.isIsPremium(); strategy.appendField(locator, this, "isPremium", buffer, theIsPremium); } return buffer; } /** * Returns A Document representation of this instance that is not formatted. * * @return The Document representation for this instance. */ public org.w3c.dom.Document toDocument() { return toDocument(false); } /** * Returns A Document representation for this instance. * * @param prettyPrint * True for pretty print, otherwise false * * @return The Document representation for this instance. */ public org.w3c.dom.Document toDocument(boolean prettyPrint) { return DocumentUtilities.toDocument(toJAXBElement(), prettyPrint); } /** * Returns JAXBElement for this instance. * * @return The JAXBElement for this instance. */ @SuppressWarnings({ "rawtypes", "unchecked" }) public JAXBElement toJAXBElement() { QName qualifiedName = STIXSchema.getQualifiedName(this); return new JAXBElement(qualifiedName, SMSMessage.class, this); } /** * Returns String representation of this instance that is not formatted. * * @return The String containing the XML mark-up. */ public String toXMLString() { return toXMLString(false); } /** * Returns XML String for JAXB Document Object Model object. * * @param prettyPrint * True for pretty print, otherwise false * * @return The String containing the XML mark-up. */ public String toXMLString(boolean prettyPrint) { return DocumentUtilities.toXMLString(toDocument(), prettyPrint); } /** * Creates SMSMessage instance for XML String * * @param text * XML String for the document * @return The SMSMessage instance for the passed XML String */ public static SMSMessage fromXMLString(String text) { JAXBContext jaxbContext; try { jaxbContext = JAXBContext.newInstance(SMSMessage.class.getPackage() .getName()); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); unmarshaller.setSchema(STIXSchema.getInstance().getSchema()); unmarshaller.setEventHandler(new ValidationEventHandler()); StreamSource streamSource = new StreamSource(new StringReader(text)); return (SMSMessage) unmarshaller.unmarshal(streamSource); } catch (JAXBException e) { throw new RuntimeException(e); } } /** * Validates the XML representation of this SMSMessage instance * Returning true indicating a successful validation, false if not. * * @return boolean True If it validates against the schema * @throws SAXException * If the a validation ErrorHandler has not been set, and * validation throws a SAXException */ public boolean validate() throws SAXException { return STIXSchema.getInstance().validate(toXMLString()); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy