Package org.ejbca.core.model.ra.raadmin

Examples of org.ejbca.core.model.ra.raadmin.AdminPreference


  /**
   * Method that returns the admin's preferences and updates it if necessary.
   */
  @Transient
  public AdminPreference getAdminPreference() {
    AdminPreference returnval = new AdminPreference();
    returnval.loadData(getData());
    return returnval;
  }
View Full Code Here


    public String getBaseUrl(){return globalconfiguration.getBaseUrl(requestServerName);}
    public String getReportsPath(){return globalconfiguration.getReportsPath();}

    /* Returns the current admins preference */
    public AdminPreference getAdminPreference() throws Exception{
      AdminPreference returnval = adminspreferences.getAdminPreference(certificatefingerprint);
      if(returnval==null) {
        returnval = currentadminpreference;
      }
      return returnval;
    }
View Full Code Here

     *             error
     */
    public void test01AddAdminPreference() throws Exception {
        log.trace(">test01AddAdminPreference()");
        Admin administrator = new Admin(Admin.TYPE_CACOMMANDLINE_USER);
        AdminPreference pref = new AdminPreference();
        pref.setPreferedLanguage(1);
        pref.setTheme("TEST");
        boolean ret = this.raAdminSession.addAdminPreference(administrator, user, pref);
        assertTrue("Adminpref for " + user + " should not exist", ret);
        ret = this.raAdminSession.addAdminPreference(administrator, user, pref);
        assertFalse("Adminpref for " + user + " should exist", ret);
        log.trace("<test01AddAdminPreference()");
View Full Code Here

     *             error
     */
    public void test02ModifyAdminPreference() throws Exception {
        log.trace(">test02ModifyAdminPreference()");
        Admin administrator = new Admin(Admin.TYPE_CACOMMANDLINE_USER);
        AdminPreference pref = this.raAdminSession.getAdminPreference(administrator, user);
        assertTrue("Error Retreiving Administrator Preference.", pref.getPreferedLanguage() == 1);
        assertTrue("Error Retreiving Administrator Preference.", pref.getTheme().equals("TEST"));
        pref.setPreferedLanguage(2);
        boolean ret = this.raAdminSession.changeAdminPreference(administrator, user, pref);
        assertTrue("Adminpref for " + user + " should exist", ret);
        pref = this.raAdminSession.getAdminPreference(administrator, user);
        assertEquals(pref.getPreferedLanguage(), 2);
        String newuser = genRandomUserName();
        ret = this.raAdminSession.changeAdminPreference(administrator, newuser, pref);
        assertFalse("Adminpref for " + newuser + " should not exist", ret);
        log.trace("<test02ModifyAdminPreference()");
    }
View Full Code Here

    this.administrator = administrator;
  }

  /** Retrieves the admin from the database or null if the admin doesn't exists. */
  public AdminPreference getAdminPreference(String certificatefingerprint) {
    AdminPreference returnvalue=null;
    try {
      returnvalue = raadminsession.getAdminPreference(administrator, certificatefingerprint);
    } catch(Exception e) {
    }
    return returnvalue;
View Full Code Here

    @Override
    public AdminPreference getAdminPreference(Admin admin, String certificatefingerprint) {
        if (log.isTraceEnabled()) {
            log.trace(">getAdminPreference()");
        }
        AdminPreference ret = null;
        AdminPreferencesData apdata = AdminPreferencesData.findById(entityManager, certificatefingerprint);
        if (apdata != null) {
            ret = apdata.getAdminPreference();
        }
        if (log.isTraceEnabled()) {
View Full Code Here

    @Override
    public AdminPreference getDefaultAdminPreference(Admin admin) {
        if (log.isTraceEnabled()) {
            log.trace(">getDefaultAdminPreference()");
        }
        AdminPreference ret = null;
        AdminPreferencesData apdata = AdminPreferencesData.findById(entityManager, DEFAULTUSERPREFERENCE);
        if (apdata != null) {
            ret = apdata.getAdminPreference();
        } else {
            try {
                // Create new configuration
                AdminPreferencesData newapdata = new AdminPreferencesData(DEFAULTUSERPREFERENCE, new AdminPreference());
                entityManager.persist(newapdata);
                ret = newapdata.getAdminPreference();
            } catch (Exception e) {
                throw new EJBException(e);
            }
View Full Code Here

TOP

Related Classes of org.ejbca.core.model.ra.raadmin.AdminPreference

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.