畢業(yè)論文-陶瓷廠的進銷存管理系統(tǒng)_第1頁
畢業(yè)論文-陶瓷廠的進銷存管理系統(tǒng)_第2頁
畢業(yè)論文-陶瓷廠的進銷存管理系統(tǒng)_第3頁
畢業(yè)論文-陶瓷廠的進銷存管理系統(tǒng)_第4頁
畢業(yè)論文-陶瓷廠的進銷存管理系統(tǒng)_第5頁
已閱讀5頁,還剩61頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、 太原理工大學(xué)畢業(yè)設(shè)計(論文)用紙 計中盡量做到松散的耦合,較高的內(nèi)聚隱蔽和內(nèi)部化。設(shè)計過程中各模塊(對象)均考慮或預(yù)留了完善和可擴充接口部分。使用盡可能多的公用窗口,增加了可維護性。 軟件測試是軟件開發(fā)過程中必不可少一個階段,軟件測試是保證軟件質(zhì)量的關(guān)鍵步驟。在設(shè)計過程中。面對復(fù)雜的問題,人的主觀認識不可能完全符合客觀現(xiàn)實,在軟件生命周期的每個階段都不可避免地會產(chǎn)生 差錯。測試的目的就是在軟件投入生產(chǎn)性運行之前,盡可能多的發(fā)現(xiàn)軟件中的錯誤。它是對軟件規(guī)格說明。設(shè)計和編碼的最后審查。軟件測試在軟件生命周期中橫跨兩個階段。通常在編寫出第一個模塊后就對它做必要的測試,稱之為單元測試,在強詞奪理結(jié)束

2、后,對軟件系統(tǒng)進行各種綜合測試。這個階段由專門的測試人員承擔(dān)這項工作。5.6系統(tǒng)維護建議首先在操作人員必須能夠熟練操作電腦。在運行該系統(tǒng)的時候,保持電壓穩(wěn)定,防止因硬件原因造成信息丟失。同時也可以保護電腦。在操作完成后要核對信息是否保存。及時對數(shù)據(jù)庫管理進行維護,防止數(shù)據(jù)丟失。要充分發(fā)揮IT投資的作用,規(guī)劃、保持并發(fā)展一個可靠而有效的數(shù)據(jù)處理及信息提供機制,及時、準確、全面地反映企業(yè)經(jīng)營活動(人力、物品、HYPERLINK /s?q=資金流向&ie=utf-8&src=wenda_link資金流向等主要資源),服務(wù)于企業(yè)內(nèi)外不同用戶,以便企業(yè)能快速響應(yīng)和提供優(yōu)質(zhì)服務(wù),系統(tǒng)維護工作成為一項重要的

3、保障措施。 整體來看,系統(tǒng)維護工作的承擔(dān)方可以分為幾類:一是系統(tǒng)移交之后的日常維護工作完全由企業(yè)自身承擔(dān);二是移交之后的維護仍由系統(tǒng)提供商負責(zé);三是一段時間內(nèi)由系統(tǒng)提供商派人協(xié)助企業(yè)進行維護,待正常運轉(zhuǎn)后完全移交企業(yè)自已獨立維護;也可以選擇外包的方式進行維護。一般對于軟件版本的更新之類的維護工作是由系統(tǒng)提供商以每年收取許可證費的形式承擔(dān)的。 系統(tǒng)維護策略的選擇 企業(yè)的規(guī)模有大有小,系統(tǒng)實施策略及功能模塊配置也各有不同。對于不同目標的應(yīng)用系統(tǒng),系統(tǒng)維護方法可以有不同的選擇。如有些HYPERLINK /s?q=企業(yè)規(guī)模&ie=utf-8&src=wenda_link企業(yè)規(guī)模較小,產(chǎn)品單一,業(yè)務(wù)流程

4、相對穩(wěn)定,那么就可以采用完全外包的方式。也可以在本企業(yè)構(gòu)造應(yīng)用環(huán)境,將部分系統(tǒng)維護工作外包給產(chǎn)品供應(yīng)商/系統(tǒng)(實施)集成商等企業(yè)外部人員。當然,對于集團性企業(yè),其系統(tǒng)日常維護量大,響應(yīng)要求很高,這些企業(yè)還是得靠本企業(yè)IT人員進行系統(tǒng)維護。除非特定業(yè)務(wù)(如升級、數(shù)據(jù)轉(zhuǎn)換、模塊添加等),可做少量外包以補充短期資源的不足。 俗話說HYPERLINK /s?q=兵無常勢&ie=utf-8&src=wenda_link兵無常勢,水無常形,解決維護系統(tǒng)的問題難有既定之法,但理解其原則并靈活應(yīng)用之,可為復(fù)雜問題的解決提供方向。 系統(tǒng)維護的原則及方法,相信系統(tǒng) 不管數(shù)據(jù)庫多先進,軟件考慮多周到,應(yīng)用系統(tǒng)都有局

5、限性。但對常用的流程,偶然出錯時,不要先去想系統(tǒng)有問題,要注意觀察操作或數(shù)據(jù)的不尋常之處,如果是系統(tǒng)有缺陷,但可通過固定操作避免,就應(yīng)該固定操作流程,并注意反復(fù)培訓(xùn)。勤于積累 不論是主動發(fā)現(xiàn)或被動遇上問題,事后都要記錄解決過程、方法,以便共享經(jīng)驗。注意及時更新有關(guān)文檔,不僅記錄下業(yè)務(wù)要求的操作過程,也要記下繞過一些系統(tǒng)固有缺陷的途經(jīng)。用戶應(yīng)當像法規(guī)條例那樣去執(zhí)行,不論理解與否都不可簡化或異化,即“死步驟,莫發(fā)揮”。測試與比較 新出現(xiàn)的異常要判別其HYPERLINK /s?q=重現(xiàn)性&ie=utf-8&src=wenda_link重現(xiàn)性(必然性),可考慮構(gòu)造測試環(huán)境,完全仿照原操作,尋找維護操作

6、的方向,并研究修改的方法。可逆修改 即使找到維護操作的方向,也不可貿(mào)然修改,搞不好會出現(xiàn)連帶負作用,使問題性質(zhì)變復(fù)雜或由局部向更大范圍擴散。應(yīng)該判斷問題涉及的數(shù)據(jù)、影響范圍,理解全部流程。修改數(shù)據(jù)時要留好余地,要具有可逆性,改不好也能退回。繞過 這是緊急情況下或一時無解決頭緒時常常采用的方法。如從一個模塊向另一模塊傳數(shù)據(jù),如果有原因不明的丟失,而且是偶發(fā)且難以查明的原因,那么就要有一個檢查機制發(fā)現(xiàn)這類異常,然后在相應(yīng)的后續(xù)模塊補上有關(guān)信息。例行檢查與操作 這是減少問題緊急程度的有效方法。利用標準功能和一些自開發(fā)的實用小程序,應(yīng)用系統(tǒng)數(shù)據(jù)主動做一些檢查。把正常情況下要到今后某一時刻(如月末)才反

7、映出問題的數(shù)據(jù)(如成本更新、接口異常)提前找出來處理掉,這種不斷檢查、測試、發(fā)現(xiàn)和解決問題的過程,是系統(tǒng)穩(wěn)定和完善的基石??蛻舻男枨?用戶有時在不經(jīng)意時可能指出系統(tǒng)需要大力改進的地方,也可能會提出一個類似于“我要一敲鍵就出工資”的無理要求。這時不能因聲音大小決定取舍,要仔細聽,但不能草率承諾。人員的維護 在實施和維護的不同階段,系統(tǒng)對維護人員數(shù)量的要求也會不同。隨著維護人員水平不斷提高,人員流動在所難免。但ITHYPERLINK /s?q=組織架構(gòu)&ie=utf-8&src=wenda_link組織架構(gòu)中骨干用戶、維護工程師都是系統(tǒng)環(huán)境中的重要組成部分,他們的離去會給企業(yè)HYPERLINK /

