Java Code Examples for org.apache.commons.lang.Validate#notEmpty()
The following examples show how to use
org.apache.commons.lang.Validate#notEmpty() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LdapManagerImpl.java From cloudstack with Apache License 2.0 | 6 votes |
private LinkDomainToLdapResponse linkDomainToLdap(Long domainId, String type, String name, short accountType) { Validate.notNull(type, "type cannot be null. It should either be GROUP or OU"); Validate.notNull(domainId, "domainId cannot be null."); Validate.notEmpty(name, "GROUP or OU name cannot be empty"); //Account type should be 0 or 2. check the constants in com.cloud.user.Account Validate.isTrue(accountType==0 || accountType==2, "accountype should be either 0(normal user) or 2(domain admin)"); LinkType linkType = LdapManager.LinkType.valueOf(type.toUpperCase()); LdapTrustMapVO vo = _ldapTrustMapDao.persist(new LdapTrustMapVO(domainId, linkType, name, accountType, 0)); DomainVO domain = domainDao.findById(vo.getDomainId()); String domainUuid = "<unknown>"; if (domain == null) { LOGGER.error("no domain in database for id " + vo.getDomainId()); } else { domainUuid = domain.getUuid(); } LinkDomainToLdapResponse response = new LinkDomainToLdapResponse(domainUuid, vo.getType().toString(), vo.getName(), vo.getAccountType()); return response; }
Example 2
Source File: NewCertificateContract.java From freehealth-connector with GNU Affero General Public License v3.0 | 6 votes |
public NewCertificateContract(GeneratedContract generatedContract, KeyPair keyPair, List<UsageType> usageTypes) throws TechnicalConnectorException { super(BeIDInfo.getInstance().getIdentity()); Validate.notNull(generatedContract); Validate.isTrue(generatedContract.isContractViewed()); Validate.notEmpty(generatedContract.getDN()); Validate.notNull(generatedContract.getSigner()); Validate.notNull(generatedContract.getContactData()); Validate.notNull(generatedContract.getIdentifierType()); Validate.notNull(keyPair); this.contact = generatedContract.getContactData(); this.dn = generatedContract.getDN().replace(generatedContract.getIdentifierType().getType(48) + "=", generatedContract.getIdentifierType().getType(48) + "\\="); this.text = generatedContract.getText(); this.usageTypes = usageTypes; this.signer = generatedContract.getSigner(); this.pkcs10 = CertificateUtils.createCSR(generatedContract.getDN(), keyPair); this.verifyPKCS10(this.pkcs10, this.dn); }
Example 3
Source File: KafkaMessageListenerContainer.java From ameliant-tools with Apache License 2.0 | 6 votes |
public KafkaMessageListenerContainer(Properties kafkaConfig, OffsetStore offsetStore, String topic, BiConsumer<K, V> messageListener) { Validate.notNull(kafkaConfig, "kafkaConfig is null"); this.kafkaConfig = kafkaConfig; this.groupId = (String) kafkaConfig.get(ConsumerConfig.GROUP_ID_CONFIG); Validate.notEmpty(groupId, "groupId is empty"); Validate.notNull(offsetStore, "offsetStore is null"); this.offsetStore = offsetStore; Validate.notEmpty(topic, "topic is empty"); this.topic = topic; Validate.notNull(messageListener, "messageListener is null"); this.messageListener = messageListener; }
Example 4
Source File: IslandInfo.java From uSkyBlock with GNU General Public License v3.0 | 6 votes |
public IslandInfo(@NotNull String islandName, @NotNull uSkyBlock plugin) { Validate.notNull(islandName, "IslandName cannot be null"); Validate.notEmpty(islandName, "IslandName cannot be empty"); this.plugin = plugin; config = new YamlConfiguration(); file = new File(directory, islandName + ".yml"); name = islandName; if (file.exists()) { readConfig(config, file); if (config.getInt("version", 0) < YML_VERSION || config.contains("maxSize")) { updateConfig(); } } else { log.fine("No file for " + islandName + " found, creating a fresh island!"); } }
Example 5
Source File: DatasetTemplate.java From keycloak with Apache License 2.0 | 5 votes |
protected static Configuration loadConfiguration() { try { CombinedConfiguration configuration = new CombinedConfigurationNoInterpolation(); String datasetPropertiesFile = System.getProperty("dataset.properties.file"); Validate.notEmpty(datasetPropertiesFile); configuration.addConfiguration(loadFromFile(new File(datasetPropertiesFile))); return configuration; } catch (ConfigurationException ex) { throw new RuntimeException(ex); } }
Example 6
Source File: LdapManagerImpl.java From cosmic with Apache License 2.0 | 5 votes |
@Override public LinkDomainToLdapResponse linkDomainToLdap(final Long domainId, final String type, final String name, final short accountType) { Validate.notNull(type, "type cannot be null. It should either be GROUP or OU"); Validate.notNull(domainId, "domainId cannot be null."); Validate.notEmpty(name, "GROUP or OU name cannot be empty"); //Account type should be 0 or 2. check the constants in com.cloud.legacymodel.user.Account Validate.isTrue(accountType == 0 || accountType == 2, "accountype should be either 0(normal user) or 2(domain admin)"); final Domain domain = _domainManager.getDomain(domainId); final LinkType linkType = LdapManager.LinkType.valueOf(type.toUpperCase()); final LdapTrustMapVO vo = _ldapTrustMapDao.persist(new LdapTrustMapVO(domainId, linkType, name, accountType)); final LinkDomainToLdapResponse response = new LinkDomainToLdapResponse(domain.getUuid(), vo.getType().toString(), vo.getName(), vo.getAccountType()); return response; }
Example 7
Source File: Organization.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
public Organization(String id, IdentifierType type, String name) { Validate.notEmpty(id); Validate.notNull(type); Validate.notEmpty(name); this.id = id; this.name = name; this.type = type; }
Example 8
Source File: SchemaValidatorHandler.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
public SchemaValidatorHandler(int verifyType, String... schemaFile) { validVerifyType(verifyType); Validate.notEmpty(schemaFile); Validate.noNullElements(schemaFile); this.verify = verifyType; this.schemaFiles = schemaFile; }
Example 9
Source File: PhysicalCraftingRecipe.java From GiantTrees with GNU General Public License v3.0 | 5 votes |
private static byte[][] bytesFromPattern(final Material[][] pattern) { Validate.notEmpty(pattern, "pattern cannot be null or empty"); final byte[][] bytes = new byte[pattern.length][]; for (int i = 0; i < bytes.length; i++) { bytes[i] = new byte[pattern[i].length]; Arrays.fill(bytes[i], (byte) -1); } return bytes; }
Example 10
Source File: SchemaValidatorHandler.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
public SchemaValidatorHandler(int verifyType, String... schemaFile) { validVerifyType(verifyType); Validate.notEmpty(schemaFile); Validate.noNullElements(schemaFile); this.verify = verifyType; this.schemaFiles = schemaFile; }
Example 11
Source File: ContractRequestBuilder.java From freehealth-connector with GNU Affero General Public License v3.0 | 4 votes |
public ContactDataStep withApplicationId(String applicationId) { Validate.notEmpty(applicationId); this.buildCertificateIdentifier(applicationId); return this; }
Example 12
Source File: ContractRequestBuilder.java From freehealth-connector with GNU Affero General Public License v3.0 | 4 votes |
public ContractRequestBuilder.ContactDataStep2 withPrivateEmail(String mail) { Validate.notEmpty(mail); this.personalEmail = mail; return this; }
Example 13
Source File: MonetaConfiguration.java From moneta with Apache License 2.0 | 4 votes |
public Topic getTopic(String topicName) { Validate.notEmpty(topicName, "Null or blank topicName not allowed"); Validate.isTrue(this.initRun, "Moneta not properly initialized."); return topicMap.get(topicName); }
Example 14
Source File: ContractRequestBuilder.java From freehealth-connector with GNU Affero General Public License v3.0 | 4 votes |
public ContractRequestBuilder.ContactDataStep withApplicationId(String applicationId) { Validate.notEmpty(applicationId); this.buildCertificateIdentifier(applicationId); return this; }
Example 15
Source File: ContractRequestBuilder.java From freehealth-connector with GNU Affero General Public License v3.0 | 4 votes |
public OrganizationChoiceStep3 withName(String name) { Validate.notEmpty(name); this.organizationName = name; return this; }
Example 16
Source File: DistinguishedName.java From freehealth-connector with GNU Affero General Public License v3.0 | 4 votes |
private void setName(String name) { Validate.notEmpty(name); this.name = normalize(name); }
Example 17
Source File: DatastreamProducerRecordBuilder.java From brooklin with BSD 2-Clause "Simplified" License | 4 votes |
/** * Set destination */ public void setDestination(String destination) { Validate.notEmpty(destination, "destination cannot be empty."); _destination = Optional.of(destination); }
Example 18
Source File: ContractBuilder.java From freehealth-connector with GNU Affero General Public License v3.0 | 4 votes |
public ContractBuilder.OrganizationChoiceStep3<T> withName(String name) { Validate.notEmpty(name); this.organizationName = name; return this; }
Example 19
Source File: DistinguishedName.java From freehealth-connector with GNU Affero General Public License v3.0 | 4 votes |
private void setName(String name) { Validate.notEmpty(name); this.name = normalize(name); }
Example 20
Source File: BrowsersComboBoxModel.java From zap-extensions with Apache License 2.0 | 3 votes |
/** * Constructs a {@code BrowsersComboBoxModel} with with the given {@code browsers}. * * <p>The selected item will be set to the first browser of the given list of {@code browsers}. * * @param browsers the browsers that will have this combo box model * @throws IllegalArgumentException if the given {@code List} of {@code browsers} is {@code * null} or empty. */ public BrowsersComboBoxModel(List<BrowserUI> browsers) { Validate.notEmpty(browsers); this.browsers = Collections.unmodifiableList(new ArrayList<>(browsers)); this.selectedBrowser = this.browsers.get(0); }