Package org.openswing.swing.table.permissions.java

Examples of org.openswing.swing.table.permissions.java.GridPermissions


   * @return GridPermissions object, built starting from user roles for the specified grid identifier
   * @throws Throwable throwed if fetching operation does not correctly accomplished
   */
  public GridPermissions getUserGridPermissions(String functionId,ArrayList userRoles,String[] columnAttributes,boolean[] columnsVisibility,boolean[] columnEditableInInsert,boolean[] columnsEditableInEdit,boolean[] columnsMandatory) throws Throwable{
    ClientApplet applet = ( (ApplicationClientFacade)MDIFrame.getInstance().getClientFacade()).getMainClass();
    GridPermissions serverPermissions = (GridPermissions)applet.getAuthorizations().getGridPermissions().get(functionId);

    GridPermissions permissions = new GridPermissions(
      functionId,
      getUsername(),
      (String[])columnAttributes.clone(),
      (boolean[])columnsVisibility.clone(),
      (boolean[])columnEditableInInsert.clone(),
      (boolean[])columnsEditableInEdit.clone(),
      (boolean[])columnsMandatory.clone()
    );
    if (serverPermissions==null)
      return permissions;

    boolean[] aux = serverPermissions.getColumnsEditabilityInInsert(); // editableColumnsInInsertFieldName
    for(int i=0;i<aux.length;i++)
      permissions.getColumnsEditabilityInInsert()[i] = permissions.getColumnsEditabilityInInsert()[i] && aux[i];

    aux = serverPermissions.getColumnsEditabilityInEdit(); // editableColumnsInEdit
    for(int i=0;i<aux.length;i++)
      permissions.getColumnsEditabilityInEdit()[i] = permissions.getColumnsEditabilityInEdit()[i] && aux[i];

    aux = serverPermissions.getColumnsMandatory(); // columnsMandatory
    for(int i=0;i<aux.length;i++)
      permissions.getColumnsMandatory()[i] = permissions.getColumnsMandatory()[i] || aux[i];

    aux = serverPermissions.getColumnsVisibility(); // columnsVisibility
    for(int i=0;i<aux.length;i++)
      permissions.getColumnsVisibility()[i] = aux[i];

    return permissions;

//    Response res = ClientUtils.getData("dbGridPermissions",new Object[]{
//        "getUserGridPermissions",
View Full Code Here


          pstmt.setObject(count++, roleId);
        }
        rset = pstmt.executeQuery();

        HashMap gridPermissions = new HashMap();
        GridPermissions permissions = null;
        String[] aux = null;
        while(rset.next()) {
          if (functionId==null || !functionId.equals(rset.getString(1))) {
            functionId = rset.getString(1);
            int num = rset.getString(2).split(",").length;
            permissions = new GridPermissions(
              functionId,
              username,
              new String[num],
              new boolean[num],
              new boolean[num],
              new boolean[num],
              new boolean[num]
            );
            gridPermissions.put(functionId,permissions);
          }
          aux = rset.getString(2).split(","); // columnAttributes
          for(int i=0;i<aux.length;i++)
            permissions.getColumnsAttribute()[i] = aux[i];

          aux = rset.getString(3).split(","); // editableColumnsInInsertFieldName
          for(int i=0;i<aux.length;i++)
            permissions.getColumnsEditabilityInInsert()[i] = aux[i].equals("true");

          aux = rset.getString(4).split(","); // editableColumnsInEdit
          for(int i=0;i<aux.length;i++)
            permissions.getColumnsEditabilityInEdit()[i] = aux[i].equals("true");

          aux = rset.getString(5).split(","); // columnsMandatory
          for(int i=0;i<aux.length;i++)
            permissions.getColumnsMandatory()[i] = aux[i].equals("true");

          aux = rset.getString(6).split(","); // columnsVisibility
          for(int i=0;i<aux.length;i++)
            permissions.getColumnsVisibility()[i] = aux[i].equals("true");
        }
        rset.close();
        pstmt.close();

        return gridPermissions;
View Full Code Here

TOP

Related Classes of org.openswing.swing.table.permissions.java.GridPermissions

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.