chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1362683 - in /chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/resources: PropertyDefinitions.txt TypeDefinitions.txt TypesXmlGenerator.groovy
Date Tue, 17 Jul 2012 22:08:27 GMT
Author: jens
Date: Tue Jul 17 22:08:27 2012
New Revision: 1362683

URL: http://svn.apache.org/viewvc?rev=1362683&view=rev
Log:
move example types sources to a better place

Added:
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/resources/PropertyDefinitions.txt
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/resources/TypeDefinitions.txt
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/resources/TypesXmlGenerator.groovy

Added: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/resources/PropertyDefinitions.txt
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/resources/PropertyDefinitions.txt?rev=1362683&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/resources/PropertyDefinitions.txt
(added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/resources/PropertyDefinitions.txt
Tue Jul 17 22:08:27 2012
@@ -0,0 +1,660 @@
+#property definitions
+string
+Artist
+artist;sap
+Artist
+single, readwrite, optional, true, true
+
+string
+Album
+album;sap
+title
+single, readwrite, optional, true, true
+
+string
+Title
+title;sap
+Title
+single, readwrite, optional, true, true
+
+string
+Comment
+comment;sap
+Comment
+single, readwrite, optional, false, false
+
+string
+Genre
+genre;sap
+Genre
+single, readwrite, optional, true, true
+
+integer
+Length
+length;sap
+Length in seconds
+single, readwrite, optional, false, false
+
+integer
+Track
+track;sap
+Track in album
+single, readwrite, optional, true, true
+
+string
+Year
+year;sap
+release date of albun
+single, readwrite, optional, true, true
+
+string
+Composer
+composer;sap
+Composer
+single, readwrite, optional, true, true
+
+string
+Disc Number
+discNo;sap
+number of disc / total discs
+single, readwrite, optional, false, false
+
+string
+Audio Format
+audioFormat;sap
+Audio Format / compression scheme
+single, readwrite, optional, false, false
+
+integer
+Sample Rate
+sampleRate;sap
+Sample Rate
+single, readwrite, optional, false, false
+
+string enum: Mono=Mono;Stereo=Stereo;5.1=5.1;7.1=7.1
+Audio Channel Type
+audioChannelType;sap
+audio channel type
+single, readwrite, optional, false, false
+
+integer
+Number Channels
+noChannels;sap
+number of audio channels
+single, readwrite, optional, false, false
+
+string
+Compressor Version
+compressorVersion;sap
+version description of compressor
+single, readwrite, optional, false, false
+
+string
+Message Recipient Address
+messageRecipientAddress;sap
+Message Recipient Address
+single, readwrite, optional, true, true
+
+string
+From
+from;sap
+sender of message
+single, readwrite, optional, true, true
+
+string
+To
+to;sap
+recipients of message
+multi, readwrite, optional, true, true
+
+string
+Cc
+cc;sap
+carbon copy recipients of message
+multi, readwrite, optional, true, true
+
+string
+Bcc
+bcc;sap
+blind carbon copy recipients of message
+multi, readwrite, optional, false, false
+
+string
+Subject
+subject;sap
+subjet of message
+single, readwrite, optional, true, true
+
+datetime
+Creation Date
+creationDate;sap
+Creation Date
+single, readwrite, optional, false, false
+
+datetime
+Last Save Date
+lastSaveDate;sap
+Last Save Date
+single, readwrite, optional, false, false
+
+integer
+Image Width
+imageWidth;sap;0x0100
+Image Width
+single, oncreate, optional, false, false
+
+integer
+Image Height
+imageHeight;sap;0x0101
+Image Height
+single, oncreate, optional, false, false
+
+integer
+Bits Per Sample
+bitsPerSample;0x0102
+Bits Per Sample
+single, oncreate, optional, false, false
+
+integer enum: 1=Uncompressed;2=CCITT 1D;3=T4/Group 3 Fax;4=T6/Group 4 Fax;5=LZW;6=JPEG (old-style);7=JPEG;8=Adobe
Deflate;9=JBIG BW;10=JBIG Color;99=JPEG;262=Kodak 262;32766=Next;32767=Sony ARW Compressed;32769=Packed
RAW;32770=Samsung SRW Compressed;32771=CCIRLEW;32773=PackBits;32809=Thunderscan;32867=Kodak
KDC Compressed;32895=IT8CTPAD;32896=IT8LW;32897=IT8MP;32898=IT8BL;32908=PixarFilm;32909=PixarLog;32946=Deflate;32947=DCS;34661=JBIG;34676=SGILog;34677=SGILog24;34712=JPEG
2000;34713=Nikon NEF Compressed;34715=JBIG2 TIFF FX;34718=Microsoft Document Imaging (MDI)
Binary Level Codec;34719=Microsoft Document Imaging (MDI) Progressive Transform Codec;34720=Microsoft
Document Imaging (MDI) Vector;65000=Kodak DCR Compressed;65535=Pentax PEF Compressed
+Compression
+compression;sap;0x0103
+Compression Format
+single, oncreate, optional, false, false
+
+integer enum: 0=WhiteIsZero;1=BlackIsZero;2=RGB;3=RGB Palette;4=Transparency Mask;5=CMYK;6=YCbCr;8=CIELab;9=ICCLab;10=ITULab;32803=Color
Filter Array;32844=Pixar LogL;32845=Pixar LogLuv;34892=Linear Raw
+Photometric Interpretation
+photometricInterpretation;0x0106
+Color Format
+single, oncreate, optional, false, false
+
+string
+Image Description
+imageDescription;sap;0x010e
+Description
+single, readwrite, optional, true, true
+	 
+string
+Make
+make;sap;0x010f
+Camera Make
+single, readwrite, optional, true, true
+
+string
+Model
+model;sap;0x0110
+Camera Model
+single, readwrite, optional, true, true
+
+integer enum: 1=Horizontal (normal);2=Mirror horizontal;3=Rotate 180;4=Mirror vertical;5=Mirror
horizontal and rotate 270 CW;6=Rotate 90 CW;7=Mirror horizontal and rotate 90 CW;8=Rotate
270 CW
+Orientation
+orientation;sap;0x0112
+Orientation
+single, readwrite, optional, false, false
+
+decimal
+X Resolution
+xResolution;sap;0x011a
+xresolution
+single, readwrite, optional, false, false
+
+decimal
+Y Resolution
+yResolution;0x011b
+yresolution
+single, readwrite, optional, false, false
+
+integer enum: 1=None;2=inches;3=cm
+Resolution Unit
+resolutionUnit;sap;0x0128
+Resolution Unit
+single, readwrite, optional, false, false
+
+string
+Software
+software;sap;0x0131
+Software
+single, readwrite, optional, false, false
+
+datetime
+Modify Date
+dateTime;sap;0x0132
+Modify Date
+single, readwrite, optional, false, false
+
+string
+Artist
+artist;sap;0x013b
+Artist
+single, readwrite, optional, true, true
+
+integer enum: 1=Centered;2=Co-sited
+YCbCrPositioning
+yCbCrPositioning;sap;0x0213
+YCbCr Positioning
+single, readwrite, optional, false, false
+
+string
+Copyright
+copyright;sap;0x8298
+Copyright Notice
+single, readwrite, optional, false, false
+
+decimal
+Exposure Time
+exposureTime;sap;0x829a
+Exposure Time
+single, oncreate, optional, false, false
+
+decimal
+F Number
+fNumber;sap;0x829d
+F-Stop Number
+single, oncreate, optional, false, false
+
+integer enum: 0=Not Defined;1=Manual;2=Program AE;3=Aperture-priority AE;4=Shutter speed
priority AE;5=Creative (Slow speed);6=Action (High speed);7=Portrait;8=Landscape;9=Bulb
+Exposure Program
+exposureProgram;sap;0x8822
+Exposure Program
+single, oncreate, optional, false, false
+
+integer
+ISO Speed
+isoSpeed;sap;0x8827
+ISO Speed Setting
+single, oncreate, optional, true, true
+
+decimal
+GPS Latitude
+gpsLatitude;sap;0x8825-0x0002
+GPS Latitude
+single, readwrite, optional, true, true
+
+string	enum: N=North;S=South
+GPS Latitude Ref
+gpsLatitudeRef;sap;0x8825-0x0001
+GPS Latitude Reference (N/S)
+single, readwrite, optional, true, true
+
+decimal
+GPS Longitude
+gpsLongitude;sap;0x8825-0x0004
+GPS Longitude
+single, readwrite, optional, true, true
+
+string enum: E=East;W=West
+GPS Longitude Ref
+gpsLongitudeRef;sap;0x8825-0x0003
+GPS Longitude Reference (W/E)
+single, readwrite, optional, true, true
+
+decimal
+GPS Altitude
+gpsAltitude;sap;0x8825-0x0006
+GPS Altitude
+single, readwrite, optional, true, true
+
+string enum: 0=Above Sea Level;1=Below Sea Level
+GPS Altitude Ref
+gpsAltitudeRef;sap;0x8825-0x0005
+GPS Altitude Reference
+single, readwrite, optional, true, true
+
+integer
+Self Timer Mode
+selfTimerMode;sap;0x882b
+Self Timer Mode
+single, readwrite, optional, false, false
+
+integer
+Time Zone Offset
+timeZoneOffset;sap;0x882a
+Time Zone Offset (GMT offset in hours)
+multi, readwrite, optional, false, false
+	
+datetime
+Date Time Original
+dateTimeOriginal;sap;0x9003
+date/time when original image was taken
+single, readwrite, optional, false, false
+
+datetime
+Create Date
+createDate;0x9004
+date/time digitized
+single, readwrite, optional, true, true
+
+decimal
+Shutter Speed Value
+shutterSpeedValue;sap;0x9201
+shutter speed value
+single, readwrite, optional, false, false
+
+decimal
+Aperture Value
+apertureValue;sap;0x9202
+Aperture Value
+single, readwrite, optional, false, false
+
+decimal
+Brightness Value
+brightnessValue;sap;0x9203
+Brightness Value
+single, readwrite, optional, false, false
+
+decimal
+Exposure Compensation
+exposureCompensation;sap;0x9204
+Exposure Compensation
+single, readwrite, optional, false, false
+
+decimal
+Max Aperture Value 	
+maxApertureValue;sap;0x9205
+Max Aperture Value 	
+single, readwrite, optional, false, false
+
+integer enum:0=Unknown;1=Average;2=Center-weighted average;3=Spot;4=Multi-spot;5=Multi-segment;6=Partial;255=Other
+Metering Mode
+meteringMode;sap;0x9207
+metering mode
+single, readwrite, optional, false, false
+
+decimal
+Subject Distance
+subjectDistance;sap;0x9206
+subject distance
+single, readwrite, optional, false, false
+
+integer
+Light Source
+lightSource;sap;0x9208
+light source value
+single, readwrite, optional, false, false
+
+integer
+Flash
+flash;sap;0x9209
+Flash Setting
+single, readwrite, optional, false, false
+
+decimal
+Focal Length
+focalLength;sap;0x920a
+focal length
+single, readwrite, optional, true, true
+
+string 
+User Comment
+userComment;sap;0x9286
+user comment
+single, readwrite, optional, true, true
+
+integer enum: 1=sRGB;2=Adobe RGB;65533=Wide Gamut RGB;65534=ICC Profile;65535=Uncalibrated
+Color Space
+colorSpace;sap;0xa001
+color space
+single, readwrite, optional, false, false
+
+integer
+PixelXDimension
+pixelXDimension;sap;0xa002
+dimension in pixel x
+single, readwrite, optional, false, false
+
+integer
+PixelYDimension
+pixelYDimension;sap;0xa003 
+dimension in pixel y
+single, readwrite, optional, false, false
+
+integer enum: 0=Auto;1=Manual;2=Auto bracket
+Exposure Mode
+exposureMode;sap;0xa402
+Exposure Mode
+single, readwrite, optional, false, false
+
+integer enum: 0=Auto;1=Manual
+White Balance
+whiteBalance;sap;0xa403
+white balance
+single, readwrite, optional, false, false
+
+integer enum: 0=Standard;1=Landscape;2=Portrait;3=Night
+Scene Capture Type
+sceneCaptureType;sap;0xa406
+Scene Capture Type
+single, readwrite, optional, false, false
+
+id
+Image Unique Id
+imageUniqueId;sap;0xa420
+Image Unique Id
+single, readwrite, optional, false, false
+
+string
+Owner Name
+ownerName;sap;0xa430
+Owner Name
+single, readwrite, optional, true, true
+
+string
+Serial Number
+serialNumber;sap;0xa431
+serial number
+single, readwrite, optional, true, true
+
+integer
+Rating
+rating;sap;0x4746
+rating value
+single, readwrite, optional, false, false
+
+integer
+Rating Percent
+ratingPercent;sap;0x4749
+rating percent
+single, readwrite, optional, false, false
+
+integer
+Data Precision
+dataPrecision;sap;0x0000
+JPEG Data Precision
+single, readwrite, optional, false, false
+
+string
+Application Name
+applicationName;sap
+Application Name
+single, readwrite, optional, true, true
+
+string
+Application Version
+applicationVersion;sap
+Application Version
+single, readwrite, optional, false, false
+
+string
+Author
+author;sap
+Author
+single, readwrite, optional, true, true
+
+string
+Category
+category;sap
+Category
+single, readwrite, optional, true, true
+
+string
+Content Status
+contentStatus;sap
+Content Status
+single, readwrite, optional, false, false
+
+string
+Comments
+comments;sap
+Comments
+single, readwrite, optional, true, true
+
+string
+Company
+company;sap
+Company
+single, readwrite, optional, true, true
+
+string
+Keywords
+keywords;sap
+Keywords
+multiple, readwrite, optional, true, true
+
+string
+Last Author
+lastAuthor;sap
+Last Author
+single, readwrite, optional, false, false
+
+string
+Manager
+manager;sap
+Manager
+single, readwrite, optional, false, false
+
+string
+Notes
+notes;sap
+Notes
+single, readwrite, optional, false, false
+
+string
+Presentation Format
+presentationFormat;sap
+Presentation Format
+single, readwrite, optional, false, false
+
+string
+Revision Number
+revisionNumber;sap
+Revision Number
+single, readwrite, optional, false, false
+
+string
+Template
+template;sap
+Template
+single, readwrite, optional, false, false
+
+string
+Version
+version;sap
+Version
+single, readwrite, optional, false, false
+
+integer
+Character Count
+characterCount;sap
+Character Count
+single, readwrite, optional, false, false
+
+integer
+Character Count With Spaces
+characterCountWithSpaces;sap
+Character Count With Spaces
+single, readwrite, optional, false, false
+
+integer
+Word Count
+wordCount;sap
+Word Count
+single, readwrite, optional, false, false
+
+integer
+Line Count
+lineCount;sap
+Line Count
+single, readwrite, optional, false, false
+
+integer
+Page Count
+pageCount;sap
+Page Count
+single, readwrite, optional, true, true
+
+integer
+Slide Count
+slideCount;sap
+Slide Count
+single, readwrite, optional, true, true
+
+integer
+Paragraph Count
+paragraphCount;sap
+Paragraph Count
+single, readwrite, optional, false, false
+
+string
+Total Time
+totalTime;sap
+Total Time
+single, readwrite, optional, false, false
+
+string
+Edit Time
+editTime;sap
+Edit Time
+single, readwrite, optional, false, false
+
+datetime
+Last Save Date
+lastSaveDate;sap
+Last Save Date
+single, readwrite, optional, false, false
+
+string
+Last Printed
+lastPrinted;sap
+Last Printed
+single, readwrite, optional, false, false
+
+integer
+No Pages
+noPages;sap
+number of pages in document
+single, readwrite, optional, false, false
+
+string
+Creator
+creator;sap
+creator of document
+single, readwrite, optional, true, true
+
+string
+Keywords
+keywords;sap
+keywords of document
+multi, readwrite, optional, true, true
+
+string
+Producer
+producer;sap
+producer of document
+single, readwrite, optional, false, false
+
+datetime
+Created Date
+createdDate;sap
+creation date of document
+single, readwrite, optional, false, false
+
+datetime
+Modified Date
+modifiedDate;sap
+date of last modification
+single, readwrite, optional, false, false
+
+string
+Trapped
+trapped;sap
+trapped
+single, readwrite, optional, false, false

Added: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/resources/TypeDefinitions.txt
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/resources/TypeDefinitions.txt?rev=1362683&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/resources/TypeDefinitions.txt
(added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/resources/TypeDefinitions.txt
Tue Jul 17 22:08:27 2012
@@ -0,0 +1,139 @@
+#EXIF type definition http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html
+document
+audioFile;sap
+Audio File
+Audio Content (compressed or uncompressed)
+    Artist
+    Album
+    Title
+    Comment
+    Genre
+    Length
+    Track
+    Year
+    Composer
+    Disc Number
+    Audio Format
+    Sample Rate
+    Audio Channel Type
+    Number Channels
+    Compressor Version
+
+document
+emailDocument;sap
+Email Document
+Document of type Email
+    From
+    To
+    Cc
+    Bcc
+    Subject
+    Message Recipient Address
+    Creation Date
+    Last Save Date
+
+document
+exifImage;sap
+EXIF Image
+Image with EXIF tags
+    Image Width
+    Image Height
+    Bits Per Sample
+    Compression
+    Photometric Interpretation
+    Image Description
+    Make
+    Model
+    Orientation
+    X Resolution
+    Y Resolution
+    Resolution Unit
+    Software
+    Modify Date
+    Artist
+    YCbCrPositioning
+    Copyright
+    Exposure Time
+    F Number
+    Exposure Program
+    ISO Speed
+    GPS Latitude
+    GPS Latitude Ref
+    GPS Longitude
+    GPS Longitude Ref
+    GPS Altitude
+    GPS Altitude Ref
+    Self Timer Mode
+    Time Zone Offset
+    Date Time Original
+    Create Date
+    Shutter Speed Value
+    Aperture Value
+    Brightness Value
+    Exposure Compensation
+    Max Aperture Value 	
+    Metering Mode
+    Subject Distance
+    Light Source
+    Flash
+    Focal Length
+    User Comment
+    Color Space
+    PixelXDimension
+    PixelYDimension
+    Exposure Mode
+    White Balance
+    Scene Capture Type
+    Image Unique Id
+    Owner Name
+    Serial Number
+    Rating
+    Rating Percent
+    Data Precision
+
+document
+officeDocument;sap
+Office Document
+Document of type Office
+    Application Name
+    Application Version
+    Author
+    Category
+    Content Status
+    Comments
+    Company
+    Keywords
+    Last Author
+    Manager
+    Notes
+    Presentation Format
+    Revision Number
+    Template
+    Version
+    Character Count
+    Character Count With Spaces
+    Word Count
+    Line Count
+    Page Count
+    Slide Count
+    Paragraph Count
+    Total Time
+    Edit Time
+    Creation Date
+    Last Save Date
+    Last Printed
+
+document
+pdfDocument;sap
+PDF Document
+Document of type PDF
+    No Pages
+    Title
+    Author
+    Creator
+    Keywords
+    Producer
+    Subject
+    Created Date
+    Modified Date
+    Trapped

Added: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/resources/TypesXmlGenerator.groovy
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/resources/TypesXmlGenerator.groovy?rev=1362683&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/resources/TypesXmlGenerator.groovy
(added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/resources/TypesXmlGenerator.groovy
Tue Jul 17 22:08:27 2012
@@ -0,0 +1,379 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////
+// 
+// Groovy script to generate a types.xml file from a text file in 
+// a simplified syntax
+// This script expects two files names TypeDefinitions.txt and 
+// PropertyDefinitions.txt in the same directory and generates
+// file types.xml that can be imported into the InMemoryServer
+// 
+////////////////////////////////////////////////////////////////////////
+
+def genCommons1(name, id, descr) {
+    def id1 = id
+    def localName = name
+    def ns = ""
+    
+    // allow syntax name;localName;namespace in property name line
+    if (id.contains(";")) {
+        names = id.tokenize(";")
+        if (names.size() > 0)
+            id1 = names[0];
+        if (names.size() > 1)
+            localName = names[1];
+        if (names.size() > 2)
+            ns = names[2];
+    }
+	outFile.println("        <id>" + id1 + "</id>")
+	outFile.println("        <localName>" + localName + "</localName>")
+	outFile.println("        <displayName>" + name + "</displayName>")
+	outFile.println("        <queryName>" + name.replaceAll(" ", "_").toUpperCase() +
"</queryName>")
+	outFile.println("        <description>" + descr + "</description>")
+	outFile.println("        <localNamespace>" + ns + "</localNamespace>")
+}
+
+//////////////////////////////////////////////////////////////////
+
+def genCommons2(choices, cardinality, updatability, required, queryable, orderable) {
+    def cardinalityStr 
+    def updatabilityStr
+    def requiredStr
+    def queryableStr
+    def orderableStr
+    
+    if (updatability.toLowerCase().startsWith("readonly"))  
+        updatabilityStr = "readonly"
+    else if (updatability.toLowerCase().startsWith("oncreate"))  
+        updatabilityStr = "oncreate"
+    else if (updatability.toLowerCase().startsWith("whencheckedout"))  
+        updatabilityStr = "whencheckedout"
+    else
+        updatabilityStr = "readwrite"
+    
+    if (required.toLowerCase().startsWith("true"))
+        requiredStr = "true"
+    else
+        requiredStr = "false"
+
+        if (cardinality.toLowerCase().startsWith("multi"))
+        cardinalityStr = "multi"
+    else
+        cardinalityStr = "single"
+    
+    if (queryable.toLowerCase().startsWith("true"))
+        queryableStr = "true"
+    else
+        queryableStr = "false"
+
+    if (orderable.toLowerCase().startsWith("true"))
+        orderableStr = "true"
+    else
+        orderableStr = "false"
+
+	outFile.println("        <cardinality>" +  cardinalityStr + "</cardinality>")
+	outFile.println("        <updatability>" + updatabilityStr + "</updatability>")
+	outFile.println("        <inherited>false</inherited>")
+	outFile.println("        <required>" + requiredStr + "</required>")
+	outFile.println("        <queryable>" + queryableStr + "</queryable>")
+	outFile.println("        <orderable>" + orderableStr + "</orderable>")
+    outFile.println("        <openChoice>false</openChoice>")
+	if (null != choices) 
+	    genChoices(choices)
+}
+
+//////////////////////////////////////////////////////////////////
+
+def genBoolean (name, uuid, descr, choices, cardinality, updatability, required, queryable,
orderable) {
+	outFile.println("    <propertyBooleanDefinition>")
+	genCommons1(name, uuid, descr)
+	outFile.println("        <propertyType>boolean</propertyType>")
+	genCommons2(choices, cardinality, updatability, required, queryable, orderable)
+	outFile.println("    </propertyBooleanDefinition>")
+}
+
+//////////////////////////////////////////////////////////////////
+
+def genDate (name, uuid, descr, choices, cardinality, updatability, required, queryable,
orderable) {
+	outFile.println("    <propertyDateTimeDefinition>")
+	genCommons1(name, uuid, descr)
+	outFile.println("        <propertyType>datetime</propertyType>")
+	genCommons2(choices, cardinality, updatability, required, queryable, orderable)
+	outFile.println("    </propertyDateTimeDefinition>")
+}
+
+//////////////////////////////////////////////////////////////////
+
+def genId (name, uuid, descr, choices, cardinality, updatability, required, queryable, orderable)
{
+	outFile.println("    <propertyIdDefinition>")
+	genCommons1(name, uuid, descr)
+	outFile.println("        <propertyType>id</propertyType>")
+	genCommons2(choices, cardinality, updatability, required, queryable, orderable)
+	outFile.println("    </propertyIdDefinition>")
+}
+ 
+45//////////////////////////////////////////////////////////////////
+
+def genInteger (name, uuid, descr, choices, cardinality, updatability, required, queryable,
orderable) {
+	outFile.println("    <propertyIntegerDefinition>")
+	genCommons1(name, uuid, descr)
+	outFile.println("        <propertyType>integer</propertyType>")
+	genCommons2(choices, cardinality, updatability, required, queryable, orderable)
+	outFile.println("    </propertyIntegerDefinition>")
+}
+
+//////////////////////////////////////////////////////////////////
+
+def genString (name, uuid, descr, choices, cardinality, updatability, required, queryable,
orderable) {
+	outFile.println("    <propertyStringDefinition>")
+	genCommons1(name, uuid, descr)
+	outFile.println("        <propertyType>string</propertyType>")
+	genCommons2(choices, cardinality, updatability, required, queryable, orderable)
+	outFile.println("    </propertyStringDefinition>")
+}
+
+//////////////////////////////////////////////////////////////////
+
+def genDecimal (name, uuid, descr, choices, cardinality, updatability, required, queryable,
orderable) {
+	outFile.println("    <propertyDecimalDefinition>")
+	genCommons1(name, uuid, descr)
+	outFile.println("        <propertyType>decimal</propertyType>")
+	genCommons2(choices, cardinality, updatability, required, queryable, orderable)
+	outFile.println("    </propertyDecimalDefinition>")
+}
+
+//////////////////////////////////////////////////////////////////
+
+def genChoices (choices) {
+	   choices.each {
+	     keyValue = it.tokenize("=")
+		 String key = keyValue.get(0).trim()
+		 String value = keyValue.get(1).trim()
+		 // println("Found enum with key: " + key + " value: " + value)
+         outFile.println("        <choice displayName=\"" + value + "\">")
+         outFile.println("            <value>" + key + "</value>")
+         outFile.println("        </choice>")
+	   }
+}
+
+//////////////////////////////////////////////////////////////////
+
+def genTypeDef (name, id, descr, typeKind, parentType, props) {
+
+    String xsiType
+    String baseId
+    
+    switch (typeKind) {
+        case "document":
+          xsiType = "cmisTypeDocumentDefinitionType"
+          baseId = "cmis:document"
+          break;
+        case "folder":
+          xsiType = "cmisTypeFolderDefinitionType"
+          baseId = "cmis:folder"
+          break;
+        default:
+           println("Error illegal type: " + typeKind)
+    }
+    if (parentType == null)
+      parentType = baseId
+      
+    def id1 = id
+    def localName = name
+    def ns = ""
+    
+    // allow syntax name;localName;namespace in property name line
+    if (id.contains(";")) {
+        names = id.tokenize(";")
+        if (names.size() > 0)
+            id1 = names[0];
+        if (names.size() > 1)
+            localName = names[1];
+            ns = names[2];
+    }
+
+	outFile.println("<cmisra:type xsi:type=\"" + xsiType + "\">")
+    outFile.println("    <id>" + id1 + "</id>")
+	outFile.println("    <localName>" + localName + "</localName>")
+	outFile.println("    <localNamespace>ns</localNamespace>")
+	outFile.println("    <parentId>" + parentType + "</parentId>")
+	outFile.println("    <displayName>" + name + "</displayName>")
+	outFile.println("    <queryName>" +  name.replaceAll(" ", "_").toUpperCase() + "</queryName>")
+	outFile.println("    <description>" + descr + "</description>")
+	outFile.println("    <baseId>" + baseId + "</baseId>")
+	outFile.println("    <creatable>true</creatable>")
+	outFile.println("    <fileable>true</fileable>")
+	outFile.println("    <queryable>true</queryable>")
+	outFile.println("    <fulltextIndexed>true</fulltextIndexed>")
+	outFile.println("    <includedInSupertypeQuery>true</includedInSupertypeQuery>")
+	outFile.println("    <controllablePolicy>false</controllablePolicy>")
+	outFile.println("    <controllableACL>true</controllableACL>")
+    if (typeKind == "document") {
+        outFile.println("    <versionable>false</versionable>")
+        outFile.println("    <contentStreamAllowed>allowed</contentStreamAllowed>")
+    }
+    if (props != null)
+        props.each { 
+            def propDef = propDefsMap.get(it)
+            if (propDef != null)
+                genPropertyDef (propDef.type, propDef.name, propDef.id, propDef.descr, propDef.choices,

+                   propDef.cardinality, propDef.updatability, propDef.required, propDef.queryable,
propDef.orderable)
+             else
+                println ("Error: unknown property definition " + it + " in type definition
" + name)
+        }
+	outFile.println("</cmisra:type>")
+    outFile.println()
+    outFile.flush()    
+}
+
+//////////////////////////////////////////////////////////////////
+
+def genPropertyDef(type, name, uuid, descr, choices, cardinality, updatability, required,
queryable, orderable) {
+        
+    switch (type) {
+     case "boolean":
+       genBoolean(name, uuid, descr, choices, cardinality, updatability, required, queryable,
orderable)
+       break
+     case "datetime":
+       genDate(name, uuid, descr, choices, cardinality, updatability, required, queryable,
orderable)
+       break
+     case "id":
+       genId(name, uuid, descr, choices, cardinality, updatability, required, queryable,
orderable)
+       break
+     case "integer":
+       genInteger(name, uuid, descr, choices, cardinality, updatability, required, queryable,
orderable)
+       break
+     case "string":
+       genString(name, uuid, descr, choices, cardinality, updatability, required, queryable,
orderable)
+       break
+     case "decimal":
+       genDecimal(name, uuid, descr, choices, cardinality, updatability, required, queryable,
orderable)
+       break
+     default:
+       println("!!!Error: unknown property type " + type);
+    }
+    
+}
+
+//////////////////////////////////////////////////////////////////
+
+def readPropertiesFile(inputFile) {    
+    def propDefMap = [:]
+    def inFile = new File(inputFile).newReader() 
+    
+    while (inFile.readLine() != null) {   
+       def typeLine = inFile.readLine()
+       def name = inFile.readLine().trim()
+       println("Processing property: " + name + " type: " + typeLine)
+       def id = inFile.readLine().trim()
+       println("   id: " + id)
+       def descr = inFile.readLine().trim()
+       def attrs = inFile.readLine().trim()
+       def choices = null;
+       def cardinality, updatability, required, queryable, orderable
+       
+
+       type = typeLine.tokenize().get(0)
+       def arr = attrs.split(",")
+       cardinality = arr.length > 0 ? arr[0].trim() : null
+       updatability = arr.length > 1 ? arr[1].trim() : null
+       required = arr.length > 2 ? arr[2].trim() : null
+       queryable = arr.length > 2 ? arr[3].trim() : "false"
+       orderable = arr.length > 2 ? arr[4].trim() : "false"
+       
+       if (typeLine.contains("enum:")) {
+           choices = typeLine[typeLine.indexOf("enum:")+ 5..typeLine.length()-1].tokenize(";")
+       }
+       propDefMap.put(name, [name:name, id:id, descr:descr, type:type, choices:choices, cardinality:cardinality,
+               updatability:updatability, required:required, queryable:queryable, orderable:orderable])
+    }
+    
+    return propDefMap;  
+}
+
+//////////////////////////////////////////////////////////////////
+
+def readTypeDefinitions(inputFile) {
+    def typeDefMap = [:]
+    def inReader = new File(inputFile).newReader() 
+    // def inReader = new StringReader(typeDefInput)
+    def line = inReader.readLine()
+    while (line != null) {   
+       def kind = inReader.readLine().trim()
+       def idLine = inReader.readLine().trim()
+       def name = inReader.readLine().trim()
+       def descr = inReader.readLine().trim()
+       def arr = idLine.split(":")
+       def id = arr.length>0 ? arr[0].trim() : null
+       def superType = arr.length>1 ? arr[1].trim() : null
+
+       def propDefs = []
+       def readProperties = true;
+       while (readProperties) {
+           line = inReader.readLine()
+           if (line != null && line.size() > 0) 
+               propDefs.push(line.trim())
+           else
+              readProperties = false;
+       }
+       println("Reading type def " + name)
+       typeDefMap.put(name, [name: name, id: id, kind: kind, super: superType, descr: descr,
props: propDefs])
+    }
+    return typeDefMap
+}
+
+//////////////////////////////////////////////////////////////////
+
+def writeTypes(typeDefsMap) {
+    outFile.println("<chem:typeDefinitions xmlns=\"http://docs.oasis-open.org/ns/cmis/core/200908/\"")
+    outFile.println("     xmlns:cmisra=\"http://docs.oasis-open.org/ns/cmis/restatom/200908/\"")
+    outFile.println("     xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"")
+    outFile.println("     xmlns:chem=\"http://chemistry.apache.org/schemas/TypeDefnitions\">")
+    for ( e in typeDefsMap   ) {
+        println("generating type" +  e.value.name)  
+        genTypeDef (e.value.name, e.value.id, e.value.descr, e.value.kind, e.value.super,
e.value.props) 
+    }
+    outFile.println("</chem:typeDefinitions>")
+}
+
+//////////////////////////////////////////////////////////////////
+
+def writePropDefs(propDefsMap) {
+    for ( e in propDefsMap   ) {
+        println("generating property" +  e.value.name)  
+        
+        genPropertyDef (e.value.type, e.value.name, e.value.id, e.value.descr, e.value.choices,
+            e.value.cardinality, e.value.updatability, e.value.required) 
+    }
+}
+
+//////////////////////////////////////////////////////////////////
+//  Main program
+
+println("Starting...")
+
+outFile = new File("types.xml").newPrintWriter()
+typeDefsMap = readTypeDefinitions("TypeDefinitions.txt")
+propDefsMap = readPropertiesFile("PropertyDefinitions.txt")
+      
+outFile.println("<!-- Generated Output file with type definitions. Do not edit! -->")
+writeTypes(typeDefsMap)
+outFile.close()
+println("...Done.")



Mime
View raw message