use of com.axway.ats.common.PublicAtsApi in project ats-framework by Axway.
the class MimePackage method getAllStreams.
@PublicAtsApi
public List<InputStream> getAllStreams() throws PackageException {
boolean storeReconnected = false;
try {
// store should be opened for actions including getting InputStream.
storeReconnected = reconnectStoreIfClosed();
ArrayList<InputStream> streams = new ArrayList<InputStream>();
try {
for (MimePart part : parts) {
streams.add(part.getInputStream());
}
} finally {
closeStoreConnection(storeReconnected);
}
return streams;
} catch (MessagingException me) {
throw new PackageException("Could not read mime parts", me);
} catch (IOException ioe) {
throw new PackageException("Could not read mime parts", ioe);
}
}
use of com.axway.ats.common.PublicAtsApi in project ats-framework by Axway.
the class MimePackage method setAttachmentFileName.
/**
* Set/modify attachment file name
*
* @param attachmentPartIndex index among attachment parts only
* @param fileName the file name. Add one or reset existing one
* @throws NoSuchMimePartException if not such attachment part is found
* @throws PackageException in case of other mail messaging exception
*/
@PublicAtsApi
public void setAttachmentFileName(int attachmentPartIndex, String fileName) throws PackageException {
// first check if there is part at this position at all
if (attachmentPartIndex >= attachmentPartIndices.size()) {
throw new NoSuchMimePartException("No attachment at position '" + attachmentPartIndex + "'");
}
try {
MimePart part = getPart(attachmentPartIndices.get(attachmentPartIndex));
// set the attachment file name
part.setFileName(fileName);
// must save now
this.message.saveChanges();
} catch (MessagingException me) {
throw new PackageException(me);
}
}
use of com.axway.ats.common.PublicAtsApi in project ats-framework by Axway.
the class RegistryOperations method setLongValue.
/**
* Applies a Long(REG_QWORD) value on the specified key.
*
* The key will be created if does not exist.
* The key type will be changed if needed.
*
* @param keyPath path to the key
* @param keyName name of the key
* @param keyValue the new key value
*/
@PublicAtsApi
public void setLongValue(@Validate(name = "keyPath", type = ValidationType.STRING_NOT_EMPTY) String keyPath, @Validate(name = "keyName", type = ValidationType.STRING_NOT_EMPTY) String keyName, @Validate(name = "keyValue", type = ValidationType.NONE) long keyValue) {
// validate input parameters
new Validator().validateMethodParameters(new Object[] { keyPath, keyName, keyValue });
registryOperationsImpl.setLongValue(rootKey, keyPath, keyName, keyValue);
}
use of com.axway.ats.common.PublicAtsApi in project ats-framework by Axway.
the class RegistryOperations method setBinaryValue.
/**
* Applies a Binary(REG_BINARY) value on the specified key.
*
* The key will be created if does not exist.
* The key type will be changed if needed.
*
* @param keyPath path to the key
* @param keyName name of the key
* @param keyValue the new key value
*/
@PublicAtsApi
public void setBinaryValue(@Validate(name = "keyPath", type = ValidationType.STRING_NOT_EMPTY) String keyPath, @Validate(name = "keyName", type = ValidationType.STRING_NOT_EMPTY) String keyName, @Validate(name = "keyValue", type = ValidationType.NOT_NULL) byte[] keyValue) {
// validate input parameters
new Validator().validateMethodParameters(new Object[] { keyPath, keyName, keyValue });
registryOperationsImpl.setBinaryValue(rootKey, keyPath, keyName, keyValue);
}
use of com.axway.ats.common.PublicAtsApi in project ats-framework by Axway.
the class RegistryOperations method setStringValue.
/**
* Applies a String(REG_SZ) value on the specified key.
*
* The key will be created if does not exist.
* The key type will be changed if needed.
*
* @param keyPath path to the key
* @param keyName name of the key
* @param keyValue the new key value
*/
@PublicAtsApi
public void setStringValue(@Validate(name = "keyPath", type = ValidationType.STRING_NOT_EMPTY) String keyPath, @Validate(name = "keyName", type = ValidationType.STRING_NOT_EMPTY) String keyName, @Validate(name = "keyValue", type = ValidationType.NOT_NULL) String keyValue) {
// validate input parameters
new Validator().validateMethodParameters(new Object[] { keyPath, keyName, keyValue });
registryOperationsImpl.setStringValue(rootKey, keyPath, keyName, keyValue);
}
Aggregations