8、s?q=ERP系統(tǒng)&ie=utf-8&src=wenda_linkERP系統(tǒng)造成巨大震蕩和不可估量的損失。6 軟件測試結(jié)論與系統(tǒng)使用說明6.1 軟件能力企業(yè)管理系統(tǒng)能使得管理員非常方便的,準確的將企業(yè)商品的采購情況,商品銷售情況,客戶信息及供貨商信息和銷售統(tǒng)計情況及時的反映給管理員,以幫助商品制定經(jīng)營策略,使商品的經(jīng)營更加合理同時創(chuàng)造更多的經(jīng)濟效益。本商品進銷信息管理系統(tǒng)軟件是一個功能比較完善的數(shù)據(jù)管理軟件,具有數(shù)據(jù)操作方便高效迅速等優(yōu)點。該軟件采用功能強大的數(shù)據(jù)庫軟件開發(fā)工具進行開發(fā),具有很好的可移植性,可在應(yīng)用范圍較廣的WINDOWS系列操作系統(tǒng)上使用。6.2 軟件限制 本系統(tǒng)要求在Win

9、dows 操作系統(tǒng)下運行。同時需要安裝如下軟件: 服務(wù)器軟件:Tomcat 、JDK 1.6 數(shù)據(jù)庫管理系統(tǒng):MS SQL SERVER 2005 瀏覽器:Internet Explorer6.3 軟件安裝指南首先,確定計算機上是否安裝了以上軟件,如果未安裝,要先安裝這幾種軟件。在安裝完成之后,啟動Tomcat服務(wù)器,打開Internet Explorer,在地址欄中輸入 HYPERLINK http:/localhost:8080/ypgl/login.jsp http:/localhost:8080/ypgl/login.jsp ,即可打開登錄界面,輸入正確的用戶名和密碼后進行企業(yè)管理系統(tǒng)

10、界面。6.4 系統(tǒng)常見問題與故障當系統(tǒng)出現(xiàn)故障時,如果計算機正常運行,要首先檢查軟件系統(tǒng)是否正確配置。否則檢查硬件系統(tǒng)是否出現(xiàn)問題??梢試L試重新啟動計算機。如果問題仍然存在要請專業(yè)人員進行修復(fù)。同時注意數(shù)據(jù)庫中數(shù)據(jù)是否丟失,及時恢復(fù)。結(jié) 論在陶瓷廠進銷存系統(tǒng)的開發(fā)過程中,按照軟件工程的要求,一步一步的加以實施,并整理出了相應(yīng)的文檔。通過對系統(tǒng)的開發(fā),我對進銷存系統(tǒng)有了較深的理解,對一個完整的軟件項目的開發(fā)流程也有了更清晰的認識。在開發(fā)一個系統(tǒng)的過程中,我們應(yīng)當學(xué)習(xí)從事系統(tǒng)開發(fā)的前人在實際系統(tǒng)開發(fā)的經(jīng)驗和教訓(xùn)及他們總結(jié)出來的理論和實踐經(jīng)驗成果,充分了解各種開發(fā)模式對于系統(tǒng)開發(fā)的指導(dǎo)意義。系統(tǒng)功能

11、基本與設(shè)計初期構(gòu)想一致,基本能夠滿足商品管理日常工作的需要。同時,由于經(jīng)驗的欠缺和第一次設(shè)計的原因系統(tǒng)存在許多不足。首先在分析和解決問題的時候考慮不夠周全,功能不是十分完善。還需要在以后的工作中加強和繼續(xù)努力。企業(yè)商品進銷信息管理系統(tǒng)的開發(fā)基本完畢,功能達到設(shè)計開發(fā)要求。能夠完成數(shù)據(jù)的錄入、查詢、統(tǒng)計功能。但由于時間比較倉促,和經(jīng)驗不足,還請老師批評指正。由于系統(tǒng)開發(fā)是工程性很強的工作,不會有一種方法適合所有的系統(tǒng)開發(fā),這也是各種新方法出現(xiàn)的原因之一。因此,應(yīng)當根據(jù)我們面臨的具體情況,吸取各種開發(fā)模式的優(yōu)點,選擇合適的系統(tǒng)開發(fā)模式,使得開發(fā)出來的系統(tǒng)和實際應(yīng)用情況最大程度貼近。通過本次畢業(yè)設(shè)計

12、,我也感受到了開源的方便,遇到什么問題,上網(wǎng)一查,就知道該怎么弄了,以前做個課程設(shè)計都是怕別人和我的一樣,不愿意給別人看,現(xiàn)在知道了程序弄不出來是多么的著急,學(xué)習(xí)都是相互的,互相研究才能共同進步的.以后要多多注意這方面的事情,本次畢業(yè)設(shè)計是我工作前一次很好的演練和實踐的機會,是培養(yǎng)獨立思考問題和自學(xué)能力的鍛煉,使我意識到必須努力學(xué)習(xí)才能才工作中體現(xiàn)自己的價值,適應(yīng)社會的需要。參考文獻張孝祥,徐明華. Java基礎(chǔ)與案例開發(fā)詳解M. 清華大學(xué)出版社, 2009 (美)Devier. JavaScript程序員教程M. 電子工業(yè)出版社, 2010(美)Harold,E.R. Java Networ

13、k ProgrammingM. 東南大學(xué)出版社, 2011畢廣吉. Java程序設(shè)計實例教程M. 北京:冶金工業(yè)出版社,2010吳其慶. Java程序設(shè)計經(jīng)典教程M. 北京:冶金工業(yè)出版社, 2008薩師煊,王珊. 數(shù)據(jù)庫系統(tǒng)概論(第三版)M. 北京: 高等教育出版社, 2011閻菲. Java程序設(shè)計教程M. 北京:中國水利水電出版社,2010孫衛(wèi)琴,李洪成. Tomcat與Java Web開發(fā)技術(shù)詳解M. 電子工業(yè)出版社, 2009黎連業(yè),王華,李淑春. 軟件測試與測試技術(shù)M. 清華大學(xué)出版社, 2009張大方,李瑋. 軟件測試技術(shù)與管理M. 湖南: 湖南大學(xué)出版社, 2007李城等. J

14、ava2簡明教程(第2版)M. 清華大學(xué)出版社, 2004Ramos.S,Expsito R.R. Design of scalable java communication middleware for multi-core systemsJ.The Computer journal,2013,56(2).214-228Zacharis N.Z. Measuring the Effects of Virtual Pair Programming in an Introductory Programming Java CourseJ. IEEE Transactions on Educatio

15、n, 2011,54(1).168-170Guillermo.L,Ramos.s,Roberto.R. Java in the High Performance Computing arena: Research,practice and experienceJ.Science of Computer Programming, 2013,78(5).425-444 致謝 從論文選題到搜集資料,從寫稿到反復(fù)修改,期間經(jīng)歷了喜悅、聒噪、痛苦和彷徨,在寫作論文的過程中心情是如此復(fù)雜。如今,伴隨著這篇畢業(yè)論文的最終成稿,復(fù)雜的心情煙消云散,自己甚至還有一點成就感。 我要感謝強彥老師、任聚財老師和胡莉老

16、師,非常感謝我的導(dǎo)師。他們?yōu)槿穗S和熱情,治學(xué)嚴謹細心。在論文的寫作和措辭等方面也總會以“專業(yè)標準”嚴格要求我,從選題、定題開始,一直到最后論文的反復(fù)修改、潤色,老師始終認真負責(zé)地給予我深刻而細致地指導(dǎo),幫助我開拓研究思路,精心點撥、熱忱鼓勵。正是老師的無私幫助與熱忱鼓勵,我的畢業(yè)論文才能夠得以順利完成,謝謝老師。 通過畢業(yè)設(shè)計過程我會到了許多知識,這也是在大學(xué)里第一次完整的完成一個項目,雖然過程中遇到了許多困難,在同學(xué)和老師的幫助下一一克服了。通過不斷的發(fā)現(xiàn)問題,總結(jié)問題和解決問題的過程,使我在此次畢業(yè)設(shè)計活動中不斷的提高,和得到了寶貴的經(jīng)驗。外文資料 A good data validati

17、on strategy is an important part of every application development project. Being able to consolidate and generalize validation using a proven framework can significantly improve the reliability of your software, especially over time. Whereas unstructured and uncontrolled validation policies will lea

18、d to increased support and maintenance costs, a consolidated validation strategy can significantly minimize the cascade effect of changes to your code base. A validation layer can also be a very useful tool for some types of debugging. I recently needed to implement a lightweight validation framewor

19、k for a project. I discovered Hibernate Validator, an open source project from JBoss. The framework impressed me with its simplicity and flexibility, so I am introducing it with this HYPERLINK /blog/java-tips/Java Tip. Ill share my experience with setting up and using Hibernate Validator, with simpl

