All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.odysz.semantic.meta.SynChangeMeta Maven / Gradle / Ivy

There is a newer version: 1.5.3
Show newest version
package io.odysz.semantic.meta;

import io.odysz.common.Utils;
import io.odysz.semantics.meta.Semantation;
import io.odysz.transact.sql.parts.AbsPart;
import io.odysz.transact.sql.parts.Resulving;
import io.odysz.transact.sql.parts.condition.Funcall;

/**
 *syn_change DDL
 *
 * @author [email protected]
 */
public class SynChangeMeta extends SemanticTableMeta {
	/** Separator in uids, ",", for separating fields of pk */
	@Semantation (noDBExists = true)
	public final static String UIDsep = ",";

	public final String domain;
	public final String entbl;

	/**
	 * Entity fk, redundant for convenient, not for synchronizing
	 * 
	 * @deprected no such field since branch "try-mandatory-uid"
	 */
	@Semantation (noDBExists = true)
	public final String entfk;

	/** Format: device + {@link #UIDsep} + entity-id */
	public final String uids;
	public final String crud;
	public final String synoder;
	public final String nyquence;
	public final String seq;

	/** updated fields when updating an entity */
	public final String updcols;

	public SynChangeMeta(String ... conn) {
		super("syn_change", conn);

		ddlSqlite = Utils.loadTxt(SynChangeMeta.class, "syn_change.sqlite.ddl");

		pk       = "cid";
		domain   = "domain";
		entbl    = "tabl";
		crud     = "crud";
		synoder  = "synoder";
		uids     = "uids";
		nyquence = "nyquence";
		seq      = "seq";
		updcols  = "updcols";

		entfk    = "entfk";
	}

	public String[] insertCols() {
		return new String[] {pk, entbl, crud, synoder, uids, nyquence, updcols};
	}

	/**
	 * Compose function for uids
	 * @param synoder
	 * @param entityId
	 * @return "synoder + UIDsep + entityId"
	 */
	public static String uids(String synoder, String entityId) {
		return synoder + UIDsep + entityId; // Funcall.concatstr(synode, UIDsep, entityId);
	}

	public static AbsPart uids(String synode, Resulving eid) {
		return Funcall.concatstr(synode, UIDsep, eid);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy