def getDict(what) :
  if what == "countries" : return Holder.getListOfCountries().getList()
  if what == "titles" : return Holder.getListOfTitles().getList()
  if what == "idtypes" : return Holder.getListOfIdTypes().getList()
  if what == "payments" : return Holder.getListOfPayment().getList()
  if what == "roles" : return Holder.IGetListOfDefaultRoles().getList()
  if what == "vat" : return Holder.IGetListOfVat().getList()
 def __init__(self, var, list=None) :
   iServer = Holder.getiServer()
   r = Holder.getRequest() 
   self.__d = iServer.findDialog(r, var["J_DIALOGNAME"])
   self.iN = Holder.getResolveName()
   if list == None : return
   self.fList = self.__d.getDialog().findList(list)
   assert self.fList != None, "Cannot find list " + list + " in the dialog " + var["J_DIALOGNAME"] 
def _toMapF(xmls,lid,lil):
  x = Holder.getMapXML();
  iR = x.getMap(xmls)  
  rmap = _toMap(iR.getMap(),lid)
  li = []
  for m in iR.getList() :
      li.append(_toMap(m,lil))
  return (rmap,li)
def fileToS(dir,filename=None):
   if filename == None : 
       filename = dir 
       dir = None
#   iS = Holder.getIJython().getResource().getRes(filename)
   iS = Holder.getFindResource().getFirstURL(dir, filename)
   s = BUtil.readFromFileInput(iS.openStream())
   return s
def createPDF1(var) :
#    s = Util.getResourceAsDirectory("docs")
#    print s
#    fis = FileReader( s + "/Sample.html")
    iS = Holder.getIJython().getResource().getRes("docs/Sample.html")
 #   s = Util.readFromFileInput(iS.openStream())

    map = {}
    map[pdfutil.AUTHOR] = "betterThanZero"
    map[pdfutil.CREATOR] = ""
    map[pdfutil.TITLE] = "Demo for iText XMLWorker"
    return pdfutil.createPDF(iS.openStream(),map)
 def __init__(self, fa, realM, seqGen, map, listid, id):
     self.__fa = fa
     if fa == None :
         self.__fa = Holder.getRegFactory()
     self.__realM = realM
     self.__seqGen = seqGen
     if seqGen == None :
         self.__seqGen = SHolder.getSequenceRealmGen()
     self.__key = "GEN_KEY";
     self.__map = map
     self.__listid = listid
     self.__id = id
def getMapFieldList(dialogName,list=None):
  """ Extract list of fields (columns) name from dialog
  
    Args:
        dialogName : dialog
        list : if None list of fields from dialog
               if not None list of columns from list 
  """    
  i = Holder.getiServer()
  dInfo =  i.findDialog(Holder.getRequest(), dialogName)
  assert dInfo != None
  dFormat = dInfo.getDialog()
  if list == None :
      flist = dFormat.getFieldList()
  else :
    lform = dFormat.findList(list)
    assert lform != None
    flist = lform.getColumns()  
          
  l = []
  for f in flist :
      name = f.getId()
      l.append(name)
  return l    
def verifyXML(xsdfile, xml):
    """ Verify xml file with xsd schema.
        Important: it is expected that schema match xml, used only for internal checking
    Args:
        xsdfile : the name of xsd (schme) file, file is read from dialog/xsd directory
        xml : xml string (important: string, not file name)
    
    Returns:
        returns if schema match the xml, if not breaks program
        
    Raise :
        run time exception if not match, not match is not expected
         
      
    """
    i = Holder.getXMLVerifies()
    ok = i.verify("xsd", xsdfile, xml)
    assert ok
def verifyXML(xsdfile, xml):
    """ Verify xml file with xsd schema.
        Important: it is expected that schema match xml, used only for internal checking
    Args:
        xsdfile : the name of xsd (schme) file, file is read from dialog/xsd directory
        xml : xml string (important: string, not file name)
    
    Returns:
        returns if schema match the xml, if not breaks program
        
    Raise :
        run time exception if not match, not match is not expected
         
      
    """
    i = Holder.getXMLVerifies()
    ok = i.verify("xsd", xsdfile, xml)
    assert ok