20、e use cases that demonstrate key features such as declarative annotations, composite validation rules, and selective validation.Data validation in Java See Victor Okunevs HYPERLINK /article/2076272/java-se/validation-with-pure-java.htmlValidation with pure Java to learn more about the java.beans pac

21、kage and the logic of constrained properties in Java.Getting started with Hibernate Validator Hibernate Validator provides a solid foundation for building lightweight, flexible validation code for Java SE and Java EE applications. Hibernate Validator is supported by a number of popular frameworks, b

22、ut its libraries can also be used in a standalone implementation. Standalone Java SE validation components can become an integral part of any complex heterogeneous server-side application. In order to follow this introduction to using Hibernate Validator to build a standalone component, you will nee

23、d to have HYPERLINK /technetwork/java/javase/downloads/index.htmlJDK 6 or higher installed. All use cases in the article are built using Validator version 5.0.3. You should download the HYPERLINK /validator/Hibernate Validator 5.0.x binary distribution package, where directory hibernate-validator-5.

24、0.x.Finaldist contains all the binaries required for standalone implementation.HYPERLINK /assets/2014/03/28/jtip-hibernate-validator-src.zipDownload the source codefor the Hibernate Validator demos used in this article. Listing 1 shows a fragment of the Ant-built script where all binary dependencies

25、, selected for the standalone implementation, are listed under the manifest section. The metainf section is required if externalized metadata validation will be used in the implementation. As a result of the Ant build the final JAR will reference all dependent Validator JARs through the Class-Path h

26、eader of the manifest file.Listing 1. Manifest section of the Ant build with dependencies. .Declarative annotation and constraint definition Hibernate Validator 5.0.x is the open source reference implementation of JSR 349: HYPERLINK /1.1/spec/1.1.0.cr3Bean Validation 1.1. Declarative annotation and

27、constraint definition are two highlights of the updated Bean Validation 1.1 framework. Expressing validation rules through a declarative syntax greatly improves the readability of the code, as shown in Listing 2.Listing 2. Declarative annotations in Hibernate Validatorpublic class Address NotBlank p

28、rivate String addresseeName; . NotBlank Pattern(regexp = A-Za-zdA-Za-zs?dA-Za-zd, message = Postal code validation failed.) private String postalCode; NotBlank private String municipality; NotBlank Pattern(regexp = AB|BC|MB|NB|NL|NT|NS|NU|ON|PE|QC|SK|YT, message = Province code validation failed.) p

29、rivate String province; .Declarative validation on method parameters clearly define preconditions, improving the overall readability of the code. Business rules are much easier to digest because you only need to look at field, method, and class annotations. The declarative style removes the need to

30、build a model of execution, consider state transitions, and analyze post-conditions and preconditions while learning the code.More Hibernate annotations Learn how to generate database schemas automatically with Hibernate. See John Ferguson Smarts HYPERLINK /article/2077886/data-storage/custom-schema

31、-generation-with-hibernate-annotations.htmlCustom schema generation with Hibernate annotations.Listing 3. Validation rules applied to a composition of objectsabstract public class LetterTemplate . NotEmpty( groups = LetterTemplateChecks.class, payload = ValidationSeverity.Error.class ) Valid private

32、 List content; . Supported validation targets are not restricted to data only: it is possible to apply constraints to bean properties get methods, method parameters, and constructors.Composite validation rules Readability and flexibility dont always work nicely together in source code; in fact they

33、often compete. Hibernate Validator demonstrates a setup where these two characteristics can actually complement each other. For example, Hibernate Validator supports compositions of annotations. The framework supports compositions of constraints and provides syntactical constructs representing OR, A

34、ND, and ALL_FALSE validation semantics. The OR composition offers stereotypes to skip validation on empty or null fields and is helpful when there is a need to declare validation for incomplete or optional data. In Listing 4, Hibernate Validators Pattern annotation is converted into an optional vali

35、dation rule using annotation composition syntax.Listing 4. Custom annotation declaration for defining OR type constraints (null or numeric field that cannot start with 0)ConstraintComposition(CompositionType.OR)Null(message = )Pattern(regexp = 1-9d*)Target( ElementType.METHOD, ElementType.FIELD )Ret

