Returns a r/o table from a CSP file

@param p
@param dim
@return a table model for properties with dimension.
500265
public static TableModel fromCSP(CSProperties p, final int dim) {
        List<String> dims = keysByMeta(p, "role", "dimension");
        if (dims.isEmpty()) {
            return null;
        }
        for (String d : dims) {
            if (Integer.parseInt(p.get(d).toString()) == dim) {
                final List<String> bounds = keysByMeta(p, "bound", d);
                final List<Object> columns = new ArrayList<Object>(bounds.size());
                for (String bound : bounds) {
                    columns.add(Conversions.convert(p.get(bound), double[].class));
                }

                return new AbstractTableModel() {

                    @Override
                    public int getRowCount() {
                        return dim;
                    }

                    @Override
                    public int getColumnCount() {
                        return bounds.size();
                    }

                    @Override
                    public Object getValueAt(int rowIndex, int columnIndex) {
                        return Array.get(columns.get(columnIndex), rowIndex);
                    }

                    @Override
                    public String getColumnName(int column) {
                        return bounds.get(column);
                    }

                    @Override
                    public Class<?> getColumnClass(int columnIndex) {
                        return Double.class;
                    }
                };
            }
        }
        return null;
    }
403391
def _from_pb(cls, pb, set_key=True, ent=None, key=None):
    
    prop_name = cls.class_._name
    class_name = []
    for plist in [pb.property_list(), pb.raw_property_list()]:
      for p in plist:
        if p.name() == prop_name:
          class_name.append(p.value().stringvalue())
    cls = cls._class_map.get(tuple(class_name), cls)
    return super(PolyModel, cls)._from_pb(pb, set_key, ent, key)
545208
@Override
  public final IProcessor lazyGet(//NOPMD
    final Map<String, Object> pAddParam,
      final String pBeanName) throws Exception {
    IProcessor proc = this.processorsMap.get(pBeanName);
    if (proc == null) {
      // locking:
      synchronized (this.processorsMap) {
        // make sure again whether it's null after locking:
        proc = this.processorsMap.get(pBeanName);
        if (proc == null) {
          if (pBeanName.equals(PrcDelItemFromCart.class.getSimpleName())) {
            proc = lazyGetPrcDelItemFromCart(pAddParam);
          } else if (pBeanName.equals(PrCart.class.getSimpleName())) {
            proc = lazyGetPrCart(pAddParam);
          } else if (pBeanName.equals(PrcItemInCart.class.getSimpleName())) {
            proc = lazyGetPrcItemInCart(pAddParam);
          } else if (pBeanName.equals(PrLog.class.getSimpleName())) {
            proc = lazyGetPrLog(pAddParam);
          } else if (pBeanName.equals(PrcCheckOut.class.getSimpleName())) {
            proc = lazyGetPrcCheckOut(pAddParam);
          } else if (pBeanName.equals(PrBuOr.class.getSimpleName())) {
            proc = lazyGetPrBuOr(pAddParam);
          } else if (pBeanName.equals(PrBur.class.getSimpleName())) {
            proc = lazyGetPrBur(pAddParam);
          } else if (pBeanName.equals(PrPur.class.getSimpleName())) {
            proc = lazyGetPrPur(pAddParam);
          } else if (pBeanName.equals(PrcItemPage.class.getSimpleName())) {
            proc = lazyGetPrcItemPage(pAddParam);
          } else if (pBeanName.equals(PrcWebstorePage.class.getSimpleName())) {
            proc = lazyGetPrcWebstorePage(pAddParam);
          }
        }
      }
    }
    if (proc == null) {
      throw new ExceptionWithCode(ExceptionWithCode.CONFIGURATION_MISTAKE,
        "There is no processor with name " + pBeanName);
    }
    return proc;
  }