def getVar(map,dialogname,xml,listv):
    """ Set map with values read from xml string for dialog form.
    
    Retrieves values from XML string and set values to the map (key->value). 
    Retrieves values only for list of keys (not for all found in XML string)
    
    Args:
       map : A map being set. Can be empty or contains some values already. In case of
          conflict new value will overwrite existing value.
       dialogname : Dialog name where form is available.
       xml : XML string to be analyzed.
       listv : List of keys to be set to the map. Only keys found in the list are set. 
           Others are ignored.    
    """
    iXml = Holder.getXMLTransformer();
    v = DialogVariables();
    iXml.fromXML(dialogname,v,xml);
    for vname in listv :
        val = v.getValue(vname)
        if val == None or val.getValue() == None: 
            map[vname] = None
            continue
        if val.getType() == TT.STRING :
            map[vname] = val.getValueS()
            continue
        if val.getType() == TT.BIGDECIMAL :
            b = val.getValueBD()
            map[vname] = con.BigDecimalToDecimal(b)
            continue
        if val.getType() == TT.BOOLEAN :
            b = val.getValueB()
            map[vname] = b
            continue
        if val.getType() == TT.INT or val.getType() == TT.LONG :
            map[vname] = val.getValue()
            continue
        if val.getType() == TT.DATE :
            map[vname] = con.toJDate(val.getValue())
            continue
        if val.getType() == TT.DATETIME :
            map[vname] = con.toJDateTime(val.getValue())
            continue         
def getVar(map,dialogname,xml,listv):
    """ Set map with values read from xml string for dialog form.
    
    Retrieves values from XML string and set values to the map (key->value). 
    Retrieves values only for list of keys (not for all found in XML string)
    
    Args:
       map : A map being set. Can be empty or contains some values already. In case of
          conflict new value will overwrite existing value.
       dialogname : Dialog name where form is available.
       xml : XML string to be analyzed.
       listv : List of keys to be set to the map. Only keys found in the list are set. 
           Others are ignored.    
    """
    iXml = Holder.getXMLTransformer();
    v = DialogVariables();
    iXml.fromXML(dialogname,v,xml);
    for vname in listv :
        val = v.getValue(vname)
        if val == None or val.getValue() == None: 
            map[vname] = None
            continue
        if val.getType() == TT.STRING :
            map[vname] = val.getValueS()
            continue
        if val.getType() == TT.BIGDECIMAL :
            b = val.getValueBD()
            map[vname] = con.BigDecimalToDecimal(b)
            continue
        if val.getType() == TT.BOOLEAN :
            b = val.getValueB()
            map[vname] = b
            continue
        if val.getType() == TT.INT :
            map[vname] = val.getValue()
            continue
        if val.getType() == TT.DATE :
            map[vname] = con.toJDate(val.getValue())
            continue
        if val.getType() == TT.DATETIME :
            map[vname] = con.toJDateTime(val.getValue())
            continue         
Exemple #12
0
def getMailList(fromm=-1, to=0):
    """ get list of mail from input box
    Args:
      fromm : the number of first mail to retrieve (counting from end)
      to : the number of last mail to retrieve (-1 : all mails)
    Returns:
      List of mails
      Element in the list:
        getHeader()
        getContent()
        getFrom()
        isText()
        isIsSeen()
        getSentDate()
        getPerson()  
    """
    iG = Holder.getGetMail()
    res = iG.getMail(fromm, to)
    assert res.getErrMess() == None
    return res.getList()
def getMailList(fromm = -1,to = 0):
    """ get list of mail from input box
    Args:
      fromm : the number of first mail to retrieve (counting from end)
      to : the number of last mail to retrieve (-1 : all mails)
    Returns:
      List of mails
      Element in the list:
        getHeader()
        getContent()
        getFrom()
        isText()
        isIsSeen()
        getSentDate()
        getPerson()  
    """
    iG = Holder.getGetMail()
    res = iG.getMail(fromm,to)
    assert res.getErrMess() == None
    return res.getList()
def urlParList(var):
    R = Holder.getRequest().getUrlParam()
    res = []
    for k in R:
        res.append(k)
    return res
 def __init__(self, fa, realm):
     if fa == None: fa = Holder.getRegFactory()
     self.r = fa.construct(realm, True, True)
def getDictFromFile(dire, dictname):
    i = Holder.getReadDict()
    seq = i.getDict(dire, dictname)
    return seq
