Reads the cost rate tables from the file.

@param resource parent resource
@param rates XML cot rate tables
500243
private void readCostRateTables(Resource resource, Rates rates)
   {
      if (rates == null)
      {
         CostRateTable table = new CostRateTable();
         table.add(CostRateTableEntry.DEFAULT_ENTRY);
         resource.setCostRateTable(0, table);

         table = new CostRateTable();
         table.add(CostRateTableEntry.DEFAULT_ENTRY);
         resource.setCostRateTable(1, table);

         table = new CostRateTable();
         table.add(CostRateTableEntry.DEFAULT_ENTRY);
         resource.setCostRateTable(2, table);

         table = new CostRateTable();
         table.add(CostRateTableEntry.DEFAULT_ENTRY);
         resource.setCostRateTable(3, table);

         table = new CostRateTable();
         table.add(CostRateTableEntry.DEFAULT_ENTRY);
         resource.setCostRateTable(4, table);
      }
      else
      {
         Set<CostRateTable> tables = new HashSet<CostRateTable>();

         for (net.sf.mpxj.mspdi.schema.Project.Resources.Resource.Rates.Rate rate : rates.getRate())
         {
            Rate standardRate = DatatypeConverter.parseRate(rate.getStandardRate());
            TimeUnit standardRateFormat = DatatypeConverter.parseTimeUnit(rate.getStandardRateFormat());
            Rate overtimeRate = DatatypeConverter.parseRate(rate.getOvertimeRate());
            TimeUnit overtimeRateFormat = DatatypeConverter.parseTimeUnit(rate.getOvertimeRateFormat());
            Double costPerUse = DatatypeConverter.parseCurrency(rate.getCostPerUse());
            Date endDate = rate.getRatesTo();

            CostRateTableEntry entry = new CostRateTableEntry(standardRate, standardRateFormat, overtimeRate, overtimeRateFormat, costPerUse, endDate);

            int tableIndex = rate.getRateTable().intValue();
            CostRateTable table = resource.getCostRateTable(tableIndex);
            if (table == null)
            {
               table = new CostRateTable();
               resource.setCostRateTable(tableIndex, table);
            }
            table.add(entry);
            tables.add(table);
         }

         for (CostRateTable table : tables)
         {
            Collections.sort(table);
         }
      }
   }
474770
protected CmsResource readSitemapEntryFolderIfPossible(CmsResource resource) {

        CmsObject cms = A_CmsUI.getCmsObject();
        try {
            if (resource.isFolder()) {
                return resource;
            }
            CmsResource parent = cms.readParentFolder(resource.getStructureId());
            CmsResource defaultFile = cms.readDefaultFile(parent, CmsResourceFilter.IGNORE_EXPIRATION);
            if ((defaultFile != null) && defaultFile.equals(resource)) {
                return parent;
            }
            return resource;
        } catch (CmsException e) {
            LOG.error(e.getLocalizedMessage(), e);
            return resource;
        }
    }
1056950
@Nullable
  @VisibleForTesting
  static Resource toResourceProto(@Nullable io.opencensus.resource.Resource resource) {
    if (resource == null || resource.getType() == null) {
      return null;
    } else {
      Resource.Builder resourceProtoBuilder = Resource.newBuilder();
      resourceProtoBuilder.setType(resource.getType());
      for (Entry<String, String> keyValuePairs : resource.getLabels().entrySet()) {
        resourceProtoBuilder.putLabels(keyValuePairs.getKey(), keyValuePairs.getValue());
      }
      return resourceProtoBuilder.build();
    }
  }