1004366
Map<CmsPrincipalBean, String> getResponsibles(CmsObject cms, CmsResource res) {

        Map<CmsPrincipalBean, String> result = new HashMap<CmsPrincipalBean, String>();
        List<CmsResource> parentResources = new ArrayList<CmsResource>();
        // get all parent folders of the current file
        try {
            parentResources = cms.readPath(res, CmsResourceFilter.IGNORE_EXPIRATION);
        } catch (CmsException e) {
            LOG.error(e.getLocalizedMessage(), e);
        }

        for (CmsResource resource : parentResources) {
            String storedSiteRoot = cms.getRequestContext().getSiteRoot();
            String sitePath = cms.getRequestContext().removeSiteRoot(resource.getRootPath());
            try {
                cms.getRequestContext().setSiteRoot("/");
                List<CmsAccessControlEntry> entries = cms.getAccessControlEntries(resource.getRootPath(), false);
                for (CmsAccessControlEntry ace : entries) {
                    if (ace.isResponsible()) {
                        I_CmsPrincipal principal = cms.lookupPrincipal(ace.getPrincipal());
                        if (principal != null) {
                            CmsPrincipalBean prinBean = new CmsPrincipalBean(
                                principal.getName(),
                                principal.getDescription(),
                                principal.isGroup());
                            if (!resource.getRootPath().equals(res.getRootPath())) {
                                if (resource.getRootPath().startsWith(storedSiteRoot)) {
                                    result.put(prinBean, sitePath);
                                } else {
                                    result.put(prinBean, resource.getRootPath());
                                }
                            } else {
                                result.put(prinBean, null);
                            }
                        }
                    }
                }
            } catch (CmsException e) {
                LOG.info(
                    "Problem with reading responsible users for "
                        + resource.getName()
                        + " : "
                        + e.getLocalizedMessage(),
                    e);
            } finally {
                cms.getRequestContext().setSiteRoot(storedSiteRoot);
            }
        }
        return result;
    }
1004049
public ThinPhysicalDatabaseParent getPDatabaseParent(Map<String,Object> properties, boolean bCreateIfNew)
    {
        return this.getEnvironment().getPDatabaseParent(properties, bCreateIfNew);
    }
152628
def extract_dimension(self, dim_name, dim_cols, dim_key, dim_stag_table, src_table, src_cols, grain_cols, where_clause):
        
        
        self.ddl_text += '---------------------------------------------\n'
        self.ddl_text += '-- CREATE Dimension - ' + dim_name + '\n'
        self.ddl_text += '---------------------------------------------\n'
        self.ddl_text += 'DROP TABLE ' + dim_stag_table + ' CASCADE CONSTRAINTS;\n'
        self.ddl_text += 'CREATE TABLE ' + dim_stag_table + ' (\n'
        self.ddl_text += ' '.join([col + ' VARCHAR2(200), \n' for col in dim_cols])
        self.ddl_text += ' ' + self.date_updated_col + '  DATE \n' # + src_table + '; \n'
        self.ddl_text += ');\n'
        
        self.ddl_text += 'DROP TABLE ' + dim_name + ' CASCADE CONSTRAINTS;\n'
        self.ddl_text += 'CREATE TABLE ' + dim_name + ' (\n'
        self.ddl_text += ' ' + dim_key + ' NUMBER, \n'
        self.ddl_text += ' '.join([col + ' VARCHAR2(200), \n' for col in dim_cols])
        self.ddl_text += ' REC_SOURCE_SYSTEM  VARCHAR2(100), \n' # + src_table + '; \n'
        self.ddl_text += ' ' + self.date_updated_col + '  DATE \n' # + src_table + '; \n'
        self.ddl_text += ');\n'
        self.ddl_text += 'CREATE OR REPLACE VIEW U' + dim_name[1:] + ' AS SELECT * FROM ' + dim_name + ';\n'
        self.ddl_text += 'GRANT SELECT ON U' + dim_name[1:] + ' TO ALL_USERS;\n'
        self.ddl_text += '\n'
        self.ddl_text += 'DROP SEQUENCE SEQ_' + dim_name + ';\n'
        self.ddl_text += 'CREATE SEQUENCE SEQ_' + dim_name + ';\n\n'
        
        
        self.sql_text += '---------------------------------------------\n'
        self.sql_text += '-- Populate Dimension - ' + dim_name + '\n'
        self.sql_text += '---------------------------------------------\n'
        self.sql_text += "DELETE FROM " + dim_stag_table + ";\n"
        self.sql_text += "COMMIT;\n"
        self.sql_text += "INSERT INTO " + dim_stag_table + " (\n"
        self.sql_text += ", ".join([col for col in dim_cols])
        self.sql_text += ")\n (SELECT \n"
        self.sql_text += ", ".join([col for col in src_cols])
        self.sql_text += "\nFROM " + src_table + "\n"
        if where_clause != '':
            self.sql_text += "WHERE " + where_clause + "\n"
        if len(grain_cols) > 0:
            self.sql_text += "GROUP BY " + ", ".join([col for col in grain_cols]) + "\n"
        self.sql_text += "); \n"
        self.sql_text += "COMMIT;\n"
        
        
        self.sql_text += "DELETE FROM " + dim_name + ";\n"
        self.sql_text += "COMMIT;\n"
        self.sql_text += "INSERT INTO " + dim_name + " (\n"
        self.sql_text += ", ".join([col for col in dim_cols])
        self.sql_text += ", REC_SOURCE_SYSTEM, " + self.date_updated_col + " "
        
        self.sql_text += ") \n(SELECT \n"
        self.sql_text += ", ".join([col for col in src_cols])
        self.sql_text += ", '" + src_table + "', sysdate "
        self.sql_text += "\nFROM " + dim_stag_table + "\n"
        self.sql_text += "); \n"
        self.sql_text += "COMMIT;\n"
        
        self.sql_text += "UPDATE " + dim_name + " SET " + dim_key + " = SEQ_" + dim_name + ".nextval;\n"
        self.sql_text += "COMMIT;\n\n"
        
        
        print(self.ddl_text)
        print(self.sql_text)
