Package com.nexirius.framework.datamodel

Examples of com.nexirius.framework.datamodel.DataModel


        }
    }

    public void createChildren(DataModel parent, ArrayModel children) {
        if (children.getSize() > 0) {
            DataModel model = children.getDataModel(0);
            DatabaseTableMapping mapping = JdbcConnectionHandler.instance().getDatabaseTableMapping(model.getClass().getName());
            try {
                mapping.createChildren(children);
            } catch (Exception e) {
                e.printStackTrace()//TODO
            }
View Full Code Here


    public void delete(DataModelVector v) {

        DataModelEnumeration en = v.getEnumeration();

        while (en.hasMore()) {
            DataModel model = en.next();
            DatabaseTableMapping mapping = JdbcConnectionHandler.instance().getDatabaseTableMapping(model.getClass().getName());
            try {
                mapping.delete(model);
            } catch (Exception e) {
                e.printStackTrace()//TODO
            }
View Full Code Here

     */
    public DataModel read(Class cl, String id) {
        try {
            XFile dir = getDirectory(cl);
            XFile file = new XFile(dir.getPath(), id);
            DataModel ret = (DataModel) cl.newInstance();
            ret.dropData(new String(file.getBytes()));
            ret.setInstanceName(id);
            return ret;
        } catch (Exception ex) {
            ex.printStackTrace();
        }

View Full Code Here

        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

    public void update(DataModel model) {
        if (model instanceof ArrayModel) {
            DataModelEnumeration en = model.getEnumeration();

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

                if (child.getInstanceName() == null) {
                    create(child);
                } else {
                    update(child);
                }
            }
View Full Code Here

    public void updateChildren(DataModel parent, ArrayModel children) {
        DataModelEnumeration en = children.getEnumeration();

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

            if (child.getInstanceName() == null) {
                child.setChildText(ITeamPersistence.FOREIGN_KEY, parent.getInstanceName());
                create(child);
            } else {
                update(child);
            }
        }
View Full Code Here

        }

        DataModelEnumeration en = children.getEnumeration();

        while (en.hasMore()) {
            DataModel model = en.next();
            model.setChildText(ITeamPersistence.FOREIGN_KEY, parent.getInstanceName());
            create(model);
        }
    }
View Full Code Here

    public void deleteMember(MemberModel member) {
        AddressArrayModel addresses = member.getAddresses();
        DataModelEnumeration en = addresses.getEnumeration();

        while (en.hasMore()) {
            DataModel model = en.next();
            FilePersistence.getInstance().delete(model);
        }

        PhoneArrayModel phones = member.getPhones();
        DataModelEnumeration en1 = phones.getEnumeration();
        while (en1.hasMore()) {
            DataModel model = en1.next();
            FilePersistence.getInstance().delete(model);
        }

        FilePersistence.getInstance().delete(member.getPerson());
        FilePersistence.getInstance().delete(member);
View Full Code Here

                    command = application.getDefaultHTMLCommand(sessionVariable.getEvent());
                }

                if (command != null) {
                    if (command.requiresMapping()) {
                        DataModel actModel = sessionVariable.getActState().getModel();

                        if (actModel != null) {
                            mapRequestParametersToModel(request, actModel);
                        }
                    }

                    try {
                        FWLog.debug("execute command " + command.getClass());
                        doSwitchState = command.execute(sessionVariable);

                        // do not try to create a response, if the command handles the response itself
                        if (command.handlesResponse()) {
                            return;
                        }
                    } catch (Exception e) {
                        application.handleException(sessionVariable, e);
                    }
                }

                if (doSwitchState) {
                    HTMLTransition defaultTransition = application.getDefaultHTMLTransition(sessionVariable.getEvent());
                    HTMLState targetState = defaultTransition == null ? null : defaultTransition.getTargetState();

                    if (BackButtonHTMLFunction.BACK_EVENT.equals(sessionVariable.getEvent())) {
                        targetState = sessionVariable.getActState();
                        FWLog.debug("targetState = " + targetState.getName());
                    }

                    if (targetState == null) {
                        sessionVariable.doStateTransition();
                    } else {
                        sessionVariable.getStateMachine().setActState(targetState);
                    }

                    String childName = sessionVariable.getChild();

                    if (childName != null) {
                        if (oldState.getModel() != null) {

                            try {
                                DataModel child = oldState.getModel().getChild(childName);

                                sessionVariable.getActState().setModel(child);

                                if (sessionVariable.getDuplicate()) {
                                    sessionVariable.getActState().startDuplicatePopup();
                                }
                            } catch (Exception e) {
                                //ignore
                            }
                        }
                    }
                }

                actState = sessionVariable.getActState();

                DataModel actModel = actState.getModel();

                FWLog.debug("ACT MODEL = " + (actModel == null ? "null" : actModel.getFieldName()));

                sessionVariable.storeActState();
                sessionVariable.getResolver().getVariableStore().setVariable(VariableStore.STATE, actState.getName());
                sessionVariable.getResolver().getVariableStore().setVariable(VariableStore.REQUEST_URL, request.getRequestURL().toString());
View Full Code Here

                continue;
            }

            // check whether child is a BooleanModel
            try {
                DataModel child = actModel.getChild(parameterName);

                if (child instanceof BooleanModel) {
                    ((BooleanModel) child).setBoolean(true);
                } else {
                    actModel.setChildText(parameterName, value);
View Full Code Here

TOP

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

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.