internal override Expression VisitConstant(ConstantExpression c) { object value = SchemaUtil.ConvertEdmType(c.Value); builder.Append(value); return(c); }
public void RegisterXML( EventTypeMetadata metadata, string representsFragmentOfProperty, string representsOriginalTypeName) { var existing = _xmlFragmentEventTypeFactory.GetTypeByName(metadata.Name); if (existing != null) { HandleRegister(existing); return; } var schemaType = _xmlFragmentEventTypeFactory.GetRootTypeByName(representsOriginalTypeName); if (schemaType == null) { throw new EPException("Failed to find XML schema type '" + representsOriginalTypeName + "'"); } var prop = PropertyParser.ParseAndWalkLaxToSimple(representsFragmentOfProperty); var schemaModelRoot = SchemaUtil.FindRootElement( schemaType.SchemaModel, schemaType.ConfigurationEventTypeXMLDOM.RootElementNamespace, schemaType.RootElementName); var item = prop.GetPropertyTypeSchema(schemaModelRoot); var complex = (SchemaElementComplex) item; var eventType = _xmlFragmentEventTypeFactory.GetCreateXMLDOMType( representsOriginalTypeName, metadata.Name, metadata.ModuleName, complex, representsFragmentOfProperty); HandleRegister(eventType); }
private static string GetDateTimeOffset(string filterToken) { if (!DateTime.TryParse(removeDateTimePrefix(filterToken), out DateTime result)) { throw new InvalidFilterException("DateTime filter token value invalid", filterToken); } return(SchemaUtil.GetUtcTicksString(result)); }
public static ApplicationSchemaDefinition FindSchemaDefinition(string fullKey) { var appAndSchema = SchemaUtil.ParseApplicationAndKey(fullKey); var appName = appAndSchema.Item1; var app = Application(appName); return(app.Schema(appAndSchema.Item2)); }
private static SlicedEntityMetadata GetUnionInstance(string unionSchema) { var appAndSchema = SchemaUtil.ParseApplicationAndKey(unionSchema); var appName = appAndSchema.Item1; var app = MetadataProvider.Application(appName); var entityName = app.Entity; var entity = MetadataProvider.Entity(entityName); var schema = app.Schema(appAndSchema.Item2); return(GetInstance(entity, schema, 300, true)); }
public DateTime?ReadDateTime() { ThrowIfDisposed(); ThrowIfInvalidState("ReadDateTime", TableEntityReaderState.HasValue); ThrowIfInvalidType("ReadDateTime", DataType.DateTime); if (currentValue.Type == JsonTokenType.Null) { return(null); } EnsureMatchingTypes(currentValue.Type, JsonTokenType.String); return(SchemaUtil.GetDateTimeFromUtcTicks(long.Parse(currentValue.GetStringValue(), CultureInfo.InvariantCulture))); }
public byte[] ReadBinary() { ThrowIfDisposed(); ThrowIfInvalidState("ReadBinary", TableEntityReaderState.HasValue); ThrowIfInvalidType("ReadBinary", DataType.Binary); if (currentValue.Type == JsonTokenType.Null) { return(null); } EnsureMatchingTypes(currentValue.Type, JsonTokenType.String); return(SchemaUtil.StringToBytes(currentValue.GetStringValue())); }
public static void ResetEnvironment() { SchemaUtil su = new SchemaUtil(); su.CreateSchemas(); BurrowFramework f = new BurrowFramework(); f.CloseWorkSpace(); f.BurrowEnvironment.ShutDown(); //Restart the environment to prepare a fresh start f.BurrowEnvironment.Start(); Checker.CheckSpanningConversations(0); f.InitWorkSpace(); }
private void WriteNameAux(string name) { if (name == null) { throw new ArgumentNullException("name"); } if (context.HasElements) { textWriter.Write(", "); } textWriter.Write(SchemaUtil.GetQuotedString(name)); textWriter.Write(": "); context.HasElements = true; }
public void WriteBinary(byte[] value) { ThrowIfDisposed(); ThrowIfInvalidState("WriteBinary", TableEntityWriterState.Value); WriteNameAux(elemantName); if (value == null) { WriteNull(DataType.Binary); } else { WriteValue(DataType.Binary, SchemaUtil.GetQuotedString(SchemaUtil.BytesToString(value))); } UpdateWriterState(); }
public void WriteDateTime(DateTime?value) { ThrowIfDisposed(); ThrowIfInvalidState("WriteDateTime", TableEntityWriterState.Value); WriteNameAux(elemantName); if (!value.HasValue) { WriteNull(DataType.DateTime); } else { WriteValue(DataType.DateTime, SchemaUtil.GetQuotedString(SchemaUtil.GetUtcTicksString(value.Value))); } UpdateWriterState(); }
public void WriteString(string value) { ThrowIfDisposed(); ThrowIfInvalidState("WriteString", TableEntityWriterState.Value); WriteNameAux(elemantName); if (value == null) { WriteNull(DataType.String); } else { WriteValue(DataType.String, SchemaUtil.GetQuotedString(value)); } UpdateWriterState(); }
public void WriteInt64(long?value) { ThrowIfDisposed(); ThrowIfInvalidState("WriteInt64", TableEntityWriterState.Value); WriteNameAux(elemantName); if (!value.HasValue) { WriteNull(DataType.Int64); } else { WriteValue(DataType.Int64, SchemaUtil.GetQuotedString(value.Value.ToString("D20", CultureInfo.InvariantCulture))); } UpdateWriterState(); }
public void WriteGuid(Guid?value) { ThrowIfDisposed(); ThrowIfInvalidState("WriteGuid", TableEntityWriterState.Value); WriteNameAux(elemantName); if (!value.HasValue) { WriteNull(DataType.Guid); } else { WriteValue(DataType.Guid, SchemaUtil.GetQuotedString(value.ToString())); } UpdateWriterState(); }
/// <summary> /// this data is serialized into a '.' separated string, in the format, schemaId.mode.platform. /// see aa_utils.js on the web client /// </summary> public ApplicationMetadataSchemaKey GetSchemaKeyFromString(string application, string schemaKey, ClientPlatform clientPlatform) { if (ClientPlatform.Mobile == clientPlatform) { //for now, the mobile schema can only be detail.input //TODO: fix it on mobile side return(new ApplicationMetadataSchemaKey(SchemaStereotype.Detail.ToString().ToLower(), SchemaMode.input, ClientPlatform.Mobile)); } if (schemaKey == null || String.IsNullOrWhiteSpace(schemaKey)) { return(null); } return(SchemaUtil.ParseKey(schemaKey, false)); // //sometimes the key may come incomplete, like without the mode, but if thereĀ“s a valid schema, it should be returned. // // then, on the schema declaration, all the data will be present. // key = MetadataProvider.Application(application).Schema(key).GetSchemaKey(); // return null; }
private static string GetBinaryData(string filterToken) { int num = filterToken.Length - "X'".Length - 1; if (num / 2 > 32) { throw new InvalidFilterException("Binary filter token length too high", filterToken); } string text = filterToken.Substring("X'".Length, num); if (!uint.TryParse(text, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out uint result)) { throw new InvalidFilterException("Binary filter token could not be parsed to uint", filterToken); } byte[] array = BitConverter.GetBytes(result); Array.Resize(ref array, text.Length / 2); Array.Reverse((Array)array); return(SchemaUtil.GetQuotedString(SchemaUtil.BytesToString(array), escapeValue: false, '\'')); }
public bool Visit(BinaryOperatorToken tokenIn) { stringBuilder.Append('('); tokenIn.Left.Accept(this); stringBuilder.Append(' '); switch (tokenIn.OperatorKind) { case BinaryOperatorKind.Or: stringBuilder.Append("OR"); break; case BinaryOperatorKind.And: stringBuilder.Append("AND"); break; case BinaryOperatorKind.Equal: stringBuilder.Append("="); break; case BinaryOperatorKind.NotEqual: stringBuilder.Append("!="); break; case BinaryOperatorKind.GreaterThan: stringBuilder.Append(">"); break; case BinaryOperatorKind.GreaterThanOrEqual: stringBuilder.Append(">="); break; case BinaryOperatorKind.LessThan: stringBuilder.Append("<"); break; case BinaryOperatorKind.LessThanOrEqual: stringBuilder.Append("<="); break; case BinaryOperatorKind.Add: stringBuilder.Append("+"); break; case BinaryOperatorKind.Subtract: stringBuilder.Append("-"); break; case BinaryOperatorKind.Multiply: stringBuilder.Append("*"); break; case BinaryOperatorKind.Divide: stringBuilder.Append("/"); break; case BinaryOperatorKind.Modulo: stringBuilder.Append("%"); break; default: throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, "QueryToken of type '{0}' is not supported.", tokenIn.OperatorKind)); } stringBuilder.Append(' '); EndPathToken endPathToken = tokenIn.Left as EndPathToken; if (endPathToken != null && endPathToken.Identifier.Equals("Timestamp") && enableTimestampQuery) { LiteralToken literalToken = tokenIn.Right as LiteralToken; stringBuilder.Append(SchemaUtil.GetTimestampEpochSecondString(literalToken.Value)); } else { tokenIn.Right.Accept(this); } stringBuilder.Append(')'); return(true); }
public override SchemaItem GetPropertyTypeSchema(SchemaElementComplex complexProperty, EventAdapterService eventAdapterService) { return(SchemaUtil.FindPropertyMapping(complexProperty, PropertyNameAtomic)); }
/*--------------------------------------------------------------------------------------------*/ public IVertexSchema GetToVertex() { return(SchemaUtil.GetVertex(ToVertexType)); }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ public IVertexSchema GetFromVertex() { return(SchemaUtil.GetVertex(FromVertexType)); }
public override SchemaItem GetPropertyTypeSchema(SchemaElementComplex complexProperty) { return SchemaUtil.FindPropertyMapping(complexProperty, PropertyNameAtomic); }
public bool Visit(LiteralToken tokenIn) { stringBuilder.Append(SchemaUtil.ConvertEdmType(tokenIn.Value)); return(true); }