1111078
protected final PrcSeSrvSpecEmbFlDel<RS>
    lazyGetPrcSeSrvSpecEmbFlDel(
      final Map<String, Object> pAddParam) throws Exception {
    String beanName = PrcSeSrvSpecEmbFlDel.class.getSimpleName();
    @SuppressWarnings("unchecked")
    PrcSeSrvSpecEmbFlDel<RS> proc = (PrcSeSrvSpecEmbFlDel<RS>)
      this.processorsMap.get(beanName);
    if (proc == null) {
      proc = new PrcSeSrvSpecEmbFlDel<RS>();
      proc.setSrvOrm(getSrvOrm());
      proc.setFindSeSeller(getFindSeSeller());
      proc.setWebAppPath(getWebAppPath());
      proc.setUploadDirectory(getUploadDirectory());
      //assigning fully initialized object:
      this.processorsMap.put(beanName, proc);
      this.logger.info(null, FctBnSeSelEntityProcs.class,
        beanName + " has been created.");
    }
    return proc;
  }
1010245
public static <P extends ParaObject> List<P> readPageFromTable(String appid, Pager p) {
		Pager pager = (p != null) ? p : new Pager();
		ScanRequest scanRequest = new ScanRequest().
				withTableName(getTableNameForAppid(appid)).
				withLimit(pager.getLimit()).
				withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL);

		if (!StringUtils.isBlank(pager.getLastKey())) {
			scanRequest = scanRequest.withExclusiveStartKey(Collections.
					singletonMap(Config._KEY, new AttributeValue(pager.getLastKey())));
		}

		ScanResult result = getClient().scan(scanRequest);
		LinkedList<P> results = new LinkedList<>();
		for (Map<String, AttributeValue> item : result.getItems()) {
			P obj = fromRow(item);
			if (obj != null) {
				results.add(obj);
			}
		}

		if (result.getLastEvaluatedKey() != null) {
			pager.setLastKey(result.getLastEvaluatedKey().get(Config._KEY).getS());
		} else if (!results.isEmpty()) {
			// set last key to be equal to the last result - end reached.
			pager.setLastKey(results.peekLast().getId());
		}
		return results;
	}