1291907
public CmsLocaleGroup readLocaleGroup(CmsResource resource) throws CmsException {

        if (resource.isFolder()) {
            CmsResource defaultFile = m_cms.readDefaultFile(resource, CmsResourceFilter.IGNORE_EXPIRATION);
            if (defaultFile != null) {
                resource = defaultFile;
            }
        }

        List<CmsRelation> relations = m_cms.readRelations(
            CmsRelationFilter.ALL.filterType(CmsRelationType.LOCALE_VARIANT).filterStructureId(
                resource.getStructureId()));
        List<CmsRelation> out = Lists.newArrayList();
        List<CmsRelation> in = Lists.newArrayList();
        for (CmsRelation rel : relations) {
            if (rel.getSourceId().equals(resource.getStructureId())) {
                out.add(rel);
            } else {
                in.add(rel);
            }
        }
        CmsResource primaryResource = null;
        List<CmsResource> secondaryResources = Lists.newArrayList();
        if ((out.size() == 0) && (in.size() == 0)) {
            primaryResource = resource;
        } else if ((out.size() == 0) && (in.size() > 0)) {
            primaryResource = resource;
            // resource is the primary variant
            for (CmsRelation relation : in) {
                CmsResource source = relation.getSource(m_cms, CmsResourceFilter.ALL);
                secondaryResources.add(source);
            }
        } else if ((out.size() == 1) && (in.size() == 0)) {

            CmsResource target = out.get(0).getTarget(m_cms, CmsResourceFilter.ALL);
            primaryResource = target;
            CmsRelationFilter filter = CmsRelationFilter.TARGETS.filterType(
                CmsRelationType.LOCALE_VARIANT).filterStructureId(target.getStructureId());
            List<CmsRelation> relationsToTarget = m_cms.readRelations(filter);
            for (CmsRelation targetRelation : relationsToTarget) {
                CmsResource secondaryResource = targetRelation.getSource(m_cms, CmsResourceFilter.ALL);
                secondaryResources.add(secondaryResource);
            }
        } else {
            throw new IllegalStateException(
                "illegal locale variant relations for resource with id="
                    + resource.getStructureId()
                    + ", path="
                    + resource.getRootPath());
        }
        return new CmsLocaleGroup(m_cms, primaryResource, secondaryResources);
    }
1263212
private void uncacheResource(CmsResource resource) {

        if (resource == null) {
            return;
        }
        if ((m_serializationPolicyPath != null) && resource.getRootPath().equals(m_serializationPolicyPath)) {
            m_serPolicyOffline = null;
        }
    }
49205
public static ProviderContextBuilder of(String provider, Collection<RateType> rateTypes) {
        return new ProviderContextBuilder(provider, rateTypes);
    }
486761
protected Set<CmsSearchField> getXSDMappings(CmsObject cms, CmsResource resource) {

        try {
            if (CmsResourceTypeXmlContent.isXmlContent(resource)) {
                I_CmsXmlContentHandler handler = CmsXmlContentDefinition.getContentHandlerForResource(cms, resource);
                if ((handler != null) && !handler.getSearchFields().isEmpty()) {
                    return handler.getSearchFields();
                }
            }
        } catch (CmsException e) {
            LOG.error(e.getMessage(), e);
        }
        return null;
    }
946401
public static List<URL> getResources(String resource) {
		final Enumeration<URL> resources;
		try {
			resources = ClassLoaderUtil.getClassLoader().getResources(resource);
		} catch (IOException e) {
			throw new IORuntimeException(e);
		}
		return CollectionUtil.newArrayList(resources);
	}
860813
private void processResourceRates()
   {
      List<Row> rows = getRows("rsrcrate", null, null);
      m_reader.processResourceRates(rows);
   }
1323463
protected void loadProperties(String filename) {
		ClassLoader thclassLoader = Thread.currentThread().getContextClassLoader();
		if (thclassLoader != null){
			URL url = thclassLoader.getResource(filename);
			if (url != null){
				try {
					this.setXMLProperties(url.openStream(), null);
				} catch (Exception e) {
					// do nothing
				} 
			}
		}
	}
