Package org.apache.cayenne.configuration

Examples of org.apache.cayenne.configuration.DataChannelDescriptor


                break;
            }
        }

        // check for duplicates in other DataMaps
        DataChannelDescriptor domain = entity.getDataMap().getDataChannelDescriptor();
        if (domain != null) {
            for (DataMap nextMap : domain.getDataMaps()) {
                if (nextMap == map) {
                    continue;
                }

                ObjEntity conflictingEntity = nextMap.getObjEntity(name);
View Full Code Here


        }

        final ProjectController c = getProjectController();

        final Object src = this;
        final DataChannelDescriptor domain = (DataChannelDescriptor) getProjectController()
                .getProject()
                .getRootNode();
        final DataNodeDescriptor node = getProjectController().getCurrentDataNode();

        final ModelMergeDelegate delegate = new ModelMergeDelegate() {
View Full Code Here

        application.getUndoManager().addEdit(
                new CreateNodeUndoableEdit(application, node));
    }

    public void createDataNode(DataNodeDescriptor node) {
        DataChannelDescriptor domain = (DataChannelDescriptor) getProjectController()
                .getProject()
                .getRootNode();
        domain.getNodeDescriptors().add(node);
        getProjectController().fireDataNodeEvent(
                new DataNodeEvent(this, node, MapEvent.ADD));
        getProjectController().fireDataNodeDisplayEvent(
                new DataNodeDisplayEvent(this, domain, node));
    }
View Full Code Here

    /**
     * Creates a new DataNode, adding to the current domain, but doesn't send any events.
     */
    public DataNodeDescriptor buildDataNode() {
        ProjectController mediator = getProjectController();
        DataChannelDescriptor domain = (DataChannelDescriptor) mediator
                .getProject()
                .getRootNode();

        // use domain name as DataNode base, as node names must be unique across the
        // project...
View Full Code Here

        DataMap map = eventController.getCurrentDataMap();

        // search for matching map name across domains, as currently they have to be
        // unique globally
        DataChannelDescriptor dataChannelDescriptor = (DataChannelDescriptor) Application
                .getInstance()
                .getProject()
                .getRootNode();

        DataMap matchingMap = dataChannelDescriptor.getDataMap(newName);

        if (matchingMap != null && !matchingMap.equals(map)) {

            // there is an entity with the same name
            throw new ValidationException("There is another DataMap named '"
View Full Code Here

            if (content != null && currentObject != null) {

                PasteCompoundUndoableEdit undoableEdit = new PasteCompoundUndoableEdit();

                DataChannelDescriptor domain = (DataChannelDescriptor) getProjectController()
                        .getProject()
                        .getRootNode();
                DataMap map = getProjectController().getCurrentDataMap();

                if (content instanceof List) {
View Full Code Here

     * Helper method that updates domain properties. If a value equals to default, null
     * value is used instead.
     */
    protected void setDomainProperty(String property, String value, String defaultValue) {

        DataChannelDescriptor domain = (DataChannelDescriptor) projectController
                .getProject()
                .getRootNode();

        if (domain == null) {
            return;
        }

        // no empty strings
        if ("".equals(value)) {
            value = null;
        }

        // use NULL for defaults
        if (value != null && value.equals(defaultValue)) {
            value = null;
        }

        Map properties = domain.getProperties();
        Object oldValue = properties.get(property);
        if (!Util.nullSafeEquals(value, oldValue)) {
            properties.put(property, value);

            DomainEvent e = new DomainEvent(this, domain);
View Full Code Here

        }
    }

    public String getDomainProperty(String property, String defaultValue) {

        DataChannelDescriptor domain = (DataChannelDescriptor) projectController
                .getProject()
                .getRootNode();

        if (domain == null) {
            return null;
        }

        String value = (String) domain.getProperties().get(property);
        return value != null ? value : defaultValue;
    }
View Full Code Here

    /**
     * Invoked on domain selection event. Updates view with the values from the currently
     * selected domain.
     */
    public void currentDomainChanged(DomainDisplayEvent e) {
        DataChannelDescriptor domain = e.getDomain();
        if (null == domain) {
            return;
        }

        // extract values from the new domain object
        name.setText(domain.getName());

        cacheSize.setText(getDomainProperty(
                DataRowStore.SNAPSHOT_CACHE_SIZE_PROPERTY,
                Integer.toString(DataRowStore.SNAPSHOT_CACHE_SIZE_DEFAULT)));

View Full Code Here

                MapQueryCacheFactory.class.getName()));
    }

    void setDomainName(String newName) {

        DataChannelDescriptor dataChannelDescriptor = (DataChannelDescriptor) Application
                .getInstance()
                .getProject()
                .getRootNode();

        if (Util.nullSafeEquals(dataChannelDescriptor.getName(), newName)) {
            return;
        }

        if (newName == null || newName.trim().length() == 0) {
            throw new ValidationException("Enter name for DataDomain");
        }

        Preferences prefs = projectController.getPreferenceForDataDomain();

        DomainEvent e = new DomainEvent(
                this,
                dataChannelDescriptor,
                dataChannelDescriptor.getName());
        dataChannelDescriptor.setName(newName);

        RenamedPreferences.copyPreferences(newName, prefs);
        projectController.fireDomainEvent(e);
    }
View Full Code Here

TOP

Related Classes of org.apache.cayenne.configuration.DataChannelDescriptor

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.