Exemple #17
0
 def __init__(self,app) :
   self.adminI = Holder.getAdmin()
   self.app = app
 def __getR(self,var) :
   return cutil.StorageRegistry(Holder.getRegFactory(),"TEMPORARY-DATA-" + var["SECURITY_TOKEN"])
 def __getR(self,var) :
   return cutil.StorageRegistry(Holder.getRegFactory(),"TEMPORARY-DATA-" + var["SECURITY_TOKEN"])
 def __init__(self, var):
     CRUDLIST.__init__(self, var)
     self.serviceS = Holder.getiJournal()
 def __init__(self, fa, realm):
     if fa == None : fa = Holder.getRegFactory()
     self.r = fa.construct(realm, True, True)
Exemple #22
0
def getMailNo():
    iG = Holder.getGetMail()
    res = iG.getMail(-1, -1)
    assert res.getErrMess() == None
    return res.getNo()
Exemple #23
0
 def __init__(self, var):
     cutil.CRUDLIST.__init__(self, var)
     self.i = Holder.getSaveMail()
     self.serviceS = Holder.getNoteStorage()
 def __init__(self):
     self.M = Holder.getAppMess()
Exemple #25
0
def sendMail(subject, content, to, froma, attachList=None, text=True):
    iM = Holder.getMail()
    res = iM.postMail(text, [
        to,
    ], subject, content, froma, attachList)
    return res
def getDialogFormat(dialname):
    i = Holder.getiServer()
    dInfo =  i.findDialog(Holder.getRequest(), dialname)
    assert dInfo != None
    return dInfo.getDialog()
Exemple #27
0
 def __init__(self, var):
     self.var = var
     self.p = Holder.getMailFrom()
def getPerson(var):
    token = var["SECURITY_TOKEN"]
    #    return Holder.getNameFromToken().getInstance(token).getPerson()
    return Holder.getiSec().getUserName(token)
def _getTransformer(xslt):
    return Holder.getTransformer().getTranformer(xslt)
def getObject(var=None):
    return Holder.getO()
Exemple #31
0
 def __init__(self):
     self.i = Holder.getInstanceCache()
 def __init__(self, var, recordid=None):
     self.serviceS = None
     self.var = var
     self.recordid = recordid
     if recordid : self.jserviceS = Holder.getiJournal()        
 def __init__(self, var):
     CRUDLIST.__init__(self, var)
     self.serviceS = Holder.getiJournal()
Exemple #34
0
 def __init__(self,app) :
   ObjectAdmin.__init__(self,app)  
   self.adminI = Holder.getAdminPerson()
Exemple #35
0
 def __init__(self):
     self.i = Holder.getInstanceCache()
def sendMail(subject,content,to,froma,attachList=None,text=True) :
    iM = Holder.getMail()
    res = iM.postMail(text,[to,],subject,content,froma,attachList)
    return res
 def __init__(self,var) :
     cutil.CRUDLIST.__init__(self,var)
     self.i = Holder.getSaveMail()
     self.serviceS = Holder.getNoteStorage()
 def __init__(self):
     self.M = Holder.getAppMess()
def urlParList(var) :
  R = Holder.getRequest().getUrlParam()
  res = []
  for k in R : res.append(k)
  return res
 def __init__(self,var):
     self.var = var
     self.p = Holder.getMailFrom()
def urlPar(var, k) :
  R = Holder.getRequest().getUrlParam()
  return R.get(k)
 def __init__(self):
     self.h = Holder.getDefaultData()
def getPerson(var):
    token = var["SECURITY_TOKEN"]
#    return Holder.getNameFromToken().getInstance(token).getPerson()
    return Holder.getiSec().getUserName(token)
def urlPar(var, k):
    R = Holder.getRequest().getUrlParam()
    return R.get(k)
def getAppId(var):
    token = var["SECURITY_TOKEN"]
    return Holder.getNameFromToken().getInstance(token)
def getAppId(var):
    token = var["SECURITY_TOKEN"]
    return Holder.getNameFromToken().getInstance(token)
def getObject(var=None):
    return Holder.getO()
 def __init__(self, var, recordid=None):
     self.serviceS = None
     self.var = var
     self.recordid = recordid
     if recordid: self.jserviceS = Holder.getiJournal()
Exemple #49
0
def __getConnection():
    return Holder.getJDBCConnection().getConnection()
Exemple #50
0
 def __init__(self, app):
     self.adminI = Holder.getAdmin()
     self.app = app
def getDictFromFile(dire, dictname) :
  i = Holder.getReadDict()
  seq = i.getDict(dire, dictname)
  return seq
Exemple #52
0
 def __init__(self, app):
     ObjectAdmin.__init__(self, app)
     self.adminI = Holder.getAdminPerson()
 def __init__(self) :
   self.h = Holder.getDefaultData()