67453
protected X509Certificate loadX509CertificateFromResource(String resource) throws CertificateException{
		InputStream derInputStream = this.getClass().getClassLoader().getResourceAsStream(resource);
		CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
		X509Certificate cert = (X509Certificate) certificateFactory.generateCertificate(derInputStream);
		try {
			derInputStream.close();
		} catch (IOException e) {
			// ignore
		}
		return cert;
	}
504318
public static Reader getResourceAsReader(String resource) {
        InputStream in = classLoaderWrapper.getResourceAsStream(resource);
        if (in == null) {
            return null;
        }
        return new InputStreamReader(in);
    }
289508
private static final void loadResources(final CClassLoader loader,
			final List URLList, final String resourceName) {
		final List l = loader.getPrivateResource(resourceName);

		if (l != null) {
			URLList.addAll(l);
		}

		final List loaderList = new ArrayList();

		for (final Iterator it = loader.childrenMap.entrySet().iterator(); it
				.hasNext();) {
			final Entry entry = (Entry) it.next();
			loaderList.add(entry.getValue());
		}

		for (int i = 0; i < loaderList.size(); i++) {
			final Object element = loaderList.get(i);
			final CClassLoader child = (CClassLoader) element;
			CClassLoader.loadResources(child, URLList, resourceName);
		}
	}
716981
private void readResource(Document.Resources.Resource resource)
   {
      Resource mpxjResource = m_projectFile.addResource();
      mpxjResource.setName(resource.getName());
      mpxjResource.setResourceCalendar(m_calendarMap.get(resource.getCalendarID()));
      mpxjResource.setStandardRate(new Rate(resource.getCost(), resource.getCostTimeUnit()));
      mpxjResource.setEmailAddress(resource.getEMail());
      mpxjResource.setGroup(resource.getGroup());
      //resource.getHyperlinks()
      mpxjResource.setUniqueID(resource.getID());
      //resource.getMarkerID()
      mpxjResource.setNotes(resource.getNote());
      mpxjResource.setID(Integer.valueOf(resource.getOutlineNumber()));
      //resource.getStyleProject()
      mpxjResource.setType(resource.getSubType() == null ? resource.getType() : resource.getSubType());
   }
159466
void readTreeLevel(CmsUUID parentId, String openPathFragment) {

        CmsObject cms = A_CmsUI.getCmsObject();
        boolean openedFragment = false;
        try {
            CmsResource parent = cms.readResource(parentId, CmsResourceFilter.IGNORE_EXPIRATION);
            String folderPath = cms.getSitePath(parent);
            List<CmsResource> folderResources = cms.readResources(folderPath, FOLDERS, false);

            // sets the parent to leaf mode, in case no child folders are present
            m_treeContainer.setChildrenAllowed(parentId, !folderResources.isEmpty());

            for (CmsResource resource : folderResources) {
                addTreeItem(cms, resource, parentId, false, m_treeContainer);
                openedFragment = openedFragment || resource.getName().equals(openPathFragment);
            }
            if (!openedFragment && (openPathFragment != null)) {
                CmsResource resource = cms.readResource(
                    CmsStringUtil.joinPaths(folderPath, openPathFragment),
                    CmsResourceFilter.IGNORE_EXPIRATION);
                addTreeItem(cms, resource, parentId, true, m_treeContainer);
            }

            m_fileTree.markAsDirtyRecursive();
        } catch (CmsException e) {
            CmsErrorDialog.showErrorDialog(e);
            LOG.error(e.getLocalizedMessage(), e);
        }
    }
437291
public void parse(CmsResource resource) throws CmsException {

        CmsFile file = m_cms.readFile(resource);
        m_resource = resource;
        CmsXmlContent content = CmsXmlContentFactory.unmarshal(m_cms, file);
        parse(content);
    }
116806
public FxRateCalculatorBuilder ratesSnapshot(final Collection<FxRate> rates) {
        if (rates != null) {
            this.ratesSnapshot.clear();
            this.ratesSnapshot = rates.stream().collect(Collectors.toMap(FxRate::getCurrencyPair, t -> t));
        }
        return this;
    }