List of usage examples for java.util Properties remove
@Override public synchronized Object remove(Object key)
From source file:org.apache.maven.archetype.creator.FilesetArchetypeCreator.java
private void restoreArtifactId(Properties properties, String artifactId) { if (StringUtils.isEmpty(artifactId)) { properties.remove(Constants.ARTIFACT_ID); } else {// ww w . j a v a 2 s . c o m properties.setProperty(Constants.ARTIFACT_ID, artifactId); } }
From source file:org.apache.maven.archetype.creator.FilesetArchetypeCreator.java
private void restoreParentArtifactId(Properties properties, String parentArtifactId) { if (StringUtils.isEmpty(parentArtifactId)) { properties.remove(Constants.PARENT_ARTIFACT_ID); } else {/*ww w. j av a 2 s. c o m*/ properties.setProperty(Constants.PARENT_ARTIFACT_ID, parentArtifactId); } }
From source file:org.apache.maven.archetype.creator.FilesetArchetypeCreator.java
private Properties getReversedProperties(ArchetypeDescriptor archetypeDescriptor, Properties properties) { Properties reversedProperties = new Properties(); reversedProperties.putAll(properties); reversedProperties.remove(Constants.ARCHETYPE_GROUP_ID); reversedProperties.remove(Constants.ARCHETYPE_ARTIFACT_ID); reversedProperties.remove(Constants.ARCHETYPE_VERSION); String packageName = properties.getProperty(Constants.PACKAGE); String packageInPathFormat = getPackageInPathFormat(packageName); if (!packageInPathFormat.equals(packageName)) { reversedProperties.setProperty(Constants.PACKAGE_IN_PATH_FORMAT, packageInPathFormat); }//from w w w.j a v a2 s . c o m // TODO check that reversed properties are all different and no one is a substring of another? // to avoid wrong variable replacements return reversedProperties; }
From source file:org.kuali.kfs.module.cam.businessobject.lookup.AssetLookupableHelperServiceImpl.java
protected HtmlData getLoanUrl(Asset asset) { AnchorHtmlData anchorHtmlData = null; List<HtmlData> childURLDataList = new ArrayList<HtmlData>(); Properties parameters = new Properties(); parameters.put(KFSConstants.DISPATCH_REQUEST_PARAMETER, KRADConstants.DOC_HANDLER_METHOD); parameters.put(CamsPropertyConstants.AssetTransferDocument.CAPITAL_ASSET_NUMBER, asset.getCapitalAssetNumber().toString()); parameters.put(KFSConstants.PARAMETER_COMMAND, "initiate"); parameters.put(KFSConstants.DOCUMENT_TYPE_NAME, CamsConstants.DocumentTypeName.ASSET_EQUIPMENT_LOAN_OR_RETURN); if (getAssetService().isAssetLoaned(asset)) { anchorHtmlData = new AnchorHtmlData("", "", ""); AnchorHtmlData childURLData = new AnchorHtmlData("", "", CamsConstants.AssetActions.LOAN); childURLDataList.add(childURLData); parameters.put(CamsConstants.AssetActions.LOAN_TYPE, CamsConstants.AssetActions.LOAN_RENEW); String childHref = UrlFactory.parameterizeUrl( CamsConstants.StrutsActions.ONE_UP + CamsConstants.StrutsActions.EQUIPMENT_LOAN_OR_RETURN, parameters);//ww w . ja v a2s .com childURLData = new AnchorHtmlData(childHref, KRADConstants.DOC_HANDLER_METHOD, CamsConstants.AssetActions.LOAN_RENEW); childURLDataList.add(childURLData); parameters.remove(CamsConstants.AssetActions.LOAN_TYPE); parameters.put(CamsConstants.AssetActions.LOAN_TYPE, CamsConstants.AssetActions.LOAN_RETURN); childHref = UrlFactory.parameterizeUrl( CamsConstants.StrutsActions.ONE_UP + CamsConstants.StrutsActions.EQUIPMENT_LOAN_OR_RETURN, parameters); childURLData = new AnchorHtmlData(childHref, KRADConstants.DOC_HANDLER_METHOD, CamsConstants.AssetActions.LOAN_RETURN); childURLDataList.add(childURLData); anchorHtmlData.setChildUrlDataList(childURLDataList); } else { anchorHtmlData = new AnchorHtmlData("", "", ""); // AnchorHtmlData childURLData = new AnchorHtmlData("", "", ""); if (asset.getCampusTagNumber() == null) { childURLData = new AnchorHtmlData("", "", CamsConstants.AssetActions.LOAN); childURLDataList.add(childURLData); } else { parameters.put(CamsConstants.AssetActions.LOAN_TYPE, CamsConstants.AssetActions.LOAN); String childHref = UrlFactory.parameterizeUrl( CamsConstants.StrutsActions.ONE_UP + CamsConstants.StrutsActions.EQUIPMENT_LOAN_OR_RETURN, parameters); childURLData = new AnchorHtmlData(childHref, KRADConstants.DOC_HANDLER_METHOD, CamsConstants.AssetActions.LOAN); childURLDataList.add(childURLData); } childURLData = new AnchorHtmlData("", "", CamsConstants.AssetActions.LOAN_RENEW); childURLDataList.add(childURLData); childURLData = new AnchorHtmlData("", "", CamsConstants.AssetActions.LOAN_RETURN); childURLDataList.add(childURLData); anchorHtmlData.setChildUrlDataList(childURLDataList); } return anchorHtmlData; }
From source file:org.apache.maven.archetype.creator.FilesetArchetypeCreator.java
private void addRequiredProperties(ArchetypeDescriptor archetypeDescriptor, Properties properties) { Properties requiredProperties = new Properties(); requiredProperties.putAll(properties); requiredProperties.remove(Constants.ARCHETYPE_GROUP_ID); requiredProperties.remove(Constants.ARCHETYPE_ARTIFACT_ID); requiredProperties.remove(Constants.ARCHETYPE_VERSION); requiredProperties.remove(Constants.GROUP_ID); requiredProperties.remove(Constants.ARTIFACT_ID); requiredProperties.remove(Constants.VERSION); requiredProperties.remove(Constants.PACKAGE); requiredProperties.remove(Constants.EXCLUDE_PATTERNS); for (Iterator<?> propertiesIterator = requiredProperties.keySet().iterator(); propertiesIterator .hasNext();) {//from w w w .j a va2 s. co m String propertyKey = (String) propertiesIterator.next(); RequiredProperty requiredProperty = new RequiredProperty(); requiredProperty.setKey(propertyKey); requiredProperty.setDefaultValue(requiredProperties.getProperty(propertyKey)); archetypeDescriptor.addRequiredProperty(requiredProperty); getLogger().debug("Adding requiredProperty " + propertyKey + "=" + requiredProperties.getProperty(propertyKey) + " to archetype's descriptor"); } }
From source file:com.cloudera.sqoop.SqoopOptions.java
/** * A put() method for Properties that is tolerent of 'null' values. * If a null value is specified, the property is unset. *///from w w w .j av a2 s . com private void putProperty(Properties props, String k, String v) { if (null == v) { props.remove(k); } else { props.setProperty(k, v); } }
From source file:org.codehaus.mojo.license.DefaultThirdPartyTool.java
protected void handleStuff(Properties customMappings, SortedMap<String, MavenProject> artifactCache) { // Store any custom mappings that are not used by this project List<String> unusedDependencies = new ArrayList<String>(); // If the custom mapping file contains GAV entries with type+classifier, remove type+classifier // A simple GAV is enough to figure out appropriate licensing Map<String, String> migrateKeys = migrateCustomMappingKeys(customMappings.stringPropertyNames()); for (String id : migrateKeys.keySet()) { String migratedId = migrateKeys.get(id); MavenProject project = artifactCache.get(migratedId); if (project == null) { // Now we are sure this is an unused dependency // Add this GAV as one that we don't care about for this project unusedDependencies.add(id);// w ww . ja v a2 s . c om } else { if (!id.equals(migratedId)) { // migrates id to migratedId getLogger().info("Migrates [" + id + "] to [" + migratedId + "] in the custom mapping file."); Object value = customMappings.get(id); customMappings.remove(id); customMappings.put(migratedId, value); } } } if (!unusedDependencies.isEmpty()) { // there are some unused dependencies in the custom mappings file, remove them for (String id : unusedDependencies) { getLogger().debug("dependency [" + id + "] does not exist in this project"); // Remove it from the custom mappings file since we don't care about it for this project customMappings.remove(id); } } }
From source file:pl.project13.maven.git.GitCommitIdMojo.java
private void filterNot(Properties properties, @Nullable List<String> exclusions) { if (exclusions == null || exclusions.isEmpty()) { return;// w w w .j a va 2s. c o m } List<Predicate<CharSequence>> excludePredicates = Lists.transform(exclusions, new Function<String, Predicate<CharSequence>>() { @Override public Predicate<CharSequence> apply(String exclude) { return Predicates.containsPattern(exclude); } }); Predicate<CharSequence> shouldExclude = Predicates.alwaysFalse(); for (Predicate<CharSequence> predicate : excludePredicates) { shouldExclude = Predicates.or(shouldExclude, predicate); } for (String key : properties.stringPropertyNames()) { if (shouldExclude.apply(key)) { log.debug("shouldExclude.apply({}) = {}", key, shouldExclude.apply(key)); properties.remove(key); } } }
From source file:pl.project13.maven.git.GitCommitIdMojo.java
private void filter(Properties properties, @Nullable List<String> inclusions) { if (inclusions == null || inclusions.isEmpty()) { return;//w w w . jav a2 s .c o m } List<Predicate<CharSequence>> includePredicates = Lists.transform(inclusions, new Function<String, Predicate<CharSequence>>() { @Override public Predicate<CharSequence> apply(String exclude) { return Predicates.containsPattern(exclude); } }); Predicate<CharSequence> shouldInclude = Predicates.alwaysFalse(); for (Predicate<CharSequence> predicate : includePredicates) { shouldInclude = Predicates.or(shouldInclude, predicate); } for (String key : properties.stringPropertyNames()) { if (!shouldInclude.apply(key)) { log.debug("!shouldInclude.apply({}) = {}", key, shouldInclude.apply(key)); properties.remove(key); } } }
From source file:com.googlecode.fascinator.indexer.SolrIndexer.java
/** * Index a specific payload/*from ww w.j a va 2 s .c o m*/ * * @param object : The payload's object * @param pid : The payload * @throws IndexerException if there were errors during indexing */ public void index(DigitalObject object, Payload payload) throws IndexerException { String oid = object.getId(); String pid = payload.getId(); // Don't proccess annotations through this function if (pid.startsWith("anotar.")) { annotate(object, payload); return; } // log.info("Indexing OID:'{}', PID: '{}'", oid, pid); // get the indexer properties or we can't index Properties props; try { props = object.getMetadata(); } catch (StorageException ex) { throw new IndexerException("Failed loading properties : ", ex); } try { // Get the harvest files String confOid = props.getProperty("jsonConfigOid"); String rulesOid = props.getProperty("rulesOid"); // Generate the Solr document String doc = index(object, payload, confOid, rulesOid, props); // Did the indexer alter metadata? String toClose = props.getProperty("objectRequiresClose"); if (toClose != null) { log.debug("Indexing has altered metadata, closing object."); props.remove("objectRequiresClose"); object.close(); try { props = object.getMetadata(); } catch (StorageException ex) { throw new IndexerException("Failed loading properties : ", ex); } } addToBuffer(oid + "/" + pid, doc); } catch (Exception e) { log.error("Indexing failed!\n-----\n", e); } }