|
| 1 | +/******************************************************************************** |
| 2 | + * Copyright (c) 2020 [Open Lowcode SAS](https://openlowcode.com/) |
| 3 | + * |
| 4 | + * This program and the accompanying materials are made available under the |
| 5 | + * terms of the Eclipse Public License 2.0 which is available at |
| 6 | + * http://www.eclipse.org/legal/epl-2.0 . |
| 7 | + * |
| 8 | + * SPDX-License-Identifier: EPL-2.0 |
| 9 | + ********************************************************************************/ |
| 10 | + |
| 11 | +package org.openlowcode.module.designer.design; |
| 12 | + |
| 13 | +import org.openlowcode.design.data.ChoiceField; |
| 14 | +import org.openlowcode.design.data.ChoiceValue; |
| 15 | +import org.openlowcode.design.data.DataObjectDefinition; |
| 16 | +import org.openlowcode.design.data.SimpleChoiceCategory; |
| 17 | +import org.openlowcode.design.data.StringField; |
| 18 | +import org.openlowcode.design.data.properties.basic.LinkedToParent; |
| 19 | +import org.openlowcode.design.data.properties.basic.Named; |
| 20 | +import org.openlowcode.design.data.properties.basic.Numbered; |
| 21 | +import org.openlowcode.design.data.properties.basic.NumberedForParent; |
| 22 | +import org.openlowcode.design.data.properties.basic.StoredObject; |
| 23 | +import org.openlowcode.design.data.properties.basic.SubObject; |
| 24 | +import org.openlowcode.design.data.properties.basic.Subtype; |
| 25 | +import org.openlowcode.design.data.properties.basic.SubtypeCompanion; |
| 26 | +import org.openlowcode.design.data.properties.basic.UniqueIdentified; |
| 27 | +import org.openlowcode.design.module.Module; |
| 28 | +import org.openlowcode.module.system.design.SystemModule; |
| 29 | + |
| 30 | +/** |
| 31 | + * Declaration of the designer module. The designer module is an interactive |
| 32 | + * tool to design an Open Lowcode module. This is an alternative to writing a |
| 33 | + * Module class by hand (such as this one ;-) ). |
| 34 | + * |
| 35 | + * @author <a href="https://openlowcode.com/" rel="nofollow">Open Lowcode |
| 36 | + * SAS</a> |
| 37 | + * |
| 38 | + */ |
| 39 | +public class DesignerModule |
| 40 | + extends |
| 41 | + Module { |
| 42 | + |
| 43 | + public DesignerModule() { |
| 44 | + super("DESIGNER", "D0", "Open Lowcode Designer", "org.openlowcode.module.designer", "Open Lowcode SAS", "0.1", |
| 45 | + "Welcome to Open Lowcode designer"); |
| 46 | + |
| 47 | + // --------------------------------------------------------------- |
| 48 | + // Module object definition |
| 49 | + // --------------------------------------------------------------- |
| 50 | + |
| 51 | + DataObjectDefinition module = new DataObjectDefinition("MODULEDEF", "Application Module", this); |
| 52 | + module.addProperties(new StoredObject()); |
| 53 | + UniqueIdentified moduleuniqueidentified = new UniqueIdentified(); |
| 54 | + module.addProperties(moduleuniqueidentified); |
| 55 | + module.addProperties(new Numbered()); |
| 56 | + module.addProperties(new Named()); |
| 57 | + module.addField(new StringField("CODE", "Code", |
| 58 | + "A unique two letters code to use as prefix for database objects", 2, StringField.INDEXTYPE_NONE)); |
| 59 | + module.addField(new StringField("PATH", "Path", "the java path of the module", 90, StringField.INDEXTYPE_NONE)); |
| 60 | + module.addField(new StringField("AUTHOR", "Author", "Author of the module", 90, StringField.INDEXTYPE_NONE)); |
| 61 | + module.addField(new StringField("VERSION", "Version", "Version of the module", 90, StringField.INDEXTYPE_NONE)); |
| 62 | + module.addField(new StringField("WELCOMEM", "Welcome Message", "Version of the module", 2550, |
| 63 | + StringField.INDEXTYPE_NONE)); |
| 64 | + |
| 65 | + // --------------------------------------------------------------- |
| 66 | + // Data Object definition |
| 67 | + // --------------------------------------------------------------- |
| 68 | + |
| 69 | + DataObjectDefinition object = new DataObjectDefinition("DATAOBJECTDEF", "Data Object", this); |
| 70 | + object.addProperty(new StoredObject()); |
| 71 | + object.addProperty(new UniqueIdentified()); |
| 72 | + object.addProperty(new Numbered()); |
| 73 | + object.addProperty(new Named("Label")); |
| 74 | + LinkedToParent<DataObjectDefinition> objectlinkedtoparentmodule = new LinkedToParent<DataObjectDefinition>( |
| 75 | + "PARENT", module); |
| 76 | + object.addProperty(objectlinkedtoparentmodule); |
| 77 | + object.addProperty(new NumberedForParent(objectlinkedtoparentmodule)); |
| 78 | + object.addField(new ChoiceField("FORCEHIDE", "Force Hide", |
| 79 | + "Even if the object is eligible for a search screen, the search screen is hidden from the module menu", |
| 80 | + SystemModule.getSystemModule().getBooleanChoice(), ChoiceField.INDEXTYPE_NONE)); |
| 81 | + |
| 82 | + // ------------------------------------------------------------------ |
| 83 | + // Property |
| 84 | + //------------------------------------------------------------------- |
| 85 | + |
| 86 | + // ------------ Definition of types of properties |
| 87 | + |
| 88 | + SimpleChoiceCategory propertytype = new SimpleChoiceCategory("PROPERTYTYPE",32); |
| 89 | + ChoiceValue PROPERTY_STOREDOBJECT = new ChoiceValue("STOREDOBJECT","Stored Object","stores the object on the database, valid for most objects except reports"); |
| 90 | + propertytype.addValue(PROPERTY_STOREDOBJECT); |
| 91 | + ChoiceValue PROPERTY_UNIQUEIDENTIFIED = new ChoiceValue("UNIQUEIDENTIFIED","Unique Identified","generates a unique id. Needed for most stored objects, except maybe some logs"); |
| 92 | + propertytype.addValue(PROPERTY_UNIQUEIDENTIFIED); |
| 93 | + ChoiceValue PROPERTY_LINKEDTOPARENT = new ChoiceValue("LINKEDTOPARENT","Linked to Parent","Links to exactly one object of the parent type."); |
| 94 | + propertytype.addValue(PROPERTY_LINKEDTOPARENT); |
| 95 | + |
| 96 | + this.addChoiceCategory(propertytype); |
| 97 | + |
| 98 | + // ----------- Definition of property object |
| 99 | + |
| 100 | + DataObjectDefinition property = new DataObjectDefinition("PROPERTYDEF","Property",this); |
| 101 | + property.addProperty(new StoredObject()); |
| 102 | + property.addProperty(new UniqueIdentified()); |
| 103 | + property.addProperty(new Numbered()); |
| 104 | + property.addProperty(new Subtype(propertytype)); |
| 105 | + property.addProperty(new LinkedToParent("PARENTFORDATAOBJECT", object)); |
| 106 | + DataObjectDefinition propertylinkedtoparent = new DataObjectDefinition("LINKEDTOPARENTDEF", "Linked to Parent", this); |
| 107 | + propertylinkedtoparent.addProperty(new StoredObject()); |
| 108 | + propertylinkedtoparent.addProperty(new SubtypeCompanion(property, new ChoiceValue[] {PROPERTY_LINKEDTOPARENT})); |
| 109 | + ; |
| 110 | + |
| 111 | + |
| 112 | + } |
| 113 | + |
| 114 | +} |
0 commit comments