Example #1
0
            internal Between(string unit)
            {
                string unitString;

                switch (unit)
                {
                case "between":
                    this.Unit  = null;
                    unitString = "logical units";
                    break;

                case "inMonths":
                    this.Unit  = ChronoUnit.MONTHS;
                    unitString = "months";
                    break;

                case "inDays":
                    this.Unit  = ChronoUnit.DAYS;
                    unitString = "days";
                    break;

                case "inSeconds":
                    this.Unit  = ChronoUnit.SECONDS;
                    unitString = "seconds";
                    break;

                default:
                    throw new System.InvalidOperationException("Unsupported unit: " + unit);
                }
                this.Signature = new UserFunctionSignature(new QualifiedName(new string[] { "duration" }, unit), SignatureConflict, Neo4jTypes.NTDuration, null, new string[0], string.format(DESCRIPTION, unitString), true);
            }
Example #2
0
 internal FunctionResult(UserFunctionSignature signature)
 {
     this.Name        = signature.Name().ToString();
     this.Signature   = signature.ToString();
     this.Description = signature.Description().orElse("");
     Roles            = Stream.of("admin", "reader", "editor", "publisher", "architect").collect(toList());
     ((IList <string>)Roles).AddRange(Arrays.asList(signature.Allowed()));
 }
Example #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("OptionalGetWithoutIsPresent") @Test public void shouldNotSetProcedureAllowedIfSettingNotSetForUDF() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotSetProcedureAllowedIfSettingNotSetForUDF()
        {
            ConfiguredSetup(DefaultConfiguration());
            Procedures procedures = Neo.LocalGraph.DependencyResolver.resolveDependency(typeof(Procedures));

            UserFunctionSignature funcSig = procedures.Function(new QualifiedName(new string[] { "test" }, "nonAllowedFunc")).signature();

            assertThat(Arrays.asList(funcSig.Allowed()), empty());
        }
Example #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("OptionalGetWithoutIsPresent") @Test public void shouldSetAllowedToConfigSettingForUDF() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldSetAllowedToConfigSettingForUDF()
        {
            ConfiguredSetup(stringMap(SecuritySettings.default_allowed.name(), "nonEmpty"));
            Procedures procedures = Neo.LocalGraph.DependencyResolver.resolveDependency(typeof(Procedures));

            UserFunctionSignature funcSig = procedures.Function(new QualifiedName(new string[] { "test" }, "nonAllowedFunc")).signature();

            assertThat(Arrays.asList(funcSig.Allowed()), containsInAnyOrder("nonEmpty"));
        }
Example #5
0
        /// <summary>
        /// Register a new function.
        /// </summary>
        /// <param name="function"> the function. </param>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void register(org.neo4j.kernel.api.proc.CallableUserFunction function, boolean overrideCurrentImplementation) throws org.neo4j.internal.kernel.api.exceptions.ProcedureException
        public virtual void Register(CallableUserFunction function, bool overrideCurrentImplementation)
        {
            UserFunctionSignature signature = function.Signature();
            QualifiedName         name      = signature.Name();

            CallableUserFunction oldImplementation = _functions.get(name);

            if (oldImplementation == null)
            {
                _functions.put(name, function, signature.CaseInsensitive());
            }
            else
            {
                if (overrideCurrentImplementation)
                {
                    _functions.put(name, function, signature.CaseInsensitive());
                }
                else
                {
                    throw new ProcedureException(Org.Neo4j.Kernel.Api.Exceptions.Status_Procedure.ProcedureRegistrationFailed, "Unable to register function, because the name `%s` is already in use.", name);
                }
            }
        }
Example #6
0
 public CallableUserAggregationFunction_BasicUserAggregationFunctionAnonymousInnerClass(UserFunctionsTest outerInstance, UserFunctionSignature signature) : base(signature)
 {
     this.outerInstance = outerInstance;
 }
Example #7
0
 private CallableUserAggregationFunction AggregationFunction(UserFunctionSignature signature)
 {
     return(new CallableUserAggregationFunction_BasicUserAggregationFunctionAnonymousInnerClass(this, signature));
 }
Example #8
0
 public CallableUserFunction_BasicUserFunctionAnonymousInnerClass(UserFunctionsTest outerInstance, UserFunctionSignature signature, Key <string> someKey) : base(signature)
 {
     this.outerInstance = outerInstance;
     this._someKey      = someKey;
 }
Example #9
0
 internal FromEpoch()
 {
     this.Signature = new UserFunctionSignature(new QualifiedName(new string[] { "datetime" }, "fromepoch"), SignatureConflict, Neo4jTypes.NTDateTime, null, new string[0], DESCRIPTION, true);
 }
Example #10
0
 public UserFunctionHandle(UserFunctionSignature signature, int id)
 {
     this._signature = signature;
     this._id        = id;
 }