⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 application_field.java

📁 java 写的一个新闻发布系统
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                                if (p instanceof JahiaUser) {                                    JahiaConsole.println("Application_Field.saveData","removed member=" + p.getName());                                    grp.removeMember(p);                                }                            }                            // then add auth users                            JahiaUser newMember = null;                            int size = authMembers.size();                            for ( int i=0 ; i<size ; i++ ){                                newMember = (JahiaUser)authMembers.get(i);                                grp.addMember(newMember);                            }                        }                        // Handle Groups                        if ( engineMap.get( "authGroups" + role ) != null ){                            JahiaConsole.println("Application_Field.saveData","authGroups is not null for role " + role);                            authMembers = (Vector)engineMap.get( "authGroups" + role );                            // first remove all groups members                            members = grp.members();                            Principal p = null;                            while( members.hasMoreElements() ){                                p = (Principal)members.nextElement();                                if (p instanceof Group) {                                    JahiaConsole.println("Application_Field.saveData","removed member=" + p.getName());                                    grp.removeMember((JahiaGroup)p);                                }                            }                            // then add auth groups                            JahiaGroup newMember = null;                            int size = authMembers.size();                            for ( int i=0 ; i<size ; i++ ){                                newMember = (JahiaGroup)authMembers.get(i);                                grp.addMember(newMember);                            }                        }                    }                }            }            Boolean flushApp = new Boolean(false);            if ( engineMap.get("flushApp") != null ){                flushApp = (Boolean) engineMap.get("flushApp");                if ( flushApp.booleanValue() ){                    HttpSession session = jParams.getRequest().getSession ();                    JahiaApplicationsDispatchingService dispatcher = ServicesRegistry.getInstance().getJahiaApplicationsDispatchingService();                    if (dispatcher != null) {                        dispatcher.flushAllSessionsCaches(session);                    }                }            }        }        return true;    } // end saveData    /***        * composes engine hash map        *        * @param        jParams             a ParamBean object        * @param        engineMap           the engine hashmap        * @param        theField            the field we are working on        * @return       true if everything went okay, false if not        *        */    private boolean composeEngineMap( ParamBean jParams, HashMap engineMap, JahiaField theField )    throws JahiaException    {        JahiaConsole.println("Application_Field.composeEngineMap","started");        // warns that application is being instanciated        // cannot use the field id to create a unique enginemap name,        // because can field id can change (in addcontainer mode, for example)        // so we use the field definition's name to create a unique enginemap name...        engineMap.put( "createApplication_" + theField.getDefinition().getName(), Boolean.TRUE );        String localSwitchUrl = "ReloadEngine('localswitch" + EngineParams.VALUE_TOKEN + "yes')";        engineMap.put( "localSwitchUrl", localSwitchUrl );        String dataSourceConnectUrl = "";        JahiaEngine dsEngine = (JahiaEngine) EnginesRegistry.getInstance().getEngine( "selectdatasource" );        dataSourceConnectUrl = dsEngine.renderLink( jParams, theField );        engineMap.put( "dataSourceConnectUrl", dataSourceConnectUrl );        String dataSourceIDUrl = "";        dsEngine = (JahiaEngine) EnginesRegistry.getInstance().getEngine( "viewdatasourceid" );        dataSourceIDUrl = dsEngine.renderLink( jParams, theField );        engineMap.put( "dataSourceIDUrl", dataSourceIDUrl );        // all apps        Vector appList = ServicesRegistry.getInstance().getJahiaApplicationsManagerService().getApplications();        // list of authorized apps        Vector authAppList = new Vector();        AppsShareService aps = ServicesRegistry.getInstance().getAppsShareService();        int size = appList.size();        ApplicationBean app =null;        JahiaSite ownerSite = null;        for (int i=0 ; i<size ; i++){            app = (ApplicationBean)appList.get(i);            if ( (app.getVisibleStatus()==1)            	  && ( app.isShared() || (app.getJahiaID() == jParams.getSiteID())                    || ( aps.getShare(jParams.getSite(),app) != null ) ) ){                if ( app.getJahiaID() != jParams.getSiteID() )                {                	// it's a shared component                	ownerSite = ServicesRegistry.getInstance().getJahiaSitesService().getSite(app.getJahiaID());                	if ( ownerSite != null ){                		app.setName(app.getName()+"-["+ownerSite.getServerName()+"]");                	}                }                authAppList.add(app);            }        }        if (authAppList == null) { authAppList = new Vector(); }        engineMap.put( "appList", authAppList.elements() );        Integer appID;        try {            appID = new Integer( (String)theField.getObject() );        } catch (NumberFormatException nfe) {            appID = new Integer(-1);        }        engineMap.put( "appID", appID );        // build the applications Manager url        String applicationManagerUrl = Applications_Engine.getInstance().renderLink(jParams, null);        engineMap.put("applicationManagerUrl", applicationManagerUrl);        // build the app download url        JahiaEngine downloadEngine      = (JahiaEngine) EnginesRegistry.getInstance().getEngine( "downloadapp" );        String appDownloadUrl = "";        if (downloadEngine != null) {            appDownloadUrl = downloadEngine.renderLink( jParams, null );        }        engineMap.put("appDownloadUrl",appDownloadUrl);        /* Hollis         * Why request application output when simply editing the field properties ?         * Doing so , we sometimes expect with an out of memory range exception ( random error )         * So I comment it .         */        //theField.setValue( FormDataManager.getInstance().formDecode(theField.getValue()) );        //theField.setValue( FormDataManager.getInstance().decode(theField.getValue()) );        boolean editable = false;        JahiaContainer theContainer = (JahiaContainer)engineMap.get("theContainer");        if ( theContainer == null ){            // in case of a field , not a field in a container            editable = true;        } else if ( theContainer.getListID()!=0 ){            JahiaBaseACL acl = JahiaEngineTools.getCtnListFieldACL((HashMap)engineMap.get("ctnListFieldAcls"), theField.getID());            if ( acl != null ){                editable = acl.getPermission(jParams.getUser(),JahiaBaseACL.WRITE_RIGHTS, jParams.getSiteID());            }        } else {            editable = true;        }        String output = "";        if ( editable ){            output = ServicesRegistry.getInstance().getJahiaFetcherService().fetchServlet( jParams, JSP_FILE );        } else {            output = ServicesRegistry.getInstance().getJahiaFetcherService().fetchServlet( jParams, READONLY_JSP );        }        engineMap.put( "fieldForm", output );        return true;    } // end composeEngineMap} // end Application_Field

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -