_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q167900 | CloudFileShare.create | validation | @DoesServiceRequest
public void create(FileRequestOptions options, OperationContext opContext) throws StorageException {
if (opContext == null) {
opContext = new OperationContext();
}
assertNoSnapshot();
if (this.properties != null && this.properties.getShareQuota() != null) {
Utility.assertInBounds("Share Quota", this.properties.getShareQuota(), 1, FileConstants.MAX_SHARE_QUOTA);
}
opContext.initialize();
options = FileRequestOptions.populateAndApplyDefaults(options, this.fileServiceClient);
ExecutionEngine.executeWithRetry(this.fileServiceClient, this, createImpl(options),
options.getRetryPolicyFactory(), opContext);
} | java | {
"resource": ""
} |
q167901 | CloudFileShare.deleteIfExists | validation | @DoesServiceRequest
public boolean deleteIfExists(AccessCondition accessCondition, FileRequestOptions options,
OperationContext opContext) throws StorageException {
return this.deleteIfExists(DeleteShareSnapshotsOption.NONE, accessCondition, options, opContext);
} | java | {
"resource": ""
} |
q167902 | CloudFileShare.downloadPermissions | validation | @DoesServiceRequest
public FileSharePermissions downloadPermissions(AccessCondition accessCondition, FileRequestOptions options,
OperationContext opContext) throws StorageException {
if (opContext == null) {
opContext = new OperationContext();
}
assertNoSnapshot();
opContext.initialize();
options = FileRequestOptions.populateAndApplyDefaults(options, this.fileServiceClient);
return ExecutionEngine.executeWithRetry(this.fileServiceClient, this,
downloadPermissionsImpl(accessCondition, options), options.getRetryPolicyFactory(), opContext);
} | java | {
"resource": ""
} |
q167903 | CloudFileShare.generateSharedAccessSignature | validation | public String generateSharedAccessSignature(
final SharedAccessFilePolicy policy, final String groupPolicyIdentifier, final IPRange ipRange,
final SharedAccessProtocols protocols)
throws InvalidKeyException, StorageException {
if (!StorageCredentialsHelper.canCredentialsSignRequest(this.fileServiceClient.getCredentials())) {
final String errorMessage = SR.CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY;
throw new IllegalArgumentException(errorMessage);
}
final String resourceName = this.getSharedAccessCanonicalName();
final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlobAndFile(
policy, null /* SharedAccessHeaders */, groupPolicyIdentifier, resourceName,
ipRange, protocols, this.fileServiceClient);
final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForBlobAndFile(
policy, null /* SharedAccessHeaders */, groupPolicyIdentifier, "s", ipRange, protocols, signature);
return builder.toString();
} | java | {
"resource": ""
} |
q167904 | CloudFileShare.uploadPermissions | validation | @DoesServiceRequest
public void uploadPermissions(final FileSharePermissions permissions) throws StorageException {
this.uploadPermissions(permissions, null /* accessCondition */, null /* options */, null /* opContext */);
} | java | {
"resource": ""
} |
q167905 | CloudFileShare.uploadPermissions | validation | @DoesServiceRequest
public void uploadPermissions(final FileSharePermissions permissions, final AccessCondition accessCondition,
FileRequestOptions options, OperationContext opContext) throws StorageException {
assertNoSnapshot();
if (opContext == null) {
opContext = new OperationContext();
}
opContext.initialize();
options = FileRequestOptions.populateAndApplyDefaults(options, this.fileServiceClient);
ExecutionEngine.executeWithRetry(this.fileServiceClient, this,
uploadPermissionsImpl(permissions, accessCondition, options), options.getRetryPolicyFactory(),
opContext);
} | java | {
"resource": ""
} |
q167906 | CloudFileShare.getQualifiedUri | validation | public final URI getQualifiedUri() throws URISyntaxException, StorageException {
if (this.isSnapshot()) {
return PathUtility.addToQuery(this.getUri(), String.format("sharesnapshot=%s", this.snapshotID));
}
return this.fileServiceClient.getCredentials().transformUri(this.getUri());
} | java | {
"resource": ""
} |
q167907 | TableGettingStartedTask.BasicInsertEntity | validation | public void BasicInsertEntity() throws StorageException {
// Note: the limitations on an insert operation are
// - the serialized payload must be 1 MB or less
// - up to 252 properties in addition to the partition key, row key and
// timestamp. 255 properties in total
// - the serialized payload of each property must be 64 KB or less
// Create a new customer entity.
CustomerEntity customer1 = new CustomerEntity("Harp", "Walter");
customer1.setEmail("Walter@contoso.com");
customer1.setPhoneNumber("425-555-0101");
// Create an operation to add the new customer to the tablebasics table.
TableOperation insertCustomer1 = TableOperation.insert(customer1);
// Submit the operation to the table service.
table.execute(insertCustomer1);
} | java | {
"resource": ""
} |
q167908 | TableGettingStartedTask.BasicBatch | validation | public void BasicBatch() throws StorageException {
// Note: the limitations on a batch operation are
// - up to 100 operations
// - all operations must share the same PartitionKey
// - if a retrieve is used it can be the only operation in the batch
// - the serialized batch payload must be 4 MB or less
// Define a batch operation.
TableBatchOperation batchOperation = new TableBatchOperation();
// Create a customer entity to add to the table.
CustomerEntity customer = new CustomerEntity("Smith", "Jeff");
customer.setEmail("Jeff@contoso.com");
customer.setPhoneNumber("425-555-0104");
batchOperation.insert(customer);
// Create another customer entity to add to the table.
CustomerEntity customer2 = new CustomerEntity("Smith", "Ben");
customer2.setEmail("Ben@contoso.com");
customer2.setPhoneNumber("425-555-0102");
batchOperation.insert(customer2);
// Create a third customer entity to add to the table.
CustomerEntity customer3 = new CustomerEntity("Smith", "Denise");
customer3.setEmail("Denise@contoso.com");
customer3.setPhoneNumber("425-555-0103");
batchOperation.insert(customer3);
// Execute the batch of operations on the "tablebasics" table.
table.execute(batchOperation);
} | java | {
"resource": ""
} |
q167909 | TableGettingStartedTask.BasicQuery | validation | public void BasicQuery() throws StorageException {
// Retrieve a single entity.
// Retrieve the entity with partition key of "Smith" and row key of
// "Jeff".
TableOperation retrieveSmithJeff = TableOperation.retrieve("Smith",
"Jeff", CustomerEntity.class);
// Submit the operation to the table service and get the specific
// entity.
@SuppressWarnings("unused")
CustomerEntity specificEntity = table.execute(retrieveSmithJeff)
.getResultAsType();
// Retrieve all entities in a partition.
// Create a filter condition where the partition key is "Smith".
String partitionFilter = TableQuery.generateFilterCondition(
"PartitionKey", QueryComparisons.EQUAL, "Smith");
// Specify a partition query, using "Smith" as the partition key filter.
TableQuery<CustomerEntity> partitionQuery = TableQuery.from(
CustomerEntity.class).where(partitionFilter);
// Loop through the results, displaying information about the entity.
for (CustomerEntity entity : table.execute(partitionQuery)) {
act.outputText(
view,
entity.getPartitionKey() + " " + entity.getRowKey() + "\t"
+ entity.getEmail() + "\t"
+ entity.getPhoneNumber());
}
} | java | {
"resource": ""
} |
q167910 | TableGettingStartedTask.BasicUpsert | validation | public void BasicUpsert() throws StorageException {
// Retrieve the entity with partition key of "Smith" and row key of
// "Jeff".
TableOperation retrieveSmithJeff = TableOperation.retrieve("Smith",
"Jeff", CustomerEntity.class);
// Submit the operation to the table service and get the specific
// entity.
CustomerEntity specificEntity = table.execute(retrieveSmithJeff)
.getResultAsType();
// Specify a new phone number.
specificEntity.setPhoneNumber("425-555-0105");
// Create an operation to replace the entity.
TableOperation replaceEntity = TableOperation.merge(specificEntity);
// Submit the operation to the table service.
table.execute(replaceEntity);
} | java | {
"resource": ""
} |
q167911 | TableGettingStartedTask.BasicDeleteEntity | validation | public void BasicDeleteEntity() throws StorageException {
// Create an operation to retrieve the entity with partition key of
// "Smith" and row key of "Jeff".
TableOperation retrieveSmithJeff = TableOperation.retrieve("Smith",
"Jeff", CustomerEntity.class);
// Retrieve the entity with partition key of "Smith" and row key of
// "Jeff".
CustomerEntity entitySmithJeff = table.execute(retrieveSmithJeff)
.getResultAsType();
// Create an operation to delete the entity.
TableOperation deleteSmithJeff = TableOperation.delete(entitySmithJeff);
// Submit the delete operation to the table service.
table.execute(deleteSmithJeff);
} | java | {
"resource": ""
} |
q167912 | TableGettingStartedTask.BasicListing | validation | public void BasicListing() {
// List the tables with a given prefix.
Iterable<String> listTables = tableClient.listTables(tableName, null,
null);
for (String s : listTables) {
act.outputText(view, String.format("List of tables: %s", s));
}
} | java | {
"resource": ""
} |
q167913 | CloudTableClient.generateListTablesQuery | validation | private TableQuery<TableServiceEntity> generateListTablesQuery(final String prefix) {
TableQuery<TableServiceEntity> listQuery = TableQuery.<TableServiceEntity> from(TableServiceEntity.class);
listQuery.setSourceTableName(TableConstants.TABLES_SERVICE_TABLES_NAME);
if (!Utility.isNullOrEmpty(prefix)) {
// Append Max char to end '{' is 1 + 'z' in AsciiTable > uppperBound = prefix + '{'
final String prefixFilter = String.format("(%s ge '%s') and (%s lt '%s{')", TableConstants.TABLE_NAME,
prefix, TableConstants.TABLE_NAME, prefix);
listQuery = listQuery.where(prefixFilter);
}
return listQuery;
} | java | {
"resource": ""
} |
q167914 | CloudTableClient.executeQuerySegmentedImpl | validation | protected <T extends TableEntity, R> ResultSegment<?> executeQuerySegmentedImpl(final TableQuery<T> queryToExecute,
final EntityResolver<R> resolver, final ResultContinuation continuationToken, TableRequestOptions options,
OperationContext opContext) throws StorageException {
if (opContext == null) {
opContext = new OperationContext();
}
opContext.initialize();
options = TableRequestOptions.populateAndApplyDefaults(options, this);
Utility.assertContinuationType(continuationToken, ResultContinuationType.TABLE);
SegmentedStorageRequest segmentedRequest = new SegmentedStorageRequest();
segmentedRequest.setToken(continuationToken);
return ExecutionEngine.executeWithRetry(this, queryToExecute,
this.executeQuerySegmentedWithResolverCoreImpl(queryToExecute, resolver, options, segmentedRequest),
options.getRetryPolicyFactory(), opContext);
} | java | {
"resource": ""
} |
q167915 | CloudTableClient.generateIteratorForQuery | validation | protected <T extends TableEntity, R> Iterable<?> generateIteratorForQuery(final TableQuery<T> queryRef,
final EntityResolver<R> resolver, TableRequestOptions options, OperationContext opContext) {
if (opContext == null) {
opContext = new OperationContext();
}
opContext.initialize();
options = TableRequestOptions.populateAndApplyDefaults(options, this);
SegmentedStorageRequest segmentedRequest = new SegmentedStorageRequest();
if (resolver == null) {
return new LazySegmentedIterable<CloudTableClient, TableQuery<T>, T>(this.executeQuerySegmentedCoreImpl(
queryRef, resolver, options, segmentedRequest), this, queryRef, options.getRetryPolicyFactory(),
opContext);
}
else {
return new LazySegmentedIterable<CloudTableClient, TableQuery<T>, R>(
this.executeQuerySegmentedWithResolverCoreImpl(queryRef, resolver, options, segmentedRequest),
this, queryRef, options.getRetryPolicyFactory(), opContext);
}
} | java | {
"resource": ""
} |
q167916 | LogRecord.populateVersion1Log | validation | private void populateVersion1Log(LogRecordStreamReader reader) throws IOException, ParseException,
URISyntaxException {
this.requestStartTime = reader.readDate(LogRecord.REQUEST_START_TIME_FORMAT);
this.operationType = reader.readString();
this.requestStatus = reader.readString();
this.httpStatusCode = reader.readString();
this.endToEndLatencyInMS = reader.readInteger();
this.serverLatencyInMS = reader.readInteger();
this.authenticationType = reader.readString();
this.requesterAccountName = reader.readString();
this.ownerAccountName = reader.readString();
this.serviceType = reader.readString();
this.requestUrl = reader.readUri();
this.requestedObjectKey = reader.readQuotedString();
this.requestIdHeader = reader.readUuid();
this.operationCount = reader.readInteger();
this.requesterIPAddress = reader.readString();
this.requestVersionHeader = reader.readString();
this.requestHeaderSize = reader.readLong();
this.requestPacketSize = reader.readLong();
this.responseHeaderSize = reader.readLong();
this.responsePacketSize = reader.readLong();
this.requestContentLength = reader.readLong();
this.requestMD5 = reader.readQuotedString();
this.serverMD5 = reader.readQuotedString();
this.eTagIdentifier = reader.readQuotedString();
this.lastModifiedTime = reader.readDate(LogRecord.LAST_MODIFIED_TIME_FORMAT);
this.conditionsUsed = reader.readQuotedString();
this.userAgentHeader = reader.readQuotedString();
this.referrerHeader = reader.readQuotedString();
this.clientRequestId = reader.readQuotedString();
reader.endCurrentRecord();
} | java | {
"resource": ""
} |
q167917 | QueueListHandler.getQueues | validation | public static ListResponse<CloudQueue> getQueues(final InputStream stream, final CloudQueueClient serviceClient)
throws SAXException, IOException, ParserConfigurationException {
SAXParser saxParser = Utility.getSAXParser();
QueueListHandler handler = new QueueListHandler(serviceClient);
saxParser.parse(stream, handler);
return handler.response;
} | java | {
"resource": ""
} |
q167918 | StorageException.translateFromHttpStatus | validation | protected static StorageException translateFromHttpStatus(final int statusCode, final String statusDescription,
final Exception inner) {
String errorCode;
switch (statusCode) {
case HttpURLConnection.HTTP_FORBIDDEN:
errorCode = StorageErrorCode.ACCESS_DENIED.toString();
break;
case HttpURLConnection.HTTP_GONE:
case HttpURLConnection.HTTP_NOT_FOUND:
errorCode = StorageErrorCode.RESOURCE_NOT_FOUND.toString();
break;
case 416:
case HttpURLConnection.HTTP_BAD_REQUEST:
// 416: RequestedRangeNotSatisfiable - No corresponding enum in HttpURLConnection
errorCode = StorageErrorCode.BAD_REQUEST.toString();
break;
case HttpURLConnection.HTTP_PRECON_FAILED:
case HttpURLConnection.HTTP_NOT_MODIFIED:
errorCode = StorageErrorCode.CONDITION_FAILED.toString();
break;
case HttpURLConnection.HTTP_CONFLICT:
errorCode = StorageErrorCode.RESOURCE_ALREADY_EXISTS.toString();
break;
case HttpURLConnection.HTTP_UNAVAILABLE:
errorCode = StorageErrorCode.SERVER_BUSY.toString();
break;
case HttpURLConnection.HTTP_GATEWAY_TIMEOUT:
errorCode = StorageErrorCode.SERVICE_TIMEOUT.toString();
break;
case HttpURLConnection.HTTP_INTERNAL_ERROR:
errorCode = StorageErrorCode.SERVICE_INTERNAL_ERROR.toString();
break;
case HttpURLConnection.HTTP_NOT_IMPLEMENTED:
errorCode = StorageErrorCode.NOT_IMPLEMENTED.toString();
break;
case HttpURLConnection.HTTP_BAD_GATEWAY:
errorCode = StorageErrorCode.BAD_GATEWAY.toString();
break;
case HttpURLConnection.HTTP_VERSION:
errorCode = StorageErrorCode.HTTP_VERSION_NOT_SUPPORTED.toString();
break;
default:
errorCode = null;
}
if (errorCode == null) {
return null;
} else {
return new StorageException(errorCode, statusDescription, statusCode, null, inner);
}
} | java | {
"resource": ""
} |
q167919 | CloudQueueClient.listQueues | validation | @DoesServiceRequest
public Iterable<CloudQueue> listQueues() {
return this.listQueues(null, QueueListingDetails.NONE, null, null);
} | java | {
"resource": ""
} |
q167920 | CloudQueueClient.listQueues | validation | @DoesServiceRequest
public Iterable<CloudQueue> listQueues(final String prefix) {
return this.listQueues(prefix, QueueListingDetails.NONE, null, null);
} | java | {
"resource": ""
} |
q167921 | CloudQueueClient.listQueues | validation | @DoesServiceRequest
public Iterable<CloudQueue> listQueues(final String prefix, final QueueListingDetails detailsIncluded,
QueueRequestOptions options, OperationContext opContext) {
if (opContext == null) {
opContext = new OperationContext();
}
opContext.initialize();
options = QueueRequestOptions.populateAndApplyDefaults(options, this);
SegmentedStorageRequest segmentedRequest = new SegmentedStorageRequest();
return new LazySegmentedIterable<CloudQueueClient, Void, CloudQueue>(this.listQueuesSegmentedImpl(prefix,
detailsIncluded, null, options, segmentedRequest), this, null, options.getRetryPolicyFactory(), opContext);
} | java | {
"resource": ""
} |
q167922 | CloudQueueClient.listQueuesSegmented | validation | @DoesServiceRequest
public ResultSegment<CloudQueue> listQueuesSegmented() throws StorageException {
return this.listQueuesSegmented(null, QueueListingDetails.NONE, null, null, null, null);
} | java | {
"resource": ""
} |
q167923 | CloudQueueClient.listQueuesSegmented | validation | @DoesServiceRequest
public ResultSegment<CloudQueue> listQueuesSegmented(final String prefix,
final QueueListingDetails detailsIncluded, final Integer maxResults,
final ResultContinuation continuationToken, QueueRequestOptions options, OperationContext opContext)
throws StorageException {
if (opContext == null) {
opContext = new OperationContext();
}
opContext.initialize();
options = QueueRequestOptions.populateAndApplyDefaults(options, this);
SegmentedStorageRequest segmentedRequest = new SegmentedStorageRequest();
segmentedRequest.setToken(continuationToken);
return ExecutionEngine.executeWithRetry(this, null,
this.listQueuesSegmentedImpl(prefix, detailsIncluded, maxResults, options, segmentedRequest),
options.getRetryPolicyFactory(), opContext);
} | java | {
"resource": ""
} |
q167924 | Schematron.addConfiguredXMLCatalog | validation | public void addConfiguredXMLCatalog (@Nonnull final XMLCatalog aXmlCatalog)
{
m_aXmlCatalog.addConfiguredXMLCatalog (aXmlCatalog);
log ("Added XMLCatalog " + aXmlCatalog, Project.MSG_DEBUG);
} | java | {
"resource": ""
} |
q167925 | PreprocessorIDPool.getUniqueID | validation | @Nullable
public String getUniqueID (@Nullable final String sID)
{
if (sID == null)
return null;
if (m_aUsedIDs.add (sID))
{
// Unique ID
return sID;
}
// Non-unique ID
int nIndex = 0;
String sNewID = sID + nIndex;
do
{
if (m_aUsedIDs.add (sNewID))
{
// Now it's unique
return sNewID;
}
++nIndex;
sNewID = sID + nIndex;
} while (true);
} | java | {
"resource": ""
} |
q167926 | SchematronResourcePure.setPhase | validation | @Nonnull
public SchematronResourcePure setPhase (@Nullable final String sPhase)
{
if (m_aBoundSchema != null)
throw new IllegalStateException ("Schematron was already bound and can therefore not be altered!");
m_sPhase = sPhase;
return this;
} | java | {
"resource": ""
} |
q167927 | SchematronResourcePure.setErrorHandler | validation | @Nonnull
public SchematronResourcePure setErrorHandler (@Nullable final IPSErrorHandler aErrorHandler)
{
if (m_aBoundSchema != null)
throw new IllegalStateException ("Schematron was already bound and can therefore not be altered!");
m_aErrorHandler = aErrorHandler;
return this;
} | java | {
"resource": ""
} |
q167928 | SchematronResourcePure.setVariableResolver | validation | @Nonnull
public SchematronResourcePure setVariableResolver (@Nullable final XPathVariableResolver aVariableResolver)
{
if (m_aBoundSchema != null)
throw new IllegalStateException ("Schematron was already bound and can therefore not be altered!");
m_aVariableResolver = aVariableResolver;
return this;
} | java | {
"resource": ""
} |
q167929 | SchematronResourcePure.setFunctionResolver | validation | @Nonnull
public SchematronResourcePure setFunctionResolver (@Nullable final XPathFunctionResolver aFunctionResolver)
{
if (m_aBoundSchema != null)
throw new IllegalStateException ("Schematron was already bound and can therefore not be altered!");
m_aFunctionResolver = aFunctionResolver;
return this;
} | java | {
"resource": ""
} |
q167930 | SchematronResourcePure.setEntityResolver | validation | @Nonnull
public SchematronResourcePure setEntityResolver (@Nullable final EntityResolver aEntityResolver)
{
if (m_aBoundSchema != null)
throw new IllegalStateException ("Schematron was already bound and can therefore not be altered!");
internalSetEntityResolver (aEntityResolver);
return this;
} | java | {
"resource": ""
} |
q167931 | SchematronResourcePure.getOrCreateBoundSchema | validation | @Nonnull
public IPSBoundSchema getOrCreateBoundSchema ()
{
if (m_aBoundSchema == null)
try
{
m_aBoundSchema = createBoundSchema ();
}
catch (final RuntimeException ex)
{
if (m_aErrorHandler != null)
m_aErrorHandler.error (getResource (), null, "Error creating bound schema", ex);
throw ex;
}
return m_aBoundSchema;
} | java | {
"resource": ""
} |
q167932 | SchematronResourcePure.validateCompletely | validation | public void validateCompletely (@Nonnull final IPSErrorHandler aErrorHandler)
{
ValueEnforcer.notNull (aErrorHandler, "ErrorHandler");
try
{
getOrCreateBoundSchema ().getOriginalSchema ().validateCompletely (aErrorHandler);
}
catch (final RuntimeException ex)
{
// May happen when XPath errors are contained
}
} | java | {
"resource": ""
} |
q167933 | SchematronResourcePure.applySchematronValidationToSVRL | validation | @Nonnull
public SchematronOutputType applySchematronValidationToSVRL (@Nonnull final Node aXMLNode,
@Nullable final String sBaseURI) throws SchematronException
{
ValueEnforcer.notNull (aXMLNode, "XMLNode");
final SchematronOutputType aSOT = getOrCreateBoundSchema ().validateComplete (aXMLNode, sBaseURI);
// Debug print the created SVRL document
if (SchematronDebug.isShowCreatedSVRL ())
LOGGER.info ("Created SVRL:\n" + new SVRLMarshaller (false).getAsString (aSOT));
return aSOT;
} | java | {
"resource": ""
} |
q167934 | PSPreprocessor._resolveRuleContent | validation | private void _resolveRuleContent (@Nonnull final ICommonsList <IPSElement> aRuleContent,
@Nonnull final PreprocessorLookup aLookup,
@Nonnull final PreprocessorIDPool aIDPool,
@Nullable final ICommonsMap <String, String> aParamValueMap,
@Nonnull final PSRule aTargetRule) throws SchematronPreprocessException
{
for (final IPSElement aElement : aRuleContent)
{
if (aElement instanceof PSAssertReport)
{
final PSAssertReport aAssertReport = (PSAssertReport) aElement;
aTargetRule.addAssertReport (_getPreprocessedAssert (aAssertReport, aIDPool, aParamValueMap));
}
else
{
final PSExtends aExtends = (PSExtends) aElement;
final String sRuleID = aExtends.getRule ();
final PSRule aBaseRule = aLookup.getAbstractRuleOfID (sRuleID);
if (aBaseRule == null)
throw new SchematronPreprocessException ("Failed to resolve rule ID '" +
sRuleID +
"' in extends statement. Available rules are: " +
aLookup.getAllAbstractRuleIDs ());
// Recursively resolve the extends of the base rule
_resolveRuleContent (aBaseRule.getAllContentElements (), aLookup, aIDPool, aParamValueMap, aTargetRule);
// Copy all lets
for (final PSLet aBaseLet : aBaseRule.getAllLets ())
aTargetRule.addLet (aBaseLet.getClone ());
}
}
} | java | {
"resource": ""
} |
q167935 | PSPreprocessor.getAsMinimalSchema | validation | @Nullable
public PSSchema getAsMinimalSchema (@Nonnull final PSSchema aSchema) throws SchematronPreprocessException
{
ValueEnforcer.notNull (aSchema, "Schema");
// Anything to do?
if (aSchema.isMinimal ())
return aSchema;
return getForcedPreprocessedSchema (aSchema);
} | java | {
"resource": ""
} |
q167936 | PSPreprocessor.getAsPreprocessedSchema | validation | @Nullable
public PSSchema getAsPreprocessedSchema (@Nonnull final PSSchema aSchema) throws SchematronPreprocessException
{
ValueEnforcer.notNull (aSchema, "Schema");
// Anything to do?
if (aSchema.isPreprocessed ())
return aSchema;
return getForcedPreprocessedSchema (aSchema);
} | java | {
"resource": ""
} |
q167937 | PSPreprocessor.getForcedPreprocessedSchema | validation | @Nullable
public PSSchema getForcedPreprocessedSchema (@Nonnull final PSSchema aSchema) throws SchematronPreprocessException
{
ValueEnforcer.notNull (aSchema, "Schema");
final PreprocessorLookup aLookup = new PreprocessorLookup (aSchema);
final PreprocessorIDPool aIDPool = new PreprocessorIDPool ();
final PSSchema ret = new PSSchema (aSchema.getResource ());
ret.setID (aIDPool.getUniqueID (aSchema.getID ()));
ret.setRich (aSchema.getRichClone ());
ret.setSchemaVersion (aSchema.getSchemaVersion ());
ret.setDefaultPhase (aSchema.getDefaultPhase ());
ret.setQueryBinding (aSchema.getQueryBinding ());
if (m_bKeepTitles && aSchema.hasTitle ())
ret.setTitle (aSchema.getTitle ().getClone ());
if (aSchema.hasAnyInclude ())
throw new SchematronPreprocessException ("Cannot preprocess <schema> with an <include>");
for (final PSNS aNS : aSchema.getAllNSs ())
ret.addNS (aNS.getClone ());
// start ps are skipped
for (final PSLet aLet : aSchema.getAllLets ())
ret.addLet (aLet.getClone ());
for (final PSPhase aPhase : aSchema.getAllPhases ())
ret.addPhase (_getPreprocessedPhase (aPhase, aIDPool));
for (final PSPattern aPattern : aSchema.getAllPatterns ())
{
final PSPattern aMinifiedPattern = _getPreprocessedPattern (aPattern, aLookup, aIDPool);
if (aMinifiedPattern != null)
{
// Pattern without rules?
if (aMinifiedPattern.getRuleCount () > 0 || m_bKeepEmptyPatterns)
ret.addPattern (aMinifiedPattern);
}
}
// Schema without patterns?
if (aSchema.getPatternCount () == 0 && !m_bKeepEmptySchema)
return null;
// end ps are skipped
if (m_bKeepDiagnostics && aSchema.hasDiagnostics ())
ret.setDiagnostics (_getPreprocessedDiagnostics (aSchema.getDiagnostics ()));
ret.addForeignElements (aSchema.getAllForeignElements ());
ret.addForeignAttributes (aSchema.getAllForeignAttributes ());
return ret;
} | java | {
"resource": ""
} |
q167938 | PSBoundSchemaCacheKey.readSchema | validation | @Nonnull
@OverrideOnDemand
public PSSchema readSchema (@Nonnull final IReadableResource aResource,
@Nullable final IPSErrorHandler aErrorHandler,
@Nullable final EntityResolver aEntityResolver) throws SchematronException
{
return new PSReader (aResource, aErrorHandler, aEntityResolver).readSchema ();
} | java | {
"resource": ""
} |
q167939 | PSBoundSchemaCacheKey.getQueryBinding | validation | @Nonnull
@OverrideOnDemand
public IPSQueryBinding getQueryBinding (@Nonnull final PSSchema aSchema) throws SchematronException
{
return PSQueryBindingRegistry.getQueryBindingOfNameOrThrow (aSchema.getQueryBinding ());
} | java | {
"resource": ""
} |
q167940 | PSBoundSchemaCacheKey.createPreprocessedSchema | validation | @Nonnull
@OverrideOnDemand
public PSSchema createPreprocessedSchema (@Nonnull final PSSchema aSchema,
@Nonnull final IPSQueryBinding aQueryBinding) throws SchematronException
{
final PSPreprocessor aPreprocessor = createPreprocessor (aQueryBinding);
final PSSchema aPreprocessedSchema = aPreprocessor.getAsPreprocessedSchema (aSchema);
if (aPreprocessedSchema == null)
throw new SchematronPreprocessException ("Failed to preprocess schema " +
aSchema +
" with query binding " +
aQueryBinding);
if (SchematronDebug.isShowPreprocessedSchematron ())
LOGGER.info ("Preprocessed Schematron:\n" +
MicroWriter.getNodeAsString (aPreprocessedSchema.getAsMicroElement ()));
return aPreprocessedSchema;
} | java | {
"resource": ""
} |
q167941 | PSWriter.writeToFile | validation | @Nonnull
public ESuccess writeToFile (@Nonnull final IPSElement aPSElement, @Nonnull final File aFile)
{
ValueEnforcer.notNull (aPSElement, "PSElement");
final IMicroElement eXML = aPSElement.getAsMicroElement ();
return MicroWriter.writeToFile (getAsDocument (eXML), aFile, m_aWriterSettings.getXMLWriterSettings ());
} | java | {
"resource": ""
} |
q167942 | PSWriter.writeToStream | validation | @Nonnull
public ESuccess writeToStream (@Nonnull final IPSElement aPSElement, @Nonnull @WillClose final OutputStream aOS)
{
ValueEnforcer.notNull (aPSElement, "PSElement");
final IMicroElement eXML = aPSElement.getAsMicroElement ();
return MicroWriter.writeToStream (getAsDocument (eXML), aOS, m_aWriterSettings.getXMLWriterSettings ());
} | java | {
"resource": ""
} |
q167943 | PSWriter.writeToWriter | validation | @Nonnull
public ESuccess writeToWriter (@Nonnull final IPSElement aPSElement, @Nonnull @WillClose final Writer aWriter)
{
ValueEnforcer.notNull (aPSElement, "PSElement");
final IMicroElement eXML = aPSElement.getAsMicroElement ();
return MicroWriter.writeToWriter (getAsDocument (eXML), aWriter, m_aWriterSettings.getXMLWriterSettings ());
} | java | {
"resource": ""
} |
q167944 | SchematronHelper.applySchematron | validation | @Nullable
public static SchematronOutputType applySchematron (@Nonnull final ISchematronResource aSchematron,
@Nonnull final IReadableResource aXML)
{
ValueEnforcer.notNull (aSchematron, "SchematronResource");
ValueEnforcer.notNull (aXML, "XMLSource");
try
{
// Apply Schematron on XML
return aSchematron.applySchematronValidationToSVRL (aXML);
}
catch (final Exception ex)
{
throw new IllegalArgumentException ("Failed to apply Schematron " +
aSchematron.getID () +
" onto XML resource " +
aXML.getResourceID (),
ex);
}
} | java | {
"resource": ""
} |
q167945 | SchematronHelper.applySchematron | validation | @Nullable
public static SchematronOutputType applySchematron (@Nonnull final ISchematronResource aSchematron,
@Nonnull final Node aNode)
{
ValueEnforcer.notNull (aSchematron, "SchematronResource");
ValueEnforcer.notNull (aNode, "Node");
return applySchematron (aSchematron, new DOMSource (aNode));
} | java | {
"resource": ""
} |
q167946 | PSXPathVariables.remove | validation | @Nonnull
public EChange remove (@Nullable final String sVarName)
{
if (StringHelper.hasText (sVarName))
if (m_aMap.remove (PSXPathQueryBinding.PARAM_VARIABLE_PREFIX + sVarName) == null)
return EChange.CHANGED;
return EChange.UNCHANGED;
} | java | {
"resource": ""
} |
q167947 | PSXPathVariables.removeAll | validation | @Nonnull
public EChange removeAll (@Nullable final Iterable <String> aVars)
{
EChange eChange = EChange.UNCHANGED;
if (aVars != null)
for (final String sName : aVars)
eChange = eChange.or (remove (sName));
return eChange;
}
@Nonnull
@ReturnsMutableCopy
public ICommonsNavigableMap <String, String> getAll ()
{
return m_aMap.getClone ();
}
public boolean contains (@Nullable final String sName)
{
if (StringHelper.hasNoText (sName))
return false;
return m_aMap.containsKey (sName);
} | java | {
"resource": ""
} |
q167948 | SVRLHelper.getAllFailedAssertions | validation | @Nonnull
@ReturnsMutableCopy
public static ICommonsList <SVRLFailedAssert> getAllFailedAssertions (@Nullable final SchematronOutputType aSchematronOutput)
{
final ICommonsList <SVRLFailedAssert> ret = new CommonsArrayList <> ();
if (aSchematronOutput != null)
for (final Object aObj : aSchematronOutput.getActivePatternAndFiredRuleAndFailedAssert ())
if (aObj instanceof FailedAssert)
ret.add (new SVRLFailedAssert ((FailedAssert) aObj));
return ret;
} | java | {
"resource": ""
} |
q167949 | SVRLHelper.getAllFailedAssertionsMoreOrEqualSevereThan | validation | @Nonnull
@ReturnsMutableCopy
public static ICommonsList <SVRLFailedAssert> getAllFailedAssertionsMoreOrEqualSevereThan (@Nullable final SchematronOutputType aSchematronOutput,
@Nonnull final IErrorLevel aErrorLevel)
{
final ICommonsList <SVRLFailedAssert> ret = new CommonsArrayList <> ();
if (aSchematronOutput != null)
for (final Object aObj : aSchematronOutput.getActivePatternAndFiredRuleAndFailedAssert ())
if (aObj instanceof FailedAssert)
{
final SVRLFailedAssert aFA = new SVRLFailedAssert ((FailedAssert) aObj);
if (aFA.getFlag ().isGE (aErrorLevel))
ret.add (aFA);
}
return ret;
} | java | {
"resource": ""
} |
q167950 | SVRLHelper.getAllSuccessfulReports | validation | @Nonnull
@ReturnsMutableCopy
public static ICommonsList <SVRLSuccessfulReport> getAllSuccessfulReports (@Nullable final SchematronOutputType aSchematronOutput)
{
final ICommonsList <SVRLSuccessfulReport> ret = new CommonsArrayList <> ();
if (aSchematronOutput != null)
for (final Object aObj : aSchematronOutput.getActivePatternAndFiredRuleAndFailedAssert ())
if (aObj instanceof SuccessfulReport)
ret.add (new SVRLSuccessfulReport ((SuccessfulReport) aObj));
return ret;
} | java | {
"resource": ""
} |
q167951 | SVRLHelper.getAllSuccessfulReportsMoreOrEqualSevereThan | validation | @Nonnull
@ReturnsMutableCopy
public static ICommonsList <SVRLSuccessfulReport> getAllSuccessfulReportsMoreOrEqualSevereThan (@Nullable final SchematronOutputType aSchematronOutput,
@Nonnull final IErrorLevel aErrorLevel)
{
final ICommonsList <SVRLSuccessfulReport> ret = new CommonsArrayList <> ();
if (aSchematronOutput != null)
for (final Object aObj : aSchematronOutput.getActivePatternAndFiredRuleAndFailedAssert ())
if (aObj instanceof SuccessfulReport)
{
final SVRLSuccessfulReport aSR = new SVRLSuccessfulReport ((SuccessfulReport) aObj);
if (aSR.getFlag ().isGE (aErrorLevel))
ret.add (aSR);
}
return ret;
} | java | {
"resource": ""
} |
q167952 | SVRLHelper.getAllFailedAssertionsAndSuccessfulReports | validation | @Nonnull
@ReturnsMutableCopy
public static ICommonsList <AbstractSVRLMessage> getAllFailedAssertionsAndSuccessfulReports (@Nullable final SchematronOutputType aSchematronOutput)
{
final ICommonsList <AbstractSVRLMessage> ret = new CommonsArrayList <> ();
if (aSchematronOutput != null)
for (final Object aObj : aSchematronOutput.getActivePatternAndFiredRuleAndFailedAssert ())
if (aObj instanceof FailedAssert)
ret.add (new SVRLFailedAssert ((FailedAssert) aObj));
else
if (aObj instanceof SuccessfulReport)
ret.add (new SVRLSuccessfulReport ((SuccessfulReport) aObj));
return ret;
} | java | {
"resource": ""
} |
q167953 | SVRLHelper.setErrorLevelDeterminator | validation | public static void setErrorLevelDeterminator (@Nonnull final ISVRLErrorLevelDeterminator aELD)
{
ValueEnforcer.notNull (aELD, "ErrorLevelDeterminator");
s_aRWLock.readLocked ( () -> s_aELD = aELD);
} | java | {
"resource": ""
} |
q167954 | PSQueryBindingRegistry.getQueryBindingOfName | validation | @Nullable
public static IPSQueryBinding getQueryBindingOfName (@Nullable final String sName)
{
if (sName == null)
return DEFAULT_QUERY_BINDING;
return s_aRWLock.readLocked ( () -> s_aMap.get (sName));
} | java | {
"resource": ""
} |
q167955 | PSQueryBindingRegistry.getQueryBindingOfNameOrThrow | validation | @Nonnull
public static IPSQueryBinding getQueryBindingOfNameOrThrow (@Nullable final String sName) throws SchematronBindException
{
final IPSQueryBinding aQB = getQueryBindingOfName (sName);
if (aQB == null)
throw new SchematronBindException ("No query binding implementation present for query binding '" + sName + "'");
return aQB;
} | java | {
"resource": ""
} |
q167956 | XQueryAsXPathFunctionConverter.loadXQuery | validation | @Nonnull
public MapBasedXPathFunctionResolver loadXQuery (@Nonnull @WillClose final InputStream aXQueryIS) throws XPathException,
IOException
{
ValueEnforcer.notNull (aXQueryIS, "XQueryIS");
try
{
final MapBasedXPathFunctionResolver aFunctionResolver = new MapBasedXPathFunctionResolver ();
// create a Configuration object
final Configuration aConfiguration = new Configuration ();
final DynamicQueryContext aDynamicQueryContext = new DynamicQueryContext (aConfiguration);
final StaticQueryContext aStaticQueryCtx = aConfiguration.newStaticQueryContext ();
// The base URI required for resolving within the XQuery
aStaticQueryCtx.setBaseURI (m_sBaseURL);
// null == auto detect
final String sEncoding = null;
final XQueryExpression exp = aStaticQueryCtx.compileQuery (aXQueryIS, sEncoding);
final Controller aXQController = exp.newController (aDynamicQueryContext);
// find all loaded methods and convert them to XPath functions
final FunctionLibraryList aFuncLibList = exp.getExecutable ().getFunctionLibrary ();
for (final FunctionLibrary aFuncLib : aFuncLibList.getLibraryList ())
{
// Ignore all Vendor, System etc. internal libraries
if (aFuncLib instanceof FunctionLibraryList)
{
// This block works with Saxon HE 9.5.1-x :)
// This is the custom function library list
final FunctionLibraryList aRealFuncLib = (FunctionLibraryList) aFuncLib;
for (final FunctionLibrary aNestedFuncLib : aRealFuncLib.getLibraryList ())
{
// Currently the user functions are in ExecutableFunctionLibrary
if (aNestedFuncLib instanceof ExecutableFunctionLibrary)
for (final UserFunction aUserFunc : new IterableIterator <> (((ExecutableFunctionLibrary) aNestedFuncLib).iterateFunctions ()))
{
// Saxon 9.7 changes "getNumberOfArguments" to "getArity"
aFunctionResolver.addUniqueFunction (aUserFunc.getFunctionName ().getNamespaceBinding ().getURI (),
aUserFunc.getFunctionName ().getLocalPart (),
aUserFunc.getArity (),
new XPathFunctionFromUserFunction (aConfiguration,
aXQController,
aUserFunc));
}
}
}
else
if (aFuncLib instanceof XQueryFunctionLibrary)
{
// This block works with Saxon HE 9.6.0-x :)
final XQueryFunctionLibrary aRealFuncLib = (XQueryFunctionLibrary) aFuncLib;
for (final XQueryFunction aXQueryFunction : new IterableIterator <> (aRealFuncLib.getFunctionDefinitions ()))
{
// Ensure the function is compiled
aXQueryFunction.compile ();
aFunctionResolver.addUniqueFunction (aXQueryFunction.getFunctionName ().getNamespaceBinding ().getURI (),
aXQueryFunction.getFunctionName ().getLocalPart (),
aXQueryFunction.getNumberOfArguments (),
new XPathFunctionFromUserFunction (aConfiguration,
aXQController,
aXQueryFunction.getUserFunction ()));
}
}
}
return aFunctionResolver;
}
finally
{
StreamHelper.close (aXQueryIS);
}
} | java | {
"resource": ""
} |
q167957 | Slf4jAdapter._format | validation | private String _format (final String format, final Object arg)
{
final FormattingTuple tuple = MessageFormatter.format (format, arg);
return tuple.getMessage ();
} | java | {
"resource": ""
} |
q167958 | Slf4jAdapter._format | validation | private String _format (final String format, final Object first, final Object second)
{
final FormattingTuple tuple = MessageFormatter.format (format, first, second);
return tuple.getMessage ();
} | java | {
"resource": ""
} |
q167959 | SchematronValidator.isValidSchematron | validation | public static boolean isValidSchematron (@Nullable final IMicroNode aNode)
{
if (aNode == null)
return false;
return isValidSchematron (TransformSourceFactory.create (MicroWriter.getNodeAsString (aNode)));
} | java | {
"resource": ""
} |
q167960 | SchematronValidator.isValidSchematron | validation | public static boolean isValidSchematron (@Nullable final Node aNode)
{
if (aNode == null)
return false;
return isValidSchematron (TransformSourceFactory.create (aNode));
} | java | {
"resource": ""
} |
q167961 | SchematronValidator.isValidSchematron | validation | public static boolean isValidSchematron (@Nullable final IReadableResource aRes)
{
if (aRes == null)
return false;
return isValidSchematron (TransformSourceFactory.create (aRes));
} | java | {
"resource": ""
} |
q167962 | SchematronValidator.isValidSchematron | validation | public static boolean isValidSchematron (@Nullable final Source aSource)
{
if (aSource == null)
return false;
try
{
// Get a validator from the RNC schema.
final Validator aValidator = RelaxNGCompactSchemaCache.getInstance ().getValidator (SCHEMATRON_RNC);
// Ensure a collecting error handler is set
final ErrorHandler aOldEH = aValidator.getErrorHandler ();
CollectingSAXErrorHandler aCEH;
if (aOldEH instanceof CollectingSAXErrorHandler)
aCEH = (CollectingSAXErrorHandler) aOldEH;
else
{
aCEH = new CollectingSAXErrorHandler ();
aValidator.setErrorHandler (aCEH.andThen (aOldEH));
}
// Perform validation
aValidator.validate (aSource, null);
// Check results
return aCEH.getErrorList ().getMostSevereErrorLevel ().isLT (EErrorLevel.ERROR);
}
catch (final SAXException ex)
{
// Document is not valid in respect to XML
}
catch (final IOException ex)
{
LOGGER.warn ("Failed to read source " + aSource, ex);
}
return false;
} | java | {
"resource": ""
} |
q167963 | SchematronResourceSCHCache.createSchematronXSLTProvider | validation | @Nullable
public static SchematronProviderXSLTFromSCH createSchematronXSLTProvider (@Nonnull final IReadableResource aSchematronResource,
@Nonnull final SCHTransformerCustomizer aTransformerCustomizer)
{
if (LOGGER.isDebugEnabled ())
LOGGER.debug ("Compiling Schematron instance " + aSchematronResource.toString ());
final SchematronProviderXSLTFromSCH aXSLTPreprocessor = new SchematronProviderXSLTFromSCH (aSchematronResource,
aTransformerCustomizer);
if (!aXSLTPreprocessor.isValidSchematron ())
{
// Schematron is invalid -> parsing failed
LOGGER.warn ("The Schematron resource '" + aSchematronResource.getResourceID () + "' is invalid!");
if (LOGGER.isDebugEnabled () && aXSLTPreprocessor.getXSLTDocument () != null)
{
// Log the created XSLT document for better error tracking
LOGGER.debug (" Created XSLT document:\n" +
XMLWriter.getNodeAsString (aXSLTPreprocessor.getXSLTDocument ()));
}
return null;
}
// If it is a valid schematron, there must be a result XSLT present!
if (aXSLTPreprocessor.getXSLTDocument () == null)
throw new IllegalStateException ("No XSLT document retrieved from Schematron resource '" +
aSchematronResource.getResourceID () +
"'!");
if (LOGGER.isDebugEnabled ())
LOGGER.debug ("Finished compiling Schematron instance " + aSchematronResource.toString ());
// Create the main validator for the schematron
return aXSLTPreprocessor;
} | java | {
"resource": ""
} |
q167964 | SchematronResourceSCHCache.getSchematronXSLTProvider | validation | @Nullable
public static SchematronProviderXSLTFromSCH getSchematronXSLTProvider (@Nonnull final IReadableResource aSchematronResource,
@Nonnull final SCHTransformerCustomizer aTransformerCustomizer)
{
ValueEnforcer.notNull (aSchematronResource, "SchematronResource");
ValueEnforcer.notNull (aTransformerCustomizer, "TransformerCustomizer");
if (!aSchematronResource.exists ())
{
LOGGER.warn ("Schematron resource " + aSchematronResource + " does not exist!");
return null;
}
if (!aTransformerCustomizer.canCacheResult ())
{
// Create new object and return without cache handling because the custom
// parameters may have side effects on the created XSLT!
return createSchematronXSLTProvider (aSchematronResource, aTransformerCustomizer);
}
// Determine the unique resource ID for caching
final String sCacheKey = StringHelper.<String> getImploded (':',
aSchematronResource.getResourceID (),
StringHelper.getNotNull (aTransformerCustomizer.getPhase ()),
StringHelper.getNotNull (aTransformerCustomizer.getLanguageCode ()));
s_aLock.lock ();
try
{
// Validator already in the cache?
SchematronProviderXSLTFromSCH aProvider = s_aCache.get (sCacheKey);
if (aProvider == null)
{
// Create new object and put in cache
aProvider = createSchematronXSLTProvider (aSchematronResource, aTransformerCustomizer);
if (aProvider != null)
s_aCache.put (sCacheKey, aProvider);
}
return aProvider;
}
finally
{
s_aLock.unlock ();
}
} | java | {
"resource": ""
} |
q167965 | PSXPathValidationHandlerSVRL._getErrorText | validation | @Nonnull
private String _getErrorText (@Nonnull final List <PSXPathBoundElement> aBoundContentElements,
@Nonnull final Node aSourceNode) throws SchematronValidationException
{
final StringBuilder aSB = new StringBuilder ();
for (final PSXPathBoundElement aBoundElement : aBoundContentElements)
{
final Object aContent = aBoundElement.getElement ();
if (aContent instanceof String)
aSB.append ((String) aContent);
else
if (aContent instanceof PSName)
{
final PSName aName = (PSName) aContent;
if (aName.hasPath ())
{
// XPath present
try
{
aSB.append ((String) XPathEvaluationHelper.evaluate (aBoundElement.getBoundExpression (),
aSourceNode,
XPathConstants.STRING,
m_sBaseURI));
}
catch (final XPathExpressionException ex)
{
_error (aName,
"Failed to evaluate XPath expression to a string: '" + aBoundElement.getExpression () + "'",
ex.getCause () != null ? ex.getCause () : ex);
// Append the path so that something is present in the output
aSB.append (aName.getPath ());
}
}
else
{
// No XPath present
aSB.append (aSourceNode.getNodeName ());
}
}
else
if (aContent instanceof PSValueOf)
{
final PSValueOf aValueOf = (PSValueOf) aContent;
try
{
aSB.append ((String) XPathEvaluationHelper.evaluate (aBoundElement.getBoundExpression (),
aSourceNode,
XPathConstants.STRING,
m_sBaseURI));
}
catch (final XPathExpressionException ex)
{
_error (aValueOf,
"Failed to evaluate XPath expression to a string: '" + aBoundElement.getExpression () + "'",
ex);
// Append the path so that something is present in the output
aSB.append (aValueOf.getSelect ());
}
}
else
if (aContent instanceof PSEmph)
aSB.append (((PSEmph) aContent).getAsText ());
else
if (aContent instanceof PSDir)
aSB.append (((PSDir) aContent).getAsText ());
else
if (aContent instanceof PSSpan)
aSB.append (((PSSpan) aContent).getAsText ());
else
throw new SchematronValidationException ("Unsupported assert/report content element: " + aContent);
}
return aSB.toString ();
} | java | {
"resource": ""
} |
q167966 | SVRLLocationBeautifierRegistry.getBeautifiedLocation | validation | @Nullable
public static String getBeautifiedLocation (@Nonnull final String sNamespaceURI, @Nonnull final String sLocalName)
{
for (final ISVRLLocationBeautifierSPI aBeautifier : s_aList)
{
final String sBeautified = aBeautifier.getReplacementText (sNamespaceURI, sLocalName);
if (sBeautified != null)
return sBeautified;
}
if (LOGGER.isDebugEnabled ())
LOGGER.debug ("Unsupported elements for beautification: " + sNamespaceURI + " -- " + sLocalName);
return null;
} | java | {
"resource": ""
} |
q167967 | PSReader._warn | validation | private void _warn (@Nonnull final IPSElement aSourceElement, @Nonnull final String sMessage)
{
ValueEnforcer.notNull (aSourceElement, "SourceElement");
ValueEnforcer.notNull (sMessage, "Message");
m_aErrorHandler.warn (m_aResource, aSourceElement, sMessage);
} | java | {
"resource": ""
} |
q167968 | PSReader.readActiveFromXML | validation | @Nonnull
public PSActive readActiveFromXML (@Nonnull final IMicroElement eActive)
{
final PSActive ret = new PSActive ();
eActive.forAllAttributes ( (sNS, sAttrName, sVal) -> {
final String sAttrValue = _getAttributeValue (sVal);
if (sAttrName.equals (CSchematronXML.ATTR_PATTERN))
ret.setPattern (sAttrValue);
else
ret.addForeignAttribute (sAttrName, sAttrValue);
});
eActive.forAllChildren (aActiveChild -> {
switch (aActiveChild.getType ())
{
case TEXT:
ret.addText (((IMicroText) aActiveChild).getNodeValue ());
break;
case ELEMENT:
final IMicroElement eElement = (IMicroElement) aActiveChild;
if (CSchematron.NAMESPACE_SCHEMATRON.equals (eElement.getNamespaceURI ()))
{
final String sLocalName = eElement.getLocalName ();
if (sLocalName.equals (CSchematronXML.ELEMENT_DIR))
ret.addDir (readDirFromXML (eElement));
else
if (sLocalName.equals (CSchematronXML.ELEMENT_EMPH))
ret.addEmph (readEmphFromXML (eElement));
else
if (sLocalName.equals (CSchematronXML.ELEMENT_SPAN))
ret.addSpan (readSpanFromXML (eElement));
else
_warn (ret, "Unsupported Schematron element '" + sLocalName + "'");
}
else
ret.addForeignElement (eElement.getClone ());
break;
case COMMENT:
// Ignore comments
break;
default:
_warn (ret, "Unsupported child node: " + aActiveChild);
}
});
return ret;
} | java | {
"resource": ""
} |
q167969 | PSReader.readAssertReportFromXML | validation | @Nonnull
public PSAssertReport readAssertReportFromXML (@Nonnull final IMicroElement eAssertReport)
{
final PSAssertReport ret = new PSAssertReport (eAssertReport.getLocalName ()
.equals (CSchematronXML.ELEMENT_ASSERT));
final PSRichGroup aRichGroup = new PSRichGroup ();
final PSLinkableGroup aLinkableGroup = new PSLinkableGroup ();
eAssertReport.forAllAttributes ( (sNS, sAttrName, sVal) -> {
final String sAttrValue = _getAttributeValue (sVal);
if (sAttrName.equals (CSchematronXML.ATTR_TEST))
ret.setTest (sAttrValue);
else
if (sAttrName.equals (CSchematronXML.ATTR_FLAG))
ret.setFlag (sAttrValue);
else
if (sAttrName.equals (CSchematronXML.ATTR_ID))
ret.setID (sAttrValue);
else
if (sAttrName.equals (CSchematronXML.ATTR_DIAGNOSTICS))
ret.setDiagnostics (sAttrValue);
else
if (PSRichGroup.isRichAttribute (sAttrName))
_handleRichGroup (sAttrName, sAttrValue, aRichGroup);
else
if (PSLinkableGroup.isLinkableAttribute (sAttrName))
_handleLinkableGroup (sAttrName, sAttrValue, aLinkableGroup);
else
ret.addForeignAttribute (sAttrName, sAttrValue);
});
ret.setRich (aRichGroup);
ret.setLinkable (aLinkableGroup);
eAssertReport.forAllChildren (aAssertReportChild -> {
switch (aAssertReportChild.getType ())
{
case TEXT:
ret.addText (((IMicroText) aAssertReportChild).getNodeValue ());
break;
case ELEMENT:
final IMicroElement eElement = (IMicroElement) aAssertReportChild;
if (CSchematron.NAMESPACE_SCHEMATRON.equals (eElement.getNamespaceURI ()))
{
final String sLocalName = eElement.getLocalName ();
if (sLocalName.equals (CSchematronXML.ELEMENT_NAME))
ret.addName (readNameFromXML (eElement));
else
if (sLocalName.equals (CSchematronXML.ELEMENT_VALUE_OF))
ret.addValueOf (readValueOfFromXML (eElement));
else
if (sLocalName.equals (CSchematronXML.ELEMENT_EMPH))
ret.addEmph (readEmphFromXML (eElement));
else
if (sLocalName.equals (CSchematronXML.ELEMENT_DIR))
ret.addDir (readDirFromXML (eElement));
else
if (sLocalName.equals (CSchematronXML.ELEMENT_SPAN))
ret.addSpan (readSpanFromXML (eElement));
else
_warn (ret, "Unsupported Schematron element '" + sLocalName + "'");
}
else
ret.addForeignElement (eElement.getClone ());
break;
case COMMENT:
// Ignore comments
break;
default:
_warn (ret, "Unsupported child node: " + aAssertReportChild);
}
});
return ret;
} | java | {
"resource": ""
} |
q167970 | PSReader.readDiagnosticFromXML | validation | @Nonnull
public PSDiagnostic readDiagnosticFromXML (@Nonnull final IMicroElement eDiagnostic)
{
final PSDiagnostic ret = new PSDiagnostic ();
final PSRichGroup aRichGroup = new PSRichGroup ();
eDiagnostic.forAllAttributes ( (sNS, sAttrName, sVal) -> {
final String sAttrValue = _getAttributeValue (sVal);
if (sAttrName.equals (CSchematronXML.ATTR_ID))
ret.setID (sAttrValue);
else
if (PSRichGroup.isRichAttribute (sAttrName))
_handleRichGroup (sAttrName, sAttrValue, aRichGroup);
else
ret.addForeignAttribute (sAttrName, sAttrValue);
});
ret.setRich (aRichGroup);
eDiagnostic.forAllChildren (aDiagnosticChild -> {
switch (aDiagnosticChild.getType ())
{
case TEXT:
ret.addText (((IMicroText) aDiagnosticChild).getNodeValue ());
break;
case ELEMENT:
final IMicroElement eElement = (IMicroElement) aDiagnosticChild;
if (CSchematron.NAMESPACE_SCHEMATRON.equals (eElement.getNamespaceURI ()))
{
final String sLocalName = eElement.getLocalName ();
if (sLocalName.equals (CSchematronXML.ELEMENT_VALUE_OF))
ret.addValueOf (readValueOfFromXML (eElement));
else
if (sLocalName.equals (CSchematronXML.ELEMENT_EMPH))
ret.addEmph (readEmphFromXML (eElement));
else
if (sLocalName.equals (CSchematronXML.ELEMENT_DIR))
ret.addDir (readDirFromXML (eElement));
else
if (sLocalName.equals (CSchematronXML.ELEMENT_SPAN))
ret.addSpan (readSpanFromXML (eElement));
else
_warn (ret, "Unsupported Schematron element '" + sLocalName + "'");
}
else
ret.addForeignElement (eElement.getClone ());
break;
case COMMENT:
// Ignore comments
break;
default:
_warn (ret, "Unsupported child node: " + aDiagnosticChild);
}
});
return ret;
} | java | {
"resource": ""
} |
q167971 | PSReader.readDiagnosticsFromXML | validation | @Nonnull
public PSDiagnostics readDiagnosticsFromXML (@Nonnull final IMicroElement eDiagnostics)
{
final PSDiagnostics ret = new PSDiagnostics ();
eDiagnostics.forAllAttributes ( (sNS, sAttrName, sVal) -> {
final String sAttrValue = _getAttributeValue (sVal);
ret.addForeignAttribute (sAttrName, sAttrValue);
});
eDiagnostics.forAllChildElements (eDiagnosticsChild -> {
if (CSchematron.NAMESPACE_SCHEMATRON.equals (eDiagnosticsChild.getNamespaceURI ()))
{
if (eDiagnosticsChild.getLocalName ().equals (CSchematronXML.ELEMENT_INCLUDE))
ret.addInclude (readIncludeFromXML (eDiagnosticsChild));
else
if (eDiagnosticsChild.getLocalName ().equals (CSchematronXML.ELEMENT_DIAGNOSTIC))
ret.addDiagnostic (readDiagnosticFromXML (eDiagnosticsChild));
else
_warn (ret, "Unsupported Schematron element '" + eDiagnosticsChild.getLocalName () + "'");
}
else
ret.addForeignElement (eDiagnosticsChild.getClone ());
});
return ret;
} | java | {
"resource": ""
} |
q167972 | PSReader.readDirFromXML | validation | @Nonnull
public PSDir readDirFromXML (@Nonnull final IMicroElement eDir)
{
final PSDir ret = new PSDir ();
eDir.forAllAttributes ( (sNS, sAttrName, sVal) -> {
final String sAttrValue = _getAttributeValue (sVal);
if (sAttrName.equals (CSchematronXML.ATTR_VALUE))
ret.setValue (EDirValue.getFromIDOrNull (sAttrValue));
else
ret.addForeignAttribute (sAttrName, sAttrValue);
});
eDir.forAllChildren (aDirChild -> {
switch (aDirChild.getType ())
{
case TEXT:
ret.addText (((IMicroText) aDirChild).getNodeValue ());
break;
case ELEMENT:
final IMicroElement eElement = (IMicroElement) aDirChild;
if (CSchematron.NAMESPACE_SCHEMATRON.equals (eElement.getNamespaceURI ()))
{
_warn (ret, "Unsupported Schematron element '" + eElement.getLocalName () + "'");
}
else
ret.addForeignElement (eElement.getClone ());
break;
case COMMENT:
// Ignore comments
break;
default:
_warn (ret, "Unsupported child node: " + aDirChild);
}
});
return ret;
} | java | {
"resource": ""
} |
q167973 | PSReader.readEmphFromXML | validation | @Nonnull
public PSEmph readEmphFromXML (@Nonnull final IMicroElement eEmph)
{
final PSEmph ret = new PSEmph ();
eEmph.forAllAttributes ( (sNS, sAttrName, sVal) -> {
final String sAttrValue = _getAttributeValue (sVal);
_warn (ret, "Unsupported attribute '" + sAttrName + "'='" + sAttrValue + "'");
});
eEmph.forAllChildren (aEmphChild -> {
switch (aEmphChild.getType ())
{
case TEXT:
ret.addText (((IMicroText) aEmphChild).getNodeValue ());
break;
case ELEMENT:
final IMicroElement eElement = (IMicroElement) aEmphChild;
if (CSchematron.NAMESPACE_SCHEMATRON.equals (eElement.getNamespaceURI ()))
{
_warn (ret, "Unsupported Schematron element '" + eElement.getLocalName () + "'");
}
else
_warn (ret, "Unsupported namespace URI '" + eElement.getNamespaceURI () + "'");
break;
case COMMENT:
// Ignore comments
break;
default:
_warn (ret, "Unsupported child node: " + aEmphChild);
}
});
return ret;
} | java | {
"resource": ""
} |
q167974 | PSReader.readExtendsFromXML | validation | @Nonnull
public PSExtends readExtendsFromXML (@Nonnull final IMicroElement eExtends)
{
final PSExtends ret = new PSExtends ();
eExtends.forAllAttributes ( (sNS, sAttrName, sVal) -> {
final String sAttrValue = _getAttributeValue (sVal);
if (sAttrName.equals (CSchematronXML.ATTR_RULE))
ret.setRule (sAttrValue);
else
ret.addForeignAttribute (sAttrName, sAttrValue);
});
eExtends.forAllChildElements (eChild -> {
if (CSchematron.NAMESPACE_SCHEMATRON.equals (eChild.getNamespaceURI ()))
{
_warn (ret, "Unsupported Schematron element '" + eChild.getLocalName () + "'");
}
else
_warn (ret, "Unsupported namespace URI '" + eChild.getNamespaceURI () + "'");
});
return ret;
} | java | {
"resource": ""
} |
q167975 | PSReader.readIncludeFromXML | validation | @Nonnull
public PSInclude readIncludeFromXML (@Nonnull final IMicroElement eInclude)
{
final PSInclude ret = new PSInclude ();
eInclude.forAllAttributes ( (sNS, sAttrName, sVal) -> {
final String sAttrValue = _getAttributeValue (sVal);
if (sAttrName.equals (CSchematronXML.ATTR_HREF))
ret.setHref (sAttrValue);
else
_warn (ret, "Unsupported attribute '" + sAttrName + "'='" + sAttrValue + "'");
});
eInclude.forAllChildElements (eValueOfChild -> {
if (CSchematron.NAMESPACE_SCHEMATRON.equals (eValueOfChild.getNamespaceURI ()))
{
_warn (ret, "Unsupported Schematron element '" + eValueOfChild.getLocalName () + "'");
}
else
_warn (ret, "Unsupported namespace URI '" + eValueOfChild.getNamespaceURI () + "'");
});
return ret;
} | java | {
"resource": ""
} |
q167976 | PSReader.readLetFromXML | validation | @Nonnull
public PSLet readLetFromXML (@Nonnull final IMicroElement eLet)
{
final PSLet ret = new PSLet ();
eLet.forAllAttributes ( (sNS, sAttrName, sVal) -> {
final String sAttrValue = _getAttributeValue (sVal);
if (sAttrName.equals (CSchematronXML.ATTR_NAME))
ret.setName (sAttrValue);
else
if (sAttrName.equals (CSchematronXML.ATTR_VALUE))
ret.setValue (sAttrValue);
else
_warn (ret, "Unsupported attribute '" + sAttrName + "'='" + sAttrValue + "'");
});
eLet.forAllChildElements (eLetChild -> {
if (CSchematron.NAMESPACE_SCHEMATRON.equals (eLetChild.getNamespaceURI ()))
{
_warn (ret, "Unsupported Schematron element '" + eLetChild.getLocalName () + "'");
}
else
_warn (ret, "Unsupported namespace URI '" + eLetChild.getNamespaceURI () + "'");
});
return ret;
} | java | {
"resource": ""
} |
q167977 | PSReader.readNameFromXML | validation | @Nonnull
public PSName readNameFromXML (@Nonnull final IMicroElement eName)
{
final PSName ret = new PSName ();
eName.forAllAttributes ( (sNS, sAttrName, sVal) -> {
final String sAttrValue = _getAttributeValue (sVal);
if (sAttrName.equals (CSchematronXML.ATTR_PATH))
ret.setPath (sAttrValue);
else
ret.addForeignAttribute (sAttrName, sAttrValue);
});
eName.forAllChildElements (eNameChild -> {
if (CSchematron.NAMESPACE_SCHEMATRON.equals (eNameChild.getNamespaceURI ()))
{
_warn (ret, "Unsupported Schematron element '" + eNameChild.getLocalName () + "'");
}
else
_warn (ret, "Unsupported namespace URI '" + eNameChild.getNamespaceURI () + "'");
});
return ret;
} | java | {
"resource": ""
} |
q167978 | PSReader.readNSFromXML | validation | @Nonnull
public PSNS readNSFromXML (@Nonnull final IMicroElement eNS)
{
final PSNS ret = new PSNS ();
eNS.forAllAttributes ( (sNS, sAttrName, sVal) -> {
final String sAttrValue = _getAttributeValue (sVal);
if (sAttrName.equals (CSchematronXML.ATTR_URI))
ret.setUri (sAttrValue);
else
if (sAttrName.equals (CSchematronXML.ATTR_PREFIX))
ret.setPrefix (sAttrValue);
else
ret.addForeignAttribute (sAttrName, sAttrValue);
});
eNS.forAllChildElements (eLetChild -> {
if (CSchematron.NAMESPACE_SCHEMATRON.equals (eLetChild.getNamespaceURI ()))
{
_warn (ret, "Unsupported Schematron element '" + eLetChild.getLocalName () + "'");
}
else
_warn (ret, "Unsupported namespace URI '" + eLetChild.getNamespaceURI () + "'");
});
return ret;
} | java | {
"resource": ""
} |
q167979 | PSReader.readPFromXML | validation | @Nonnull
public PSP readPFromXML (@Nonnull final IMicroElement eP)
{
final PSP ret = new PSP ();
eP.forAllAttributes ( (sNS, sAttrName, sVal) -> {
final String sAttrValue = _getAttributeValue (sVal);
if (sAttrName.equals (CSchematronXML.ATTR_ID))
ret.setID (sAttrValue);
else
if (sAttrName.equals (CSchematronXML.ATTR_CLASS))
ret.setClazz (sAttrValue);
else
if (sAttrName.equals (CSchematronXML.ATTR_ICON))
ret.setIcon (sAttrValue);
else
ret.addForeignAttribute (sAttrName, sAttrValue);
});
eP.forAllChildren (aChild -> {
switch (aChild.getType ())
{
case TEXT:
ret.addText (((IMicroText) aChild).getNodeValue ());
break;
case ELEMENT:
final IMicroElement eElement = (IMicroElement) aChild;
if (CSchematron.NAMESPACE_SCHEMATRON.equals (eElement.getNamespaceURI ()))
{
final String sLocalName = eElement.getLocalName ();
if (sLocalName.equals (CSchematronXML.ELEMENT_DIR))
ret.addDir (readDirFromXML (eElement));
else
if (sLocalName.equals (CSchematronXML.ELEMENT_EMPH))
ret.addEmph (readEmphFromXML (eElement));
else
if (sLocalName.equals (CSchematronXML.ELEMENT_SPAN))
ret.addSpan (readSpanFromXML (eElement));
else
_warn (ret, "Unsupported Schematron element '" + sLocalName + "'");
}
else
ret.addForeignElement (eElement.getClone ());
break;
case COMMENT:
// Ignore comments
break;
default:
_warn (ret, "Unsupported child node: " + aChild);
}
});
return ret;
} | java | {
"resource": ""
} |
q167980 | PSReader.readParamFromXML | validation | @Nonnull
public PSParam readParamFromXML (@Nonnull final IMicroElement eParam)
{
final PSParam ret = new PSParam ();
eParam.forAllAttributes ( (sNS, sAttrName, sVal) -> {
final String sAttrValue = _getAttributeValue (sVal);
if (sAttrName.equals (CSchematronXML.ATTR_NAME))
ret.setName (sAttrValue);
else
if (sAttrName.equals (CSchematronXML.ATTR_VALUE))
ret.setValue (sAttrValue);
else
_warn (ret, "Unsupported attribute '" + sAttrName + "'='" + sAttrValue + "'");
});
eParam.forAllChildElements (eParamChild -> {
if (CSchematron.NAMESPACE_SCHEMATRON.equals (eParamChild.getNamespaceURI ()))
{
_warn (ret, "Unsupported Schematron element '" + eParamChild.getLocalName () + "'");
}
else
_warn (ret, "Unsupported namespace URI '" + eParamChild.getNamespaceURI () + "'");
});
return ret;
} | java | {
"resource": ""
} |
q167981 | PSReader.readPatternFromXML | validation | @Nonnull
public PSPattern readPatternFromXML (@Nonnull final IMicroElement ePattern)
{
final PSPattern ret = new PSPattern ();
final PSRichGroup aRichGroup = new PSRichGroup ();
ePattern.forAllAttributes ( (sNS, sAttrName, sVal) -> {
final String sAttrValue = _getAttributeValue (sVal);
if (sAttrName.equals (CSchematronXML.ATTR_ABSTRACT))
ret.setAbstract (StringParser.parseBool (sAttrValue));
else
if (sAttrName.equals (CSchematronXML.ATTR_ID))
ret.setID (sAttrValue);
else
if (sAttrName.equals (CSchematronXML.ATTR_IS_A))
ret.setIsA (sAttrValue);
else
if (PSRichGroup.isRichAttribute (sAttrName))
_handleRichGroup (sAttrName, sAttrValue, aRichGroup);
else
ret.addForeignAttribute (sAttrName, sAttrValue);
});
ret.setRich (aRichGroup);
ePattern.forAllChildElements (ePatternChild -> {
if (CSchematron.NAMESPACE_SCHEMATRON.equals (ePatternChild.getNamespaceURI ()))
{
if (ePatternChild.getLocalName ().equals (CSchematronXML.ELEMENT_INCLUDE))
ret.addInclude (readIncludeFromXML (ePatternChild));
else
if (ePatternChild.getLocalName ().equals (CSchematronXML.ELEMENT_TITLE))
ret.setTitle (readTitleFromXML (ePatternChild));
else
if (ePatternChild.getLocalName ().equals (CSchematronXML.ELEMENT_P))
ret.addP (readPFromXML (ePatternChild));
else
if (ePatternChild.getLocalName ().equals (CSchematronXML.ELEMENT_LET))
ret.addLet (readLetFromXML (ePatternChild));
else
if (ePatternChild.getLocalName ().equals (CSchematronXML.ELEMENT_RULE))
ret.addRule (readRuleFromXML (ePatternChild));
else
if (ePatternChild.getLocalName ().equals (CSchematronXML.ELEMENT_PARAM))
ret.addParam (readParamFromXML (ePatternChild));
else
_warn (ret,
"Unsupported Schematron element '" +
ePatternChild.getLocalName () +
"' in " +
ret.toString ());
}
else
ret.addForeignElement (ePatternChild.getClone ());
});
return ret;
} | java | {
"resource": ""
} |
q167982 | PSReader.readPhaseFromXML | validation | @Nonnull
public PSPhase readPhaseFromXML (@Nonnull final IMicroElement ePhase)
{
final PSPhase ret = new PSPhase ();
final PSRichGroup aRichGroup = new PSRichGroup ();
ePhase.forAllAttributes ( (sNS, sAttrName, sVal) -> {
final String sAttrValue = _getAttributeValue (sVal);
if (sAttrName.equals (CSchematronXML.ATTR_ID))
ret.setID (sAttrValue);
else
if (PSRichGroup.isRichAttribute (sAttrName))
_handleRichGroup (sAttrName, sAttrValue, aRichGroup);
else
ret.addForeignAttribute (sAttrName, sAttrValue);
});
ret.setRich (aRichGroup);
ePhase.forAllChildElements (ePhaseChild -> {
if (CSchematron.NAMESPACE_SCHEMATRON.equals (ePhaseChild.getNamespaceURI ()))
{
if (ePhaseChild.getLocalName ().equals (CSchematronXML.ELEMENT_INCLUDE))
ret.addInclude (readIncludeFromXML (ePhaseChild));
else
if (ePhaseChild.getLocalName ().equals (CSchematronXML.ELEMENT_P))
ret.addP (readPFromXML (ePhaseChild));
else
if (ePhaseChild.getLocalName ().equals (CSchematronXML.ELEMENT_LET))
ret.addLet (readLetFromXML (ePhaseChild));
else
if (ePhaseChild.getLocalName ().equals (CSchematronXML.ELEMENT_ACTIVE))
ret.addActive (readActiveFromXML (ePhaseChild));
else
_warn (ret, "Unsupported Schematron element '" + ePhaseChild.getLocalName () + "'");
}
else
ret.addForeignElement (ePhaseChild.getClone ());
});
return ret;
} | java | {
"resource": ""
} |
q167983 | PSReader.readRuleFromXML | validation | @Nonnull
public PSRule readRuleFromXML (@Nonnull final IMicroElement eRule)
{
final PSRule ret = new PSRule ();
final PSRichGroup aRichGroup = new PSRichGroup ();
final PSLinkableGroup aLinkableGroup = new PSLinkableGroup ();
eRule.forAllAttributes ( (sNS, sAttrName, sVal) -> {
final String sAttrValue = _getAttributeValue (sVal);
if (sAttrName.equals (CSchematronXML.ATTR_FLAG))
ret.setFlag (sAttrValue);
else
if (sAttrName.equals (CSchematronXML.ATTR_ABSTRACT))
ret.setAbstract (StringParser.parseBool (sAttrValue));
else
if (sAttrName.equals (CSchematronXML.ATTR_CONTEXT))
ret.setContext (sAttrValue);
else
if (sAttrName.equals (CSchematronXML.ATTR_ID))
ret.setID (sAttrValue);
else
if (PSRichGroup.isRichAttribute (sAttrName))
_handleRichGroup (sAttrName, sAttrValue, aRichGroup);
else
if (PSLinkableGroup.isLinkableAttribute (sAttrName))
_handleLinkableGroup (sAttrName, sAttrValue, aLinkableGroup);
else
ret.addForeignAttribute (sAttrName, sAttrValue);
});
ret.setRich (aRichGroup);
ret.setLinkable (aLinkableGroup);
eRule.forAllChildElements (eRuleChild -> {
if (CSchematron.NAMESPACE_SCHEMATRON.equals (eRuleChild.getNamespaceURI ()))
{
final String sLocalName = eRuleChild.getLocalName ();
if (sLocalName.equals (CSchematronXML.ELEMENT_INCLUDE))
ret.addInclude (readIncludeFromXML (eRuleChild));
else
if (sLocalName.equals (CSchematronXML.ELEMENT_LET))
ret.addLet (readLetFromXML (eRuleChild));
else
if (sLocalName.equals (CSchematronXML.ELEMENT_ASSERT) || sLocalName.equals (CSchematronXML.ELEMENT_REPORT))
ret.addAssertReport (readAssertReportFromXML (eRuleChild));
else
if (sLocalName.equals (CSchematronXML.ELEMENT_EXTENDS))
ret.addExtends (readExtendsFromXML (eRuleChild));
else
_warn (ret, "Unsupported Schematron element '" + sLocalName + "'");
}
else
ret.addForeignElement (eRuleChild.getClone ());
});
return ret;
} | java | {
"resource": ""
} |
q167984 | PSReader.readSchemaFromXML | validation | @Nonnull
public PSSchema readSchemaFromXML (@Nonnull final IMicroElement eSchema) throws SchematronReadException
{
ValueEnforcer.notNull (eSchema, "Schema");
if (!CSchematron.NAMESPACE_SCHEMATRON.equals (eSchema.getNamespaceURI ()))
throw new SchematronReadException (m_aResource, "The passed element is not an ISO Schematron element!");
final PSSchema ret = new PSSchema (m_aResource);
final PSRichGroup aRichGroup = new PSRichGroup ();
eSchema.forAllAttributes ( (sNS, sAttrName, sVal) -> {
final String sAttrValue = _getAttributeValue (sVal);
if (sAttrName.equals (CSchematronXML.ATTR_ID))
ret.setID (sAttrValue);
else
if (sAttrName.equals (CSchematronXML.ATTR_SCHEMA_VERSION))
ret.setSchemaVersion (sAttrValue);
else
if (sAttrName.equals (CSchematronXML.ATTR_DEFAULT_PHASE))
ret.setDefaultPhase (sAttrValue);
else
if (sAttrName.equals (CSchematronXML.ATTR_QUERY_BINDING))
ret.setQueryBinding (sAttrValue);
else
if (PSRichGroup.isRichAttribute (sAttrName))
_handleRichGroup (sAttrName, sAttrValue, aRichGroup);
else
ret.addForeignAttribute (sAttrName, sAttrValue);
});
ret.setRich (aRichGroup);
eSchema.forAllChildElements (eSchemaChild -> {
if (CSchematron.NAMESPACE_SCHEMATRON.equals (eSchemaChild.getNamespaceURI ()))
{
if (eSchemaChild.getLocalName ().equals (CSchematronXML.ELEMENT_INCLUDE))
ret.addInclude (readIncludeFromXML (eSchemaChild));
else
if (eSchemaChild.getLocalName ().equals (CSchematronXML.ELEMENT_TITLE))
ret.setTitle (readTitleFromXML (eSchemaChild));
else
if (eSchemaChild.getLocalName ().equals (CSchematronXML.ELEMENT_NS))
ret.addNS (readNSFromXML (eSchemaChild));
else
if (eSchemaChild.getLocalName ().equals (CSchematronXML.ELEMENT_P))
{
final PSP aP = readPFromXML (eSchemaChild);
if (ret.hasNoPatterns ())
ret.addStartP (aP);
else
ret.addEndP (aP);
}
else
if (eSchemaChild.getLocalName ().equals (CSchematronXML.ELEMENT_LET))
ret.addLet (readLetFromXML (eSchemaChild));
else
if (eSchemaChild.getLocalName ().equals (CSchematronXML.ELEMENT_PHASE))
ret.addPhase (readPhaseFromXML (eSchemaChild));
else
if (eSchemaChild.getLocalName ().equals (CSchematronXML.ELEMENT_PATTERN))
ret.addPattern (readPatternFromXML (eSchemaChild));
else
if (eSchemaChild.getLocalName ().equals (CSchematronXML.ELEMENT_DIAGNOSTICS))
ret.setDiagnostics (readDiagnosticsFromXML (eSchemaChild));
else
_warn (ret, "Unsupported Schematron element '" + eSchemaChild.getLocalName () + "'");
}
else
ret.addForeignElement (eSchemaChild.getClone ());
});
return ret;
} | java | {
"resource": ""
} |
q167985 | PSReader.readSpanFromXML | validation | @Nonnull
public PSSpan readSpanFromXML (@Nonnull final IMicroElement eSpan)
{
final PSSpan ret = new PSSpan ();
eSpan.forAllAttributes ( (sNS, sAttrName, sVal) -> {
final String sAttrValue = _getAttributeValue (sVal);
if (sAttrName.equals (CSchematronXML.ATTR_CLASS))
ret.setClazz (sAttrValue);
else
ret.addForeignAttribute (sAttrName, sAttrValue);
});
eSpan.forAllChildren (aSpanChild -> {
switch (aSpanChild.getType ())
{
case TEXT:
ret.addText (((IMicroText) aSpanChild).getNodeValue ());
break;
case ELEMENT:
final IMicroElement eElement = (IMicroElement) aSpanChild;
if (CSchematron.NAMESPACE_SCHEMATRON.equals (eElement.getNamespaceURI ()))
{
_warn (ret, "Unsupported Schematron element '" + eElement.getLocalName () + "'");
}
else
ret.addForeignElement (eElement.getClone ());
break;
case COMMENT:
// Ignore comments
break;
default:
_warn (ret, "Unsupported child node: " + aSpanChild);
}
});
return ret;
} | java | {
"resource": ""
} |
q167986 | PSReader.readTitleFromXML | validation | @Nonnull
public PSTitle readTitleFromXML (@Nonnull final IMicroElement eTitle)
{
final PSTitle ret = new PSTitle ();
eTitle.forAllAttributes ( (sNS, sAttrName, sVal) -> {
final String sAttrValue = _getAttributeValue (sVal);
_warn (ret, "Unsupported attribute '" + sAttrName + "'='" + sAttrValue + "'");
});
eTitle.forAllChildren (aTitleChild -> {
switch (aTitleChild.getType ())
{
case TEXT:
ret.addText (((IMicroText) aTitleChild).getNodeValue ());
break;
case ELEMENT:
final IMicroElement eElement = (IMicroElement) aTitleChild;
if (CSchematron.NAMESPACE_SCHEMATRON.equals (eElement.getNamespaceURI ()))
{
final String sLocalName = eElement.getLocalName ();
if (sLocalName.equals (CSchematronXML.ELEMENT_DIR))
ret.addDir (readDirFromXML (eElement));
else
_warn (ret, "Unsupported Schematron element '" + sLocalName + "'");
}
else
_warn (ret, "Unsupported namespace URI '" + eElement.getNamespaceURI () + "'");
break;
case COMMENT:
// Ignore comments
break;
default:
_warn (ret, "Unsupported child node: " + aTitleChild);
}
});
return ret;
} | java | {
"resource": ""
} |
q167987 | PSReader.readValueOfFromXML | validation | @Nonnull
public PSValueOf readValueOfFromXML (@Nonnull final IMicroElement eValueOf)
{
final PSValueOf ret = new PSValueOf ();
eValueOf.forAllAttributes ( (sNS, sAttrName, sVal) -> {
final String sAttrValue = _getAttributeValue (sVal);
if (sAttrName.equals (CSchematronXML.ATTR_SELECT))
ret.setSelect (sAttrValue);
else
ret.addForeignAttribute (sAttrName, sAttrValue);
});
eValueOf.forAllChildElements (eValueOfChild -> {
if (CSchematron.NAMESPACE_SCHEMATRON.equals (eValueOfChild.getNamespaceURI ()))
{
_warn (ret, "Unsupported Schematron element '" + eValueOfChild.getLocalName () + "'");
}
else
_warn (ret, "Unsupported namespace URI '" + eValueOfChild.getNamespaceURI () + "'");
});
return ret;
} | java | {
"resource": ""
} |
q167988 | PSWriterSettings.createNamespaceMapping | validation | @Nonnull
@ReturnsMutableCopy
public static MapBasedNamespaceContext createNamespaceMapping (@Nonnull final PSSchema aSchema)
{
final MapBasedNamespaceContext ret = new MapBasedNamespaceContext ();
ret.addDefaultNamespaceURI (CSchematron.NAMESPACE_SCHEMATRON);
for (final PSNS aItem : aSchema.getAllNSs ())
ret.addMapping (aItem.getPrefix (), aItem.getUri ());
return ret;
} | java | {
"resource": ""
} |
q167989 | ConstraintLogic.regex | validation | private <T> CompletionStage<T> regex(final Http.RequestHeader requestHeader,
final DeadboltHandler deadboltHandler,
final Optional<String> content,
final String[] values,
final int valueIndex,
final ConstraintMode mode,
final boolean invert,
final Function<Http.RequestHeader, CompletionStage<T>> pass,
final TriFunction<Http.RequestHeader, DeadboltHandler, Optional<String>, CompletionStage<T>> fail,
final ConstraintPoint constraintPoint)
{
return CompletableFuture.completedFuture(patternCache.apply(values[valueIndex]))
.thenCombine(getSubject(requestHeader,
deadboltHandler),
(patternValue, subject) ->
F.Tuple(subject._1.isPresent() ? analyzer.checkRegexPattern(subject._1,
Optional.ofNullable(patternValue))
: invert, subject._2)) // this is a little clumsy - it means no subject + invert is still denied
.thenCompose(hasPassed -> (invert ? !hasPassed._1 : hasPassed._1) ? (successCallAgain(mode, values, valueIndex) ? regex(hasPassed._2,
deadboltHandler,
content,
values,
valueIndex + 1,
mode,
invert,
pass,
fail,
constraintPoint)
: pass(hasPassed._2,
deadboltHandler,
pass,
constraintPoint,
"pattern - regex"))
: (failCallAgain(mode, values, valueIndex) ? regex(hasPassed._2,
deadboltHandler,
content,
values,
valueIndex + 1,
mode,
invert,
pass,
fail,
constraintPoint)
: fail.apply(hasPassed._2,
deadboltHandler,
content)));
} | java | {
"resource": ""
} |
q167990 | AbstractDeadboltAction.markAsAuthorised | validation | private Http.RequestHeader markAsAuthorised(final Http.RequestHeader request)
{
this.authorised = true;
return request.addAttr(ACTION_AUTHORISED,
true);
} | java | {
"resource": ""
} |
q167991 | AbstractDeadboltAction.isAuthorised | validation | protected static boolean isAuthorised(final Http.RequestHeader request)
{
return request.attrs().getOptional(ACTION_AUTHORISED).orElse(false);
} | java | {
"resource": ""
} |
q167992 | AbstractDeadboltAction.defer | validation | protected Http.RequestHeader defer(final Http.RequestHeader request,
final AbstractDeadboltAction<T> action)
{
if (action != null)
{
LOGGER.info("Deferring action [{}]",
this.getClass().getName());
return request.addAttr(ACTION_DEFERRED,
action);
}
return request;
} | java | {
"resource": ""
} |
q167993 | AbstractDeadboltAction.getDeferredAction | validation | @SuppressWarnings("unchecked")
public F.Tuple<AbstractDeadboltAction<?>, Http.RequestHeader> getDeferredAction(final Http.RequestHeader request)
{
return request.attrs().getOptional(ACTION_DEFERRED).map(action -> {
action.delegate = this;
return F.<AbstractDeadboltAction<?>, Http.RequestHeader>Tuple(action, request.removeAttr(ACTION_DEFERRED).addAttr(IGNORE_DEFERRED_FLAG, true));
}).orElseGet(() -> F.Tuple(null, request));
} | java | {
"resource": ""
} |
q167994 | AbstractDeadboltAction.authorizeAndExecute | validation | protected CompletionStage<Result> authorizeAndExecute(final Http.RequestHeader request)
{
if(constraintAnnotationMode != ConstraintAnnotationMode.AND)
{
// In AND mode we don't mark an action as authorised because we want ALL (remaining) constraints to be evaluated as well!
return delegate.call((Http.Request)markAsAuthorised(request));
}
return delegate.call((Http.Request)request);
} | java | {
"resource": ""
} |
q167995 | AbstractDeadboltAction.deadboltActionLeftInActionChain | validation | private static boolean deadboltActionLeftInActionChain(final Action<?> action) {
if(action != null) {
if(action.delegate instanceof AbstractDeadboltAction) {
return true; // yes, there is at least one deadbolt action remaining
}
// action.delegate wasn't a deadbolt action, let's check the next one in the chain
return deadboltActionLeftInActionChain(action.delegate);
}
return false;
} | java | {
"resource": ""
} |
q167996 | DeadboltAnalyzer.getRoleNames | validation | public List<String> getRoleNames(final Optional<? extends Subject> subjectOption)
{
final List<String> roleNames = new ArrayList<>();
subjectOption.ifPresent(subject ->
{
final List<? extends Role> roles = subject.getRoles();
if (roles != null)
{
roleNames.addAll(roles.stream()
.filter(Objects::nonNull)
.map(Role::getName)
.collect(Collectors.toList()));
}
});
return roleNames;
} | java | {
"resource": ""
} |
q167997 | DeadboltAnalyzer.hasRole | validation | public boolean hasRole(final Optional<? extends Subject> subjectOption,
final String roleName)
{
return getRoleNames(subjectOption).contains(roleName);
} | java | {
"resource": ""
} |
q167998 | FilterConstraints.subjectPresent | validation | public FilterFunction subjectPresent(final Optional<String> content)
{
return (Http.RequestHeader requestHeader,
DeadboltHandler handler,
Function<Http.RequestHeader, CompletionStage<Result>> next) ->
beforeAuthCheckCache.apply(handler, requestHeader, content)
.thenCompose(maybePreAuth -> maybePreAuth._1.map(preAuthResult -> (CompletionStage<Result>) CompletableFuture.completedFuture(preAuthResult))
.orElseGet(() -> constraintLogic.subjectPresent(maybePreAuth._2,
handler,
content,
(rh, hdlr, cntent) -> next.apply(rh),
(rh, hdlr, cntent) -> hdlr.onAuthFailure(rh,
cntent),
ConstraintPoint.FILTER)));
} | java | {
"resource": ""
} |
q167999 | TemplateUtils.roles | validation | public static String[] roles(final Role... roles)
{
final List<String> names = new ArrayList<>(roles.length);
for (Role role : roles)
{
names.add(role.getName());
}
return names.toArray(new String[names.size()]);
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.