1196461
protected final PrcRevealTaxCat<RS>
    createPutPrcRevealTaxCat(
      final Map<String, Object> pAddParam) throws Exception {
    PrcRevealTaxCat<RS> proc = new PrcRevealTaxCat<RS>();
    proc.setLogger(getLogger());
    proc.setSrvDatabase(getSrvDatabase());
    //assigning fully initialized object:
    this.processorsMap
      .put(PrcRevealTaxCat.class.getSimpleName(), proc);
    return proc;
  }
534514
def _get_properties(self, rule, p_selectors, p_parents, p_children, scope, media, c_lineno, c_property, c_codestr):
        
        prop, value = (_prop_split_re.split(c_property, 1) + [None])[:2]
        try:
            is_var = (c_property[len(prop)] == '=')
        except IndexError:
            is_var = False
        prop = prop.strip()
        prop = self.do_glob_math(
            prop, rule[CONTEXT], rule[OPTIONS], rule, True)
        if prop:
            if value:
                value = value.strip()
                value = self.calculate(
                    value, rule[CONTEXT], rule[OPTIONS], rule)
            _prop = (scope or '') + prop
            if is_var or prop.startswith('$') and value is not None:
                if isinstance(value, basestring):
                    if '!default' in value:
                        if _prop in rule[CONTEXT]:
                            value = None
                        else:
                            value = value.replace(
                                '!default', '').replace('  ', ' ').strip()
                elif isinstance(value, ListValue):
                    value = ListValue(value)
                    for k, v in value.value.items():
                        if v == '!default':
                            if _prop in rule[CONTEXT]:
                                value = None
                            else:
                                del value.value[k]
                                value = value.first(
                                ) if len(value) == 1 else value
                            break
                if value is not None:
                    rule[CONTEXT][_prop] = value
            else:
                _prop = self.apply_vars(
                    _prop, rule[CONTEXT], rule[OPTIONS], rule, True)
                rule[PROPERTIES].append((c_lineno, _prop,
                                         to_str(value) if value is not None else None))
540473
public static void extractColumn(DMatrixRMaj P, int col, GeoTuple3D_F64 a) {
		a.x = P.unsafe_get(0,col);
		a.y = P.unsafe_get(1,col);
		a.z = P.unsafe_get(2,col);
	}
441793
@Override
  public final Long fromString(final Map<String, Object> pAddParam,
    final String pStrVal) throws Exception {
    if (pStrVal == null || "".equals(pStrVal)) {
      return null;
    }
    if (pAddParam != null) {
      String dgsep = (String) pAddParam.get("decGrSepv");
      if (dgsep != null) {
        String strVal = pStrVal.replace(dgsep, "");
        return Long.valueOf(strVal);
      }
    }
    return Long.valueOf(pStrVal);
  }
1325673
private DataSource getDataSource(ComponentHelper cmp, Resource resource) {
    try {
      /*
       * by default the path is read from request "path" parameter
       * here we overwrite it via a synthetic resource because the path may be overwritten by validation logic
       * to ensure the path is not beyond the configured root path
       */
      ValueMap overwriteProperties = new ValueMapDecorator(ImmutableMap.<String, Object>of("path", resource.getPath()));
      Resource dataSourceResourceWrapper = GraniteUiSyntheticResource.wrapMerge(request.getResource(), overwriteProperties);
      return cmp.getItemDataSource(dataSourceResourceWrapper);
    }
    catch (ServletException | IOException ex) {
      throw new RuntimeException("Unable to get data source.", ex);
    }
  }
757091
@SuppressWarnings("unused")
    // TODO 
    private static void widthTable(XWPFTable table, float[] colWidths) {
        float widthCM = 0;
        for (float w : colWidths) {
            widthCM += w;
        }
        long width = (int) (widthCM / 2.54 * 1440);
        CTTblPr tblPr = getTblPr(table);
        CTTblWidth tblW = tblPr.isSetTblW() ? tblPr.getTblW() : tblPr.addNewTblW();
        tblW.setType(0 == width ? STTblWidth.AUTO : STTblWidth.DXA);
        tblW.setW(BigInteger.valueOf(width));

        if (0 != width) {
            CTTblGrid tblGrid = table.getCTTbl().getTblGrid();
            if (null == tblGrid) {
                tblGrid = table.getCTTbl().addNewTblGrid();
            }

            for (float w : colWidths) {
                CTTblGridCol addNewGridCol = tblGrid.addNewGridCol();
                addNewGridCol.setW(BigInteger.valueOf((long) (w / 2.54 * 1440)));
            }
        }
    }
