From e61b6add5b8987914904cb40de3a26250465fc31 Mon Sep 17 00:00:00 2001 From: Bruno De Bel Date: Fri, 9 Feb 2018 11:19:47 +0100 Subject: [PATCH] retrofit to monograph --- loadInventory/inventoryparser.cpp | 1 + project/config.xml | 15 ++++---------- project/inventory.h | 1 + project/sql.cpp | 3 ++- project/verifyBook.cpp | 8 ++++---- project/verifyFolder.cpp | 34 ++++++++++++++++++++++++++----- 6 files changed, 41 insertions(+), 21 deletions(-) diff --git a/loadInventory/inventoryparser.cpp b/loadInventory/inventoryparser.cpp index e76d62e..75c05df 100644 --- a/loadInventory/inventoryparser.cpp +++ b/loadInventory/inventoryparser.cpp @@ -165,6 +165,7 @@ StateParserState* StateParserInventoryRootState::getNext(const char* const name) map["premis"]= map["sequenceNumber"]= map["issueNumber"]= + map["systemNumber"]= map["barcode"]= new StateParserParamState(); map["language"]= diff --git a/project/config.xml b/project/config.xml index adb7ec1..cd7ea00 100644 --- a/project/config.xml +++ b/project/config.xml @@ -1,7 +1,7 @@ - C:/Data/DB/SMALLTEST3 + C:/Data/DB/SMALLTEST6 inventory.xml @@ -126,16 +126,9 @@ + the inventory become needed for all type of document + so the parser mets must be check active on inventory to check for exemple the name of file agaisnt system number + --> 1 0 diff --git a/project/inventory.h b/project/inventory.h index d123574..206c25f 100644 --- a/project/inventory.h +++ b/project/inventory.h @@ -19,6 +19,7 @@ class inventory{ std::string issuenumber; std::string yearnumber; std::string callnumber; + std::string systemnumber; std::string printer; std::string publisher; std::string formaldate; diff --git a/project/sql.cpp b/project/sql.cpp index 9ec8abd..3fb4443 100644 --- a/project/sql.cpp +++ b/project/sql.cpp @@ -191,7 +191,7 @@ void database::dberror(std::string sql){ bool database::getInventory(std::string _sysnum, inventory& _inventory){ bool ret = false; static std::string sql = "SELECT UNIQUEBUILDKEY,AUTHOR,PAPERID," - " LANGUAGES,FORMALDATE,TYPE,TITLE,TITLECOLLECTION,CALLNUMBER,ISSUENUMBER,YEARNUMBER,PAGES," + " LANGUAGES,FORMALDATE,TYPE,TITLE,TITLECOLLECTION,CALLNUMBER,ISSUENUMBER,YEARNUMBER,SYSTEMNUMBER,PAGES," " CHECKED" " from INVENTORY where UNIQUEBUILDKEY=?"; @@ -224,6 +224,7 @@ bool database::getInventory(std::string _sysnum, inventory& _inventory){ _inventory.callnumber = safe_sqlite3_column_text(pStmt, col++); _inventory.issuenumber = safe_sqlite3_column_text(pStmt, col++); _inventory.yearnumber = safe_sqlite3_column_text(pStmt, col++); + _inventory.systemnumber = safe_sqlite3_column_text(pStmt, col++); _inventory.pages = safe_sqlite3_column_text(pStmt, col++); _inventory.checked = sqlite3_column_int(pStmt, col++); diff --git a/project/verifyBook.cpp b/project/verifyBook.cpp index 93baf79..f1fca00 100644 --- a/project/verifyBook.cpp +++ b/project/verifyBook.cpp @@ -74,8 +74,8 @@ std::string verifyBook::buildPartNumber(std::string& yearNumber, std::string& is int yearLen = yearNumber.length(); int issueLen = issueNumber.length(); - std::cout << "YEAR NUMBER:" << yearNumber << std::endl; - std::cout << "ISSUE NUMBER:" << issueNumber << std::endl; + //std::cout << "YEAR NUMBER:" << yearNumber << std::endl; + //std::cout << "ISSUE NUMBER:" << issueNumber << std::endl; std::stringstream ss; if ( yearLen != 0 ){ @@ -87,10 +87,10 @@ std::string verifyBook::buildPartNumber(std::string& yearNumber, std::string& is ss << ", "; } - ss << "n°" << issueNumber; + ss << "n\xc2\xba" << issueNumber; } - std::cout << "RESULTE" << ss.str() << std::endl; + //std::cout << "RESULTE" << ss.str() << std::endl; return ss.str(); } diff --git a/project/verifyFolder.cpp b/project/verifyFolder.cpp index 3e4cb3f..1e89203 100644 --- a/project/verifyFolder.cpp +++ b/project/verifyFolder.cpp @@ -14,15 +14,39 @@ void verifyFolder::check(int check ,metsparserContext& context){ std::string search = "/\\"; int pos = path.find_last_of(search); - std::string uniq = context.inventory.getInventory("MODSMD_PRINT")->uniquebuildkey; - int poss = uniq.find_last_of('/'); - - uniq = uniq.substr(poss+1); + std::string uniq=context.inventory.getInventory("MODSMD_PRINT")->uniquebuildkey; + + int count = 0; + for ( char *tmp=(char*)uniq.c_str();*tmp !=0 ; tmp++){ // + if (*tmp == '/'){ + count ++; + } + } + + + + if ( count < 2 ){ + inventory invent; + if (!db->getInventory(uniq,invent)){ + hError -> getError(cat_bookinventory,"METS","DMDSEC MODSMD_PRINT", "Unable tocheck File Name:" + uniq ,context.currentMetsFile,uniq); + return; // skip all + }; + uniq = invent.systemnumber; + // check mets naming file + if ( context.currentMetsFile.compare(uniq + "-mets.xml")!=0 ){ + hError->getError(cat_wrongFolderName,"METS","FOLDER", "Wrong Metsfile name: " + uniq + "-mets.xml" + " != Name of folder :" + context.currentMetsFile, context.currentMetsFile,""); + } + + + }else{ + int poss = uniq.find_last_of('/'); + uniq = uniq.substr(poss+1); + } if ( pos + 1 < path.length() ){ std::string sub = path.substr(pos+1); if ( sub.compare( uniq ) == 0 ) return ; // hoping that inventory is correcltly provided }; - hError->getError(cat_wrongFolderName,"METS","FOLDER", path + " is not UNIQ : "+ uniq ,context.currentMetsFile,uniq); + hError->getError(cat_wrongFolderName,"METS","FOLDER", "Wrong Path:"+ path + " is not UNIQ : "+ uniq ,context.currentMetsFile,uniq); } \ No newline at end of file