36、ention(RetentionPolicy.RUNTIME)Constraint(validatedBy = )ReportAsSingleViolationDocumentedpublic interface NullOrNumber String message() default Validation for an optional numeric field failed.; Class groups() default ; Class payload() default ;Listing 5 demonstrates the use of the custom composite

37、annotation on the optional postal box property of the Address object.Listing 5. Declaring a validation rule where the property can be either null or a numberpublic class Address . / Optional field defining PO box NullOrNumber private String poBoxNumber; .Classifying validation rules Hibernate Valida

38、tor lets developers classify validation rules. This means, for example, that you could associate a different runtime strategy with varying levels of failure. The framework supports an annotation payload attribute, which can be used in combination with Java marker interfaces to classify validation ru

39、les. You can also link the severity of validation failures with different levels of logging severity, where the logging strategy is configurable at runtime. Consider the simplest possible classification, where the validation rules are associated with non-recoverable errors or warnings.Listing 6. Mar

40、ker payload interfaces defined for classificationpublic class ValidationSeverity public interface Error extends Payload public interface Warning extends Payload In Listing 6, the ValidationSeverity interface class is used as a parameter in a validation-rule declaration. You could use the same techni

41、que for custom annotations:Listing 7. Marking validation constraints as errors or warningspublic class MailLetterTemplate extends LetterTemplate NotNull ( payload = ValidationSeverity.Warning.class) private Address returnAddress; NotNull (payload = ValidationSeverity.Error.class) private Address rec

