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

org.mitre.stix.ttp_1.TTP Maven / Gradle / Ivy

There is a newer version: 1.2.0.2
Show 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.06.23 at 10:59:44 AM EDT 
//

package org.mitre.stix.ttp_1;

import java.io.StringReader;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
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.datatype.XMLGregorianCalendar;
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.data_marking.marking_1.MarkingType;
import org.mitre.stix.DocumentUtilities;
import org.mitre.stix.STIXSchema;
import org.mitre.stix.ValidationEventHandler;
import org.mitre.stix.common_1.InformationSourceType;
import org.mitre.stix.common_1.KillChainPhasesReferenceType;
import org.mitre.stix.common_1.KillChainsType;
import org.mitre.stix.common_1.RelatedPackageRefsType;
import org.mitre.stix.common_1.StatementType;
import org.mitre.stix.common_1.StructuredTextType;
import org.mitre.stix.common_1.TTPBaseType;

/**
 * TTPs play a central role in cyber threat information and cyber threat intelligence. They are relevant for Indicators, Incidents, Campaigns, and ThreatActors. In addition, they hold a close relationship with ExploitTargets that characterize the specific targets that the TTPs seek to exploit.
 * 
 * 

Java class for TTPType complex type. * *

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

 * <complexType name="TTPType">
 *   <complexContent>
 *     <extension base="{http://stix.mitre.org/common-1}TTPBaseType">
 *       <sequence>
 *         <element name="Title" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="Description" type="{http://stix.mitre.org/common-1}StructuredTextType" maxOccurs="unbounded" minOccurs="0"/>
 *         <element name="Short_Description" type="{http://stix.mitre.org/common-1}StructuredTextType" maxOccurs="unbounded" minOccurs="0"/>
 *         <element name="Intended_Effect" type="{http://stix.mitre.org/common-1}StatementType" maxOccurs="unbounded" minOccurs="0"/>
 *         <element name="Behavior" type="{http://stix.mitre.org/TTP-1}BehaviorType" minOccurs="0"/>
 *         <element name="Resources" type="{http://stix.mitre.org/TTP-1}ResourceType" minOccurs="0"/>
 *         <element name="Victim_Targeting" type="{http://stix.mitre.org/TTP-1}VictimTargetingType" minOccurs="0"/>
 *         <element name="Exploit_Targets" type="{http://stix.mitre.org/TTP-1}ExploitTargetsType" minOccurs="0"/>
 *         <element name="Related_TTPs" type="{http://stix.mitre.org/TTP-1}RelatedTTPsType" minOccurs="0"/>
 *         <element name="Kill_Chain_Phases" type="{http://stix.mitre.org/common-1}KillChainPhasesReferenceType" minOccurs="0"/>
 *         <element name="Information_Source" type="{http://stix.mitre.org/common-1}InformationSourceType" minOccurs="0"/>
 *         <element name="Kill_Chains" type="{http://stix.mitre.org/common-1}KillChainsType" minOccurs="0"/>
 *         <element name="Handling" type="{http://data-marking.mitre.org/Marking-1}MarkingType" minOccurs="0"/>
 *         <element name="Related_Packages" type="{http://stix.mitre.org/common-1}RelatedPackageRefsType" minOccurs="0"/>
 *       </sequence>
 *       <attribute name="version" type="{http://stix.mitre.org/TTP-1}TTPVersionType" />
 *     </extension>
 *   </complexContent>
 * </complexType>
 * 
* * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "TTPType", propOrder = { "title", "descriptions", "shortDescriptions", "intendedEffects", "behavior", "resources", "victimTargeting", "exploitTargets", "relatedTTPs", "killChainPhases", "informationSource", "killChains", "handling", "relatedPackages" }) @XmlRootElement(name = "TTP") public class TTP extends TTPBaseType implements Equals, HashCode, ToString { @XmlElement(name = "Title") protected String title; @XmlElement(name = "Description") protected List descriptions; @XmlElement(name = "Short_Description") protected List shortDescriptions; @XmlElement(name = "Intended_Effect") protected List intendedEffects; @XmlElement(name = "Behavior") protected BehaviorType behavior; @XmlElement(name = "Resources") protected ResourceType resources; @XmlElement(name = "Victim_Targeting") protected VictimTargetingType victimTargeting; @XmlElement(name = "Exploit_Targets") protected ExploitTargetsType exploitTargets; @XmlElement(name = "Related_TTPs") protected RelatedTTPsType relatedTTPs; @XmlElement(name = "Kill_Chain_Phases") protected KillChainPhasesReferenceType killChainPhases; @XmlElement(name = "Information_Source") protected InformationSourceType informationSource; @XmlElement(name = "Kill_Chains") protected KillChainsType killChains; @XmlElement(name = "Handling") protected MarkingType handling; @XmlElement(name = "Related_Packages") protected RelatedPackageRefsType relatedPackages; @XmlAttribute(name = "version") protected String version; /** * Default no-arg constructor * */ public TTP() { super(); } /** * Fully-initialising value constructor * */ public TTP(final QName id, final QName idref, final XMLGregorianCalendar timestamp, final String title, final List descriptions, final List shortDescriptions, final List intendedEffects, final BehaviorType behavior, final ResourceType resources, final VictimTargetingType victimTargeting, final ExploitTargetsType exploitTargets, final RelatedTTPsType relatedTTPs, final KillChainPhasesReferenceType killChainPhases, final InformationSourceType informationSource, final KillChainsType killChains, final MarkingType handling, final RelatedPackageRefsType relatedPackages, final String version) { super(id, idref, timestamp); this.title = title; this.descriptions = descriptions; this.shortDescriptions = shortDescriptions; this.intendedEffects = intendedEffects; this.behavior = behavior; this.resources = resources; this.victimTargeting = victimTargeting; this.exploitTargets = exploitTargets; this.relatedTTPs = relatedTTPs; this.killChainPhases = killChainPhases; this.informationSource = informationSource; this.killChains = killChains; this.handling = handling; this.relatedPackages = relatedPackages; this.version = version; } /** * Gets the value of the title property. * * @return * possible object is * {@link String } * */ public String getTitle() { return title; } /** * Sets the value of the title property. * * @param value * allowed object is * {@link String } * */ public void setTitle(String value) { this.title = value; } /** * Gets the value of the descriptions property. * *

* This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the descriptions property. * *

* For example, to add a new item, do as follows: *

	 *    getDescriptions().add(newItem);
	 * 
* * *

* Objects of the following type(s) are allowed in the list * {@link StructuredTextType } * * */ public List getDescriptions() { if (descriptions == null) { descriptions = new ArrayList(); } return this.descriptions; } /** * Gets the value of the shortDescriptions property. * *

* This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the shortDescriptions property. * *

* For example, to add a new item, do as follows: *

	 *    getShortDescriptions().add(newItem);
	 * 
* * *

* Objects of the following type(s) are allowed in the list * {@link StructuredTextType } * * */ public List getShortDescriptions() { if (shortDescriptions == null) { shortDescriptions = new ArrayList(); } return this.shortDescriptions; } /** * Gets the value of the intendedEffects property. * *

* This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the intendedEffects property. * *

* For example, to add a new item, do as follows: *

	 *    getIntendedEffects().add(newItem);
	 * 
* * *

* Objects of the following type(s) are allowed in the list * {@link StatementType } * * */ public List getIntendedEffects() { if (intendedEffects == null) { intendedEffects = new ArrayList(); } return this.intendedEffects; } /** * Gets the value of the behavior property. * * @return * possible object is * {@link BehaviorType } * */ public BehaviorType getBehavior() { return behavior; } /** * Sets the value of the behavior property. * * @param value * allowed object is * {@link BehaviorType } * */ public void setBehavior(BehaviorType value) { this.behavior = value; } /** * Gets the value of the resources property. * * @return * possible object is * {@link ResourceType } * */ public ResourceType getResources() { return resources; } /** * Sets the value of the resources property. * * @param value * allowed object is * {@link ResourceType } * */ public void setResources(ResourceType value) { this.resources = value; } /** * Gets the value of the victimTargeting property. * * @return * possible object is * {@link VictimTargetingType } * */ public VictimTargetingType getVictimTargeting() { return victimTargeting; } /** * Sets the value of the victimTargeting property. * * @param value * allowed object is * {@link VictimTargetingType } * */ public void setVictimTargeting(VictimTargetingType value) { this.victimTargeting = value; } /** * Gets the value of the exploitTargets property. * * @return * possible object is * {@link ExploitTargetsType } * */ public ExploitTargetsType getExploitTargets() { return exploitTargets; } /** * Sets the value of the exploitTargets property. * * @param value * allowed object is * {@link ExploitTargetsType } * */ public void setExploitTargets(ExploitTargetsType value) { this.exploitTargets = value; } /** * Gets the value of the relatedTTPs property. * * @return * possible object is * {@link RelatedTTPsType } * */ public RelatedTTPsType getRelatedTTPs() { return relatedTTPs; } /** * Sets the value of the relatedTTPs property. * * @param value * allowed object is * {@link RelatedTTPsType } * */ public void setRelatedTTPs(RelatedTTPsType value) { this.relatedTTPs = value; } /** * Gets the value of the killChainPhases property. * * @return * possible object is * {@link KillChainPhasesReferenceType } * */ public KillChainPhasesReferenceType getKillChainPhases() { return killChainPhases; } /** * Sets the value of the killChainPhases property. * * @param value * allowed object is * {@link KillChainPhasesReferenceType } * */ public void setKillChainPhases(KillChainPhasesReferenceType value) { this.killChainPhases = value; } /** * Gets the value of the informationSource property. * * @return * possible object is * {@link InformationSourceType } * */ public InformationSourceType getInformationSource() { return informationSource; } /** * Sets the value of the informationSource property. * * @param value * allowed object is * {@link InformationSourceType } * */ public void setInformationSource(InformationSourceType value) { this.informationSource = value; } /** * Gets the value of the killChains property. * * @return * possible object is * {@link KillChainsType } * */ public KillChainsType getKillChains() { return killChains; } /** * Sets the value of the killChains property. * * @param value * allowed object is * {@link KillChainsType } * */ public void setKillChains(KillChainsType value) { this.killChains = value; } /** * Gets the value of the handling property. * * @return * possible object is * {@link MarkingType } * */ public MarkingType getHandling() { return handling; } /** * Sets the value of the handling property. * * @param value * allowed object is * {@link MarkingType } * */ public void setHandling(MarkingType value) { this.handling = value; } /** * Gets the value of the relatedPackages property. * * @return * possible object is * {@link RelatedPackageRefsType } * */ public RelatedPackageRefsType getRelatedPackages() { return relatedPackages; } /** * Sets the value of the relatedPackages property. * * @param value * allowed object is * {@link RelatedPackageRefsType } * */ public void setRelatedPackages(RelatedPackageRefsType value) { this.relatedPackages = value; } /** * Gets the value of the version property. * * @return * possible object is * {@link String } * */ public String getVersion() { return version; } /** * Sets the value of the version property. * * @param value * allowed object is * {@link String } * */ public void setVersion(String value) { this.version = value; } public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) { if (!(object instanceof TTP)) { return false; } if (this == object) { return true; } if (!super.equals(thisLocator, thatLocator, object, strategy)) { return false; } final TTP that = ((TTP) object); { String lhsTitle; lhsTitle = this.getTitle(); String rhsTitle; rhsTitle = that.getTitle(); if (!strategy.equals( LocatorUtils.property(thisLocator, "title", lhsTitle), LocatorUtils.property(thatLocator, "title", rhsTitle), lhsTitle, rhsTitle)) { return false; } } { List lhsDescriptions; lhsDescriptions = (((this.descriptions != null) && (!this.descriptions .isEmpty())) ? this.getDescriptions() : null); List rhsDescriptions; rhsDescriptions = (((that.descriptions != null) && (!that.descriptions .isEmpty())) ? that.getDescriptions() : null); if (!strategy.equals(LocatorUtils.property(thisLocator, "descriptions", lhsDescriptions), LocatorUtils.property( thatLocator, "descriptions", rhsDescriptions), lhsDescriptions, rhsDescriptions)) { return false; } } { List lhsShortDescriptions; lhsShortDescriptions = (((this.shortDescriptions != null) && (!this.shortDescriptions .isEmpty())) ? this.getShortDescriptions() : null); List rhsShortDescriptions; rhsShortDescriptions = (((that.shortDescriptions != null) && (!that.shortDescriptions .isEmpty())) ? that.getShortDescriptions() : null); if (!strategy.equals(LocatorUtils.property(thisLocator, "shortDescriptions", lhsShortDescriptions), LocatorUtils .property(thatLocator, "shortDescriptions", rhsShortDescriptions), lhsShortDescriptions, rhsShortDescriptions)) { return false; } } { List lhsIntendedEffects; lhsIntendedEffects = (((this.intendedEffects != null) && (!this.intendedEffects .isEmpty())) ? this.getIntendedEffects() : null); List rhsIntendedEffects; rhsIntendedEffects = (((that.intendedEffects != null) && (!that.intendedEffects .isEmpty())) ? that.getIntendedEffects() : null); if (!strategy.equals(LocatorUtils.property(thisLocator, "intendedEffects", lhsIntendedEffects), LocatorUtils .property(thatLocator, "intendedEffects", rhsIntendedEffects), lhsIntendedEffects, rhsIntendedEffects)) { return false; } } { BehaviorType lhsBehavior; lhsBehavior = this.getBehavior(); BehaviorType rhsBehavior; rhsBehavior = that.getBehavior(); if (!strategy .equals(LocatorUtils.property(thisLocator, "behavior", lhsBehavior), LocatorUtils.property(thatLocator, "behavior", rhsBehavior), lhsBehavior, rhsBehavior)) { return false; } } { ResourceType lhsResources; lhsResources = this.getResources(); ResourceType rhsResources; rhsResources = that.getResources(); if (!strategy.equals(LocatorUtils.property(thisLocator, "resources", lhsResources), LocatorUtils.property( thatLocator, "resources", rhsResources), lhsResources, rhsResources)) { return false; } } { VictimTargetingType lhsVictimTargeting; lhsVictimTargeting = this.getVictimTargeting(); VictimTargetingType rhsVictimTargeting; rhsVictimTargeting = that.getVictimTargeting(); if (!strategy.equals(LocatorUtils.property(thisLocator, "victimTargeting", lhsVictimTargeting), LocatorUtils .property(thatLocator, "victimTargeting", rhsVictimTargeting), lhsVictimTargeting, rhsVictimTargeting)) { return false; } } { ExploitTargetsType lhsExploitTargets; lhsExploitTargets = this.getExploitTargets(); ExploitTargetsType rhsExploitTargets; rhsExploitTargets = that.getExploitTargets(); if (!strategy.equals(LocatorUtils.property(thisLocator, "exploitTargets", lhsExploitTargets), LocatorUtils.property(thatLocator, "exploitTargets", rhsExploitTargets), lhsExploitTargets, rhsExploitTargets)) { return false; } } { RelatedTTPsType lhsRelatedTTPs; lhsRelatedTTPs = this.getRelatedTTPs(); RelatedTTPsType rhsRelatedTTPs; rhsRelatedTTPs = that.getRelatedTTPs(); if (!strategy.equals(LocatorUtils.property(thisLocator, "relatedTTPs", lhsRelatedTTPs), LocatorUtils.property( thatLocator, "relatedTTPs", rhsRelatedTTPs), lhsRelatedTTPs, rhsRelatedTTPs)) { return false; } } { KillChainPhasesReferenceType lhsKillChainPhases; lhsKillChainPhases = this.getKillChainPhases(); KillChainPhasesReferenceType rhsKillChainPhases; rhsKillChainPhases = that.getKillChainPhases(); if (!strategy.equals(LocatorUtils.property(thisLocator, "killChainPhases", lhsKillChainPhases), LocatorUtils .property(thatLocator, "killChainPhases", rhsKillChainPhases), lhsKillChainPhases, rhsKillChainPhases)) { return false; } } { InformationSourceType lhsInformationSource; lhsInformationSource = this.getInformationSource(); InformationSourceType rhsInformationSource; rhsInformationSource = that.getInformationSource(); if (!strategy.equals(LocatorUtils.property(thisLocator, "informationSource", lhsInformationSource), LocatorUtils .property(thatLocator, "informationSource", rhsInformationSource), lhsInformationSource, rhsInformationSource)) { return false; } } { KillChainsType lhsKillChains; lhsKillChains = this.getKillChains(); KillChainsType rhsKillChains; rhsKillChains = that.getKillChains(); if (!strategy.equals(LocatorUtils.property(thisLocator, "killChains", lhsKillChains), LocatorUtils.property( thatLocator, "killChains", rhsKillChains), lhsKillChains, rhsKillChains)) { return false; } } { MarkingType lhsHandling; lhsHandling = this.getHandling(); MarkingType rhsHandling; rhsHandling = that.getHandling(); if (!strategy .equals(LocatorUtils.property(thisLocator, "handling", lhsHandling), LocatorUtils.property(thatLocator, "handling", rhsHandling), lhsHandling, rhsHandling)) { return false; } } { RelatedPackageRefsType lhsRelatedPackages; lhsRelatedPackages = this.getRelatedPackages(); RelatedPackageRefsType rhsRelatedPackages; rhsRelatedPackages = that.getRelatedPackages(); if (!strategy.equals(LocatorUtils.property(thisLocator, "relatedPackages", lhsRelatedPackages), LocatorUtils .property(thatLocator, "relatedPackages", rhsRelatedPackages), lhsRelatedPackages, rhsRelatedPackages)) { return false; } } { String lhsVersion; lhsVersion = this.getVersion(); String rhsVersion; rhsVersion = that.getVersion(); if (!strategy.equals( LocatorUtils.property(thisLocator, "version", lhsVersion), LocatorUtils.property(thatLocator, "version", rhsVersion), lhsVersion, rhsVersion)) { 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); { String theTitle; theTitle = this.getTitle(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "title", theTitle), currentHashCode, theTitle); } { List theDescriptions; theDescriptions = (((this.descriptions != null) && (!this.descriptions .isEmpty())) ? this.getDescriptions() : null); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "descriptions", theDescriptions), currentHashCode, theDescriptions); } { List theShortDescriptions; theShortDescriptions = (((this.shortDescriptions != null) && (!this.shortDescriptions .isEmpty())) ? this.getShortDescriptions() : null); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "shortDescriptions", theShortDescriptions), currentHashCode, theShortDescriptions); } { List theIntendedEffects; theIntendedEffects = (((this.intendedEffects != null) && (!this.intendedEffects .isEmpty())) ? this.getIntendedEffects() : null); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "intendedEffects", theIntendedEffects), currentHashCode, theIntendedEffects); } { BehaviorType theBehavior; theBehavior = this.getBehavior(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "behavior", theBehavior), currentHashCode, theBehavior); } { ResourceType theResources; theResources = this.getResources(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "resources", theResources), currentHashCode, theResources); } { VictimTargetingType theVictimTargeting; theVictimTargeting = this.getVictimTargeting(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "victimTargeting", theVictimTargeting), currentHashCode, theVictimTargeting); } { ExploitTargetsType theExploitTargets; theExploitTargets = this.getExploitTargets(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "exploitTargets", theExploitTargets), currentHashCode, theExploitTargets); } { RelatedTTPsType theRelatedTTPs; theRelatedTTPs = this.getRelatedTTPs(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "relatedTTPs", theRelatedTTPs), currentHashCode, theRelatedTTPs); } { KillChainPhasesReferenceType theKillChainPhases; theKillChainPhases = this.getKillChainPhases(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "killChainPhases", theKillChainPhases), currentHashCode, theKillChainPhases); } { InformationSourceType theInformationSource; theInformationSource = this.getInformationSource(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "informationSource", theInformationSource), currentHashCode, theInformationSource); } { KillChainsType theKillChains; theKillChains = this.getKillChains(); currentHashCode = strategy .hashCode(LocatorUtils.property(locator, "killChains", theKillChains), currentHashCode, theKillChains); } { MarkingType theHandling; theHandling = this.getHandling(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "handling", theHandling), currentHashCode, theHandling); } { RelatedPackageRefsType theRelatedPackages; theRelatedPackages = this.getRelatedPackages(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "relatedPackages", theRelatedPackages), currentHashCode, theRelatedPackages); } { String theVersion; theVersion = this.getVersion(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "version", theVersion), currentHashCode, theVersion); } return currentHashCode; } public int hashCode() { final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE; return this.hashCode(null, strategy); } public TTP withTitle(String value) { setTitle(value); return this; } public TTP withDescriptions(StructuredTextType... values) { if (values != null) { for (StructuredTextType value : values) { getDescriptions().add(value); } } return this; } public TTP withDescriptions(Collection values) { if (values != null) { getDescriptions().addAll(values); } return this; } public TTP withShortDescriptions(StructuredTextType... values) { if (values != null) { for (StructuredTextType value : values) { getShortDescriptions().add(value); } } return this; } public TTP withShortDescriptions(Collection values) { if (values != null) { getShortDescriptions().addAll(values); } return this; } public TTP withIntendedEffects(StatementType... values) { if (values != null) { for (StatementType value : values) { getIntendedEffects().add(value); } } return this; } public TTP withIntendedEffects(Collection values) { if (values != null) { getIntendedEffects().addAll(values); } return this; } public TTP withBehavior(BehaviorType value) { setBehavior(value); return this; } public TTP withResources(ResourceType value) { setResources(value); return this; } public TTP withVictimTargeting(VictimTargetingType value) { setVictimTargeting(value); return this; } public TTP withExploitTargets(ExploitTargetsType value) { setExploitTargets(value); return this; } public TTP withRelatedTTPs(RelatedTTPsType value) { setRelatedTTPs(value); return this; } public TTP withKillChainPhases(KillChainPhasesReferenceType value) { setKillChainPhases(value); return this; } public TTP withInformationSource(InformationSourceType value) { setInformationSource(value); return this; } public TTP withKillChains(KillChainsType value) { setKillChains(value); return this; } public TTP withHandling(MarkingType value) { setHandling(value); return this; } public TTP withRelatedPackages(RelatedPackageRefsType value) { setRelatedPackages(value); return this; } public TTP withVersion(String value) { setVersion(value); return this; } @Override public TTP withId(QName value) { setId(value); return this; } @Override public TTP withIdref(QName value) { setIdref(value); return this; } @Override public TTP withTimestamp(XMLGregorianCalendar value) { setTimestamp(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); { String theTitle; theTitle = this.getTitle(); strategy.appendField(locator, this, "title", buffer, theTitle); } { List theDescriptions; theDescriptions = (((this.descriptions != null) && (!this.descriptions .isEmpty())) ? this.getDescriptions() : null); strategy.appendField(locator, this, "descriptions", buffer, theDescriptions); } { List theShortDescriptions; theShortDescriptions = (((this.shortDescriptions != null) && (!this.shortDescriptions .isEmpty())) ? this.getShortDescriptions() : null); strategy.appendField(locator, this, "shortDescriptions", buffer, theShortDescriptions); } { List theIntendedEffects; theIntendedEffects = (((this.intendedEffects != null) && (!this.intendedEffects .isEmpty())) ? this.getIntendedEffects() : null); strategy.appendField(locator, this, "intendedEffects", buffer, theIntendedEffects); } { BehaviorType theBehavior; theBehavior = this.getBehavior(); strategy.appendField(locator, this, "behavior", buffer, theBehavior); } { ResourceType theResources; theResources = this.getResources(); strategy.appendField(locator, this, "resources", buffer, theResources); } { VictimTargetingType theVictimTargeting; theVictimTargeting = this.getVictimTargeting(); strategy.appendField(locator, this, "victimTargeting", buffer, theVictimTargeting); } { ExploitTargetsType theExploitTargets; theExploitTargets = this.getExploitTargets(); strategy.appendField(locator, this, "exploitTargets", buffer, theExploitTargets); } { RelatedTTPsType theRelatedTTPs; theRelatedTTPs = this.getRelatedTTPs(); strategy.appendField(locator, this, "relatedTTPs", buffer, theRelatedTTPs); } { KillChainPhasesReferenceType theKillChainPhases; theKillChainPhases = this.getKillChainPhases(); strategy.appendField(locator, this, "killChainPhases", buffer, theKillChainPhases); } { InformationSourceType theInformationSource; theInformationSource = this.getInformationSource(); strategy.appendField(locator, this, "informationSource", buffer, theInformationSource); } { KillChainsType theKillChains; theKillChains = this.getKillChains(); strategy.appendField(locator, this, "killChains", buffer, theKillChains); } { MarkingType theHandling; theHandling = this.getHandling(); strategy.appendField(locator, this, "handling", buffer, theHandling); } { RelatedPackageRefsType theRelatedPackages; theRelatedPackages = this.getRelatedPackages(); strategy.appendField(locator, this, "relatedPackages", buffer, theRelatedPackages); } { String theVersion; theVersion = this.getVersion(); strategy.appendField(locator, this, "version", buffer, theVersion); } 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, TTP.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 TTP instance for XML String * * @param text * XML String for the document * @return The TTP instance for the passed XML String */ public static TTP fromXMLString(String text) { JAXBContext jaxbContext; try { jaxbContext = JAXBContext.newInstance(TTP.class.getPackage() .getName()); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); unmarshaller.setSchema(STIXSchema.getInstance().getSchema()); unmarshaller.setEventHandler(new ValidationEventHandler()); StreamSource streamSource = new StreamSource(new StringReader(text)); return (TTP) unmarshaller.unmarshal(streamSource); } catch (JAXBException e) { throw new RuntimeException(e); } } /** * Validates the XML representation of this TTP instance * Returning true indicating a successful validation, false if not. * * @return boolean */ public boolean validate() { return STIXSchema.getInstance().validate(toXMLString()); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy