Examples of IViewManagement


Examples of org.palo.viewapi.internal.IViewManagement

  }
 
  private final XDirectLinkData findPaloSuiteView(AuthUser authenticatedUser, String viewId, SimpleLogger log, XDirectLinkData data, ArrayList <ConnectionDescriptor> connections, String locale) {
    Account accountToUse = null;
    View viewToUse = null;
    IViewManagement mgmt = MapperRegistry.getInstance().getViewManagement();
    Account bestMatch = null;
    View bestView = null;
    View viewIdFound = null;
   
    log.debug("Listing all existing views:");
    try {
      for (View v: mgmt.listViews()) {
        log.debug("  " + v.getName() + " does it match?");
        if (checkPaloSuiteId(v, viewId, log)) {
          log.debug("   => it has the correct paloSuiteId, so go on... List accounts:");
          viewIdFound = v;
          for (Account acc: authenticatedUser.getAccounts()) {
View Full Code Here

Examples of org.palo.viewapi.internal.IViewManagement

 
  public String [] mayDelete(String sessionId, XObject xObj) throws SessionExpiredException {
    String type = xObj.getType();
    if (type.equals(XUser.TYPE)) {
      User user = getNative(sessionId, (XUser) xObj);
      IViewManagement viewManagement = MapperRegistry.getInstance().getViewManagement();
      try {
        List <View> allViews = viewManagement.findViews(user);       
        List <String> viewNames = new ArrayList<String>();
        if (!allViews.isEmpty()) {                   
          for (View v: allViews) {
            viewNames.add(v.getName());
          }
        }
       
        List <String> accountErrors = new ArrayList<String>();
        IAccountManagement accountManagement = MapperRegistry.getInstance().getAccountManagement();
        for (Account a: accountManagement.getAccounts(user.getId())) {
          allViews = viewManagement.findViews(a);
          for (View v: allViews) {
            Account acc = v.getAccount();
            Account replaceAccount = findReplaceAccount(sessionId, user, acc);
            if (replaceAccount == null) {
              accountErrors.add(v.getName());
            }                       
          }
        }
       
        if (!accountErrors.isEmpty()) {
          accountErrors.add(0, "_NO_ACCOUNT_ERROR_");
          return accountErrors.toArray(new String[0]);
        }
        return viewNames.toArray(new String[0]);
       
      } catch (SQLException e) {
        e.printStackTrace();
      }   
    } else if (type.equals(XAccount.TYPE)) {
      List <String> accountErrors = new ArrayList<String>();
      Account a = getNative(sessionId, (XAccount) xObj);     
      IViewManagement viewManagement = MapperRegistry.getInstance().getViewManagement();       
      try {
        List <View> allViews = viewManagement.findViews(a);
        for (View v: allViews) {
          Account acc = v.getAccount();
          Account replaceAccount = findReplaceAccount(sessionId, a.getUser(), acc);
          if (replaceAccount == null) {
            accountErrors.add(v.getName());
View Full Code Here

Examples of org.palo.viewapi.internal.IViewManagement

  public void delete(String sessionId, XObject xObj) throws DbOperationFailedException, SessionExpiredException {
    try {
      String type = xObj.getType();
      if (type.equals(XAccount.TYPE)) {
        Account a = getNative(sessionId, (XAccount) xObj);
        IViewManagement viewManagement = MapperRegistry.getInstance().getViewManagement();       
        try {
          List <View> allViews = viewManagement.findViews(a);
          ViewService viewService = ServiceProvider.getViewService(getLoggedInUser(sessionId));
          try {
            CubeViewReader.CHECK_RIGHTS = false;
            for (View v: allViews) {
              Account acc = v.getAccount();
              Account replaceAccount = findReplaceAccount(sessionId, a.getUser(), acc);
              if (replaceAccount != null && !v.getAccount().getId().equals(replaceAccount.getId())) {
                ((ViewImpl) v).setAccount(replaceAccount);
                viewService.save(v);
              }
            }
          } finally {
            CubeViewReader.CHECK_RIGHTS = true;
          }
        } catch (SQLException e) {
          e.printStackTrace();
        }
        delete(sessionId, getNative(sessionId, (XAccount) xObj));
      }
      else if (type.equals(XConnection.TYPE))
        delete(sessionId, getNative(sessionId, (XConnection) xObj));
      else if (type.equals(XGroup.TYPE))
        delete(sessionId, getNative(sessionId, (XGroup) xObj));
      else if (type.equals(XRole.TYPE))
        delete(sessionId, getNative(sessionId, (XRole) xObj));
      else if (type.equals(XUser.TYPE)) {
        User user = getNative(sessionId, (XUser) xObj);
        IViewManagement viewManagement = MapperRegistry.getInstance().getViewManagement();
        try {
          try {
            IFolderManagement folders = MapperRegistry.getInstance().
              getFolderManagement();         
            AuthUser aUser = ServiceProvider.getAuthenticationService().authenticateHash(user.getLoginName(),
                user.getPassword());
            List <ExplorerTreeNode> nodes = folders.reallyGetFolders(aUser);
            for (ExplorerTreeNode nd: nodes) {
              folders.delete(nd);
            }
          } catch (SQLException e) {
            e.printStackTrace();
          } catch (AuthenticationFailedException e) {
            e.printStackTrace();
          }       
          List <View> allViews = viewManagement.findViews(user);
          ViewService viewService = ServiceProvider.getViewService(getLoggedInUser(sessionId));
          // At this point, the user has agreed to map all his views to admin...
          if (!viewManagement.findViews(user).isEmpty()) {           
            User adminUser = getLoggedInUser(sessionId);
            try {
              CubeViewReader.CHECK_RIGHTS = false;
              for (View v: allViews) {                           
                viewService.setOwner(adminUser, v);
                viewService.save(v);
              }
            } finally {
              CubeViewReader.CHECK_RIGHTS = true;
            }
          }
          IAccountManagement accountManagement = MapperRegistry.getInstance().getAccountManagement();
          for (Account a: accountManagement.getAccounts(user.getId())) {
            allViews = viewManagement.findViews(a);
            try {                 
              CubeViewReader.CHECK_RIGHTS = false;
              for (View v: allViews) {
                Account acc = v.getAccount();
                Account replaceAccount = findReplaceAccount(sessionId, user, acc);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.