42、ipientAddress; .In Listing 8, warning-level validation failures are logged at the info level, while errors are logged at the error level.Listing 8. Associating logging level with validation errors or warningsfor (ConstraintViolation error : constraintViolations) if (error.getConstraintDescriptor().g

43、etPayload().iterator().next() .equals(ValidationSeverity.Warning.class) StmtValLog.getInstance().info(Property + error.getPropertyPath().toString() + runtime value + error.getInvalidValue() + . Warning level constraint violation: + error.getMessage(); if (error.getConstraintDescriptor().getPayload()

44、.iterator().next() .equals(ValidationSeverity.Error.class) StmtValLog.getInstance().error(Property + error.getPropertyPath().toString() + runtime value + error.getInvalidValue() + . Error level constraint violation: + error.getMessage(); Selective validation and the marker interface technique Hibern

45、ate Validator also lets you apply validation logic selectively at runtime, adding another dimension of flexibility. This technique is helpful if the state of the system and underlying object structures goes through a well-defined set of transitions. For example, in a class hierarchy where derived cl

46、asses can be in an incomplete state, while base class state has to be complete every class can be associated with a different level of validation.Use the (groups) marker interface technique to separate validation rules into different categories. In this technique, a marker interface class is passed

47、as a groups parameter to an annotation declaration.Listing 9. Marker interface declaration and usage in two classespublic interface MailLetterTemplateChecks .public interface EmailLetterTemplateChecks .final public class MailLetterTemplate extends LetterTemplate NullOrNotBlank (groups = MailLetterTe

48、mplateChecks.class, payload = ValidationSeverity.Warning.class)private Address returnAddress;NotNull (groups = MailLetterTemplateChecks.class, payload = ValidationSeverity.Error.class)private Address recipientAddress;final public class EmailLetterTemplate extends LetterTemplate private Image logo; N

49、otBlank ( groups = EmailLetterTemplateChecks.class, payload = ValidationSeverity.Error.class )private String subject; Email ( groups = EmailLetterTemplateChecks.class, payload = ValidationSeverity.Error.class )private String recipientEmail;In Listing 10, validation is restricted to rules marked by t

50、wo classes: LetterTemplateChecks and EmailLetterTemplateChecks.Listing 10. Selective validation of an email objectEmailLetterTemplate email = new EmailLetterTemplate(slaval);email.setSubject(Renewal letter);email.setContent(new ArrayList();email.setSignature(Serge Laval);SetConstraintViolation const

51、raintViolations = validator.validate(email, LetterTemplateChecks.class, EmailLetterTemplateChecks.class);for(ConstraintViolation errors: constraintViolations) System.out.println(Property + errors.getPropertyPath().toString() + runtime value + errors.getInvalidValue() + . Constraint violation: + erro

52、rs.getMessage();Selective validation can be used as a powerful debugging technique, where only a subset of the object hierarchy has to be verified at a given time.Externalized metadata validation In addition to declarative annotation-based validation, the Bean Validation 1.1 specification supports a

53、 validation metadata model and programmatic validation APIs. The validation metadata model can be used as an effective control mechanism at runtime without the need to rebuild code. A variety of control mechanisms can be employed in controlling validation policies at runtime, ranging from disabling

54、programmatically defined validation constraints to complimenting programmatically defined rules. Metadata configuration has several advanced options available. See the Hibernate Validator HYPERLINK /hibernate/validator/5.0/reference/en-US/htmldocumentation for the complete set of options. In order t

55、o enable metadata validation, an validation.xml file has to be available on the classpath. Constraint-mapping fields refer to XML descriptors where application-specific constraints are defined.Listing 11. A Hibernate configuration file, validation.xml stmnts_declarative_validation.xml false If youre

56、 doing validation programmatically, the validate method of the Validator class accepts a list of marker interface classes as parameters, defining the scope of a selective validation. By default, all validation rules belong to a default validation group, which is designated by Default.class.外文翻譯 良好的數(shù)

57、據(jù)驗證策略是每個應(yīng)用程序開發(fā)項目的重要組成部分。如果能夠利用經(jīng)過驗證的架構(gòu),以鞏固和推廣驗證可以顯著提高軟件的可靠性,特別是隨著時間的推移。而非結(jié)構(gòu)化和不受控制的驗證政策將導(dǎo)致更多的支持和維護成本,綜合驗證策略可以顯著減少改變你的代碼庫的連帶效應(yīng)。一個驗證層也可以為某些類型的調(diào)試非常有用的工具。 我最近需要實現(xiàn)一個輕量級的驗證框架的一個項目。我發(fā)現(xiàn)了Hibernate Validator的,從JBoss的一個開源項目。該框架給我的印象與它的簡單性和靈活性,所以我用這個Java技巧介紹它。我將與設(shè)置和使用Hibernate Validator的分享我的經(jīng)驗,與展示關(guān)鍵功能,如聲明式注解,復(fù)合驗證

58、規(guī)則,以及選擇性驗證簡單的用例。在Java中的數(shù)據(jù)驗證 見Victor Okunev的HYPERLINK /article/2076272/java-se/validation-with-pure-java.htmlValidation with pure Java ,以了解更多有關(guān)java.beans包和Java中的約束性的邏輯。開始使用Hibernate Validator Hibernate驗證器為構(gòu)建輕量級的,靈活的驗證代碼為Java SE和Java EE應(yīng)用程序打下堅實的基礎(chǔ)。 Hibernate驗證器是由一些流行的框架為支持,但它的庫也可以在一個獨立的實現(xiàn)中使用。獨立的Java S

59、E驗證組件可以成為任何復(fù)雜的異構(gòu)服務(wù)器端應(yīng)用程序的一個組成部分。為了遵循這個介紹使用Hibernate Validator建立一個獨立的組件,需要有JDK 6或更高版本。所有的用例在文章中使用驗證器版本5.0.3構(gòu)建。你應(yīng)該下載Hibernate Validator的5.0.x的二進制發(fā)行包,其中directory hibernate-validator-5.0.x.Finaldist 區(qū)包含所有需要獨立實施的二進制文件。下載這篇文章中所使用的Hibernate Validator的源代碼。 Listing 1顯示了所有的二進制依賴關(guān)系,選擇了獨立實施,列在清單部分Ant的構(gòu)建腳本的片段。所需

60、的metainf部分,如果外部化元數(shù)據(jù)驗證將在實現(xiàn)中使用。由于Ant構(gòu)建最終的JAR的結(jié)果會參考所有相關(guān)的驗證器的JAR文件通過manifest文件中的Class- Path頭。Listing 1. Manifest section of the Ant build with dependencies. .聲明標注和約束定義 Hibernate Validator的5.0.x的是開源參考實現(xiàn)JSR 349 : Bean驗證1.1 。聲明標注和約束定義是兩個亮點更新Bean驗證1.1框架。通過聲明性語法表達的驗證規(guī)則大大提高了代碼的可讀性,如Listing 2所示。Listing 2. Decl

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論