Changeset 116


Ignore:
Timestamp:
Apr 14, 2009, 10:16:05 PM (10 years ago)
Author:
gav
Message:

First commit of Inventory domain, including domain-classes, controllers, views and bootstrap. Also double check/adjust as required security extends in controllers.

Location:
trunk
Files:
105 added
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/Definitions/InventoryTerms.txt

    r115 r116  
    5959                - Of Class UnitOfMeasure.
    6060
    61     alternateItem
    62                 - An InventoryItem may have many alternateItems of Class AlternateItem.
     61    alternateItems
     62                - An InventoryItem may have many alternateItems of Class InventoryItem.
    6363                - Indicates that this InventoryItem has alternatives.
    6464
     
    6666                - An InventoryItem may have many assets that it is a spare for, of Class Asset.
    6767
    68     storedItem
     68    storedItems
    6969                - An InventoryItem may have many StoredItems of Class StoredItem.
    7070
    71     inventoryMovement
     71    inventoryMovements
    7272                - An InventoryItem may have many InventoryMovements of Class InventoryMovement.
    7373
    74     manufacturer
     74    manufacturers
    7575                - An InventoryItem may have many Manufacturers of the Class Manufacturer.
    7676
    77     supplier
     77    suppliers
    7878               - An InventoryItem may have many Suppliers of the Class Supplier.
    7979
     
    8282Calculate/Show total storedItems.
    8383
     84InventoryMovementType
     85    Initially one of "Used", "Received", "Repaired"
    8486
     87
  • trunk/doc/Definitions/TaskTerms.txt

    r113 r116  
    7373                - Of Class Person.
    7474
    75     primayAsset 
     75    primaryAsset 
    7676                - The primay asset that costs will be assigned to.
    7777                - Of Class Asset
     
    9292                - The parentTask value must be set in the subTask.
    9393
    94     associatedAsset   
     94    associatedAssets   
    9595                - A task may have many associatedAssets of Class Asset.
    9696                - No costs are assigned to these assets this is for reference purposes.
     97
     98    inventoryMovements
     99                - A task may have many inventoryMovements of Class InventoryMovement.
    97100
    98101
  • trunk/grails-app/conf/BootStrap.groovy

    r114 r116  
    3333        println "BootStrapping demo data..."
    3434   
    35         //TypeOfPersonGroup
     35//TypeOfPersonGroup
    3636        def personGroupTypeInstance
    3737        personGroupTypeInstance = new PersonGroupType(name:"Department")
     
    4242        BootStrapSaveAndTest(personGroupTypeInstance)
    4343   
    44         //PersonGroup
     44//PersonGroup
    4545        def personGroupInstance
    4646        personGroupInstance = new PersonGroup(personGroupType:PersonGroupType.findByName("Department"),
     
    6060        BootStrapSaveAndTest(personGroupInstance)
    6161
    62         //Authority
     62//Authority
    6363        def authInstance
    6464
     
    7575        BootStrapSaveAndTest(authInstance)
    7676           
    77         //Person
     77//Person
    7878        def passClearText = "pass"
    7979        def passwordEncoded = authenticateService.encodePassword(passClearText)
     
    149149        personInstance.addToPersonGroups(PersonGroup.findByName("Production"))
    150150
    151         //TaskGroup
     151//TaskGroup
    152152        def taskGroupInstance
    153153
     
    164164        BootStrapSaveAndTest(taskGroupInstance)
    165165
    166         //TaskStatus
     166//TaskStatus
    167167        def taskStatusInstance
    168168   
     
    176176        BootStrapSaveAndTest(taskStatusInstance)
    177177
    178         //TaskPriority
     178//TaskPriority
    179179        def taskPriorityInstance
    180180
     
    191191        BootStrapSaveAndTest(taskPriorityInstance)
    192192
    193         //TaskType
     193//TaskType
    194194        def taskTypeInstance
    195195
     
    209209        BootStrapSaveAndTest(taskTypeInstance)
    210210
    211         //Task
     211//Task
    212212        def taskInstance
    213213
     214        //Task #1
    214215        taskInstance = new Task(taskGroup:TaskGroup.findByName("Engineering Activites"),
    215216                 taskStatus:TaskStatus.findByName("Not Started"),
     
    221222        BootStrapSaveAndTest(taskInstance)
    222223
     224        //Task #2
    223225        taskInstance = new Task(taskGroup:TaskGroup.findByName("Engineering Activites"),
    224226                taskStatus:TaskStatus.findByName("Not Started"),
     
    231233        BootStrapSaveAndTest(taskInstance)
    232234
     235        //Task #3
    233236        taskInstance = new Task(taskGroup:TaskGroup.findByName("Engineering Activites"),
    234237                taskStatus:TaskStatus.findByName("Not Started"),
     
    241244        BootStrapSaveAndTest(taskInstance)
    242245
     246        //Task #4
    243247        taskInstance = new Task(taskGroup:TaskGroup.findByName("Engineering Activites"),
    244248                 taskStatus:TaskStatus.findByName("Not Started"),
     
    251255        BootStrapSaveAndTest(taskInstance)
    252256
     257        //Task #5
    253258        taskInstance = new Task(taskGroup:TaskGroup.findByName("Production Activites"),
    254259                 taskStatus:TaskStatus.findByName("Not Started"),
     
    260265        BootStrapSaveAndTest(taskInstance)
    261266
     267        //Task #6
    262268        taskInstance = new Task(taskGroup:TaskGroup.findByName("New Projects"),
    263269                 taskStatus:TaskStatus.findByName("Not Started"),
     
    269275        BootStrapSaveAndTest(taskInstance)
    270276
    271         //EntryType
     277//EntryType
    272278        def entryTypeInstance
    273279
     
    284290        BootStrapSaveAndTest(entryTypeInstance)
    285291
    286         //Entry
     292//Entry
    287293        def entryInstance
    288294
     295        //Entry #1
    289296        entryInstance = new Entry(enteredBy: Person.get(6),
    290297                                                    task: Task.get(1),
     
    294301        BootStrapSaveAndTest(entryInstance)
    295302
     303        //Entry #2
    296304        entryInstance = new Entry(enteredBy: Person.get(4),
    297305                                                    task: Task.get(1),
     
    301309        BootStrapSaveAndTest(entryInstance)
    302310
     311        //Entry #3
    303312        entryInstance = new Entry(enteredBy: Person.get(4),
    304313                                                    task: Task.get(1),
     
    308317        BootStrapSaveAndTest(entryInstance)
    309318
    310         //ModificationType
     319//ModificationType
    311320        def taskModificationTypeInstance
    312321        taskModificationTypeInstance = new TaskModificationType(name:"Created").save()
     
    320329        taskModificationTypeInstance = new TaskModificationType(name:"NameModified").save()
    321330   
    322         //AssignedPerson
     331//AssignedPerson
    323332        def assignedPersonInstance
    324333
     334        //AssignedPerson #1
    325335        assignedPersonInstance = new AssignedPerson(person: Person.get(4),
    326336                                                                                        task: Task.get(1),
     
    329339        BootStrapSaveAndTest(assignedPersonInstance)
    330340
     341        //AssignedPerson #2
    331342        assignedPersonInstance = new AssignedPerson(person: Person.get(5),
    332343                                                                                        task: Task.get(1),
     
    335346        BootStrapSaveAndTest(assignedPersonInstance)
    336347
    337 
    338         //Finally did it all work.       
     348//Site
     349        def siteInstance
     350
     351        siteInstance = new Site(name: "Commercial Site")
     352        BootStrapSaveAndTest(siteInstance)
     353
     354//Asset
     355        def assetInstance
     356
     357        assetInstance = new Asset(name: "RockCrusher1")
     358        BootStrapSaveAndTest(assetInstance)
     359
     360
     361//InventoryStore
     362        def inventoryStoreInstance = new InventoryStore(site: Site.get(1),
     363                                                                                            name: "Store #1")
     364        BootStrapSaveAndTest(inventoryStoreInstance)
     365
     366//StoreLocation
     367        def storeLocation = new StoreLocation(inventoryStore: InventoryStore.get(1),
     368                                                                            bin: "A1-2")
     369        BootStrapSaveAndTest(storeLocation)
     370
     371//UnitOfMeasure
     372        def unitOfMeasureInstance
     373
     374        unitOfMeasureInstance = new UnitOfMeasure(name: "each")
     375        BootStrapSaveAndTest(unitOfMeasureInstance)
     376
     377        unitOfMeasureInstance = new UnitOfMeasure(name: "meter(s)")
     378        BootStrapSaveAndTest(unitOfMeasureInstance)
     379
     380        unitOfMeasureInstance = new UnitOfMeasure(name: "box(es)")
     381        BootStrapSaveAndTest(unitOfMeasureInstance)
     382
     383        unitOfMeasureInstance = new UnitOfMeasure(name: "litre(s)")
     384        BootStrapSaveAndTest(unitOfMeasureInstance)
     385
     386        unitOfMeasureInstance = new UnitOfMeasure(name: "kilogram(s)")
     387        BootStrapSaveAndTest(unitOfMeasureInstance)
     388
     389//InventoryGroup
     390        def inventoryGroupInstance
     391
     392        inventoryGroupInstance = new InventoryGroup(name: "Misc")
     393        BootStrapSaveAndTest(inventoryGroupInstance)
     394
     395//InventoryType
     396        def inventoryTypeInstance
     397
     398        inventoryTypeInstance = new InventoryType(name: "Consumable")
     399        BootStrapSaveAndTest(inventoryTypeInstance)
     400
     401        inventoryTypeInstance = new InventoryType(name: "Repairable")
     402        BootStrapSaveAndTest(inventoryTypeInstance)
     403
     404//InventoryItem
     405        def inventoryItemInstance
     406
     407        inventoryItemInstance = new InventoryItem(inventoryGroup: InventoryGroup.get(1),
     408                                                                                    inventoryType: InventoryType.get(1),
     409                                                                                    unitOfMeasure: UnitOfMeasure.get(1),
     410                                                                                    name: "1051 Bearing",
     411                                                                                    reorderPoint: 0)
     412        BootStrapSaveAndTest(inventoryItemInstance)
     413
     414//StoredItem
     415        def storedItemInstance
     416
     417        storedItemInstance = new StoredItem(inventoryItem: InventoryItem.get(1),
     418                                                                            storeLocation: StoreLocation.get(1),
     419                                                                            quantity: 8)
     420        BootStrapSaveAndTest(storedItemInstance)
     421
     422//Finally did it all work.       
    339423        if(BootStrapDemoDataSuccessful) {
    340424            println "BootStrapping demo data...successful."
     
    342426        else println "BootStrapping demo data...failed."
    343427    }
    344    
     428
     429//Call this function instead of .save()
    345430    void BootStrapSaveAndTest(object) {
    346431        if(!object.save()) {
  • trunk/grails-app/controllers/AuthorityController.groovy

    r71 r116  
    11import org.codehaus.groovy.grails.plugins.springsecurity.Secured
    22
    3 @Secured(['ROLE_AppAdmin'])
    4 class AuthorityController {
     3class AuthorityController extends BaseAppAdminController {
    54
    65        // the delete, save and update actions only accept POST requests
  • trunk/grails-app/controllers/EntryController.groovy

    r74 r116  
    11import org.codehaus.groovy.grails.plugins.springsecurity.Secured
    22
    3 class EntryController extends BaseController {
     3class EntryController extends BaseAppAdminController {
    44   
    55    def index = { redirect(action:list,params:params) }
  • trunk/grails-app/controllers/EntryTypeController.groovy

    r74 r116  
    11import org.codehaus.groovy.grails.plugins.springsecurity.Secured
    22
    3 class EntryTypeController extends BaseController {
     3class EntryTypeController extends BaseAppAdminController {
    44   
    55    def index = { redirect(action:list,params:params) }
  • trunk/grails-app/controllers/PersonGroupController.groovy

    r74 r116  
    11import org.codehaus.groovy.grails.plugins.springsecurity.Secured
    22
    3 @Secured(['ROLE_AppAdmin'])
    4 class PersonGroupController extends BaseController {
     3class PersonGroupController extends BaseAppAdminController {
    54
    65    def index = { redirect(action:list,params:params) }
  • trunk/grails-app/controllers/PersonGroupTypeController.groovy

    r74 r116  
    11import org.codehaus.groovy.grails.plugins.springsecurity.Secured
    22
    3 @Secured(['ROLE_AppAdmin'])
    4 class PersonGroupTypeController extends BaseController {
     3class PersonGroupTypeController extends BaseAppAdminController {
    54
    65    def index = { redirect(action:list,params:params) }
  • trunk/grails-app/controllers/TaskGroupController.groovy

    r74 r116  
    11import org.codehaus.groovy.grails.plugins.springsecurity.Secured
    22
    3 class TaskGroupController extends BaseController {
     3class TaskGroupController extends BaseAppAdminController {
    44   
    55    def index = { redirect(action:list,params:params) }
  • trunk/grails-app/controllers/TaskModificationController.groovy

    r93 r116  
    11import org.codehaus.groovy.grails.plugins.springsecurity.Secured
    22
    3 class TaskModificationController extends BaseController {
     3class TaskModificationController extends BaseAppAdminController {
    44   
    55    def index = { redirect(action:list,params:params) }
  • trunk/grails-app/controllers/TaskModificationTypeController.groovy

    r93 r116  
    11import org.codehaus.groovy.grails.plugins.springsecurity.Secured
    22
    3 class TaskModificationTypeController extends BaseController {
     3class TaskModificationTypeController extends BaseAppAdminController{
    44   
    55    def index = { redirect(action:list,params:params) }
  • trunk/grails-app/controllers/TaskPriorityController.groovy

    r74 r116  
    11import org.codehaus.groovy.grails.plugins.springsecurity.Secured
    22
    3 class TaskPriorityController extends BaseController {
     3class TaskPriorityController extends BaseAppAdminController {
    44   
    55    def index = { redirect(action:list,params:params) }
  • trunk/grails-app/controllers/TaskStatusController.groovy

    r74 r116  
    11import org.codehaus.groovy.grails.plugins.springsecurity.Secured
    22
    3 class TaskStatusController extends BaseController {
     3class TaskStatusController extends BaseAppAdminController {
    44   
    55    def index = { redirect(action:list,params:params) }
  • trunk/grails-app/controllers/TaskTypeController.groovy

    r74 r116  
    11import org.codehaus.groovy.grails.plugins.springsecurity.Secured
    22
    3 class TaskTypeController extends BaseController {
     3class TaskTypeController extends BaseAppAdminController {
    44   
    55    def index = { redirect(action:list,params:params) }
  • trunk/grails-app/domain/EntryType.groovy

    r66 r116  
    77   
    88    static contstraints = {
     9        name(maxSize:50,unique:true,blank:false)
     10        description(maxSize:100)
    911    }
    1012
  • trunk/grails-app/domain/Task.groovy

    r106 r116  
    66    Task    parentTask
    77    Person leadPerson
     8    Asset primaryAsset
    89    String description
    910    String comment = ""
     
    1718                        taskModifications: TaskModification,
    1819                        assignedPersons: AssignedPerson,
    19                         subTasks: Task]
     20                        subTasks: Task,
     21                        associatedAssets: Asset,
     22                        inventoryMovements: InventoryMovement]
    2023
    2124    static belongsTo = [TaskGroup, TaskStatus, Task, Person]
     
    2932        parentTask(blank: true, nullable:true)
    3033        comment()
     34        primaryAsset(blank: true, nullable:true)
    3135       
    3236    }
  • trunk/grails-app/domain/TaskModificationType.groovy

    r93 r116  
    77
    88    static constraints = {
     9        name(maxSize:50,unique:true,blank:false)
     10        description(maxSize:100)
    911    }
    1012
  • trunk/grails-app/views/appCore/appAdmin.gsp

    r106 r116  
    1414                Warning!<br />
    1515                The pages bellow this line are for use by the application admin only and NOT for daily use.<br />
    16                 They allow direct administration of the back-end data, cascade deletion and updates may occur.<br />
     16                They allow direct administration of the back-end data, uncontrolled cascade deletion and updates may occur.<br />
    1717                The manager authorisation and pages should be used for normal daily use.<br />
    1818            </div>
  • trunk/grails-app/views/appCore/home.gsp

    r110 r116  
    99        <div class="nav">
    1010            <span class="menuButton"><g:link class="list" controller="taskDetailed" action="list">Tasks</g:link></span>
     11            <span class="menuButton"><g:link class="list" controller="inventoryItemDetailed" action="list">Inventory</g:link></span>
    1112
    1213        </div>
Note: See TracChangeset for help on using the changeset viewer.