1302139
public static TableModel createTableModel(final CSTable src) {
        final List<String[]> rows = new ArrayList<String[]>();
        for (String[] row : src.rows()) {
            rows.add(row);
        }

        return new TableModel() {

            @Override
            public int getColumnCount() {
                return src.getColumnCount();
            }

            @Override
            public String getColumnName(int column) {
                return src.getColumnName(column);
            }

            @Override
            public int getRowCount() {
                return rows.size();
            }

            @Override
            public Class<?> getColumnClass(int columnIndex) {
                return String.class;
            }

            @Override
            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return false;
            }

            @Override
            public Object getValueAt(int rowIndex, int columnIndex) {
                return rows.get(rowIndex)[columnIndex];
            }

            @Override
            public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
//        rows.get(rowIndex)[columnIndex] = (String) aValue;
            }

            @Override
            public void addTableModelListener(TableModelListener l) {
            }

            @Override
            public void removeTableModelListener(TableModelListener l) {
            }
        };
    }
656331
public CmsFormatterConfiguration getFormatters(CmsObject cms, CmsResource res) {

        if (CmsResourceTypeFunctionConfig.isFunction(res)) {

            CmsFormatterConfigurationCacheState formatters = getCachedFormatters();
            I_CmsFormatterBean function = formatters.getFormatters().get(res.getStructureId());
            if (function != null) {
                return CmsFormatterConfiguration.create(cms, Collections.singletonList(function));
            } else {
                if ((!res.getStructureId().isNullUUID())
                    && cms.existsResource(res.getStructureId(), CmsResourceFilter.IGNORE_EXPIRATION)) {
                    // usually if it's just been created, but not added to the configuration cache yet
                    CmsFormatterBeanParser parser = new CmsFormatterBeanParser(cms, new HashMap<>());
                    try {
                        function = parser.parse(
                            CmsXmlContentFactory.unmarshal(cms, cms.readFile(res)),
                            res.getRootPath(),
                            "" + res.getStructureId());
                        return CmsFormatterConfiguration.create(cms, Collections.singletonList(function));
                    } catch (Exception e) {
                        LOG.warn(e.getLocalizedMessage(), e);
                        return CmsFormatterConfiguration.EMPTY_CONFIGURATION;
                    }

                } else {
                    // if a new function has been dragged on the page, it doesn't exist in the VFS yet, so we need a different
                    // instance as a replacement
                    CmsResource defaultFormatter = CmsFunctionRenderer.getDefaultFunctionInstance(cms);
                    if (defaultFormatter != null) {
                        I_CmsFormatterBean defaultFormatterBean = formatters.getFormatters().get(
                            defaultFormatter.getStructureId());
                        return CmsFormatterConfiguration.create(cms, Collections.singletonList(defaultFormatterBean));
                    } else {
                        LOG.warn("Could not read default formatter for functions.");
                        return CmsFormatterConfiguration.EMPTY_CONFIGURATION;
                    }
                }
            }
        } else {
            try {
                int resTypeId = res.getTypeId();
                return getFormatters(
                    cms,
                    OpenCms.getResourceManager().getResourceType(resTypeId),
                    getFormattersFromSchema(cms, res));
            } catch (CmsLoaderException e) {
                LOG.warn(e.getLocalizedMessage(), e);
                return CmsFormatterConfiguration.EMPTY_CONFIGURATION;
            }
        }
    }
1369980
public String getProperty(String pColumn) {
        if (mColumnMap == null || pColumn == null)
            return null;

        String property = (String) mColumnMap.get(pColumn);

        int dotIdx = 0;
        if (property == null && (dotIdx = pColumn.lastIndexOf(".")) >= 0)
            property = (String) mColumnMap.get(pColumn.substring(dotIdx + 1));

        return property;
    }