Changeset 25542
- Timestamp:
- 2012-05-08T15:04:31+12:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSDocumentModel.java
r25074 r25542 130 130 return; 131 131 } 132 133 //If the document does not have an OID specified then generate one132 133 //If the collection is not specified then we cannot continue 134 134 if (oid == null || oid.equals("")) 135 135 { 136 oid = generateOID(); 137 } 138 else if (archiveCheckDocumentOrSectionExists(oid, collection, userContext)) 136 _errorStatus = ERROR_OID_NOT_SPECIFIED; 137 return; 138 } 139 140 if (archiveCheckDocumentOrSectionExists(oid, collection, userContext)) 139 141 { 140 142 _errorStatus = ERROR_DESTINATION_DOCUMENT_OR_SECTION_ALREADY_EXISTS; … … 673 675 try 674 676 { 675 Document docXML = null; 676 677 String filePath = archiveGetDocumentFilePath(oid, collection, userContext); 678 File docFile = new File(filePath); 679 if (!docFile.exists() && !docFile.createNewFile()) 677 String s = File.separator; 678 679 String docFolderPath = _siteHome + s + "collect" + s + collection + s + "import" + s + oid; 680 File docFolder = new File(docFolderPath); 681 682 if (!docFolder.exists()) 683 { 684 if(!docFolder.mkdirs()) 685 { 686 _errorStatus = ERROR_DOC_XML_COULD_NOT_BE_CREATED; 687 return; 688 } 689 } 690 691 File docFile = new File(docFolderPath + s + "doc.xml"); 692 if(!docFile.exists() && !docFile.createNewFile()) 680 693 { 681 694 _errorStatus = ERROR_DOC_XML_COULD_NOT_BE_CREATED; … … 687 700 bw.write("<!DOCTYPE Archive SYSTEM \"http://greenstone.org/dtd/Archive/1.0/Archive.dtd\">\n"); 688 701 bw.write("<Archive>\n"); 702 bw.write(" <Section>\n"); 703 bw.write(" <Description>\n"); 704 bw.write(" <Metadata name=\"Identifier\">" + oid + "</Metadata>\n"); 705 bw.write(" <Metadata name=\"dc.Title\">UNTITLED DOCUMENT</Metadata>\n"); 706 bw.write(" </Description>\n"); 707 bw.write(" <Content>\n"); 708 bw.write(" </Content>\n"); 709 bw.write(" </Section>\n"); 689 710 bw.write("</Archive>\n"); 690 711 bw.close(); 691 712 713 Document docXML = null; 692 714 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); 693 715 DocumentBuilder db = dbf.newDocumentBuilder(); … … 1831 1853 } 1832 1854 1833 protected static String generateOID()1834 {1835 return "temp";1836 }1837 1838 1855 public boolean copyDirectory(File src, File dest) 1839 1856 {
Note:
See TracChangeset
for help on using the changeset viewer.