Enum DASemantics.smtype

java.lang.Object
java.lang.Enum<DASemantics.smtype>
io.odysz.semantic.DASemantics.smtype
All Implemented Interfaces:
Serializable, Comparable<DASemantics.smtype>, java.lang.constant.Constable
Enclosing class:
DASemantics

public static enum DASemantics.smtype extends Enum<DASemantics.smtype>
Semantics type supported by DASemantics. For each semantics example, see semantic.DA/test/semantics.xml
For semanticx.xml/s/smtc value, check the individual enum values:
0. autoInc
1. fkIns
2. fkCateIns
3. fullpath
4. defltVal
5. parentChildrenOnDel
6. parentChildrenOnDelByCate
7. dencrypt
8. opTime
9. checkSqlCountOnDel
10.checkSqlCountOnInsert
11.postFk
12.extFile
13.extFilev2
14.synChange
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Auto Key
    xml/smtc = "auto" | "pk" | "a-k" | "autopk"
    Generate auto increased value for the field when inserting.
    on-events: insert
    "ck-cnt-del" | "check-count-del" | "checksqlcountondel":
    check is this record a referee of children records - results from sql.select(count, description-args ...).
    "ck-cnt-ins" | "check-count-ins" | "checksqlcountoninsert":
    Check is this record count when inserting - results from sql.select(count-sql, description-args ...).
    xml/smtc = "dv" | "d-v" | "dfltVal":
    Handler: DASemantics.ShDefltVal
    "d-e" | "de-encrypt" | "dencrypt":
    decrypt then encrypt (target col cannot be pk or anything other semantics will updated
    Handler: DASemantics.ShDencrypt
    Deprecated.
    to be implemented: new semantics handler: de-encrypt field on reading (in case client requiring read plain password etc.
    Deprecated.
    this is the same with extFilev2
    xml/smtc = "ef2.0" | "xf2.0" | "ext-file2.0" | "e-f2.0" | "x-f2.0"
    xml/smtc = "fkc" | "f-i-c" | "fk-ins-cate"
    xml/smtc = "fk" | "pkref" | "fk-ins"
    xml/smtc = "f-p" | "fp" | "fullpath":
    xml/smtc = "o-t" | "oper-time" | "optime"
    Finger printing session user's db updating - record operator / oper-time
    Handler: DASemantics.ShOperTime
    "pc-del-all" | "parent-child-del-all" | "parentchildondel"
    "pc-del-tbl" | "pc-del-by-tbl" | "pc-tbl"
    "p-f" | "p-fk" | "post-fk"
    xml/smtc = "syn-change" | "s-c"
    Logging table changes for DB synchronizing.
  • Method Summary

    Modifier and Type
    Method
    Description
    parse(String type)
    Convert string key to DASemantics.smtype.
    Returns the enum constant of this type with the specified name.
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • autoInc

      public static final DASemantics.smtype autoInc
      Auto Key
      xml/smtc = "auto" | "pk" | "a-k" | "autopk"
      Generate auto increased value for the field when inserting.
      on-events: insert

      args: [0]: pk-field; [1]: optional, pk-prefix (since 1.4.35)

      Handler: DASemantics.ShAutoKPrefix
      Since:
      1.4.35, add pk-prefix, args[1], can be a field name or string consts., 1.4.45, will automatically insert sequence number to oz_autoseq.
    • fkIns

      public static final DASemantics.smtype fkIns
      xml/smtc = "fk" | "pkref" | "fk-ins"

      Automatically fill fk when inserting. Only referenced auto pk can be resolved.

      args: 0 referencing col, 1 parent table, 2 parent pk

      Handler: DASemantics.ShFkOnIns
    • fkCateIns

      public static final DASemantics.smtype fkCateIns
      xml/smtc = "fkc" | "f-i-c" | "fk-ins-cate"

      Automatically fill merged child fk when inserting. Only referenced auto pk can be resolved.

      About Merged Child Table:
      Take the attachements table for external file's information for example, the a_attaShExtFileches(See sqlite test DB) has a field, named 'busiId', referencing multiple parent table. The parent table is distinguished with filed busiTbl.

      args: 0 business cate (table name); 1 merged child fk; 2 parent table, 3 parent referee [, ...]

      Handler: DASemantics.ShFkInsCates
    • fullpath

      public static final DASemantics.smtype fullpath
      xml/smtc = "f-p" | "fp" | "fullpath":

      args: 0: parent Id field, 1: sibling/sort field (optional), 2: fullpath field, 3: sort size (optional, default 2)
      where sort size is the digital length for formatting fullpath string.

      Handler: DASemantics.ShFullpath
    • defltVal

      public static final DASemantics.smtype defltVal
      xml/smtc = "dv" | "d-v" | "dfltVal":
      Handler: DASemantics.ShDefltVal
    • parentChildrenOnDel

      public static final DASemantics.smtype parentChildrenOnDel
      "pc-del-all" | "parent-child-del-all" | "parentchildondel"
      args: [pc-define, ...], where pc-define is a space sperated strings:
                      pc-define[0] name or child referencing column, e.g. domainId for a_domain.domainId
                      pc-define[1] child table, e.g. a_orgs
                      pc-define[2] child fk (or condition columnr), e.g. orgType
                      
                      Example: domainId a_orgs orgType, ...
                      
                      When deleting a_domain, the sql of the results shall be:
                      delete from a_orgs where orgType in (select domainId from a_domain where domainId = '000001')
                      where the 'where clause' in select clause is composed from condition of the delete request's where condition.
       
      Handler: DASemantics.ShPCDelAll
    • parentChildrenOnDelByCate

      public static final DASemantics.smtype parentChildrenOnDelByCate
      "pc-del-tbl" | "pc-del-by-tbl" | "pc-tbl"
      args: [pc-define, ...], where pc-define is a space sperated strings:
                      pc-define[0] name or child referencing column (a_domain.domainId's value will be used)
                      pc-define[1] child table
                      pc-define[2] child fk (or condition column)
                      pc-define[3] child cate (e.g. table name)
                      
                      Example: domainId a_orgs orgType, ...
                      
                      The sql of the results shall be:
                      delete from a_orgs where orgType in (select domainId from a_domain where domainId = '000001')
                      where the 'where clause' in select clause is composed from condition of the delete request's where condition.
       
      Handler: DASemantics.ShPCDelByCate
    • dencrypt

      public static final DASemantics.smtype dencrypt
      "d-e" | "de-encrypt" | "dencrypt":
      decrypt then encrypt (target col cannot be pk or anything other semantics will updated
      Handler: DASemantics.ShDencrypt
    • dencryptOnRead

      public static final DASemantics.smtype dencryptOnRead
      Deprecated.
      to be implemented: new semantics handler: de-encrypt field on reading (in case client requiring read plain password etc. by accident.
      "d-e.r" | "de-encrypt.r" | "dencrypt.r":
    • opTime

      public static final DASemantics.smtype opTime
      xml/smtc = "o-t" | "oper-time" | "optime"
      Finger printing session user's db updating - record operator / oper-time
      Handler: DASemantics.ShOperTime
    • checkSqlCountOnDel

      public static final DASemantics.smtype checkSqlCountOnDel
      "ck-cnt-del" | "check-count-del" | "checksqlcountondel":
      check is this record a referee of children records - results from sql.select(count, description-args ...). The record(s) can't been deleted if referenced;
        [0] name or child referencing column (a_domain.domainId's value will be used)
                      [1] child table
                      [2] child pk (or condition column)
                      
                      Example: domainId a_orgs orgType, ...
                      
                      The sql of the results shall be:
                      select count(orgType) from a_orgs where orgType in (select domainId from a_domain where domainId = '000001')
                      where the 'where clause' in select clause is composed from condition of the delete request's where condition.
       
      where args are column name of parent table.

      Handler: DASemantics.ShChkCntDel
    • checkSqlCountOnInsert

      public static final DASemantics.smtype checkSqlCountOnInsert
      "ck-cnt-ins" | "check-count-ins" | "checksqlcountoninsert":
      Check is this record count when inserting - results from sql.select(count-sql, description-args ...). The record(s) can't been inserted if count > 0;

      args: [0] arg1, [1] arg2, ..., [len -1] count-sql with "%s" formatter
      where args are column name of parent table.

      Handler: DASemantics.ShChkCntDel
    • postFk

      public static final DASemantics.smtype postFk
      "p-f" | "p-fk" | "post-fk"

      semantics:
      post fk wire back - parent has an fk to child (only one child makes sense, like making cross refs)

      Note:
      This semantics works only when previously resolved auto key exists; if the value doesn't exist, will be ignored.
      The former is the case of inserting new child, and parent refer to it;
      the later is the case of updating a child, the parent already has it's pk, nothing should be done.

      r Further Discussion:
      As cross reference is not a good ideal, this semantics sometimes leads to trouble. Any suggestion or comments are welcome.

      args: 0 referencing col, 1 target table, 2 target pk(must be an auto key)

      Handler: DASemantics.ShPostFk
    • extFile

      public static final DASemantics.smtype extFile
      Deprecated.
      this is the same with extFilev2
      xml/smtc = "ef" | "xf" | "ext-file" | "e-f" | "x-f"
    • extFilev2

      public static final DASemantics.smtype extFilev2
      xml/smtc = "ef2.0" | "xf2.0" | "ext-file2.0" | "e-f2.0" | "x-f2.0"

      Save and load a special field as file of file system. Can handle more subfolder (configered in xml as field name of data table).

      The file content should be a Base 64 encoded block.

      This semantics only used for handling small files. If the file is large, there are an example in Semantic.jserv which uses a block sequence for uploading files.

      Tips

      • Multiple nodes writing into the same file path can causing the file locking exception.

      args:
      0: rec-id
      1: uri, the Base64 content
      2: subfolder
      3: ...
      -1: file name

      args
      0: uploads,
      1: uri - uri field,
      2: sub-folder level 0,
      3: sub-folder level 1,
      ... ,
      -1: client-name for saving readable file name

      At least one level of subfolder is recommended.
      Since:
      1.4.25
    • synChange

      public static final DASemantics.smtype synChange
      xml/smtc = "syn-change" | "s-c"
      Logging table changes for DB synchronizing.

      args
      0: full qualified name of table meta
      1: global identity fields, separated with space, e.g. "synoder clientpath"
      2: [deprecated] fields to be cleared (optional with empty value), separated with space

      Example: <args>io.odysz.semantic.meta.SynodeMeta,crud,org synid,remarks</args>
  • Method Details

    • values

      public static DASemantics.smtype[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static DASemantics.smtype valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • parse

      public static DASemantics.smtype parse(String type) throws SemanticException
      Convert string key to DASemantics.smtype. Note: we don't use enum.valueOf(), because of fault / fuzzy tolerate.
      Parameters:
      type -
      Returns:
      DASemantics.smtype
      Throws:
      SemanticException