def saveData(self): feedType = self.params.safeGetStringParam("feedType") feedContent = self.params.safeGetStringParam("feedContent") if feedContent != "": f = Feedback() f.setLoginName(self.loginUser.loginName) f.setTrueName(self.loginUser.trueName) f.setCreateDate(Date()) f.setFeedbackType(feedType) f.setContent(feedContent) feedbackService = __spring__.getBean("feedbackService") feedbackService.saveOrUpdateFeedback(f) return ActionResult.SUCCESS
def testExplicitValue(self): with hn_session(Death) as session: with hn_transact(session): death = Death() death.date = Date() death.howDoesItHappen = "Well, haven't seen it" session.saveOrUpdate(death) with hn_session(Death) as session: with hn_transact(session): q = session.createQuery("from " + Death.__name__) death = q.uniqueResult() assertEquals("Well, haven't seen it", death.howDoesItHappen) session.delete(death)
def tick_generator(): now = 0 previous_state = None for i in xrange(10): state = 5.3 + random() tick = HashMap() tick.put("time", Date(now)) tick.put("name", "TestString1") tick.put("previous_state", previous_state) tick.put("state", state) previous_state = state yield tick now += 1
def doPost(self, request, response): customer = CustomerFixture.createSingleCustomer() out = response.getWriter() response.setContentType("text/html") out.println("<html><head><title>Jython Servlet Test</title>" + "<body><h1>Jython Servlet Test</h1>") out.println("<p><b>Today is:</b>" + Date().toString() + "</p>") out.println("<p><b>Java Customer:</b>" + customer.toString() + "</p>") out.println("</body></html>")
def setupjob(job, args): """ Set up a job to run on a date range of directories. Jobs expect two arguments, startdate and enddate, both in yyyy-MM-dd format. """ import java.text.SimpleDateFormat as SimpleDateFormat import java.util.Date as Date import java.util.Calendar as Calendar import com.mozilla.util.DateUtil as DateUtil import com.mozilla.util.DateIterator as DateIterator import org.apache.hadoop.mapreduce.lib.input.FileInputFormat as FileInputFormat import org.apache.hadoop.mapreduce.lib.input.SequenceFileAsTextInputFormat as MyInputFormat if len(args) != 3: raise Exception( "Usage: <testpilot_study> <startdate-YYYY-MM-DD> <enddate-YYYY-MM-DD>" ) # use to collect up each date in the given range class MyDateIterator(DateIterator): def __init__(self): self._list = [] def get(self): return self._list def see(self, aTime): self._list.append(aTime) sdf = SimpleDateFormat(dateformat) study = args[0] startdate = Calendar.getInstance() startdate.setTime(sdf.parse(args[1])) enddate = Calendar.getInstance() enddate.setTime(sdf.parse(args[2])) dates = MyDateIterator() DateUtil.iterateByDay(startdate.getTimeInMillis(), enddate.getTimeInMillis(), dates) paths = [] for d in dates.get(): paths.append(pathformat % (study, sdf.format(Date(d)))) job.setInputFormatClass(MyInputFormat) FileInputFormat.setInputPaths(job, ",".join(paths)) job.getConfiguration().set("org.mozilla.jydoop.mappertype", "TEXT")
def saveLogFile(self, fileName): if self.saveBoolean == (1 == 0): return logfile = open(fileName + "log", "wt") self.CurrentBuffer.append("<file_saved time=\"") self.CurrentBuffer.append( (Date(System.currentTimeMillis())).toString()) self.CurrentBuffer.append("\">") self.CurrentBuffer.append(fileName) self.CurrentBuffer.append("</file_saved>") self.CurrentBuffer.append("\n") self.CurrentBuffer.append("</file_created>\n") logfile.write(self.CurrentBuffer.toString()) logfile.close()
def __init__(self, selectFields): BaseQuery.__init__(self, selectFields) self.params = ParamUtil(request) self.orderType = 0 self.createUserId = None self.ownerType = None self.ownerId = None self.status = None self.qryDate = None self.k = self.params.getStringParam("k") self.filter = self.params.getStringParam("filter") sft = SimpleDateFormat("yyyy-MM-dd HH:mm:ss") self.nowDate = sft.format(Date())
def execute(self): request.setAttribute("today", CommonUtil.rssDateFormat(Date())) type = request.getParameter("type") if type == "article": return self.article() elif type == "resource": return self.resource() elif type == "photo": return self.photo() elif type == "topic": return self.topic() else: response.setContentType("text/html; charset=UTF-8") return "/WEB-INF/ftl/site_rss.ftl"
def run(self): frame = JFrame('Spinner5', layout=FlowLayout(), defaultCloseOperation=JFrame.EXIT_ON_CLOSE) frame.add( JSpinner( SpinnerDateModel( Date(2000, 2, 1), # zero origin month None, # minimum None, # maximum Calendar.DAY_OF_MONTH # Ignored by GUI ))) frame.pack() frame.setVisible(1)
def execute(self): user = self.loginUser if user == None: return ActionResult.LOGIN accessControlService = __spring__.getBean("accessControlService") if accessControlService.isSystemAdmin(user) == False and accessControlService.isSystemContentAdmin(user) == False: self.addActionError(u"没有管理权限,只有超级管理员和系统内容管理员才可以使用此功能。") return ActionResult.ERROR if self.contentSpaceService == None: self.addActionError(u"无法获得 contentSpaceService 服务,检查配置文件。") return ActionResult.ERROR if request.getMethod() == "POST": contentSpaceArticle = ContentSpaceArticle() contentSpaceId = self.params.safeGetIntParam("contentSpaceId") if contentSpaceId == 0: self.addActionError(u"无效的分类,请选择一个自定义分类。") return ActionResult.ERROR contentSpace = self.contentSpaceService.getContentSpaceById(contentSpaceId) if contentSpace == None: self.addActionError(u"不能加载自定义分类对象,请选择一个正确的标识。") return ActionResult.ERROR title = self.params.safeGetStringParam("title") pictureUrl = self.params.safeGetStringParam("pictureUrl") content = self.params.safeGetStringParam("content") if title == "": self.addActionError(u"请输入文章标题。") return ActionResult.ERROR if content == "": self.addActionError(u"请输入文章内容。") return ActionResult.ERROR contentSpaceArticle.setTitle(title) contentSpaceArticle.setContent(content) if pictureUrl == "": pictureUrl = None contentSpaceArticle.setPictureUrl(pictureUrl) contentSpaceArticle.setCreateUserId(self.loginUser.userId) contentSpaceArticle.setCreateUserLoginName(self.loginUser.loginName) contentSpaceArticle.setCreateDate(Date()) contentSpaceArticle.setOwnerType(0) contentSpaceArticle.setOwnerId(0) contentSpaceArticle.setViewCount(0) contentSpaceArticle.setContentSpaceId(contentSpaceId) self.contentSpaceService.saveOrUpdateArticle(contentSpaceArticle) self.addActionMessage(u"您成功发表了一篇文章: " + title + u"。") self.addActionLink(u"返回", "usercate_article.py") return ActionResult.SUCCESS self.get_content_space_cate() return "/WEB-INF/ftl/admin/content_space_article_add.ftl"
def handleBankTip(core, owner, eventType, returnList): bankSurcharge = int(math.ceil(0.05 * float(transferTotal))) core = NGECore.getInstance() chatSvc = core.chatService actorGlobal = tipFrom targetGlobal = tipTo actorFunds = actorGlobal.getBankCredits() totalLost = int(transferTotal) + bankSurcharge if eventType == 0: if int(totalLost) > actorFunds: actorGlobal.sendSystemMessage('You do not have ' + str(totalLost) + ' credits (surcharge included) to tip the desired amount to ' + targetGlobal.getCustomName() + '.', 0) return if int(transferTotal) > 0 and int(actorFunds) >= int(totalLost): date = Date() targetName = targetGlobal.getCustomName() targetMail = Mail() targetMail.setMailId(chatSvc.generateMailId()) targetMail.setTimeStamp((int) (date.getTime() / 1000)) targetMail.setRecieverId(targetGlobal.getObjectId()) targetMail.setStatus(Mail.NEW) targetMail.setMessage(`transferTotal` + ' credits from ' + actorGlobal.getCustomName() + ' have been successfully delivered from escrow to your bank account') targetMail.setSubject('@base_player:wire_mail_subject') targetMail.setSenderName('bank') actorMail = Mail() actorMail.setMailId(chatSvc.generateMailId()) actorMail.setRecieverId(actorGlobal.getObjectId()) actorMail.setStatus(Mail.NEW) actorMail.setTimeStamp((int) (date.getTime() / 1000)) actorMail.setMessage('An amount of ' + `transferTotal` + ' credits have been transfered from your bank to escrow. It will be delivered to ' + targetGlobal.getCustomName() + ' as soon as possible.') actorMail.setSubject('@base_player:wire_mail_subject') actorMail.setSenderName('bank') targetGlobal.addBankCredits(int(transferTotal)) actorGlobal.deductBankCredits(int(totalLost)) actorGlobal.sendSystemMessage('You have successfully sent ' + `transferTotal` + ' bank credits to ' + targetGlobal.getCustomName(), 0) targetGlobal.sendSystemMessage('You have successfully received ' + `transferTotal` + ' bank credits from ' + actorGlobal.getCustomName(), 0) chatSvc.storePersistentMessage(actorMail) chatSvc.storePersistentMessage(targetMail) chatSvc.sendPersistentMessageHeader(actorGlobal.getClient(), actorMail) chatSvc.sendPersistentMessageHeader(targetGlobal.getClient(), targetMail) return else: actorGlobal.sendSystemMessage('You lack the bank funds to wire ' + `transferTotal` + ' bank funds to ' + targetGlobal.getCustomName() + '.', 0) return return
def execute(self): if self.loginUser == None: self.printer.addMessage( u"请先<a href='../../login.jsp'>登录</a>,然后才能编辑") return self.printer.printMessage("login.jsp", "") site_config = SiteConfig() site_config.get_config() self.prepareCourseId = self.params.getIntParam("prepareCourseId") self.prepareCourse = self.pc_svc.getPrepareCourse(self.prepareCourseId) if self.prepareCourse == None: self.printer.addMessage(u"未能加载备课。请重新选择一次备课。") return self.printer.printMessage( "p/" + str(self.prepareCourse.prepareCourseId) + "/0/", "") if self.canAdmin() == "false": self.printer.addMessage(u"只有 管理员 和 主备人(备课创建者)才可以修改。") return self.printer.printMessage( "p/" + str(self.prepareCourse.prepareCourseId) + "/0/", "") #self.prepareCourseEdit = self.pc_svc.getLastestPrepareCourseEdit(self.prepareCourseId, self.loginUser.userId) if self.prepareCourse.lockedUserId > 0 and self.prepareCourse.lockedUserId != self.loginUser.userId: user = self.user_svc.getUserById(self.prepareCourse.lockedUserId) if user == None: self.printer.addMessage(u"此备课已经被 未知的人 签出,你暂时不能进行编辑该备课。") else: self.printer.addMessage(u"此备课已经被 " + user.trueName + u" 签出,你暂时不能进行编辑该备课。") return self.printer.printMessage( "p/" + str(self.prepareCourse.prepareCourseId) + "/0/", "") else: #设置锁标记 self.prepareCourse.setLockedUserId(self.loginUser.userId) self.prepareCourse.setLockedDate(Date()) self.pc_svc.updatePrepareCourse(self.prepareCourse) if request.getMethod() == "POST": return self.saveOrUpdate() prepareCourseEdit_list = self.pc_svc.getPrepareCourseEditList( self.prepareCourseId) request.setAttribute("prepareCourseEdit_list", prepareCourseEdit_list) request.setAttribute("loginUser", self.loginUser) request.setAttribute("prepareCourse", self.prepareCourse) request.setAttribute("head_nav", "cocourses") return "/WEB-INF/ftl/course/coEditCommonPrepareCourse.ftl"
def bookPosition(self, position): if not position.isCanceled() and not position.isBooked( ) and position.getCreditZpk() != None and position.getDebitZpk( ) != None: debitBalance = position.getDebitZpk().getCurrentBalance() creditBalance = position.getCreditZpk().getCurrentBalance() debitBalance.setDebit(position.getValue().add( BigDecimal(debitBalance.getDebit())).floatValue()) creditBalance.setCredit(position.getValue().add( BigDecimal(creditBalance.getCredit())).floatValue()) position.setBooked(True) position.setBookedAt(Date()) self.saveEntity(debitBalance) self.saveEntity(creditBalance) self.savePosition(position)
def esper_bridge(event): event_type = event.getProperty('type') if event_type == 'ItemStateEvent': event_payload = json.loads(event.getProperty('payload')) event_topic = event.getProperty('topic').split('/') item_name = event_topic[2] record = { "type": event_type, "time": Date(), "name": item_name, "state": event_payload['value'] } runtime.sendEvent(record, record['type']) elif event_type == 'ItemStateChangedEvent': event_payload = json.loads(event.getProperty('payload')) event_topic = event.getProperty('topic').split('/') item_name = event_topic[2] record = { "type": event_type, "time": Date(), "name": item_name, "previous_state": event_payload['oldValue'], "state": event_payload['value'] } runtime.sendEvent(record, record['type']) elif event_type == 'ItemCommandEvent': event_payload = json.loads(event.getProperty('payload')) event_topic = event.getProperty('topic').split('/') item_name = event_topic[2] record = { "type": event_type, "time": Date(), "name": item_name, "command": event_payload['value'], } runtime.sendEvent(record, record['type'])
def save_post(self): st = self.params.safeGetStringParam("st") if st == "": self.addActionError(u"请输入专题标题。") return self.ERROR so = self.params.safeGetStringParam("so") sd = self.params.safeGetStringParam("sd") se = self.params.safeGetStringParam("se") expire_date = Date() try: expire_date = SimpleDateFormat("yyyy-MM-dd").parse(se) except: actionErrors = [u"输入的日期格式不正确,应当是: '年年年年-月月-日日' 格式"] request.setAttribute("actionErrors", actionErrors) return self.ERROR if self.specialSubject == None: self.specialSubject = SpecialSubject() self.specialSubject.setObjectType("subject") self.specialSubject.setObjectId(self.subject.subjectId) self.specialSubject.setCreateDate(Date()) self.specialSubject.setCreateUserId(self.loginUser.userId) self.specialSubject.setTitle(st) if so != "": self.specialSubject.setLogo(so) else: self.specialSubject.setLogo(None) if sd != "": self.specialSubject.setDescription(sd) else: self.specialSubject.setDescription(None) self.specialSubject.setExpiresDate(expire_date) self.specialSubject_svc.saveOrUpdateSpecialSubject(self.specialSubject) return self.SUCCESS
def convertWorkbookToTemplate(self): print "%s\n" % self.templateName sheet = self.workbook.getSheetAt(0) template = Release() template.setTitle(self.templateName) template.setStatus(ReleaseStatus.TEMPLATE) template.setScheduledStartDate(Date()) self.template = self.templateApi.createTemplate( template, self.targetFolderId) for row in sheet: print "Row %d\n" % row.getRowNum() if row.getRowNum() == 0: self.doHeaderRow(row) else: self.doDataRow(row)
def convertWorkbookToTemplate(self): print "%s\n" % self.templateName sheet = self.workbook.getSheetAt(0) # templateJson = {"id" : None, "type" : "xlrelease.Release", "title" : templateName, "phases" : [], "status" : "TEMPLATE"} template = Release() template.setTitle(self.templateName) template.setStatus(ReleaseStatus.TEMPLATE) template.setScheduledStartDate(Date()) self.template = self.templateApi.createTemplate(template) for row in sheet: print "Row %d\n" % row.getRowNum() if row.getRowNum() == 0: self.doHeaderRow(row) else: self.doDataRow(row)
def minDiff(date): now = Date() cal = Calendar.getInstance() now = cal.getTime() dbDataTime = date.getTime() #in ms nowTime = now.getTime() #in ms diff = nowTime - dbDataTime min = ((diff / (1000 * 60)) % 60) hr = ((diff / (1000 * 60 * 60)) % 24) days = (diff / (1000 * 60 * 60 * 24)) tot_min = (days * 24) * 60 + hr * 60 + min return min
def save_or_update(self): q_topic = self.params.safeGetStringParam("quesition_title") q_content = self.params.safeGetStringParam("quesition_content") if self.question == None: #objectGuid = UUID.randomUUID().toString().upper() self.question = Question() self.question.setParentGuid(self.parentGuid) #self.question.setObjectGuid(str(objectGuid)) self.question.setCreateDate(Date()) self.question.setParentObjectType(self.parentType) self.question.setAddIp(self.get_client_ip()) self.question.setCreateUserName(self.loginUser.trueName) self.question.setCreateUserId(self.loginUser.userId) self.question.setTopic(q_topic) self.question.setQuestionContent(q_content) self.questionAnswerService.saveOrUpdate(self.question)
def current_can_attend_action(self): usercount = self.act_svc.getUserCountByActionId(self.action.actionId) request.setAttribute("usercount", usercount) # 活动如果报名日期截止了,不能再参加,当前日期大于设置的报名截止日期 if DateUtil.compareDateTime(Date(), self.action.attendLimitDateTime) > -1: request.setAttribute("isDeadLimit", "1") return "0" # 活动状态不正常,不能参加 if self.action.status != 0: return "0" # 当前用户没有登录,不能参加 if self.loginUser == None: return "0" # 活动如果是不是公开的,不能参加,只能邀请 if self.action.visibility != 0: return "0" # 参加的人数是否超过了许可人数:0 表示不限制 if self.action.userLimit == 0: return "1" else: if usercount < self.action.userLimit: return "1" else: return "0" # 如果只能邀请,用户也不能参加 if self.action.actionType == 2: return "0" # 外部条件已经判断完毕 # 下面判断个人的情况 if self.action.actionType == 0: # 任意参加 return "1" elif self.action.actionType == 1: # 组内人员参加 # 如果是组内, # 如果用户,则好友可以参加 # 如果是群组。则组内人员可以参加 # 如果是集体备课,则组内人员可以参加 return self.check_user_in_group()
def updateBufferedImage(self): w = self.getWidth() h = self.getHeight() if w <= 0 or h <= 0: return g = self.buff.getGraphics() map1y = self.gameToMapY(108000) map2x = self.gameToMapX(-165000) g.clearRect(0,0,w,h) g.drawImage(self.image1, 0, map1y, map2x, h - map1y, self) g.drawImage(self.image2, map2x, 0, w - map2x, h, self) all_player = L2World.getInstance().getAllPlayersArray() for p in all_player: self.drawPlayer(g, p) self.last_buff_update = Date().getTime()
def createFile(self): if (os.path.exists(self.datafilename) == 0): fid = open(self.datafilename, 'w') df = SimpleDateFormat('hh.mm.dd.MM.yyyy') today = df.format(Date()) print "Writing data to file:" + self.datafilename print "Writing mca file to:" + self.mcadir # write datetime line = " I18_EXAFS_RUN=" + str(self.fileno) + " " + today print >> fid, line print >> fid, self.title print >> fid, self.condition1 print >> fid, self.condition2 print >> fid, self.condition3 print >> fid, 'Sample X=', MicroFocusSampleX.getPosition( ), 'Sample Y=', MicroFocusSampleY.getPosition() print >> fid, 'comboDCM energy time I0 It drain flu1 flu2 flu3 flu4 flu5 flu6 flu7 flu8 flu9 flutot' fid.close()
def savePreviousArguments(managedServerName): from java.io import File from java.io import FileOutputStream from java.util import Properties from java.util import Date from java.text import SimpleDateFormat import string startToEdit() # parameter on the wsdl ant task call fileLocation = sys.argv[1].replace("\\", "/") print "The backup file location is" print fileLocation try: dateFormat = SimpleDateFormat('_d_MMM_yyyy_HH_mm_ss') date = Date() formattedDate = dateFormat.format(date) print formattedDate except: print "The date cannot be created/formatted" try: propsFile = File(fileLocation + managedServerName + formattedDate + "_config.bkp") print propsFile.exists() if (propsFile.exists() == 0): propsFile.createNewFile() except: print "The file cannot be created on:" print propsFile.getAbsoluteFile() dumpStack() previousProperties = Properties() print '===> Saving the previous arguments - ' + managedServerName cd('/Servers/' + managedServerName) print "Getting the Classpath" classPath = cmo.getServerStart().getClassPath() print classPath if classPath == None: classPath = "" previousProperties.setProperty("classPath", classPath) print "Saving Arguments to file" previousProperties.store(FileOutputStream(propsFile), None) print '===> Saved arguments! Please verify the file on:' + fileLocation + "in" + managedServerName
def getDailyScheduleName(self): self.scheduleName = None now = Date() for calendarItem in self.config: self.logger.info("Parser: found calendar item: " + str(calendarItem)) # check if daily schedule exists: try: self.schedules.getSchedules(calendarItem['daily_schedule']) except Exception as e: self.logger.warn("Config Error" + str(e)) raise e if calendarItem.get('cron') != None: cronExpression = "* * * " + calendarItem.get('cron') self.logger.debug(cronExpression) self.logger.debug(now) if CronExpression(cronExpression).isSatisfiedBy(now): # don't break we want to test the config if self.scheduleName == None: self.scheduleName = calendarItem['daily_schedule'] else: # has to be timerange df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.GERMAN) fromDate = df.parse(calendarItem['timerange']['from']) toDate = df.parse(calendarItem['timerange']['to']) self.logger.debug(calendarItem['timerange']['from']) self.logger.debug(fromDate) self.logger.debug(calendarItem['timerange']['to']) self.logger.debug(toDate) self.logger.debug(now) if now.before(toDate) and now.after(fromDate): # don't break we want to test the config if self.scheduleName == None: self.scheduleName = calendarItem['daily_schedule'] if self.scheduleName == None: self.logger.warn("Todays daily schedule: " + str(self.scheduleName)) else: self.logger.info("todays daily schedule: " + str(self.scheduleName)) return self.scheduleName
def __call__(self): # 加cookie threadContext = HTTPPluginControl.getThreadHTTPClientContext() expiryDate = Date() expiryDate.year += 10 grinder.logger.info(hostlist[2][:-5]) # url地址 url2 = 'http://%s/goldbeta-service/bkt/api' % (hostlist[2]) result = test('api.system.simulation.trade.stock.list', '{"uid":"527","betaId":"1020491295"}', 527, '1.0', url2) # 返回结果检查,有返回特定字符,则判断请求成功 if result.getText().find("success") != -1: grinder.statistics.forLastTest.success = 1 grinder.logger.info(result.getText()) else: grinder.statistics.forLastTest.success = 0 # 请求失败,则输出失败时服务器返回的值 grinder.logger.info(result.getText())
def __init__(self, fileToPrint): self.fileName = fileToPrint self.today = SimpleDateFormat("yyyy.MM.dd HH:mm").format(Date()) self.textFont = Font("Monospaced", Font.PLAIN, 12) # We use a RandomAccessFile because Java likes to seek around and # print pages multiple times. self.raf = RandomAccessFile(self.fileName, "r") # These keep track of what pages we've found so far, # and where in the file the pages start. # Page 0's starts out filled, and the following pages' are filled # at the end of its predecessor. self.pagePointers = [] self.pageAfterEnd = None # Set the pointer for page 0. self.pagePointers.append(self.raf.getFilePointer())
def save_or_update(self): q_topic = self.params.safeGetStringParam("quesition_title") q_content = self.params.safeGetStringParam("quesition_content") if self.question == None: objectGuid = UUID.randomUUID() self.question = Question() self.question.setParentGuid(self.parentGuid) self.question.setObjectGuid(str(objectGuid)) self.question.setCreateDate(Date()) self.question.setAddIp(self.get_client_ip()) self.question.setCreateUserName(self.loginUser.trueName) self.question.setCreateUserId(self.loginUser.userId) self.question.setTopic(q_topic) self.question.setQuestionContent(q_content) self.questionAnswerService.saveOrUpdate(self.question) response.sendRedirect(self.redUrl) return return "/WEB-INF/mod/questionanswer/success.ftl"
def isScanOverdue(Framework): """Check whether the scanning of client is overdue by download time of scan file""" isOverdue = 1 timeToOverdue = getOverdueInterval(Framework) if not timeToOverdue: timeToOverdue = DEFAULT_OVERDUE_TIME # two weeks logger.debug("Time to scan overdue:", timeToOverdue) scanFileDownloadTime = Framework.getDestinationAttribute( 'scanFileLastDownloadedTime') if scanFileDownloadTime: now = System.currentTimeMillis() try: downloadTime = long(scanFileDownloadTime) except: downloadTime = 0 logger.debug('scan file last downloaded time:', Date(downloadTime)) isOverdue = now > (downloadTime + timeToOverdue) logger.debug("Overdue to scan:", isOverdue) return isOverdue
def initDocument(self, type): document = Document() document.setCreatedAt(Date()) document.setType(type) document.setCommunity( self.findById("Community", int(self._svars.get('communityId')))) if self._svars.get('possessionId') != None and self._svars.get( 'possessionId') != '0': document.setPossession( self.findById("Possession", int(self._svars.get('possessionId')))) if self._svars.get('contractorId') != None and self._svars.get( 'contractorId') != '0': document.setContractor( self.findById("Contractor", int(self._svars.get('contractorId')))) document.setDescription(self._svars.get('documentDescription')) self._logger.info("New document of type %s created" % document.getType()) return document
def main(*args): from java.util import Date fecha = Date() builder = ExpressionUtils.createExpressionBuilder() print builder.and( builder.group( builder.or( builder.le(builder.variable("fecha_entrada"), builder.date(fecha)), builder.is_null(builder.variable("fecha_entrada")) )), builder.group( builder.or( builder.le(builder.variable("fecha_salida"), builder.date(fecha)), builder.is_null(builder.variable("fecha_salida")) )) ).toString() print builder.toString() print getStretchFeatureStore() print "f",findOwnership(fecha, 'CV301', 10) print "f",findOwnership(fecha, 'CV-70', 49.7)