com.microsoft.graph.generated.models.Operation Maven / Gradle / Ivy
package com.microsoft.graph.models;
import com.microsoft.kiota.serialization.Parsable;
import com.microsoft.kiota.serialization.ParseNode;
import com.microsoft.kiota.serialization.SerializationWriter;
import java.time.OffsetDateTime;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
@jakarta.annotation.Generated("com.microsoft.kiota")
public class Operation extends Entity implements Parsable {
/**
* Instantiates a new {@link Operation} and sets the default values.
*/
public Operation() {
super();
}
/**
* Creates a new instance of the appropriate class based on discriminator value
* @param parseNode The parse node to use to read the discriminator value and create the object
* @return a {@link Operation}
*/
@jakarta.annotation.Nonnull
public static Operation createFromDiscriminatorValue(@jakarta.annotation.Nonnull final ParseNode parseNode) {
Objects.requireNonNull(parseNode);
final ParseNode mappingValueNode = parseNode.getChildNode("@odata.type");
if (mappingValueNode != null) {
final String mappingValue = mappingValueNode.getStringValue();
switch (mappingValue) {
case "#microsoft.graph.onenoteOperation": return new OnenoteOperation();
}
}
return new Operation();
}
/**
* Gets the createdDateTime property value. The start time of the operation.
* @return a {@link OffsetDateTime}
*/
@jakarta.annotation.Nullable
public OffsetDateTime getCreatedDateTime() {
return this.backingStore.get("createdDateTime");
}
/**
* The deserialization information for the current model
* @return a {@link Map>}
*/
@jakarta.annotation.Nonnull
public Map> getFieldDeserializers() {
final HashMap> deserializerMap = new HashMap>(super.getFieldDeserializers());
deserializerMap.put("createdDateTime", (n) -> { this.setCreatedDateTime(n.getOffsetDateTimeValue()); });
deserializerMap.put("lastActionDateTime", (n) -> { this.setLastActionDateTime(n.getOffsetDateTimeValue()); });
deserializerMap.put("status", (n) -> { this.setStatus(n.getEnumValue(OperationStatus::forValue)); });
return deserializerMap;
}
/**
* Gets the lastActionDateTime property value. The time of the last action of the operation.
* @return a {@link OffsetDateTime}
*/
@jakarta.annotation.Nullable
public OffsetDateTime getLastActionDateTime() {
return this.backingStore.get("lastActionDateTime");
}
/**
* Gets the status property value. The current status of the operation: notStarted, running, completed, failed
* @return a {@link OperationStatus}
*/
@jakarta.annotation.Nullable
public OperationStatus getStatus() {
return this.backingStore.get("status");
}
/**
* Serializes information the current object
* @param writer Serialization writer to use to serialize this model
*/
public void serialize(@jakarta.annotation.Nonnull final SerializationWriter writer) {
Objects.requireNonNull(writer);
super.serialize(writer);
writer.writeOffsetDateTimeValue("createdDateTime", this.getCreatedDateTime());
writer.writeOffsetDateTimeValue("lastActionDateTime", this.getLastActionDateTime());
writer.writeEnumValue("status", this.getStatus());
}
/**
* Sets the createdDateTime property value. The start time of the operation.
* @param value Value to set for the createdDateTime property.
*/
public void setCreatedDateTime(@jakarta.annotation.Nullable final OffsetDateTime value) {
this.backingStore.set("createdDateTime", value);
}
/**
* Sets the lastActionDateTime property value. The time of the last action of the operation.
* @param value Value to set for the lastActionDateTime property.
*/
public void setLastActionDateTime(@jakarta.annotation.Nullable final OffsetDateTime value) {
this.backingStore.set("lastActionDateTime", value);
}
/**
* Sets the status property value. The current status of the operation: notStarted, running, completed, failed
* @param value Value to set for the status property.
*/
public void setStatus(@jakarta.annotation.Nullable final OperationStatus value) {
this.backingStore.set("status", value);
}
}