Package com.nexirius.framework.datamodel

Examples of com.nexirius.framework.datamodel.DataModelVector


public class ArrayModelXmlGenerator implements IXmlGenerator {
    public static final String DATA_MODEL = "DataModel";
    public static final String ARRAY_MODEL = "ArrayModel";

    public void generateXml(DataModelXmlGenerator generator, OutputStream out, DataModel model) throws IOException {
        DataModelVector children = model.getChildren();
        DataModelEnumeration en = children.getEnumeration();

        generator.startTag(out, ARRAY_MODEL, model.getFieldName());
        generator.newLine(out);
        generator.incrementIndent();
        while(en.hasMore()) {
View Full Code Here


public class StructModelXmlGenerator implements IXmlGenerator {
    public static final String STRUCT_MODEL = "StructModel";

    public void generateXml(DataModelXmlGenerator generator, OutputStream out, DataModel model) throws IOException {
        DataModelVector children = model.getChildren();
        DataModelEnumeration en = children.getEnumeration();

        generator.startTag(out, STRUCT_MODEL, model.getFieldName());
        generator.newLine(out);
        generator.incrementIndent();
        while(en.hasMore()) {
View Full Code Here

     * checkboxes which have been created with the $!select() command
     *
     * @return
     */
    public DataModelVector getSelectedChildren() {
        DataModelVector ret = new DataModelVector();
        DataModel parentModel = getActModel();

        FWLog.debug("selectedChildren " + selectedChildren);
        FWLog.debug("parentModel " + parentModel.getFieldName());

        if (selectedChildren == null) {
            return ret;
        }

        for (String childName = selectedChildren.firstItem(); childName != null; childName = selectedChildren.nextItem())
        {
            try {
                ret.append(parentModel.getChild(childName));
            } catch (Exception e) {
                //ignore
                e.printStackTrace();
            }
        }
View Full Code Here

        public boolean requiresMapping() {
            return true;
        }

        public boolean execute(HTMLSessionVariable sessionVariable) throws Exception {
            DataModelVector selectedChildren = sessionVariable.getSelectedChildren();
            DataModelEnumeration en = selectedChildren.getEnumeration();

            while (en.hasMore()) {
                DataModel model = en.next();

                PersistenceManager.remove(model);
View Full Code Here

    }

    public static void save(ItemArrayModel array) throws Exception {
        DatabaseTableMapping m = JdbcConnectionHandler.instance().getDatabaseTableMapping(ItemModel.class.getName());
        DataModelEnumeration en = array.getEnumeration();
        DataModelVector remove = new DataModelVector();

        while (en.hasMore()) {
            ItemModel model = (ItemModel) en.next();

            if (model.getFlag(ModelFlag.DELETED)) {
                if (model.getInstanceName() == null) {
                    m.delete(model);
                }

                remove.append(model);
            } else {
                if (model.getInstanceName() == null) {
                    m.create(model);
                } else {
                    m.update(model);
                }
            }
        }

        for (DataModel model = remove.firstItem(); model != null; model = remove.nextItem()) {
            array.removeItem(model);
        }
    }
View Full Code Here

        return true;
    }
    //Method that defines that actual command and should return true if the transition
    //it could be mapped into should take place.
    public boolean execute(HTMLSessionVariable sessionVariable) throws Exception {
        DataModelVector selectedChildren = sessionVariable.getSelectedChildren();
        DataModelEnumeration en = selectedChildren.getEnumeration();

        while (en.hasMore()) {
            MainModel mainModel = ((MainModel) sessionVariable.getApplicationModel());

            DataModel model = en.next();
View Full Code Here

     * @param propertyName  the field name of the field which is used to reduce the hits (e.g. foreign key) can be null to access all items
     * @param propertyValue the value of the specified field (or null)
     * @return always returns a valid vector (which can be empty)
     */
    public SortedVector getAll(Class cl, String propertyName, String propertyValue) {
        SortedVector ret = new DataModelVector();
        try {
            XFile dir = getDirectory(cl);
            StringVector files = dir.getFiles(false); // get the list of all the files in this directory
            for (String id = files.firstItem(); id != null; id = files.nextItem()) {
                DataModel model = (DataModel) cl.newInstance(); //create a new instance of the given type
                XFile file = new XFile(dir.getPath(), id);
                model.dropData(new String(file.getBytes()));
                model.setInstanceName(id);
                if (propertyValue == null || propertyValue.equals(model.getChildText(propertyName))) {
                    ret.addElement(model);
                }
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
View Full Code Here

     * selected (assotiated tab appears)
     */
    public void dataModelGrabFocus(DataModelEvent event) {
        if (isCreated() && event.fromChild()) {
            DataModel child = null;
            DataModelVector transmitter = event.getTransmitterVector();

            if (transmitter.size() != 2) {

                return;
            }

            child = transmitter.lastItem();

            if (child != null) {
                child = transmitter.previousItem();
            }

            if (child == null) {

                return;
View Full Code Here

     * selected (assotiated tab appears)
     */
    public void dataModelGrabFocus(DataModelEvent event) {
        if (isCreated() && event.fromChild()) {
            DataModel child = null;
            DataModelVector transmitter = event.getTransmitterVector();

            if (transmitter.size() > 1) {
                child = transmitter.getItem(1);
            } else {

                return;
            }

View Full Code Here

        return null;
    }

    public DataModelEnumeration getNotSaved() {
        DataModelVector v = new DataModelVector();
        Iterator iter = environments.getEnvironments().iterator();

        while (iter.hasNext()) {
            DirectoryEnvironment de = (DirectoryEnvironment) iter.next();

            de.getNotSaved(v);
        }

        return v.getEnumeration();
    }
View Full Code Here

TOP

Related Classes of com.nexirius.framework.datamodel.DataModelVector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.