Index: trunk/grails-app/services/AssetService.groovy
===================================================================
--- trunk/grails-app/services/AssetService.groovy	(revision 429)
+++ trunk/grails-app/services/AssetService.groovy	(revision 688)
@@ -5,4 +5,6 @@
 
     boolean transactional = false
+
+    def sessionFactory
 
     def assetSubItemService
@@ -235,3 +237,119 @@
     } // end saveCopySrvce
 
+    /**
+    * Create recommended extended attributes for all assets.
+    */
+    def createRecommendedExtendedAttributes() {
+        def result = [:]
+
+        def hibernateSession = sessionFactory.currentSession
+
+        def assets = Asset.list()
+        def locationDescription = ExtendedAttributeType.get(5)
+        def ecr = ExtendedAttributeType.get(9)
+        def assetNumber = ExtendedAttributeType.get(17)
+        def assetCondition = ExtendedAttributeType.get(16)
+        def maintenancePercentComplete = ExtendedAttributeType.get(13)
+        def registrationRequired = ExtendedAttributeType.get(14)
+        def registrationExpiryDate =  ExtendedAttributeType.get(15)
+        def regulatoryRequirement = ExtendedAttributeType.get(12)
+        def riskLevel = ExtendedAttributeType.get(10)
+        def safeWorkProcedure = ExtendedAttributeType.get(11)
+
+        for(asset in assets) {
+
+            def attributeTypes = asset.assetExtendedAttributes.collect {it.extendedAttributeType}
+
+            //AssetExtendedAttribute
+            def assetExtendedAttributeInstance
+
+            if(!attributeTypes.contains(locationDescription)) {
+                //AssetExtendedAttribute #1
+                assetExtendedAttributeInstance = new AssetExtendedAttribute(value: "Not Specified",
+                                                                                                                    asset: asset,
+                                                                                                                    extendedAttributeType: locationDescription)
+                assetExtendedAttributeInstance.save()
+            }
+
+            if(!attributeTypes.contains(ecr)) {
+                //AssetExtendedAttribute #2
+                assetExtendedAttributeInstance = new AssetExtendedAttribute(value: "Not Specified",
+                                                                                                                    asset: asset,
+                                                                                                                    extendedAttributeType: ecr)
+                assetExtendedAttributeInstance.save()
+            }
+
+            if(!attributeTypes.contains(assetNumber)) {
+                //AssetExtendedAttribute #3
+                assetExtendedAttributeInstance = new AssetExtendedAttribute(value: "Not Specified",
+                                                                                                                    asset: asset,
+                                                                                                                    extendedAttributeType: assetNumber)
+                assetExtendedAttributeInstance.save()
+            }
+
+            if(!attributeTypes.contains(assetCondition)) {
+                //AssetExtendedAttribute #4
+                assetExtendedAttributeInstance = new AssetExtendedAttribute(value: "Not Specified",
+                                                                                                                    asset: asset,
+                                                                                                                    extendedAttributeType: assetCondition)
+                assetExtendedAttributeInstance.save()
+            }
+
+            if(!attributeTypes.contains(maintenancePercentComplete)) {
+                //AssetExtendedAttribute #5
+                assetExtendedAttributeInstance = new AssetExtendedAttribute(value: "TBA",
+                                                                                                                    asset: asset,
+                                                                                                                    extendedAttributeType: maintenancePercentComplete)
+                assetExtendedAttributeInstance.save()
+            }
+
+            if(!attributeTypes.contains(registrationRequired)) {
+                //AssetExtendedAttribute #6
+                assetExtendedAttributeInstance = new AssetExtendedAttribute(value: "Not Specified",
+                                                                                                                    asset: asset,
+                                                                                                                    extendedAttributeType: registrationRequired)
+                assetExtendedAttributeInstance.save()
+            }
+
+            if(!attributeTypes.contains(registrationExpiryDate)) {
+                //AssetExtendedAttribute #7
+                assetExtendedAttributeInstance = new AssetExtendedAttribute(value: "Not Specified",
+                                                                                                                    asset: asset,
+                                                                                                                    extendedAttributeType:registrationExpiryDate)
+                assetExtendedAttributeInstance.save()
+            }
+
+            if(!attributeTypes.contains(regulatoryRequirement)) {
+                //AssetExtendedAttribute #8
+                assetExtendedAttributeInstance = new AssetExtendedAttribute(value: "Not Specified",
+                                                                                                                    asset: asset,
+                                                                                                                    extendedAttributeType: regulatoryRequirement)
+                assetExtendedAttributeInstance.save()
+            }
+
+            if(!attributeTypes.contains(riskLevel)) {
+                //AssetExtendedAttribute #9
+                assetExtendedAttributeInstance = new AssetExtendedAttribute(value: "Not Specified",
+                                                                                                                    asset: asset,
+                                                                                                                    extendedAttributeType: riskLevel)
+                assetExtendedAttributeInstance.save()
+            }
+
+            if(!attributeTypes.contains(safeWorkProcedure)) {
+                //AssetExtendedAttribute #10
+                assetExtendedAttributeInstance = new AssetExtendedAttribute(value: "Not Specified",
+                                                                                                                    asset: asset,
+                                                                                                                    extendedAttributeType: safeWorkProcedure)
+                assetExtendedAttributeInstance.save()
+            }
+
+            hibernateSession.flush()
+
+        } // for
+
+        // Success.
+        return result
+
+    } // createRecommendedExtendedAttributes()
+
 } // end class
