Examples of ReadStatus


Examples of loxia.support.excel.ReadStatus

    }
    return readStatus;
  }
 
  public ReadStatus readSheet(InputStream is, int sheetNo, Map<String, Object> beans) {
    ReadStatus readStatus = new DefaultReadStatus();
    readStatus.setStatus(ReadStatus.STATUS_SUCCESS);
    OgnlStack stack = new OgnlStack(beans);
    try {
      Workbook wb = WorkbookFactory.create(is);
      readSheet(wb,sheetNo,
          definition.getExcelSheets().iterator().next(),
          stack, readStatus);     
    } catch (IOException e) {
      readStatus.setStatus(ReadStatus.STATUS_READ_FILE_ERROR);     
    } catch (InvalidFormatException e) {
      readStatus.setStatus(ReadStatus.STATUS_READ_FILE_ERROR);
    }
    return readStatus;
  }
View Full Code Here

Examples of loxia.support.excel.ReadStatus

 
  private ExcelManipulatorDefinition definition;
  private boolean skipErrors = true;
 
  public ReadStatus readAll(InputStream is, Map<String, Object> beans) {
    ReadStatus readStatus = new DefaultReadStatus();
    readStatus.setStatus(ReadStatus.STATUS_SUCCESS);
    try {
      Workbook wb = WorkbookFactory.create(is);
      if(definition.getExcelSheets().size() == 0 ||
        wb.getNumberOfSheets() < definition.getExcelSheets().size()){
        readStatus.setStatus(ReadStatus.STATUS_SETTING_ERROR);
        readStatus.setMessage("No sheet definition found or Sheet Number in definition is more than number in file.");
      }else{
        OgnlStack stack = new OgnlStack(beans);
        for(int i=0; i< definition.getExcelSheets().size(); i++){
          readSheet(wb,i,
              definition.getExcelSheets().get(i), stack, readStatus);
        }
      }
    } catch (IOException e) {
      readStatus.setStatus(ReadStatus.STATUS_READ_FILE_ERROR);     
    } catch (InvalidFormatException e) {
      readStatus.setStatus(ReadStatus.STATUS_READ_FILE_ERROR);
    }
    return readStatus;
  }
View Full Code Here

