Exemplo n.º 1
0
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()
Exemplo n.º 2
0
 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"] 
Exemplo n.º 3
0
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)
Exemplo n.º 4
0
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
Exemplo n.º 5
0
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)
Exemplo n.º 6
0
 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
Exemplo n.º 7
0
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    
Exemplo n.º 8
0
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
Exemplo n.º 9
0
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
Exemplo n.º 10
0
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         
Exemplo n.º 11
0
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         
Exemplo n.º 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()
Exemplo n.º 13
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()
Exemplo n.º 14
0
def urlParList(var):
    R = Holder.getRequest().getUrlParam()
    res = []
    for k in R:
        res.append(k)
    return res
Exemplo n.º 15
0
 def __init__(self, fa, realm):
     if fa == None: fa = Holder.getRegFactory()
     self.r = fa.construct(realm, True, True)
Exemplo n.º 16
0
def getDictFromFile(dire, dictname):
    i = Holder.getReadDict()
    seq = i.getDict(dire, dictname)
    return seq
Exemplo n.º 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"])
Exemplo n.º 19
0
 def __getR(self,var) :
   return cutil.StorageRegistry(Holder.getRegFactory(),"TEMPORARY-DATA-" + var["SECURITY_TOKEN"])
Exemplo n.º 20
0
 def __init__(self, var):
     CRUDLIST.__init__(self, var)
     self.serviceS = Holder.getiJournal()
Exemplo n.º 21
0
 def __init__(self, fa, realm):
     if fa == None : fa = Holder.getRegFactory()
     self.r = fa.construct(realm, True, True)
Exemplo n.º 22
0
def getMailNo():
    iG = Holder.getGetMail()
    res = iG.getMail(-1, -1)
    assert res.getErrMess() == None
    return res.getNo()
Exemplo n.º 23
0
 def __init__(self, var):
     cutil.CRUDLIST.__init__(self, var)
     self.i = Holder.getSaveMail()
     self.serviceS = Holder.getNoteStorage()
Exemplo n.º 24
0
 def __init__(self):
     self.M = Holder.getAppMess()
Exemplo n.º 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
Exemplo n.º 26
0
def getDialogFormat(dialname):
    i = Holder.getiServer()
    dInfo =  i.findDialog(Holder.getRequest(), dialname)
    assert dInfo != None
    return dInfo.getDialog()
Exemplo n.º 27
0
 def __init__(self, var):
     self.var = var
     self.p = Holder.getMailFrom()
Exemplo n.º 28
0
def getPerson(var):
    token = var["SECURITY_TOKEN"]
    #    return Holder.getNameFromToken().getInstance(token).getPerson()
    return Holder.getiSec().getUserName(token)
Exemplo n.º 29
0
def _getTransformer(xslt):
    return Holder.getTransformer().getTranformer(xslt)
Exemplo n.º 30
0
def getObject(var=None):
    return Holder.getO()
Exemplo n.º 31
0
 def __init__(self):
     self.i = Holder.getInstanceCache()
Exemplo n.º 32
0
 def __init__(self, var, recordid=None):
     self.serviceS = None
     self.var = var
     self.recordid = recordid
     if recordid : self.jserviceS = Holder.getiJournal()        
Exemplo n.º 33
0
 def __init__(self, var):
     CRUDLIST.__init__(self, var)
     self.serviceS = Holder.getiJournal()
Exemplo n.º 34
0
 def __init__(self,app) :
   ObjectAdmin.__init__(self,app)  
   self.adminI = Holder.getAdminPerson()
Exemplo n.º 35
0
 def __init__(self):
     self.i = Holder.getInstanceCache()
Exemplo n.º 36
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
Exemplo n.º 37
0
 def __init__(self,var) :
     cutil.CRUDLIST.__init__(self,var)
     self.i = Holder.getSaveMail()
     self.serviceS = Holder.getNoteStorage()
Exemplo n.º 38
0
 def __init__(self):
     self.M = Holder.getAppMess()
Exemplo n.º 39
0
def urlParList(var) :
  R = Holder.getRequest().getUrlParam()
  res = []
  for k in R : res.append(k)
  return res
Exemplo n.º 40
0
 def __init__(self,var):
     self.var = var
     self.p = Holder.getMailFrom()
Exemplo n.º 41
0
def urlPar(var, k) :
  R = Holder.getRequest().getUrlParam()
  return R.get(k)
Exemplo n.º 42
0
 def __init__(self):
     self.h = Holder.getDefaultData()
Exemplo n.º 43
0
def getPerson(var):
    token = var["SECURITY_TOKEN"]
#    return Holder.getNameFromToken().getInstance(token).getPerson()
    return Holder.getiSec().getUserName(token)
Exemplo n.º 44
0
def urlPar(var, k):
    R = Holder.getRequest().getUrlParam()
    return R.get(k)
Exemplo n.º 45
0
def getAppId(var):
    token = var["SECURITY_TOKEN"]
    return Holder.getNameFromToken().getInstance(token)
Exemplo n.º 46
0
def getAppId(var):
    token = var["SECURITY_TOKEN"]
    return Holder.getNameFromToken().getInstance(token)
Exemplo n.º 47
0
def getObject(var=None):
    return Holder.getO()
Exemplo n.º 48
0
 def __init__(self, var, recordid=None):
     self.serviceS = None
     self.var = var
     self.recordid = recordid
     if recordid: self.jserviceS = Holder.getiJournal()
Exemplo n.º 49
0
def __getConnection():
    return Holder.getJDBCConnection().getConnection()
Exemplo n.º 50
0
 def __init__(self, app):
     self.adminI = Holder.getAdmin()
     self.app = app
Exemplo n.º 51
0
def getDictFromFile(dire, dictname) :
  i = Holder.getReadDict()
  seq = i.getDict(dire, dictname)
  return seq
Exemplo n.º 52
0
 def __init__(self, app):
     ObjectAdmin.__init__(self, app)
     self.adminI = Holder.getAdminPerson()
Exemplo n.º 53
0
 def __init__(self) :
   self.h = Holder.getDefaultData()