first commit

This commit is contained in:
MaddoScientisto 2026-03-14 20:04:39 +01:00
commit 4d332ef662
27586 changed files with 3281783 additions and 0 deletions

View file

@ -0,0 +1,80 @@
package com.ablia.bookmark;
import com.ablia.util.AbMessages;
import com.ablia.util.Vectumerator;
import java.io.Serializable;
import java.util.Hashtable;
public class Bookmark implements Serializable {
private static final long serialVersionUID = 1L;
private Hashtable items = null;
private int numberOfItems = 0;
private String msg;
public Bookmark() {
this.items = new Hashtable();
}
public String addBookmarkItem(BookmarkItem theBI) {
if (!this.items.containsKey(theBI.getBookmarkItemId())) {
this.items.put(theBI.getBookmarkItemId(), theBI);
this.numberOfItems++;
setMsg(AbMessages.getMessage("BM_ITEM_ADDED"));
return AbMessages.getMessage("BM_ITEM_ADDED");
}
setMsg(AbMessages.getMessage("BM_ITEM_PRESENT"));
return AbMessages.getMessage("BM_ITEM_PRESENT");
}
public void clear() {
this.items.clear();
this.numberOfItems = 0;
}
protected void finalize() throws Throwable {
this.items.clear();
}
public Vectumerator getItems() {
return new Vectumerator(this.items.elements());
}
public String getMsg() {
if (this.msg == null)
return "";
String temp = this.msg;
setMsg(null);
return temp;
}
public int getNumberOfItems() {
return this.numberOfItems;
}
public String removeBookmarkItem(BookmarkItem theBI) {
if (this.items.containsKey(theBI.getBookmarkItemId())) {
this.items.remove(theBI.getBookmarkItemId());
this.numberOfItems--;
setMsg(AbMessages.getMessage("BM_ITEM_DELETED"));
return AbMessages.getMessage("BM_ITEM_DELETED");
}
setMsg(AbMessages.getMessage("BM_ITEM_NOT_PRESENT"));
return AbMessages.getMessage("BM_ITEM_NOT_PRESENT");
}
public String removeBookmarkItem(Long bookmarkItemId) {
if (this.items.containsKey(bookmarkItemId)) {
this.items.remove(bookmarkItemId);
this.numberOfItems--;
return AbMessages.getMessage("BM_ITEM_DELETED");
}
return AbMessages.getMessage("BM_ITEM_NOT_PRESENT");
}
private void setMsg(String newMsg) {
this.msg = newMsg;
}
}

View file

@ -0,0 +1,136 @@
package com.ablia.bookmark;
import com.ablia.db.ApplParmFull;
import com.ablia.db.DBAdapter;
import java.io.Serializable;
public class BookmarkItem implements Serializable {
private static final long serialVersionUID = 1L;
private Object itemId;
private Class itemClass;
private ApplParmFull applParmFull;
private DBAdapter dbItem;
private String flgTipoBookmarkItem;
public static final String TIPO_RISORSA = "R";
public static final String TIPO_LINK = "L";
private String link;
private String itemDescription;
public BookmarkItem(Object anItemPrimaryKey, Class theItemClass, String theItemDescription, ApplParmFull theApplParmFull) {
setItemClass(theItemClass);
setApplParmFull(theApplParmFull);
setFflgTipoBookmarkItem("R");
setItemDescription(theItemDescription);
setItemId(anItemPrimaryKey);
}
public BookmarkItem(String link) {
setLink(link);
setFflgTipoBookmarkItem("L");
}
public ApplParmFull getApplParmFull() {
return this.applParmFull;
}
public Long getBookmarkItemId() {
if (getFlgTipoBookmarkItem().equals("L"))
return new Long((long)(String.valueOf(getFlgTipoBookmarkItem()) + getLink()).hashCode());
return new Long(
(long)(String.valueOf(getFlgTipoBookmarkItem()) + String.valueOf(getItemId()) + getItemClass().toString()).hashCode());
}
public DBAdapter getDbItem() {
if (this.dbItem == null && this.itemId != null)
try {
this.dbItem =
getItemClass().newInstance();
this.dbItem.setApFull(getApplParmFull());
this.dbItem.findByPrimaryKey(getItemId());
} catch (Exception e) {
e.printStackTrace();
}
return this.dbItem;
}
private Class getItemClass() {
return this.itemClass;
}
public String getItemDescription() {
return (this.itemDescription == null) ? "" : this.itemDescription;
}
public Object getItemId() {
return new Long((String)this.itemId);
}
public String getLink() {
return this.link;
}
private void setApplParmFull(ApplParmFull newApplParmFull) {
this.applParmFull = newApplParmFull;
}
private void setDbItem(DBAdapter newDbItem) {
this.dbItem = newDbItem;
}
private void setFflgTipoBookmarkItem(String newFflgTipoBookmarkItem) {
this.flgTipoBookmarkItem = newFflgTipoBookmarkItem;
}
private void setItemClass(Class newItemClass) {
this.itemClass = newItemClass;
}
private void setItemDescription(String newItemDescription) {
this.itemDescription = newItemDescription;
}
public void setItemId(Object newItemId) {
this.itemId = newItemId;
setDbItem(null);
}
private void setLink(String newLink) {
this.link = newLink;
}
public String getDescrizione() {
if (getFlgTipoBookmarkItem().equals("L"))
return getLink();
if (getFlgTipoBookmarkItem().equals("R"))
return getItemDescription();
return "???";
}
public String getFlgTipoBookmarkItem() {
return this.flgTipoBookmarkItem;
}
public String getTipoBookmarkItem() {
if (getFlgTipoBookmarkItem().equals("L"))
return "Link";
if (getFlgTipoBookmarkItem().equals("R"))
return "Risorsa";
return "???";
}
public String getItemClassType() {
return this.itemClass.toString().substring(6);
}
}