Examples of loxia.support.excel.ReadStatus

    }
    return readStatus;
  }
 
  public ReadStatus readAllPerSheet(InputStream is, Map<String, Object> beans) {
    ReadStatus readStatus = new DefaultReadStatus();
    readStatus.setStatus(ReadStatus.STATUS_SUCCESS);
    try {
      Workbook wb = WorkbookFactory.create(is);
      if(definition.getExcelSheets().size() == 0){
        readStatus.setStatus(ReadStatus.STATUS_SETTING_ERROR);   
        readStatus.setMessage("No sheet definition found");
      }else{
        //Only first ExcelSheet Definition will be used
        ExcelSheet sheetDefinition = definition.getExcelSheets().iterator().next();
       
        Map<String,List<Object>> cacheMap = new HashMap<String, List<Object>>();
        for(String key: beans.keySet()){
          if(beans.get(key) != null)
            cacheMap.put(key, new ArrayList<Object>());
        }
        for(int i = 0; i< wb.getNumberOfSheets(); i++){
          Map<String, Object> clonedBeans = cloneMap(beans);
          readSheet(wb,i, sheetDefinition, new OgnlStack(clonedBeans), readStatus);
          for(String key: clonedBeans.keySet())
            cacheMap.get(key).add(clonedBeans.get(key));
        }
        for(String key: beans.keySet()){
          if(cacheMap.containsKey(key)){
            beans.put(key, cacheMap.get(key));
          }else{
            beans.put(key, null);
          }
        }
      }
    } catch (IOException e) {
      readStatus.setStatus(ReadStatus.STATUS_READ_FILE_ERROR);     
    } catch (InvalidFormatException e) {
      readStatus.setStatus(ReadStatus.STATUS_READ_FILE_ERROR);
    } catch (InstantiationException e) {     
      e.printStackTrace();
      readStatus.setStatus(ReadStatus.STATUS_SYSTEM_ERROR);
      readStatus.setMessage("New Instance Error");
    } catch (IllegalAccessException e) {
      e.printStackTrace();
      readStatus.setStatus(ReadStatus.STATUS_SYSTEM_ERROR);
      readStatus.setMessage("New Instance Error");
    }
    return readStatus;
  }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authorization.permission.ReadStatus

    boolean canReadThisNode() {
        return getReadStatus().includes(ReadStatus.ALLOW_THIS);
    }

    boolean canReadAllProperties() {
        ReadStatus rs = getReadStatus();
        return rs.includes(ReadStatus.ALLOW_PROPERTIES);
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authorization.permission.ReadStatus

        ReadStatus rs = getReadStatus();
        return rs.includes(ReadStatus.ALLOW_PROPERTIES);
    }

    boolean canReadProperty(PropertyState property) {
        ReadStatus rs = getReadStatus();
        if (rs.includes(ReadStatus.ALLOW_PROPERTIES)) {
            return true;
        } else if (rs.appliesToThis()) {
            rs = permissionProvider.getReadStatus(base, property);
            return rs.isAllow();
        } else {
            return false;
        }
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authorization.permission.ReadStatus

public class ReadStatusTest {

    @Test
    public void testAllowAll() {
        ReadStatus allowAll = ReadStatus.ALLOW_ALL;

        assertTrue(allowAll.includes(ReadStatus.ALLOW_THIS));
        assertTrue(allowAll.includes(ReadStatus.ALLOW_CHILDREN));
        assertTrue(allowAll.includes(ReadStatus.ALLOW_NODES));
        assertTrue(allowAll.includes(ReadStatus.ALLOW_PROPERTIES));
        assertTrue(allowAll.includes(ReadStatus.ALLOW_THIS_PROPERTIES));
        assertTrue(allowAll.includes(ReadStatus.ALLOW_CHILDITEMS));
        assertTrue(allowAll.includes(ReadStatus.ALLOW_ALL_REGULAR));
        assertTrue(allowAll.includes(ReadStatus.ALLOW_ACCESS_CONTROL));
        assertTrue(allowAll.includes(ReadStatus.ALLOW_ALL));
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authorization.permission.ReadStatus

        return compiledPermissions.isGranted(acTree, acProperty, Permissions.READ_ACCESS_CONTROL);
    }

    private ReadStatus getVersionContentReadStatus(@Nonnull Tree versionStoreTree, @Nullable PropertyState property) {
        TreeLocation location = getLocation(versionStoreTree, property);
        ReadStatus status = ReadStatus.DENY_THIS;
        if (location != null) {
            Tree tree = (property == null) ? location.getTree() : location.getParent().getTree();
            if (tree != null) {
                status = compiledPermissions.getReadStatus(tree, property);
            } else {
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authorization.permission.ReadStatus

        return compiledPermissions.isGranted(acTree, acProperty, Permissions.READ_ACCESS_CONTROL);
    }

    private ReadStatus getVersionContentReadStatus(@Nonnull Tree versionStoreTree, @Nullable PropertyState property) {
        TreeLocation location = getVersionableLocation(versionStoreTree, property);
        ReadStatus status;
        if (location != null) {
            Tree tree = (property == null) ? location.getTree() : location.getParent().getTree();
            if (tree == null) {
                long permission = (property == null) ? Permissions.READ_NODE : Permissions.READ_PROPERTY;
                if (compiledPermissions.isGranted(location.getPath(), permission)) {
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authorization.permission.ReadStatus

        return compiledPermissions.isGranted(acTree, acProperty, Permissions.READ_ACCESS_CONTROL);
    }

    private ReadStatus getVersionContentReadStatus(@Nonnull Tree versionStoreTree, @Nullable PropertyState property) {
        TreeLocation location = getVersionableLocation(versionStoreTree, property);
        ReadStatus status;
        if (location != null) {
            Tree tree = (property == null) ? location.getTree() : location.getParent().getTree();
            if (tree == null) {
                long permission = (property == null) ? Permissions.READ_NODE : Permissions.READ_PROPERTY;
                if (compiledPermissions.isGranted(location.getPath(), permission)) {
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authorization.permission.ReadStatus

*/
public class ReadStatusTest {

    @Test
    public void testAllowAll() {
        ReadStatus allowAll = ReadStatus.ALLOW_ALL;

        assertTrue(allowAll.includes(ReadStatus.ALLOW_THIS));
        assertTrue(allowAll.includes(ReadStatus.ALLOW_CHILDREN));
        assertTrue(allowAll.includes(ReadStatus.ALLOW_NODES));
        assertTrue(allowAll.includes(ReadStatus.ALLOW_PROPERTIES));
        assertTrue(allowAll.includes(ReadStatus.ALLOW_THIS_PROPERTIES));
        assertTrue(allowAll.includes(ReadStatus.ALLOW_CHILDITEMS));
        assertTrue(allowAll.includes(ReadStatus.ALLOW_ALL_REGULAR));
        assertTrue(allowAll.includes(ReadStatus.ALLOW_ACCESS_CONTROL));
        assertTrue(allowAll.includes(ReadStatus.ALLOW_ALL));
    }
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.