working on it ...

Filters

Explore Public Snippets

Sort by

Found 1,948 snippets matching: managed

    public by DanielOgbuagu  201738  1  5  0

    Adding a *.jar file (originating from java-wrapped C++ code) to an SBT project classpath

    I thought using unmanaged dependencies in SBT projects was simply dropping a jar file into the lib directory, until I bought an SDK for a biometric device. Both the C++ and the Java packages were provided. I opted for the Java package, copying the provided jar file and the JNI (*.so) files into the appropriate locations and configuring the ja
    /**
     * In my <code>build.sbt</code> file, I appended a blank line and then the following:
     */
    
    libraryDependencies += "groupID" % "artifactId" % "revision" from "file:///home/Danogbuagu/Projects/biometric-lib/filename.jar"
    
    // where,
    // groupID for example is like: com.zigzagcompany 
    // artifactId for example is like: zigzag
    // revision for example is like: 1.3.4
    // Remember the line befor the code and that after.

    public by sTiLL-iLL @ SniPitz-KND  2727  6  7  14

    C# Non Blocking, Multithreaded, Maker/Taker Queue

    effn sweet....
    public class KQue
    {
      readonly object synk = new object();
      Thread[] wrkrz;
      Queue<Action> itmQ = new Queue<Action>();
    
      public KQue (int workerCount)
      {
        wrkrz = new Thread [workerCount];
        for (int i = 0; i < workerCount; i++)
        {
          (wrkrz[i] = new Thread(konsume)).Start();
        }
      }
    
    
      public void Shutdown (bool waitingFor)
      {
        foreach (var thd in wrkrz)
        {
          NQItem (null);
        }
        if (waitingFor)
        {
          foreach (var thd in wrkrz)
          {
            thd.Join();
          }
        }
      }
    
      public void NQItem (Action itm)
      {
        lock (synk)
        {
          itmQ.Enqueue (itm);       
          Monitor.Pulse (synk);         
        }
      }
    
      private void konsume()
      {
        while (true)     
        {                               
          Action itm;
          lock (synk)
          {
            while (itmQ.Count == 0)
            {
                Monitor.Wait (synk);
            }
            itm = itmQ.Dequeue();
          }
    
          if (itm == null)  
          {
              return;
          }
    
          itm();   
        }
      }
    }
    
                

    public by sTiLL-iLL  2602  1  8  13

    Managed Interval! Timer Alchemy with concurrent kueue executes tasks on the b bb b bbeat

    check files, ping a server, download a receipt... if you can list it this can execute it, neat and tidy. its like a gold watch of timer structs (use my non-bloking kueue with this)
    using System;
    using System.IO;
    using System.Linq;
    using System.Threading;
    using System.Threading.Tasks;
    
    
    void Main()
    {
    	var dct = new DownCount(5);
    	new Thread (() =>
    	{
    		for (int i = 0; i < 5; i++)
    		{
    			Thread.Sleep(1000);
    			dct.Signal();
    			Console.WriteLine ("Signal " + i);
    		}
    	}).Start();
    	
    	Console.WriteLine ("Wait for it...");
    	dc.Wait();
    	Console.WriteLine ("ahhhhhh......");
    }
    
    public class DownCount
    {
      int val;
    	object loka = new object ();
    	public DownCount() { }
    	
    	public DownCount (int cnt1)
    	{
    	  val = cnt1;
    	}
    	
    	public void Signal()
    	{
    	  DCnt1 (-1);
    	}
    	
    	public void DCnt1 (int totl)
    	{
    		lock (loka) 
    		{ 
    			val += totl;
    			if (val <= 0)
    			{
    			  Monitor.PulseAll (loka);
    			}
    		}
    	}
    	
    	public void Wait()
    	{
    		lock (loka)
    		{
    			while (val > 0)
    			{
    				Monitor.Wait (loka);
    			}
    		}
    	}
    }
    
    //////////////////////////////////////////////////////////
    
    public class betterInterval
    {
      static void Tik(long t)
      {
        this.onTik.Invoke(t);
      }
      
      static IObservable<long> Interval(TimeSpan period)
      {
          return Observable.Create<long> (observer => {
    	    long i = 0;
    	    object sync = new object();
    	        return new Timer (_ => {
                      lock (sync) observer.OnNext (i++);
              }, Tik(i), period, period);
        });
      }
      
      static IObservable<long> kreate(TimeSpan period)
      {
        return Interval (TimeSpan.FromSeconds(period)).Subscribe(onTik);
      }
      
      static async void onTik(t)
      {
        Console.WriteLine(t);
      }
    }
    
    void Main()
    {
        IObservable<long> bi = betterInterval.kreate(TimeSpan.FromSeconds(5));
        bi.Subscribe(Console.WriteLine(t);
    }
    
    
    ///////////////////////////////////////////////////////////////////////
    
    public class KInterval
    {
        public delegate void Signal (object signal);
        public event Signal Received;
    
        static long tcnt = 0;
        long dly = 0;
        long prd = 0;
        KQue kq = new KQue(5);
        Timer tmr;
    
        public KInterval (long delay = 5000, long period = 3000, int workersCount = 3)
        {
            dly = delay;
            prd = period;
            if (workersCount > 0)
            {
                kq = new KQue(workersCount);
            }
        }
    
        public void Begin ( )
        {
            kq.NQItem(( ) => tmr = new Timer(Signaled, tcnt, dly, prd));
        }
    
        public void Kill ( )
        {
            tmr.Dispose();
            kq.ShutdownKQ(true);
        }
    
        private void Signaled (object signal)
        {
            var sig = (long) signal;
            var st = sig;
            this.Received += KInterval_Received;
            this.Received.Invoke(sig);
            this.Received -= KInterval_Received;
        }
    
        void KInterval_Received (object signal)
        {      }
    }                        

    public by Geometry  931  0  5  0

    FromManagedImage: Create unmanaged image from the specified managed image.

    Create unmanaged image from the specified managed image. Source managed image. Returns new unmanaged image, which is a copy of source managed image. The method creates an exact copy of specified managed image, but allocated in unmanaged memory. Unsupported pixel format of source image.
    /// <summary>
    /// Create unmanaged image from the specified managed image.
    /// </summary>
    /// 
    /// <param name="image">Source managed image.</param>
    /// 
    /// <returns>Returns new unmanaged image, which is a copy of source managed image.</returns>
    /// 
    /// <remarks><para>The method creates an exact copy of specified managed image, but allocated
    /// in unmanaged memory.</para></remarks>
    /// 
    /// <exception cref="UnsupportedImageFormatException">Unsupported pixel format of source image.</exception>
    /// 
    public static UnmanagedImage FromManagedImage(Bitmap image)
    {
        UnmanagedImage dstImage = null;
    
        BitmapData sourceData = image.LockBits(new Rectangle(0, 0, image.Width, image.Height),
            ImageLockMode.ReadOnly, image.PixelFormat);
    
        try
        {
            dstImage = FromManagedImage(sourceData);
        }
        finally
        {
            image.UnlockBits(sourceData);
        }
    
        return dstImage;
    }

    public by cghersi  14979  33  10  3

    C#: String Tokenizer

    This class provides a fast way to tokenize the given string and can be fully customizable in terms of splitting symbols, strange characters managed as letters, etc.
    using System;
    using System.IO;
    using System.Text;
    using System.Collections;
    using System.Collections.Generic;
    
    public class StringTokenizer
    {
        const char EOF = (char)0;
    
        int line;
        int column;
        int pos;	// position within data
    
        string data;
    
        List<Token> tokens;
    
        bool ignoreWhiteSpace;
        bool ignoreEqualChar;
        bool ignoreDigits;
        bool tokenSeparatedBySpace;
        char[] symbolChars;
        char[] symbolAsLetter;  //array of symbols treated as common letters inside words
    
        int saveLine;
        int saveCol;
        int savePos;
    
        bool tokenListCreated = false;
    
        public StringTokenizer(TextReader reader)
        {
            if (reader == null)
                throw new ArgumentNullException("reader");
    
            data = reader.ReadToEnd();
    
            Reset();
        }
    
        public StringTokenizer(string data)
        {
            if (data == null)
                throw new ArgumentNullException("data");
    
            this.data = data;
    
            Reset();
        }
    
    
        /// <summary>
        /// gets the list of tokens representing the input
        /// </summary>
        public List<Token> Tokens
        {
            get
            {
                if (!tokenListCreated)
                    this.CreateArrayList();
                return this.tokens;
            }
        }
    
    
        /// <summary>
        /// gets or sets which characters are part of TokenKind.Symbol
        /// </summary>
        public char[] SymbolChars
        {
            get { return this.symbolChars; }
            set { this.symbolChars = value; }
        }
    
    
        /// <summary>
        /// gets or sets which special characters (symbols) are treated as common letters inside words.
        /// Default is empty list.
        /// </summary>
        public char[] SymbolAsLetter
        {
            get { return this.symbolAsLetter; }
            set { this.symbolAsLetter = value; }
        }
    
    
        /// <summary>
        /// if set to true, white space characters will be ignored,
        /// but EOL and whitespace inside of string will still be tokenized.
        /// Default is false.
        /// </summary>
        public bool IgnoreWhiteSpace
        {
            get { return this.ignoreWhiteSpace; }
            set { this.ignoreWhiteSpace = value; }
        }
    
        /// <summary>
        /// if set to true, '=' character will be ignored,
        /// but EOL and whitespace inside of string will still be tokenized.
        /// Default is false.
        /// </summary>
        public bool IgnoreEqualChar
        {
            get { return this.ignoreEqualChar; }
            set { this.ignoreEqualChar = value; }
        }
    
        /// <summary>
        /// if set to true, digits are treated as normal characters, like literals.
        /// Default is false.
        /// </summary>
        public bool IgnoreDigits
        {
            get { return this.ignoreDigits; }
            set { this.ignoreDigits = value; }
        }
    
        /// <summary>
        /// if set to true, tokens must be separated by separators (spaces, tabs, etc).
        /// Default is false.
        /// </summary>
        public bool TokenSeparatedBySpace
        {
            get { return this.tokenSeparatedBySpace; }
            set { this.tokenSeparatedBySpace = value; }
        }
    
        private void Reset()
        {
            this.ignoreWhiteSpace = false;
            this.ignoreEqualChar = false;
            this.ignoreDigits = false;
            this.tokenSeparatedBySpace = false;
            this.symbolChars = new char[]{  '+', '-', '/', '*', '~', '@', '#', '%', '^',
                                            '=', '<', '>', '!',
                                            ',', '.', ':', ';', '_',
                                            '$', '€', '£', '&', '?', '|', '\\', '\'', '§', '°', 
                                            'ç', 'ì', 'è', 'é', 'ò', 'à', 'ù',    
                                            '(', ')', '{', '}', '[', ']'};
            this.symbolAsLetter = new char[] { };
    
            this.tokens = new List<Token>();
    
            line = 1;
            column = 1;
            pos = 0;
            tokenListCreated = false;
        }
    
        protected char LA(int count)
        {
            if (pos + count >= data.Length)
                return EOF;
            else
                return data[pos + count];
        }
    
        protected char Consume()
        {
            char ret = data[pos];
            pos++;
            column++;
    
            return ret;
        }
    
        protected Token CreateToken(TokenKind kind, string value)
        {
            Token tmp = new Token(kind, value, line, column);
            tokens.Add(tmp);
            return tmp;
        }
    
        protected Token CreateToken(TokenKind kind)
        {
            string tokenData = data.Substring(savePos, pos - savePos);
            Token tmp = new Token(kind, tokenData, saveLine, saveCol);
            tokens.Add(tmp);
            return tmp;
        }
    
        /* populate the arraylist. */
        protected void CreateArrayList()
        {
            //initialization of the positions for the scrolling of the input string:
            line = 1;
            column = 1;
            pos = 0;
            tokens.Clear();
    
            //sliding input in order to fill the arraylist:
            Token tmp = Next();
            while ((tmp.Kind != TokenKind.EOF) && (tmp.Kind != TokenKind.EOL))
                tmp = Next();
    
            tokenListCreated = true;
        }
    
        public Token Next()
        {
        ReadToken:
    
            char ch = LA(0);
            switch (ch)
            {
                case EOF:
                    return CreateToken(TokenKind.EOF, string.Empty);
    
                case ' ':
                case '\t':
                    {
                        if (this.ignoreWhiteSpace)
                        {
                            Consume();
                            goto ReadToken;
                        }
                        else
                            return ReadWhitespace();
                    }
    
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                    if (ignoreDigits)
                        return ReadWord();
                    else
                        return ReadNumber();
    
                case '\r':
                    {
                        StartRead();
                        Consume();
                        if (LA(0) == '\n')
                            Consume();	// on DOS/Windows we have \r\n for new line
    
                        line++;
                        column = 1;
    
                        return CreateToken(TokenKind.EOL);
                    }
                case '\n':
                    {
                        StartRead();
                        Consume();
                        line++;
                        column = 1;
    
                        return CreateToken(TokenKind.EOL);
                    }
    
                case '"':
                    {
                        return ReadString();
                    }
    
                default:
                    {
                        if (Char.IsLetter(ch) || (ignoreDigits && Char.IsDigit(ch)) ||
                            (ch == '_') || IsSymbolAsLetter(ch))
                            return ReadWord();
                        else if (IsSymbol(ch))
                        {
                            string symbol = new string(ch, 1);
                            char firstChar = ch;
    
                            StartRead();
                            Consume();
                            ch = LA(0);
    
                            //case of symbols composed by more than 1 char:
                            //symbols: "<>" or "!=" or ">=" or "<=":
                            switch (firstChar)
                            {
                                case '<':
                                    if ((ch == '>') || (ch == '='))
                                    {
                                        StartRead();
                                        Consume();
                                        symbol = string.Format("{0}{1}", symbol, ch);
                                    }
                                    break;
    
                                case '>':
                                    if ((ch == '<') || (ch == '='))
                                    {
                                        StartRead();
                                        Consume();
                                        symbol = string.Format("{0}{1}", symbol, ch);
                                    }
                                    break;
    
                                case '!':
                                    if (ch == '=')
                                    {
                                        StartRead();
                                        Consume();
                                        symbol = string.Format("{0}{1}", symbol, ch);
                                    }
                                    break;
    
                                default: break;
                            }
    
                            //if user wants tokens separated only by separators (spaces, tabs, etc.), check if 
                            //symbol is alone or within a word:
                            if (tokenSeparatedBySpace && (ch != EOF) && (ch != ' ') && (ch != '\t') &&
                                (ch != '\n') && (ch != '\r'))
                            {
                                return ReadWord(string.Format("{0}{1}", firstChar, ch));
                            }
    
                            return CreateToken(TokenKind.Symbol, symbol);
                        }
                        else
                        {
                            StartRead();
                            Consume();
                            return CreateToken(TokenKind.Unknown);
                        }
                    }
    
            }
        }
    
        /// <summary>
        /// save read point positions so that CreateToken can use those
        /// </summary>
        private void StartRead()
        {
            saveLine = line;
            saveCol = column;
            savePos = pos;
        }
    
        /// <summary>
        /// reads all whitespace characters (does not include newline)
        /// </summary>
        /// <returns></returns>
        protected Token ReadWhitespace()
        {
            StartRead();
    
            Consume(); // consume the looked-ahead whitespace char
    
            while (true)
            {
                char ch = LA(0);
                if (ch == '\t' || ch == ' ')
                    Consume();
                else
                    break;
            }
    
            return CreateToken(TokenKind.WhiteSpace);
    
        }
    
        /// <summary>
        /// reads number. Number is: DIGIT+ ("." DIGIT*)?
        /// </summary>
        /// <returns></returns>
        protected Token ReadNumber()
        {
            StartRead();
    
            bool hadDot = false;
    
            Consume(); // read first digit
    
            while (true)
            {
                char ch = LA(0);
                if (Char.IsDigit(ch))
                    Consume();
                else if (ch == '.' && !hadDot)
                {
                    hadDot = true;
                    Consume();
                }
                else
                    break;
            }
    
            return CreateToken(TokenKind.Number);
        }
    
        /// <summary>
        /// reads word. Word contains any alpha character or _
        /// </summary>
        protected Token ReadWord()
        {
            StartRead();
    
            Consume(); // consume first character of the word
    
            while (true)
            {
                char ch = LA(0);
                if (Char.IsLetter(ch) || (ignoreDigits && Char.IsDigit(ch)) || ch == '_' ||
                    (ignoreEqualChar && (ch == '=')) || IsSymbolAsLetter(ch) ||
                    (tokenSeparatedBySpace && IsSymbol(ch)))
                    Consume();
                else
                    break;
            }
    
            return CreateToken(TokenKind.Word);
        }
    
        /// <summary>
        /// reads word. Word contains any alpha character or _ and is appended to input string
        /// </summary>
        /// <param name="prefix">string which word is appended to</param>
        protected Token ReadWord(string prefix)
        {
            StartRead();
    
            //bring forward the position cursor of the nmber of chars in prefix:
            savePos = savePos - prefix.Length + 1;
    
            while (true)
            {
                char ch = LA(0);
                if (Char.IsLetter(ch) || (ignoreDigits && Char.IsDigit(ch)) || ch == '_' ||
                    (ignoreEqualChar && (ch == '=')) || IsSymbolAsLetter(ch) ||
                    (tokenSeparatedBySpace && IsSymbol(ch)))
                    Consume();
                else
                    break;
            }
    
            return CreateToken(TokenKind.Word);
        }
    
        /// <summary>
        /// reads all characters until next " is found.
        /// If "" (2 quotes) are found, then they are consumed as
        /// part of the string
        /// </summary>
        /// <returns></returns>
        protected Token ReadString()
        {
            StartRead();
    
            Consume(); // read "
    
            while (true)
            {
                char ch = LA(0);
                if (ch == EOF)
                    break;
                else if (ch == '\r')	// handle CR in strings
                {
                    Consume();
                    if (LA(0) == '\n')	// for DOS & windows
                        Consume();
    
                    line++;
                    column = 1;
                }
                else if (ch == '\n')	// new line in quoted string
                {
                    Consume();
    
                    line++;
                    column = 1;
                }
                else if (ch == '"')
                {
                    Consume();
                    if (LA(0) != '"')
                        break;	// done reading, and this quotes does not have escape character
                    else
                        Consume(); // consume second ", because first was just an escape
                }
                else
                    Consume();
            }
    
            return CreateToken(TokenKind.QuotedString);
        }
    
        /// <summary>
        /// checks whether c is a symbol character.
        /// </summary>
        protected bool IsSymbol(char c)
        {
            for (int i = 0; i < symbolChars.Length; i++)
                if (symbolChars[i] == c)
                    return true;
    
            return false;
        }
    
        /// <summary>
        /// checks whether c is a symbol character treated as common letter inside words.
        /// </summary>
        protected bool IsSymbolAsLetter(char c)
        {
            for (int i = 0; i < symbolAsLetter.Length; i++)
                if (symbolAsLetter[i] == c)
                    return true;
    
            return false;
        }
    }
    
    public enum TokenKind
    {
        Unknown,
        Word,
        Number,
        QuotedString,
        WhiteSpace,
        Symbol,
        EOL,
        EOF,
        BinaryOp,
        UnaryOp,
        MetaValueOp,
        OpenBrace,
        ClosedBrace
    }
    
    
    /// <summary>
    /// Token is the single element in which is broken a string
    /// </summary>
    public class Token
    {
        int line;
        int column;
        string value;
        TokenKind kind;
    
        public Token(TokenKind kind, string value, int line, int column)
        {
            this.kind = kind;
    
            //if the token is a QuotedString, remove quotes from the value:
            if (kind == TokenKind.QuotedString)
            {
                if (value[0] == '"' && (value.Length >= 2))
                {
                    int len = value.Length - 2;
                    //particular case when the quoted string doesn't end with '"' (e.g. "san francisco)
                    if (value[value.Length - 1] != '"')
                        len++;
                    this.value = value.Substring(1, len);
                }
                else
                    this.value = value;
            }
            else
                this.value = value;
    
            this.line = line;
            this.column = column;
        }
    
        public Token(TokenKind kind, string value) : this (kind, value, 0, 0)
        {
        }
    
        public int Column
        {
            get { return this.column; }
        }
    
        public TokenKind Kind
        {
            get { return this.kind; }
            set { kind = value; }
        }
    
        public int Line
        {
            get { return this.line; }
        }
    
        public string Value
        {
            get { return this.value; }
            set { this.value = value; }
        }
    
        public override string ToString()
        {
            string val = value;
            if (kind == TokenKind.QuotedString)
                val = string.Format("\"{0}\"", val);
    
            return string.Format("value:{0} ;kind:{1}", val, kind);
        }
    }

    public by SergioMarquez @ DTW  1566  0  5  2

    Acceder a un MB desde otro ManagedBean

    HttpSessionsesion = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
    HistorialTramites histMB = (HistorialTramites) sesion.getAttribute("histTramites");
    
    -----------------
    
    ...        
    @ManagedBean(name = "histTramites")
    @SessionScoped
    public class HistorialTramites{
    ...                                                            

    public by Geometry  2189  0  6  0

    CopyUnmanagedMemory: Copy block of unmanaged memory.

    Copy block of unmanaged memory. Destination pointer. Source pointer. Memory block's length to copy. Return's value of - pointer to destination. This function is required because of the fact that .NET does not provide any way to copy unmanaged blocks, but provides only methods to copy from unmanaged memory to managed memory and vi
    /// <summary>
    /// Copy block of unmanaged memory.
    /// </summary>
    /// 
    /// <param name="dst">Destination pointer.</param>
    /// <param name="src">Source pointer.</param>
    /// <param name="count">Memory block's length to copy.</param>
    /// 
    /// <returns>Return's value of <paramref name="dst"/> - pointer to destination.</returns>
    /// 
    /// <remarks><para>This function is required because of the fact that .NET does
    /// not provide any way to copy unmanaged blocks, but provides only methods to
    /// copy from unmanaged memory to managed memory and vise versa.</para></remarks>
    /// 
    public static unsafe byte* CopyUnmanagedMemory(byte* dst, byte* src, int count)
    {
        return memcpy(dst, src, count);
    }

    public by Geometry  2124  0  6  0

    CopyUnmanagedMemory: Copy block of unmanaged memory.

    Copy block of unmanaged memory. Destination pointer. Source pointer. Memory block's length to copy. Return's value of - pointer to destination. This function is required because of the fact that .NET does not provide any way to copy unmanaged blocks, but provides only methods to copy from unmanaged memory to managed memory and vi
    /// <summary>
    /// Copy block of unmanaged memory.
    /// </summary>
    /// 
    /// <param name="dst">Destination pointer.</param>
    /// <param name="src">Source pointer.</param>
    /// <param name="count">Memory block's length to copy.</param>
    /// 
    /// <returns>Return's value of <paramref name="dst"/> - pointer to destination.</returns>
    /// 
    /// <remarks><para>This function is required because of the fact that .NET does
    /// not provide any way to copy unmanaged blocks, but provides only methods to
    /// copy from unmanaged memory to managed memory and vise versa.</para></remarks>
    ///
    public static IntPtr CopyUnmanagedMemory(IntPtr dst, IntPtr src, int count)
    {
        unsafe
        {
            CopyUnmanagedMemory((byte*)dst.ToPointer(), (byte*)src.ToPointer(), count);
        }
        return dst;
    }

    public by lbottaro  1915  1  6  0

    Port class - Integration of java JPA and JAXB

    This is a generic abstract Port class, managed by a Card class.
    package com.examples.jpa;
    
    import java.io.Serializable;
    
    import javax.persistence.CascadeType;
    import javax.persistence.Column;
    import javax.persistence.DiscriminatorColumn;
    import javax.persistence.Entity;
    import javax.persistence.FetchType;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    import javax.persistence.Inheritance;
    import javax.persistence.InheritanceType;
    import javax.persistence.ManyToOne;
    import javax.persistence.Transient;
    import javax.persistence.Version;
    import javax.xml.bind.annotation.XmlAccessType;
    import javax.xml.bind.annotation.XmlAccessorType;
    import javax.xml.bind.annotation.XmlElement;
    import javax.xml.bind.annotation.XmlIDREF;
    import javax.xml.bind.annotation.XmlSeeAlso;
    import javax.xml.bind.annotation.XmlTransient;
    import javax.xml.bind.annotation.XmlType;
    
    @Entity
    @Inheritance(strategy = InheritanceType.JOINED)
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlSeeAlso(value={SdhPort.class, EthernetPort.class})
    @XmlType(name="Port")
    public abstract class Port implements Serializable {
    
        @Id
        @GeneratedValue(strategy = GenerationType.AUTO)
    	@XmlElement(name = "id")
        private String id;
        
        @Column(name = "LABEL", length = 125)
        @XmlElement(name = "label")
        private String label;
        
        @ManyToOne
        @XmlIDREF
        private Card card;
        
        @Column(name = "DESCRIPTION", length = 125)
        @XmlElement(name = "description")
        private String description;
        
        @Version
        @XmlTransient
        private int version;
    
        public Port() {
        }
    
        public Port(String label) {
            this.label = label;
        }
    
        public String getId() {
            return id;
        }
    
        public void setId(String id) {
            this.id = id;
        }
    
        public Card getCard() {
            return card;
        }
    
        public void setCard(Card card) {
            this.card = card;
        }
    
        public String getLabel() {
            return label;
        }
    
        public void setLabel(String label) {
            this.label = label;
        }
    
        public int getVersion() {
            return version;
        }
    
        public void setVersion(int version) {
            this.version = version;
        }
    
        public String getDescription() {
            return description;
        }
    
        public void setDescription(String description) {
            this.description = description;
        }
    
        @Override
        public String toString() {
            return "Port{" + "id=" + id + ", label=" + label + '}';
        }
    
    }
    

    public by cghersi @ MailUp API DEV  1002  4  7  0

    Data Contract as input parameter for Create/Update List

    This bean collects all the parameters that should be passed to the methods regarding the management of Lists. There are two distinguished beans for the creation and for the update so that the "required" attributes can be set properly for the two different cases. The attribute 'scope' is designed as String, and will be managed in the backend code
    namespace MailUpSOA.Ws.Contract.API.DataContracts.Console
    {
        [DataContract(Name = "ConsoleListCreateDetails", Namespace = "http://MailupSoa.Ws.Schema.API.Console")]
        public class ConsoleListCreateDetails : ConsoleListDetails
        {
            [DataMember(IsRequired = true)]
            public String Name { get; set; }
    
            [DataMember(IsRequired = true)]
            public Int32 idSettings { get; set; }
    
            [DataMember(IsRequired = true)]
            public Boolean useDefaultSettings { get; set; }
    
            [DataMember(IsRequired = true)]
            public Boolean copyTemplate { get; set; }
    
            [DataMember(IsRequired = true)]
            public String scope { get; set; }
    
            [DataMember(IsRequired = true)]
            public Boolean business { get; set; }
    
            [DataMember(IsRequired = true)]
            public Boolean Customer { get; set; }
    
            [DataMember(IsRequired = true)]
            public Boolean copyWebhooks { get; set; }
        }
        
        [DataContract(Name = "ConsoleListUpdateDetails", Namespace = "http://MailupSoa.Ws.Schema.API.Console")]
        public class ConsoleListUpdateDetails : ConsoleListDetails
        {
            [DataMember(IsRequired = true)]
            public Int32 IdList { get; set; }
    
            [DataMember(IsRequired = false)]
            public String Name { get; set; }
    
            [DataMember(IsRequired = false)]
            public String scope { get; set; }
    
            [DataMember(IsRequired = false)]
            public Boolean? business { get; set; }
    
            [DataMember(IsRequired = false)]
            public Boolean? Customer { get; set; }
        }
        
        [DataContract(Name = "ConsoleListDetails", Namespace = "http://MailupSoa.Ws.Schema.API.Console")]
        public class ConsoleListDetails : BaseDataContract
        {
            #region OPTIONS
    
            [DataMember(IsRequired = false)]
            public String format { get; set; }
    
            [DataMember(IsRequired = false)]
            public String owneremail { get; set; }
    
            [DataMember(IsRequired = false)]
            public String bouncedemail { get; set; }
    
            [DataMember(IsRequired = false)]
            public String description { get; set; }
    
            [DataMember(IsRequired = false)]
            public String charset { get; set; }
    
            [DataMember(IsRequired = false)]
            public Boolean? @public { get; set; }
    
            [DataMember(IsRequired = false)]
            public Boolean? tracking { get; set; }
    
            [DataMember(IsRequired = false)]
            public String nl_sendername { get; set; }
    
            [DataMember(IsRequired = false)]
            public String sms_sendername { get; set; }
    
            [DataMember(IsRequired = false)]
            public Int32? optout_type { get; set; }
    
            [DataMember(IsRequired = false)]
            public Boolean? sendemailoptout { get; set; }
    
            [DataMember(IsRequired = false)]
            public String notifyemail { get; set; }
    
            [DataMember(IsRequired = false)]
            public Boolean? frontendform { get; set; }
    
            [DataMember(IsRequired = false)]
            public String disclaimer { get; set; }
    
            [DataMember(IsRequired = false)]
            public String headerxabuse { get; set; }
    
            [DataMember(IsRequired = false)]
            public Int32? kbmax { get; set; }
    
            [DataMember(IsRequired = false)]
            public String replyto { get; set; }
    
            [DataMember(IsRequired = false)]
            public String displayas { get; set; }
    
            [DataMember(IsRequired = false)]
            public String headerlistunsubscriber { get; set; }
    
            [DataMember(IsRequired = false)]
            public Boolean? multipart_text { get; set; }
    
            [DataMember(IsRequired = false)]
            public String conversionlab_trackcode { get; set; }
    
            [DataMember(IsRequired = false)]
            public String default_prefix { get; set; }
    
            [DataMember(IsRequired = false)]
            public String multi_optout_list { get; set; }
    
            [DataMember(IsRequired = false)]
            public Boolean? subscribedemail { get; set; }
    
            [DataMember(IsRequired = false)]
            public Boolean? sendconfirmsms { get; set; }
    
            [DataMember(IsRequired = false)]
            public String senderfaxname { get; set; }
    
            [DataMember(IsRequired = false)]
            public String senderfax { get; set; }
    
            #endregion
        }
        
        /// <summary>
        /// Provides an enumeration of the possible scopes of a list
        /// </summary>
        public enum ListScopeEnum
        {
            /// <summary>
            /// List to be used to send newsletters
            /// </summary>
            newsletters,
            /// <summary>
            /// List to be used to send direct messages
            /// </summary>
            Direct_Advertising,
            /// <summary>
            /// List to be used to send transactional emails
            /// </summary>
            Transactional
        }
    }
    • Public Snippets
    • Channels Snippets