instruction
string | input
string | output
string | source_file
string | priority
int64 |
|---|---|---|---|---|
请完成以下Java代码
|
public int getUpdateCount() {
if (resultSetPointer >= m_resultSets.size()) {
int updateCount = m_updateCount;
m_updateCount = -1;
return updateCount;
}
return -1;
}
public void setUpdateCount(int updateCount) {
m_updateCount = updateCount;
}
public void addResultSet(ResultSet rs) {
m_resultSets.add(rs);
}
public boolean getMoreResults() {
if (resultSetPointer >= m_resultSets.size())
return false;
//implicitly close the current resultset
try {
m_resultSets.get(resultSetPointer).close();
} catch (SQLException e) {}
resultSetPointer ++;
return (resultSetPointer < m_resultSets.size());
}
|
public ResultSet getResultSet() {
if (resultSetPointer >= m_resultSets.size())
return null;
return m_resultSets.get(resultSetPointer);
}
public boolean isFirstResult() {
return firstResult;
}
public void setFirstResult(boolean firstResult) {
this.firstResult = firstResult;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\compiere\util\ExecuteResult.java
| 1
|
请完成以下Java代码
|
public static AddressDisplaySequence ofNullable(@Nullable final String pattern)
{
return pattern != null && !Check.isBlank(pattern)
? new AddressDisplaySequence(pattern)
: EMPTY;
}
@Override
@Deprecated
public String toString()
{
return pattern;
}
public void assertValid()
{
final boolean existsBPName = hasToken(Addressvars.BPartnerName);
final boolean existsBP = hasToken(Addressvars.BPartner);
final boolean existsBPGreeting = hasToken(Addressvars.BPartnerGreeting);
if ((existsBP && existsBPName) || (existsBP && existsBPGreeting))
{
throw new AdempiereException(MSG_AddressBuilder_WrongDisplaySequence)
//.appendParametersToMessage()
.setParameter("displaySequence", this);
}
}
|
public boolean hasToken(@NonNull final Addressvars token)
{
// TODO: optimize it! this is just some crap refactored code
final Scanner scan = new Scanner(pattern);
scan.useDelimiter("@");
while (scan.hasNext())
{
if (scan.next().equals(token.getName()))
{
scan.close();
return true;
}
}
scan.close();
return false;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\location\AddressDisplaySequence.java
| 1
|
请完成以下Java代码
|
public boolean hasField(final String fieldName)
{
return getQuickInputDocument().hasField(fieldName);
}
//
//
// ------
//
//
//
public static final class Builder
{
private static final AtomicInteger nextQuickInputDocumentId = new AtomicInteger(1);
private DocumentPath _rootDocumentPath;
private QuickInputDescriptor _quickInputDescriptor;
private Builder()
{
super();
}
public QuickInput build()
{
return new QuickInput(this);
}
public Builder setRootDocumentPath(final DocumentPath rootDocumentPath)
{
_rootDocumentPath = Preconditions.checkNotNull(rootDocumentPath, "rootDocumentPath");
return this;
}
private DocumentPath getRootDocumentPath()
{
Check.assumeNotNull(_rootDocumentPath, "Parameter rootDocumentPath is not null");
return _rootDocumentPath;
}
|
public Builder setQuickInputDescriptor(final QuickInputDescriptor quickInputDescriptor)
{
_quickInputDescriptor = quickInputDescriptor;
return this;
}
private QuickInputDescriptor getQuickInputDescriptor()
{
Check.assumeNotNull(_quickInputDescriptor, "Parameter quickInputDescriptor is not null");
return _quickInputDescriptor;
}
private DetailId getTargetDetailId()
{
final DetailId targetDetailId = getQuickInputDescriptor().getDetailId();
Check.assumeNotNull(targetDetailId, "Parameter targetDetailId is not null");
return targetDetailId;
}
private Document buildQuickInputDocument()
{
return Document.builder(getQuickInputDescriptor().getEntityDescriptor())
.initializeAsNewDocument(nextQuickInputDocumentId::getAndIncrement, VERSION_DEFAULT);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\quickinput\QuickInput.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private ProjectQuotationPricingInfo getPricingInfo(@NonNull final ServiceRepairProjectInfo project)
{
final PriceListVersionId priceListVersionId = project.getPriceListVersionId();
if (priceListVersionId == null)
{
throw new AdempiereException("@NotFound@ @M_PriceList_Version_ID@")
.setParameter("project", project);
}
final I_M_PriceList priceList = priceListDAO.getPriceListByPriceListVersionId(priceListVersionId);
final OrgId orgId = project.getClientAndOrgId().getOrgId();
final ZoneId orgTimeZone = orgDAO.getTimeZone(orgId);
return ProjectQuotationPricingInfo.builder()
.orgId(orgId)
.orgTimeZone(orgTimeZone)
.shipBPartnerId(project.getBpartnerId())
.datePromised(extractDatePromised(project, orgTimeZone))
|
.pricingSystemId(PricingSystemId.ofRepoId(priceList.getM_PricingSystem_ID()))
.priceListId(PriceListId.ofRepoId(priceList.getM_PriceList_ID()))
.priceListVersionId(priceListVersionId)
.currencyId(CurrencyId.ofRepoId(priceList.getC_Currency_ID()))
.countryId(CountryId.ofRepoId(priceList.getC_Country_ID()))
.build();
}
private static ZonedDateTime extractDatePromised(
@NonNull final ServiceRepairProjectInfo project,
@NonNull final ZoneId timeZone)
{
final ZonedDateTime dateFinish = project.getDateFinish();
return dateFinish != null
? TimeUtil.convertToTimeZone(dateFinish, timeZone)
: SystemTime.asZonedDateTimeAtEndOfDay(timeZone);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.servicerepair.base\src\main\java\de\metas\servicerepair\project\service\commands\CreateQuotationFromProjectCommand.java
| 2
|
请完成以下Java代码
|
public int getVersion() {
return version;
}
@Override
public String getResourceName() {
return resourceName;
}
@Override
public String getDeploymentId() {
return deploymentId;
}
@Override
public boolean hasGraphicalNotation() {
return isGraphicalNotationDefined;
}
public boolean isGraphicalNotationDefined() {
return hasGraphicalNotation();
}
@Override
public String getDiagramResourceName() {
return diagramResourceName;
}
@Override
public boolean hasStartFormKey() {
return hasStartFormKey;
}
@Override
public String getTenantId() {
return tenantId;
}
@Override
public void setDescription(String description) {
this.description = description;
}
@Override
public void setCategory(String category) {
this.category = category;
}
@Override
public void setVersion(int version) {
this.version = version;
}
@Override
public void setKey(String key) {
this.key = key;
}
@Override
public void setResourceName(String resourceName) {
this.resourceName = resourceName;
}
@Override
|
public void setDeploymentId(String deploymentId) {
this.deploymentId = deploymentId;
}
@Override
public void setHasGraphicalNotation(boolean hasGraphicalNotation) {
this.isGraphicalNotationDefined = hasGraphicalNotation;
}
@Override
public void setDiagramResourceName(String diagramResourceName) {
this.diagramResourceName = diagramResourceName;
}
@Override
public void setHasStartFormKey(boolean hasStartFormKey) {
this.hasStartFormKey = hasStartFormKey;
}
@Override
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
@Override
public List<IdentityLinkEntity> getIdentityLinks() {
if (!isIdentityLinksInitialized) {
definitionIdentityLinkEntities = CommandContextUtil.getCmmnEngineConfiguration().getIdentityLinkServiceConfiguration()
.getIdentityLinkService().findIdentityLinksByScopeDefinitionIdAndType(id, ScopeTypes.CMMN);
isIdentityLinksInitialized = true;
}
return definitionIdentityLinkEntities;
}
public String getLocalizedName() {
return localizedName;
}
@Override
public void setLocalizedName(String localizedName) {
this.localizedName = localizedName;
}
public String getLocalizedDescription() {
return localizedDescription;
}
@Override
public void setLocalizedDescription(String localizedDescription) {
this.localizedDescription = localizedDescription;
}
}
|
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\persistence\entity\CaseDefinitionEntityImpl.java
| 1
|
请完成以下Java代码
|
protected FileUpload createFileUploadInstance() {
return new FileUpload();
}
protected MultipartFormData createMultipartFormDataInstance() {
return new MultipartFormData();
}
protected void parseRequest(MultipartFormData multipartFormData, FileUpload fileUpload, RestMultipartRequestContext requestContext) {
try {
FileItemIterator itemIterator = fileUpload.getItemIterator(requestContext);
while (itemIterator.hasNext()) {
FileItemStream stream = itemIterator.next();
multipartFormData.addPart(new FormPart(stream));
}
} catch (Exception e) {
throw new RestException(Status.BAD_REQUEST, e, "multipart/form-data cannot be processed");
}
}
protected RestMultipartRequestContext createRequestContext(InputStream entityStream, String contentType) {
return new RestMultipartRequestContext(entityStream, contentType);
}
/**
* Exposes the REST request to commons fileupload
*
*/
|
static class RestMultipartRequestContext implements RequestContext {
protected InputStream inputStream;
protected String contentType;
public RestMultipartRequestContext(InputStream inputStream, String contentType) {
this.inputStream = inputStream;
this.contentType = contentType;
}
public String getCharacterEncoding() {
return null;
}
public String getContentType() {
return contentType;
}
public int getContentLength() {
return -1;
}
public InputStream getInputStream() throws IOException {
return inputStream;
}
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\mapper\MultipartPayloadProvider.java
| 1
|
请完成以下Java代码
|
public int getC_Campaign_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Campaign_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Description.
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** Set Promotion.
@param M_Promotion_ID Promotion */
public void setM_Promotion_ID (int M_Promotion_ID)
{
if (M_Promotion_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Promotion_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Promotion_ID, Integer.valueOf(M_Promotion_ID));
}
/** Get Promotion.
@return Promotion */
public int getM_Promotion_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Promotion_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
|
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Set Relative Priority.
@param PromotionPriority
Which promotion should be apply to a product
*/
public void setPromotionPriority (int PromotionPriority)
{
set_Value (COLUMNNAME_PromotionPriority, Integer.valueOf(PromotionPriority));
}
/** Get Relative Priority.
@return Which promotion should be apply to a product
*/
public int getPromotionPriority ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_PromotionPriority);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_Promotion.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public JsonRemittanceAdvice getRemittanceAdviceWithLines(@NonNull final List<JsonRemittanceAdviceLine> lines)
{
if (document.getDocumentExtension() == null
|| document.getDocumentExtension().getDocumentExtension() == null
|| document.getDocumentExtension().getDocumentExtension().getREMADVExtension() == null)
{
throw new RuntimeException("Missing required document extension! doc: " + document);
}
final REMADVExtensionType remadvDocExtension = document.getDocumentExtension().getDocumentExtension().getREMADVExtension();
final String currencyISOCode = document.getDocumentCurrency().value();
return JsonRemittanceAdvice.builder()
.remittanceAdviceType(RemittanceAdviceType.INBOUND)
.senderId(getSenderId())
.recipientId(getRecipientId())
.sendDate(sendDate)
.documentDate(getDocumentDate())
.documentNumber(document.getDocumentNumber())
.paymentDiscountAmountSum(asBigDecimal(remadvDocExtension.getPaymentDiscountAmount()).orElse(null))
.serviceFeeAmount(asBigDecimal(remadvDocExtension.getComissionAmount()).orElse(null))
.remittedAmountSum(asBigDecimal(remadvDocExtension.getAmountRemitted())
.orElseThrow(() -> new RuntimeException("Total remitted amount missing!" + document)))
.remittanceAmountCurrencyISO(currencyISOCode)
.serviceFeeCurrencyISO(currencyISOCode)
.lines(lines)
.build();
}
@NonNull
private String getSenderId()
{
final CustomerType customerType = document.getCustomer();
if (customerType == null)
{
throw new RuntimeException("No customer found for document! doc: " + document);
}
return getGLNFromBusinessEntityType(customerType);
}
@NonNull
private String getRecipientId()
{
|
return getGLNFromBusinessEntityType(document.getSupplier());
}
private String getGLNFromBusinessEntityType(@NonNull final BusinessEntityType businessEntityType)
{
if (Check.isNotBlank(businessEntityType.getGLN()))
{
return GLN_PREFIX + businessEntityType.getGLN();
}
final String gln = businessEntityType.getFurtherIdentification()
.stream()
.filter(furtherIdentificationType -> furtherIdentificationType.getIdentificationType().equals("GLN"))
.findFirst()
.map(FurtherIdentificationType::getValue)
.orElseThrow(() -> new RuntimeException("No GLN found for businessEntity!businessEntity: " + businessEntityType));
return GLN_PREFIX + gln;
}
private String getDocumentDate()
{
return document.getDocumentDate()
.toGregorianCalendar()
.toZonedDateTime()
.withZoneSameLocal(ZoneId.of(DOCUMENT_ZONE_ID))
.toInstant()
.toString();
}
private Optional<BigDecimal> asBigDecimal(@Nullable final String value)
{
if (Check.isBlank(value))
{
return Optional.empty();
}
try
{
final BigDecimal bigDecimalValue = new BigDecimal(value);
return Optional.of(bigDecimalValue.abs());
}
catch (final Exception e)
{
return Optional.empty();
}
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java\de\metas\edi\esb\remadvimport\ecosio\JsonRemittanceAdviceProducer.java
| 2
|
请完成以下Java代码
|
protected void executeSetOperation(TaskEntity task, Integer value) {
if (isAssignee(type)) {
task.setAssignee(userId);
return;
}
if (isOwner(type)) {
task.setOwner(userId);
return;
}
task.addIdentityLink(userId, groupId, type);
}
/**
* Method to be overridden by concrete identity commands that wish to log an operation.
*
* @param context the command context
* @param task the task related entity
*/
protected abstract void logOperation(CommandContext context, TaskEntity task);
@Override
protected String getUserOperationLogName() {
return null; // Ignored for identity commands
}
protected void validateParameters(String type, String userId, String groupId) {
if (isAssignee(type) && groupId != null) {
throw new BadUserRequestException("Incompatible usage: cannot use ASSIGNEE together with a groupId");
}
if (!isAssignee(type) && hasNullIdentity(userId, groupId)) {
throw new NullValueException("userId and groupId cannot both be null");
|
}
}
protected boolean hasNullIdentity(String userId, String groupId) {
return (userId == null) && (groupId == null);
}
protected boolean isAssignee(String type) {
return IdentityLinkType.ASSIGNEE.equals(type);
}
protected boolean isOwner(String type) {
return IdentityLinkType.OWNER.equals(type);
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmd\AbstractAddIdentityLinkCmd.java
| 1
|
请完成以下Java代码
|
public String toString() {
return this.delegate.toString();
}
/**
* Factory method for creating a {@link DelegatingSecurityContextRunnable}.
* @param delegate the original {@link Runnable} that will be delegated to after
* establishing a {@link SecurityContext} on the {@link SecurityContextHolder}. Cannot
* have null.
* @param securityContext the {@link SecurityContext} to establish before invoking the
* delegate {@link Runnable}. If null, the current {@link SecurityContext} from the
* {@link SecurityContextHolder} will be used.
* @return
*/
public static Runnable create(Runnable delegate, @Nullable SecurityContext securityContext) {
Assert.notNull(delegate, "delegate cannot be null");
|
return (securityContext != null) ? new DelegatingSecurityContextRunnable(delegate, securityContext)
: new DelegatingSecurityContextRunnable(delegate);
}
static Runnable create(Runnable delegate, @Nullable SecurityContext securityContext,
SecurityContextHolderStrategy securityContextHolderStrategy) {
Assert.notNull(delegate, "delegate cannot be null");
Assert.notNull(securityContextHolderStrategy, "securityContextHolderStrategy cannot be null");
DelegatingSecurityContextRunnable runnable = (securityContext != null)
? new DelegatingSecurityContextRunnable(delegate, securityContext)
: new DelegatingSecurityContextRunnable(delegate);
runnable.setSecurityContextHolderStrategy(securityContextHolderStrategy);
return runnable;
}
}
|
repos\spring-security-main\core\src\main\java\org\springframework\security\concurrent\DelegatingSecurityContextRunnable.java
| 1
|
请完成以下Java代码
|
public Optional<ExternalSystemParentConfig> getByTypeAndValue(@NonNull final ExternalSystemType type, @NonNull final String childConfigValue)
{
return externalSystemConfigRepo.getByTypeAndValue(type, childConfigValue);
}
@NonNull
public Optional<ExternalSystemExportAudit> getMostRecentByTableReferenceAndSystem(
@NonNull final TableRecordReference tableRecordReference,
@NonNull final ExternalSystemType externalSystemType)
{
return externalSystemExportAuditRepo.getMostRecentByTableReferenceAndSystem(tableRecordReference, externalSystemType);
}
@NonNull
public ExternalSystemExportAudit createESExportAudit(@NonNull final CreateExportAuditRequest request)
{
return externalSystemExportAuditRepo.createESExportAudit(request);
}
@NonNull
private InsertRemoteIssueRequest createInsertRemoteIssueRequest(final JsonErrorItem jsonErrorItem, final PInstanceId pInstanceId)
{
return InsertRemoteIssueRequest.builder()
.issueCategory(jsonErrorItem.getIssueCategory())
.issueSummary(StringUtils.isEmpty(jsonErrorItem.getMessage()) ? DEFAULT_ISSUE_SUMMARY : jsonErrorItem.getMessage())
.sourceClassName(jsonErrorItem.getSourceClassName())
.sourceMethodName(jsonErrorItem.getSourceMethodName())
|
.stacktrace(jsonErrorItem.getStackTrace())
.errorCode(jsonErrorItem.getErrorCode())
.pInstance_ID(pInstanceId)
.orgId(RestUtils.retrieveOrgIdOrDefault(jsonErrorItem.getOrgCode()))
.build();
}
@Nullable
public ExternalSystemType getExternalSystemTypeByCodeOrNameOrNull(@Nullable final String value)
{
final ExternalSystem externalSystem = value != null
? externalSystemRepository.getByLegacyCodeOrValueOrNull(value)
: null;
return externalSystem != null
? externalSystem.getType()
: null;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business.rest-api-impl\src\main\java\de\metas\rest_api\v1\externlasystem\dto\ExternalSystemService.java
| 1
|
请完成以下Java代码
|
private void runScripts(List<Resource> resources) {
runScripts(new Scripts(resources).continueOnError(this.settings.isContinueOnError())
.separator(this.settings.getSeparator())
.encoding(this.settings.getEncoding()));
}
/**
* Initialize the database by running the given {@code scripts}.
* @param scripts the scripts to run
* @since 3.0.0
*/
protected abstract void runScripts(Scripts scripts);
private static class ScriptLocationResolver {
private final ResourcePatternResolver resourcePatternResolver;
ScriptLocationResolver(ResourceLoader resourceLoader) {
this.resourcePatternResolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader);
}
private List<Resource> resolve(String location) throws IOException {
List<Resource> resources = new ArrayList<>(
Arrays.asList(this.resourcePatternResolver.getResources(location)));
resources.sort((r1, r2) -> {
try {
return r1.getURL().toString().compareTo(r2.getURL().toString());
}
catch (IOException ex) {
return 0;
}
});
return resources;
}
}
/**
* Scripts to be used to initialize the database.
*
* @since 3.0.0
*/
public static class Scripts implements Iterable<Resource> {
private final List<Resource> resources;
private boolean continueOnError;
private String separator = ";";
private @Nullable Charset encoding;
|
public Scripts(List<Resource> resources) {
this.resources = resources;
}
@Override
public Iterator<Resource> iterator() {
return this.resources.iterator();
}
public Scripts continueOnError(boolean continueOnError) {
this.continueOnError = continueOnError;
return this;
}
public boolean isContinueOnError() {
return this.continueOnError;
}
public Scripts separator(String separator) {
this.separator = separator;
return this;
}
public String getSeparator() {
return this.separator;
}
public Scripts encoding(@Nullable Charset encoding) {
this.encoding = encoding;
return this;
}
public @Nullable Charset getEncoding() {
return this.encoding;
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-sql\src\main\java\org\springframework\boot\sql\init\AbstractScriptDatabaseInitializer.java
| 1
|
请完成以下Java代码
|
private static DecodedJWT verifyJWT(String jwtToken) {
try {
DecodedJWT decodedJWT = verifier.verify(jwtToken);
return decodedJWT;
} catch (JWTVerificationException e) {
System.out.println(e.getMessage());
}
return null;
}
private static boolean isJWTExpired(DecodedJWT decodedJWT) {
Date expiresAt = decodedJWT.getExpiresAt();
return expiresAt.getTime() < System.currentTimeMillis();
}
private static String getClaim(DecodedJWT decodedJWT, String claimName) {
Claim claim = decodedJWT.getClaim(claimName);
return claim != null ? claim.asString() : null;
}
public static void main(String args[]) throws InterruptedException {
initialize();
String jwtToken = createJWT();
System.out.println("Created JWT : " + jwtToken);
DecodedJWT decodedJWT = verifyJWT(jwtToken);
if (decodedJWT == null) {
System.out.println("JWT Verification Failed");
}
Thread.sleep(1000L);
decodedJWT = verifyJWT(jwtToken);
|
if (decodedJWT != null) {
System.out.println("Token Issued At : " + decodedJWT.getIssuedAt());
System.out.println("Token Expires At : " + decodedJWT.getExpiresAt());
System.out.println("Subject : " + decodedJWT.getSubject());
System.out.println("Data : " + getClaim(decodedJWT, DATA_CLAIM));
System.out.println("Header : " + decodedJWT.getHeader());
System.out.println("Payload : " + decodedJWT.getPayload());
System.out.println("Signature : " + decodedJWT.getSignature());
System.out.println("Algorithm : " + decodedJWT.getAlgorithm());
System.out.println("JWT Id : " + decodedJWT.getId());
Boolean isExpired = isJWTExpired(decodedJWT);
System.out.println("Is Expired : " + isExpired);
}
}
}
|
repos\tutorials-master\security-modules\jwt\src\main\java\com\baeldung\jwt\auth0\Auth0JsonWebToken.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Transport getTransport() {
return this.transport;
}
public void setTransport(Transport transport) {
this.transport = transport;
}
public Compression getCompression() {
return this.compression;
}
public void setCompression(Compression compression) {
this.compression = compression;
}
public Map<String, String> getHeaders() {
return this.headers;
}
public void setHeaders(Map<String, String> headers) {
|
this.headers = headers;
}
public enum Compression {
/**
* Gzip compression.
*/
GZIP,
/**
* No compression.
*/
NONE
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-micrometer-tracing-opentelemetry\src\main\java\org\springframework\boot\micrometer\tracing\opentelemetry\autoconfigure\otlp\OtlpTracingProperties.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public List<Pet> findPetsForAdoption(String speciesName) {
var species = speciesRepo.findByName(speciesName)
.orElseThrow(() -> new IllegalArgumentException("Unknown Species: " + speciesName));
return petsRepo.findPetsByOwnerNullAndSpecies(species);
}
public Pet adoptPet(UUID petUuid, String ownerName, String petName) {
var newOwner = ownersRepo.findByName(ownerName)
.orElseThrow(() -> new IllegalArgumentException("Unknown owner"));
var pet = petsRepo.findPetByUuid(petUuid)
.orElseThrow(() -> new IllegalArgumentException("Unknown pet"));
if ( pet.getOwner() != null) {
throw new IllegalArgumentException("Pet already adopted");
}
pet.setOwner(newOwner);
pet.setName(petName);
petsRepo.save(pet);
return pet;
}
public Pet returnPet(UUID petUuid) {
var pet = petsRepo.findPetByUuid(petUuid)
.orElseThrow(() -> new IllegalArgumentException("Unknown pet"));
pet.setOwner(null);
petsRepo.save(pet);
return pet;
}
public List<PetHistoryEntry> listPetHistory(UUID petUuid) {
|
var pet = petsRepo.findPetByUuid(petUuid)
.orElseThrow(() -> new IllegalArgumentException("No pet with UUID '" + petUuid + "' found"));
return petsRepo.findRevisions(pet.getId()).stream()
.map(r -> {
CustomRevisionEntity rev = r.getMetadata().getDelegate();
return new PetHistoryEntry(r.getRequiredRevisionInstant(),
r.getMetadata().getRevisionType(),
r.getEntity().getUuid(),
r.getEntity().getSpecies().getName(),
r.getEntity().getName(),
r.getEntity().getOwner() != null ? r.getEntity().getOwner().getName() : null,
rev.getRemoteHost(),
rev.getRemoteUser());
})
.toList();
}
}
|
repos\tutorials-master\persistence-modules\spring-data-envers\src\main\java\com\baeldung\envers\customrevision\service\AdoptionService.java
| 2
|
请完成以下Java代码
|
public int sendRequestWithAuthHeader(String url) throws IOException {
HttpURLConnection connection = null;
try {
connection = createConnection(url);
connection.setRequestProperty("Authorization", createBasicAuthHeaderValue());
return connection.getResponseCode();
} catch (URISyntaxException e) {
throw new IOException(e);
} finally {
if (connection != null) {
connection.disconnect();
}
}
}
public int sendRequestWithAuthenticator(String url) throws IOException, URISyntaxException {
setAuthenticator();
HttpURLConnection connection = null;
try {
connection = createConnection(url);
return connection.getResponseCode();
} finally {
if (connection != null) {
connection.disconnect();
}
}
}
private HttpURLConnection createConnection(String urlString) throws MalformedURLException, IOException, URISyntaxException {
URL url = new URI(String.format(urlString)).toURL();
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
return connection;
}
private String createBasicAuthHeaderValue() {
|
String auth = user + ":" + password;
byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(StandardCharsets.UTF_8));
String authHeaderValue = "Basic " + new String(encodedAuth);
return authHeaderValue;
}
private void setAuthenticator() {
Authenticator.setDefault(new BasicAuthenticator());
}
private final class BasicAuthenticator extends Authenticator {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(user, password.toCharArray());
}
}
}
|
repos\tutorials-master\core-java-modules\core-java-networking-2\src\main\java\com\baeldung\url\auth\HttpClient.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String getValue() {
return value;
}
/**
* Sets the value of the value property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setValue(String value) {
this.value = value;
}
/**
* Used to identify the type of further information. Currently, the following identification types are used:
* ZZZ ... mutually defined ID by both parties
* IssuedBySupplier ... ID given by supplier
* IssuedByCustomer ... ID given by customer
* FiscalNumber ... fiscal number of party
*
*
* @return
* possible object is
|
* {@link String }
*
*/
public String getIdentificationType() {
return identificationType;
}
/**
* Sets the value of the identificationType property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIdentificationType(String value) {
this.identificationType = value;
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\documents\extensions\edifact\FurtherIdentificationType.java
| 2
|
请完成以下Java代码
|
public void setRestTemplate(RestTemplate restTemplate) {
this.restTemplate = restTemplate;
}
public boolean isAtAll() {
return atAll;
}
public void setAtAll(boolean atAll) {
this.atAll = atAll;
}
public String getSecret() {
return secret;
}
public void setSecret(String secret) {
this.secret = secret;
}
public MessageType getMessageType() {
return messageType;
}
public void setMessageType(MessageType messageType) {
this.messageType = messageType;
}
public Card getCard() {
return card;
}
public void setCard(Card card) {
this.card = card;
}
|
public enum MessageType {
text, interactive
}
public static class Card {
/**
* This is header title.
*/
private String title = "Codecentric's Spring Boot Admin notice";
private String themeColor = "red";
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getThemeColor() {
return themeColor;
}
public void setThemeColor(String themeColor) {
this.themeColor = themeColor;
}
}
}
|
repos\spring-boot-admin-master\spring-boot-admin-server\src\main\java\de\codecentric\boot\admin\server\notify\FeiShuNotifier.java
| 1
|
请完成以下Java代码
|
public String asString() {
return "graphql.operation.name";
}
},
/**
* {@link graphql.execution.ExecutionId} of the GraphQL request.
*/
EXECUTION_ID {
@Override
public String asString() {
return "graphql.execution.id";
}
}
}
public enum DataFetcherLowCardinalityKeyNames implements KeyName {
/**
* Outcome of the GraphQL data fetching operation.
*/
OUTCOME {
@Override
public String asString() {
return "graphql.outcome";
}
},
/**
* Name of the field being fetched.
*/
FIELD_NAME {
@Override
public String asString() {
return "graphql.field.name";
}
},
/**
* Class name of the data fetching error.
*/
ERROR_TYPE {
@Override
public String asString() {
return "graphql.error.type";
}
}
}
public enum DataFetcherHighCardinalityKeyNames implements KeyName {
/**
* Path to the field being fetched.
*/
FIELD_PATH {
@Override
public String asString() {
return "graphql.field.path";
}
}
}
public enum DataLoaderLowCardinalityKeyNames implements KeyName {
/**
* Class name of the data fetching error.
*/
|
ERROR_TYPE {
@Override
public String asString() {
return "graphql.error.type";
}
},
/**
* {@link DataLoader#getName()} of the data loader.
*/
LOADER_NAME {
@Override
public String asString() {
return "graphql.loader.name";
}
},
/**
* Outcome of the GraphQL data fetching operation.
*/
OUTCOME {
@Override
public String asString() {
return "graphql.outcome";
}
}
}
public enum DataLoaderHighCardinalityKeyNames implements KeyName {
/**
* Size of the list of elements returned by the data loading operation.
*/
LOADER_SIZE {
@Override
public String asString() {
return "graphql.loader.size";
}
}
}
}
|
repos\spring-graphql-main\spring-graphql\src\main\java\org\springframework\graphql\observation\GraphQlObservationDocumentation.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class CommonJWorkManagerExecutorService implements ExecutorService {
private static Logger logger = Logger.getLogger(CommonJWorkManagerExecutorService.class.getName());
protected WorkManager workManager;
protected JcaExecutorServiceConnector ra;
protected String commonJWorkManagerName;
protected WorkManager lookupWorkMananger() {
try {
InitialContext initialContext = new InitialContext();
return (WorkManager) initialContext.lookup(commonJWorkManagerName);
} catch (Exception e) {
throw new RuntimeException("Error while starting JobExecutor: could not look up CommonJ WorkManager in Jndi: "+e.getMessage(), e);
}
}
public CommonJWorkManagerExecutorService(JcaExecutorServiceConnector ra, String commonJWorkManagerName) {
this.ra = ra;
this.commonJWorkManagerName = commonJWorkManagerName;
}
public boolean schedule(Runnable runnable, boolean isLongRunning) {
if(isLongRunning) {
return scheduleLongRunning(runnable);
} else {
return executeShortRunning(runnable);
}
}
protected boolean executeShortRunning(Runnable runnable) {
try {
workManager.schedule(new CommonjWorkRunnableAdapter(runnable));
return true;
} catch (WorkRejectedException e) {
logger.log(Level.FINE, "Work rejected", e);
|
} catch (WorkException e) {
logger.log(Level.WARNING, "WorkException while scheduling jobs for execution", e);
}
return false;
}
protected boolean scheduleLongRunning(Runnable acquisitionRunnable) {
// initialize the workManager here, because we have access to the initial context
// of the calling thread (application), so the jndi lookup is working -> see JCA 1.6 specification
if(workManager == null) {
workManager = lookupWorkMananger();
}
try {
workManager.schedule(new CommonjDeamonWorkRunnableAdapter(acquisitionRunnable));
return true;
} catch (WorkException e) {
logger.log(Level.WARNING, "Could not schedule Job Acquisition Runnable: "+e.getMessage(), e);
return false;
}
}
public Runnable getExecuteJobsRunnable(List<String> jobIds, ProcessEngineImpl processEngine) {
return new JcaInflowExecuteJobsRunnable(jobIds, processEngine, ra);
}
// getters / setters ////////////////////////////////////
public WorkManager getWorkManager() {
return workManager;
}
}
|
repos\camunda-bpm-platform-master\javaee\jobexecutor-ra\src\main\java\org\camunda\bpm\container\impl\threading\ra\commonj\CommonJWorkManagerExecutorService.java
| 2
|
请完成以下Java代码
|
public class BeanManagerLookup {
/** holds a local beanManager if no jndi is available */
public static BeanManager localInstance;
/** provide a custom jndi lookup name */
public static String jndiName;
public static BeanManager getBeanManager() {
BeanManager beanManager = lookupBeanManagerInJndi();
if(beanManager != null) {
return beanManager;
} else {
if (localInstance != null) {
return localInstance;
} else {
throw new ProcessEngineException(
"Could not lookup beanmanager in jndi. If no jndi is available, set the beanmanger to the 'localInstance' property of this class.");
}
}
}
private static BeanManager lookupBeanManagerInJndi() {
if (jndiName != null) {
|
try {
return (BeanManager) InitialContext.doLookup(jndiName);
} catch (NamingException e) {
throw new ProcessEngineException("Could not lookup beanmanager in jndi using name: '" + jndiName + "'.", e);
}
}
try {
// in an application server
return (BeanManager) InitialContext.doLookup("java:comp/BeanManager");
} catch (NamingException e) {
// silently ignore
}
try {
// in a servlet container
return (BeanManager) InitialContext.doLookup("java:comp/env/BeanManager");
} catch (NamingException e) {
// silently ignore
}
return null;
}
}
|
repos\camunda-bpm-platform-master\engine-cdi\core\src\main\java\org\camunda\bpm\engine\cdi\impl\util\BeanManagerLookup.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Condition getCondition() {
return this.condition;
}
public ConditionOutcome getOutcome() {
return this.outcome;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
ConditionAndOutcome other = (ConditionAndOutcome) obj;
return (ObjectUtils.nullSafeEquals(this.condition.getClass(), other.condition.getClass())
&& ObjectUtils.nullSafeEquals(this.outcome, other.outcome));
}
@Override
public int hashCode() {
return this.condition.getClass().hashCode() * 31 + this.outcome.hashCode();
|
}
@Override
public String toString() {
return this.condition.getClass() + " " + this.outcome;
}
}
private static final class AncestorsMatchedCondition implements Condition {
@Override
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
throw new UnsupportedOperationException();
}
}
}
|
repos\spring-boot-4.0.1\core\spring-boot-autoconfigure\src\main\java\org\springframework\boot\autoconfigure\condition\ConditionEvaluationReport.java
| 2
|
请完成以下Java代码
|
private static void showLoginDialog()
{
final Splash splash = Splash.getSplash();
final Properties ctx = Env.getCtx();
final ALogin login = new ALogin(splash, ctx);
if (login.initLogin())
{
return; // automatic login, nothing more to do
}
// Center the window
try (final IAutoCloseable c = ModelValidationEngine.postponeInit())
{
AEnv.showCenterScreen(login); // HTML load errors
}
catch (final Exception ex)
{
logger.error("Login failed", ex);
}
if (!(login.isConnected() && login.isOKpressed()))
{
AEnv.exit(1);
}
}
private static void basicStartup()
{
Adempiere.instance.startup(RunMode.SWING_CLIENT);
// Focus Traversal
KeyboardFocusManager.setCurrentKeyboardFocusManager(AKeyboardFocusManager.get());
Services.registerService(IClientUI.class, new SwingClientUI());
}
@Bean
@Primary
|
public ObjectMapper jsonObjectMapper()
{
return JsonObjectMapperHolder.sharedJsonObjectMapper();
}
@Bean(Adempiere.BEAN_NAME)
public Adempiere adempiere()
{
return Env.getSingleAdempiereInstance(applicationContext);
}
@EventListener(ApplicationReadyEvent.class)
public void showSwingUIMainWindow()
{
ModelValidationEngine
.get()
.loginComplete(
Env.getAD_Client_ID(),
Env.getAD_Org_ID(Env.getCtx()),
Env.getAD_Role_ID(Env.getCtx()),
Env.getAD_User_ID());
new AMenu();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java\de\metas\SwingUIApplicationTemplate.java
| 1
|
请完成以下Java代码
|
public HttpComponentsClientHttpRequestFactoryBuilder withConnectionConfigCustomizer(
Consumer<ConnectionConfig.Builder> connectionConfigCustomizer) {
Assert.notNull(connectionConfigCustomizer, "'connectionConfigCustomizer' must not be null");
return new HttpComponentsClientHttpRequestFactoryBuilder(getCustomizers(),
this.httpClientBuilder.withConnectionConfigCustomizer(connectionConfigCustomizer));
}
/**
* Return a new {@link HttpComponentsClientHttpRequestFactoryBuilder} with a
* replacement {@link TlsSocketStrategy} factory.
* @param tlsSocketStrategyFactory the new factory used to create a
* {@link TlsSocketStrategy} for a given {@link SslBundle}
* @return a new {@link HttpComponentsClientHttpRequestFactoryBuilder} instance
*/
public HttpComponentsClientHttpRequestFactoryBuilder withTlsSocketStrategyFactory(
TlsSocketStrategyFactory tlsSocketStrategyFactory) {
Assert.notNull(tlsSocketStrategyFactory, "'tlsSocketStrategyFactory' must not be null");
return new HttpComponentsClientHttpRequestFactoryBuilder(getCustomizers(),
this.httpClientBuilder.withTlsSocketStrategyFactory(tlsSocketStrategyFactory));
}
/**
* Return a new {@link HttpComponentsClientHttpRequestFactoryBuilder} that applies
* additional customization to the underlying
* {@link org.apache.hc.client5.http.config.RequestConfig.Builder} used for default
* requests.
* @param defaultRequestConfigCustomizer the customizer to apply
* @return a new {@link HttpComponentsClientHttpRequestFactoryBuilder} instance
*/
public HttpComponentsClientHttpRequestFactoryBuilder withDefaultRequestConfigCustomizer(
Consumer<RequestConfig.Builder> defaultRequestConfigCustomizer) {
Assert.notNull(defaultRequestConfigCustomizer, "'defaultRequestConfigCustomizer' must not be null");
return new HttpComponentsClientHttpRequestFactoryBuilder(getCustomizers(),
this.httpClientBuilder.withDefaultRequestConfigCustomizer(defaultRequestConfigCustomizer));
}
/**
* Return a new {@link HttpComponentsClientHttpRequestFactoryBuilder} that applies the
|
* given customizer. This can be useful for applying pre-packaged customizations.
* @param customizer the customizer to apply
* @return a new {@link HttpComponentsClientHttpRequestFactoryBuilder}
* @since 4.0.0
*/
public HttpComponentsClientHttpRequestFactoryBuilder with(
UnaryOperator<HttpComponentsClientHttpRequestFactoryBuilder> customizer) {
return customizer.apply(this);
}
@Override
protected HttpComponentsClientHttpRequestFactory createClientHttpRequestFactory(HttpClientSettings settings) {
HttpClient httpClient = this.httpClientBuilder.build(settings);
return new HttpComponentsClientHttpRequestFactory(httpClient);
}
static class Classes {
static final String HTTP_CLIENTS = "org.apache.hc.client5.http.impl.classic.HttpClients";
static boolean present(@Nullable ClassLoader classLoader) {
return ClassUtils.isPresent(HTTP_CLIENTS, classLoader);
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-http-client\src\main\java\org\springframework\boot\http\client\HttpComponentsClientHttpRequestFactoryBuilder.java
| 1
|
请完成以下Java代码
|
public void writeDTD(String dtd) throws XMLStreamException {
writer.writeDTD(dtd);
}
public void writeEntityRef(String name) throws XMLStreamException {
writer.writeEntityRef(name);
}
public void writeStartDocument() throws XMLStreamException {
writer.writeStartDocument();
}
public void writeStartDocument(String version) throws XMLStreamException {
writer.writeStartDocument(version);
}
public void writeStartDocument(String encoding, String version) throws XMLStreamException {
writer.writeStartDocument(encoding, version);
}
public void writeCharacters(String text) throws XMLStreamException {
writer.writeCharacters(text);
}
public void writeCharacters(char[] text, int start, int len) throws XMLStreamException {
writer.writeCharacters(text, start, len);
}
|
public String getPrefix(String uri) throws XMLStreamException {
return writer.getPrefix(uri);
}
public void setPrefix(String prefix, String uri) throws XMLStreamException {
writer.setPrefix(prefix, uri);
}
public void setDefaultNamespace(String uri) throws XMLStreamException {
writer.setDefaultNamespace(uri);
}
public void setNamespaceContext(NamespaceContext context) throws XMLStreamException {
writer.setNamespaceContext(context);
}
public NamespaceContext getNamespaceContext() {
return writer.getNamespaceContext();
}
public Object getProperty(String name) throws IllegalArgumentException {
return writer.getProperty(name);
}
}
|
repos\Activiti-develop\activiti-core\activiti-bpmn-converter\src\main\java\org\activiti\bpmn\converter\DelegatingXMLStreamWriter.java
| 1
|
请完成以下Java代码
|
public String getCallbackType() {
return callbackType;
}
public String getParentCaseInstanceId() {
return parentCaseInstanceId;
}
public String getReferenceId() {
return referenceId;
}
public String getReferenceType() {
return referenceType;
}
public List<ProcessInstanceQueryImpl> getOrQueryObjects() {
return orQueryObjects;
}
/**
* Methods needed for ibatis because of re-use of query-xml for executions. ExecutionQuery contains a parentId property.
*/
public String getParentId() {
return null;
}
public boolean isOnlyChildExecutions() {
return onlyChildExecutions;
}
public boolean isOnlyProcessInstanceExecutions() {
return onlyProcessInstanceExecutions;
}
public boolean isOnlySubProcessExecutions() {
return onlySubProcessExecutions;
}
public Date getStartedBefore() {
return startedBefore;
}
public void setStartedBefore(Date startedBefore) {
this.startedBefore = startedBefore;
}
public Date getStartedAfter() {
return startedAfter;
}
public void setStartedAfter(Date startedAfter) {
this.startedAfter = startedAfter;
}
public String getStartedBy() {
return startedBy;
}
public void setStartedBy(String startedBy) {
this.startedBy = startedBy;
}
|
public boolean isWithJobException() {
return withJobException;
}
public String getLocale() {
return locale;
}
public boolean isNeedsProcessDefinitionOuterJoin() {
if (isNeedsPaging()) {
if (AbstractEngineConfiguration.DATABASE_TYPE_ORACLE.equals(databaseType)
|| AbstractEngineConfiguration.DATABASE_TYPE_DB2.equals(databaseType)
|| AbstractEngineConfiguration.DATABASE_TYPE_MSSQL.equals(databaseType)) {
// When using oracle, db2 or mssql we don't need outer join for the process definition join.
// It is not needed because the outer join order by is done by the row number instead
return false;
}
}
return hasOrderByForColumn(ProcessInstanceQueryProperty.PROCESS_DEFINITION_KEY.getName());
}
public List<List<String>> getSafeProcessInstanceIds() {
return safeProcessInstanceIds;
}
public void setSafeProcessInstanceIds(List<List<String>> safeProcessInstanceIds) {
this.safeProcessInstanceIds = safeProcessInstanceIds;
}
public List<List<String>> getSafeInvolvedGroups() {
return safeInvolvedGroups;
}
public void setSafeInvolvedGroups(List<List<String>> safeInvolvedGroups) {
this.safeInvolvedGroups = safeInvolvedGroups;
}
}
|
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\ProcessInstanceQueryImpl.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public @Nullable Boolean getRequired() {
return this.required;
}
public void setRequired(@Nullable Boolean required) {
this.required = required;
}
public @Nullable String getDefaultVersion() {
return this.defaultVersion;
}
public void setDefaultVersion(@Nullable String defaultVersion) {
this.defaultVersion = defaultVersion;
}
public @Nullable List<String> getSupported() {
return this.supported;
}
public void setSupported(@Nullable List<String> supported) {
this.supported = supported;
}
public @Nullable Boolean getDetectSupported() {
return this.detectSupported;
}
public void setDetectSupported(@Nullable Boolean detectSupported) {
this.detectSupported = detectSupported;
}
public Use getUse() {
return this.use;
}
public static class Use {
/**
* Use the HTTP header with the given name to obtain the version.
*/
private @Nullable String header;
/**
* Use the query parameter with the given name to obtain the version.
*/
private @Nullable String queryParameter;
/**
* Use the path segment at the given index to obtain the version.
*/
|
private @Nullable Integer pathSegment;
/**
* Use the media type parameter with the given name to obtain the version.
*/
private Map<MediaType, String> mediaTypeParameter = new LinkedHashMap<>();
public @Nullable String getHeader() {
return this.header;
}
public void setHeader(@Nullable String header) {
this.header = header;
}
public @Nullable String getQueryParameter() {
return this.queryParameter;
}
public void setQueryParameter(@Nullable String queryParameter) {
this.queryParameter = queryParameter;
}
public @Nullable Integer getPathSegment() {
return this.pathSegment;
}
public void setPathSegment(@Nullable Integer pathSegment) {
this.pathSegment = pathSegment;
}
public Map<MediaType, String> getMediaTypeParameter() {
return this.mediaTypeParameter;
}
public void setMediaTypeParameter(Map<MediaType, String> mediaTypeParameter) {
this.mediaTypeParameter = mediaTypeParameter;
}
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-webflux\src\main\java\org\springframework\boot\webflux\autoconfigure\WebFluxProperties.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public String getServicePhone() {
return servicePhone;
}
public void setServicePhone(String servicePhone) {
this.servicePhone = servicePhone;
}
public String getProductDesc() {
return productDesc;
}
public void setProductDesc(String productDesc) {
this.productDesc = productDesc;
}
public String getRate() {
return rate;
}
public void setRate(String rate) {
this.rate = rate;
}
public String getContactPhone() {
return contactPhone;
}
public void setContactPhone(String contactPhone) {
this.contactPhone = contactPhone;
}
@Override
public String toString() {
return "RpMicroSubmitRecord{" +
"businessCode='" + businessCode + '\'' +
", subMchId='" + subMchId + '\'' +
", idCardCopy='" + idCardCopy + '\'' +
", idCardNational='" + idCardNational + '\'' +
|
", idCardName='" + idCardName + '\'' +
", idCardNumber='" + idCardNumber + '\'' +
", idCardValidTime='" + idCardValidTime + '\'' +
", accountBank='" + accountBank + '\'' +
", bankAddressCode='" + bankAddressCode + '\'' +
", accountNumber='" + accountNumber + '\'' +
", storeName='" + storeName + '\'' +
", storeAddressCode='" + storeAddressCode + '\'' +
", storeStreet='" + storeStreet + '\'' +
", storeEntrancePic='" + storeEntrancePic + '\'' +
", indoorPic='" + indoorPic + '\'' +
", merchantShortname='" + merchantShortname + '\'' +
", servicePhone='" + servicePhone + '\'' +
", productDesc='" + productDesc + '\'' +
", rate='" + rate + '\'' +
", contactPhone='" + contactPhone + '\'' +
", idCardValidTimeBegin='" + idCardValidTimeBegin + '\'' +
", idCardValidTimeEnd='" + idCardValidTimeEnd + '\'' +
'}';
}
}
|
repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\trade\entity\RpMicroSubmitRecord.java
| 2
|
请完成以下Java代码
|
public String getLogo() {
return logo;
}
public void setLogo(String logo) {
this.logo = logo;
}
public String getBigPic() {
return bigPic;
}
public void setBigPic(String bigPic) {
this.bigPic = bigPic;
}
public String getBrandStory() {
return brandStory;
}
public void setBrandStory(String brandStory) {
this.brandStory = brandStory;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
|
sb.append(", id=").append(id);
sb.append(", name=").append(name);
sb.append(", firstLetter=").append(firstLetter);
sb.append(", sort=").append(sort);
sb.append(", factoryStatus=").append(factoryStatus);
sb.append(", showStatus=").append(showStatus);
sb.append(", productCount=").append(productCount);
sb.append(", productCommentCount=").append(productCommentCount);
sb.append(", logo=").append(logo);
sb.append(", bigPic=").append(bigPic);
sb.append(", brandStory=").append(brandStory);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
|
repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\PmsBrand.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public AuthorizedUrlVariable hasVariable(String variable) {
return new AuthorizedUrlVariable(variable);
}
/**
* Allows specifying a custom {@link AuthorizationManager}.
* @param manager the {@link AuthorizationManager} to use
* @return the {@link AuthorizationManagerRequestMatcherRegistry} for further
* customizations
*/
public AuthorizationManagerRequestMatcherRegistry access(
AuthorizationManager<? super RequestAuthorizationContext> manager) {
Assert.notNull(manager, "manager cannot be null");
return (this.not)
? AuthorizeHttpRequestsConfigurer.this.addMapping(this.matchers, AuthorizationManagers.not(manager))
: AuthorizeHttpRequestsConfigurer.this.addMapping(this.matchers, manager);
}
/**
* An object that allows configuring {@link RequestMatcher}s with URI path
* variables
*
* @author Taehong Kim
* @since 6.3
*/
public final class AuthorizedUrlVariable {
private final String variable;
private AuthorizedUrlVariable(String variable) {
this.variable = variable;
}
/**
* Compares the value of a path variable in the URI with an `Authentication`
|
* attribute
* <p>
* For example, <pre>
* requestMatchers("/user/{username}").hasVariable("username").equalTo(Authentication::getName));
* </pre>
* @param function a function to get value from {@link Authentication}.
* @return the {@link AuthorizationManagerRequestMatcherRegistry} for further
* customization.
*/
public AuthorizationManagerRequestMatcherRegistry equalTo(Function<Authentication, String> function) {
return access((auth, requestContext) -> {
String value = requestContext.getVariables().get(this.variable);
return new AuthorizationDecision(function.apply(auth.get()).equals(value));
});
}
}
}
}
|
repos\spring-security-main\config\src\main\java\org\springframework\security\config\annotation\web\configurers\AuthorizeHttpRequestsConfigurer.java
| 2
|
请完成以下Java代码
|
public CreditDebitCode getCdtDbtInd() {
return cdtDbtInd;
}
/**
* Sets the value of the cdtDbtInd property.
*
* @param value
* allowed object is
* {@link CreditDebitCode }
*
*/
public void setCdtDbtInd(CreditDebitCode value) {
this.cdtDbtInd = value;
}
/**
* Gets the value of the ccy property.
*
* @return
* possible object is
* {@link String }
|
*
*/
public String getCcy() {
return ccy;
}
/**
* Sets the value of the ccy property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCcy(String value) {
this.ccy = value;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.camt53\src\main\java-xjc\de\metas\banking\camt53\jaxb\camt053_001_02\CurrencyAndAmountRange2.java
| 1
|
请完成以下Java代码
|
public List<String> getUserTaskFormTypes() {
return userTaskFormTypes;
}
public void setUserTaskFormTypes(List<String> userTaskFormTypes) {
this.userTaskFormTypes = userTaskFormTypes;
}
public List<String> getStartEventFormTypes() {
return startEventFormTypes;
}
public void setStartEventFormTypes(List<String> startEventFormTypes) {
this.startEventFormTypes = startEventFormTypes;
}
@JsonIgnore
public Object getEventSupport() {
return eventSupport;
}
|
public void setEventSupport(Object eventSupport) {
this.eventSupport = eventSupport;
}
public String getExporter() {
return exporter;
}
public void setExporter(String exporter) {
this.exporter = exporter;
}
public String getExporterVersion() {
return exporterVersion;
}
public void setExporterVersion(String exporterVersion) {
this.exporterVersion = exporterVersion;
}
}
|
repos\flowable-engine-main\modules\flowable-bpmn-model\src\main\java\org\flowable\bpmn\model\BpmnModel.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class SumUpTransactionId implements RepoIdAware
{
@JsonCreator
public static SumUpTransactionId ofRepoId(final int repoId)
{
return new SumUpTransactionId(repoId);
}
@Nullable
public static SumUpTransactionId ofRepoIdOrNull(final int repoId)
{
return repoId > 0 ? new SumUpTransactionId(repoId) : null;
}
public static int toRepoId(@Nullable final SumUpTransactionId SumUpTransactionId)
{
|
return SumUpTransactionId != null ? SumUpTransactionId.getRepoId() : -1;
}
int repoId;
private SumUpTransactionId(final int repoId)
{
this.repoId = Check.assumeGreaterThanZero(repoId, "SUMUP_Transaction_ID");
}
@Override
@JsonValue
public int getRepoId()
{
return repoId;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.sumup\src\main\java\de\metas\payment\sumup\SumUpTransactionId.java
| 2
|
请完成以下Spring Boot application配置
|
# Deprecated Properties for Demonstration
#spring:
# resources:
# cache:
# period: 31536000
# chain:
# compressed: true
# html-application-cache: true
spring:
web:
res
|
ources:
cache:
period: 31536000
chain:
compressed: false
|
repos\tutorials-master\spring-boot-modules\spring-boot-properties-migrator-demo\src\main\resources\application-dev.yaml
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class SimpleLoggingHandler implements ObservationHandler<Observation.Context> {
private static final Logger log = LoggerFactory.getLogger(SimpleLoggingHandler.class);
private static String toString(Observation.Context context) {
return null == context ? "(no context)" : context.getName()
+ " (" + context.getClass().getName() + "@" + System.identityHashCode(context) + ")";
}
private static String toString(Observation.Event event) {
return null == event ? "(no event)" : event.getName();
}
@Override
public boolean supportsContext(Observation.Context context) {
return true;
}
@Override
public void onStart(Observation.Context context) {
log.info("Starting context " + toString(context));
}
@Override
public void onError(Observation.Context context) {
log.info("Error for context " + toString(context));
}
@Override
|
public void onEvent(Observation.Event event, Observation.Context context) {
log.info("Event for context " + toString(context) + " [" + toString(event) + "]");
}
@Override
public void onScopeOpened(Observation.Context context) {
log.info("Scope opened for context " + toString(context));
}
@Override
public void onScopeClosed(Observation.Context context) {
log.info("Scope closed for context " + toString(context));
}
@Override
public void onStop(Observation.Context context) {
log.info("Stopping context " + toString(context));
}
}
|
repos\tutorials-master\spring-boot-modules\spring-boot-3-observation\src\main\java\com\baeldung\samples\config\SimpleLoggingHandler.java
| 2
|
请完成以下Java代码
|
public class Dialog {
private Locale locale;
private String hello;
private String thanks;
public Dialog() {
}
public Dialog(Locale locale, String hello, String thanks) {
this.locale = locale;
this.hello = hello;
this.thanks = thanks;
}
public Locale getLocale() {
return locale;
}
public void setLocale(Locale locale) {
this.locale = locale;
}
|
public String getHello() {
return hello;
}
public void setHello(String hello) {
this.hello = hello;
}
public String getThanks() {
return thanks;
}
public void setThanks(String thanks) {
this.thanks = thanks;
}
}
|
repos\tutorials-master\spring-core-2\src\main\java\com\baeldung\applicationcontext\Dialog.java
| 1
|
请完成以下Java代码
|
public void onDocValidate(final Object model, final DocTimingType timing) throws Exception
{
if (timing != DocTimingType.AFTER_COMPLETE)
{
return; // nothing to do
}
final ICounterDocBL counterDocumentBL = Services.get(ICounterDocBL.class);
if (!counterDocumentBL.isCreateCounterDocument(model))
{
return; // nothing to do
}
counterDocumentBL.createCounterDocument(model, async);
}
/** {@link CounterDocHandlerInterceptor} instance builder */
public static final class Builder
{
private String tableName;
private boolean async = false;
private Builder()
{
super();
}
public CounterDocHandlerInterceptor build()
{
|
return new CounterDocHandlerInterceptor(this);
}
public Builder setTableName(String tableName)
{
this.tableName = tableName;
return this;
}
private final String getTableName()
{
Check.assumeNotEmpty(tableName, "tableName not empty");
return tableName;
}
public Builder setAsync(boolean async)
{
this.async = async;
return this;
}
private boolean isAsync()
{
return async;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\document\model\interceptor\CounterDocHandlerInterceptor.java
| 1
|
请完成以下Java代码
|
public void itemStateChanged(ItemEvent e)
{
onActionPerformed();
}
});
}
@Override
public String toString()
{
return ObjectUtils.toString(this);
}
private final void updateFromAction()
{
final String displayName = action.getDisplayName();
setText(displayName);
// setToolTipText(displayName);
setOpaque(false);
setChecked(action.isToggled());
}
public final boolean isChecked()
{
return this.isSelected();
}
private final void setChecked(final boolean checked)
{
this.setSelected(checked);
}
protected void onActionPerformed()
{
if (!isEnabled())
{
return;
|
}
setEnabled(false);
try
{
action.setToggled(isChecked());
action.execute();
}
catch (Exception e)
{
final int windowNo = Env.getWindowNo(this);
Services.get(IClientUI.class).error(windowNo, e);
}
finally
{
setEnabled(true);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java\org\adempiere\ui\sideactions\swing\CheckableSideActionComponent.java
| 1
|
请完成以下Java代码
|
public void setU_Key (String U_Key)
{
set_Value (COLUMNNAME_U_Key, U_Key);
}
/** Get Key.
@return Key */
public String getU_Key ()
{
return (String)get_Value(COLUMNNAME_U_Key);
}
/** Set Value.
@param U_Value Value */
public void setU_Value (String U_Value)
{
set_Value (COLUMNNAME_U_Value, U_Value);
}
/** Get Value.
@return Value */
public String getU_Value ()
{
return (String)get_Value(COLUMNNAME_U_Value);
}
/** Set Web Properties.
@param U_Web_Properties_ID Web Properties */
public void setU_Web_Properties_ID (int U_Web_Properties_ID)
|
{
if (U_Web_Properties_ID < 1)
set_ValueNoCheck (COLUMNNAME_U_Web_Properties_ID, null);
else
set_ValueNoCheck (COLUMNNAME_U_Web_Properties_ID, Integer.valueOf(U_Web_Properties_ID));
}
/** Get Web Properties.
@return Web Properties */
public int getU_Web_Properties_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_U_Web_Properties_ID);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_U_Web_Properties.java
| 1
|
请完成以下Java代码
|
public void simpleInitApp() {
Box mesh = new Box(1, 2, 3);
Geometry geometry = new Geometry("Box", mesh);
Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
material.setColor("Color", ColorRGBA.Red);
geometry.setMaterial(material);
Node rotation = new Node("rotation");
rotation.attachChild(geometry);
rootNode.attachChild(rotation);
inputManager.addMapping("Rotate", new KeyTrigger(KeyInput.KEY_SPACE));
inputManager.addMapping("Left", new KeyTrigger(KeyInput.KEY_J));
inputManager.addMapping("Right", new KeyTrigger(KeyInput.KEY_K));
ActionListener actionListener = new ActionListener() {
@Override
public void onAction(String name, boolean isPressed, float tpf) {
if (name.equals("Rotate") && !isPressed) {
rotationEnabled = !rotationEnabled;
}
}
};
AnalogListener analogListener = new AnalogListener() {
@Override
public void onAnalog(String name, float value, float tpf) {
if (name.equals("Left")) {
|
rotation.rotate(0, -tpf, 0);
} else if (name.equals("Right")) {
rotation.rotate(0, tpf, 0);
}
}
};
inputManager.addListener(actionListener, "Rotate");
inputManager.addListener(analogListener, "Left", "Right");
}
@Override
public void simpleUpdate(float tpf) {
if (rotationEnabled) {
Spatial rotation = rootNode.getChild("rotation");
rotation.rotate(0, 0, tpf);
}
}
}
|
repos\tutorials-master\jmonkeyengine\src\main\java\com\baeldung\jmonkeyengine\UserInputApplication.java
| 1
|
请完成以下Java代码
|
public void setHU_Expired (final @Nullable java.lang.String HU_Expired)
{
set_ValueNoCheck (COLUMNNAME_HU_Expired, HU_Expired);
}
@Override
public java.lang.String getHU_Expired()
{
return get_ValueAsString(COLUMNNAME_HU_Expired);
}
@Override
public void setHU_ExpiredWarnDate (final @Nullable java.sql.Timestamp HU_ExpiredWarnDate)
{
set_ValueNoCheck (COLUMNNAME_HU_ExpiredWarnDate, HU_ExpiredWarnDate);
}
@Override
public java.sql.Timestamp getHU_ExpiredWarnDate()
|
{
return get_ValueAsTimestamp(COLUMNNAME_HU_ExpiredWarnDate);
}
@Override
public void setM_HU_ID (final int M_HU_ID)
{
if (M_HU_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_HU_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_HU_ID, M_HU_ID);
}
@Override
public int getM_HU_ID()
{
return get_ValueAsInt(COLUMNNAME_M_HU_ID);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java-gen\de\metas\handlingunits\model\X_M_HU_BestBefore_V.java
| 1
|
请完成以下Java代码
|
protected void onInit(final IModelValidationEngine engine, final I_AD_Client client)
{
this.engine = engine;
ruleService.addRulesChangedListener(this::updateFromBusinessRulesRepository);
Services.get(INotificationBL.class).addCtxProvider(new RecordWarningTextProvider(recordWarningRepository));
updateFromBusinessRulesRepository();
}
private synchronized void updateFromBusinessRulesRepository()
{
final BusinessRulesCollection rulesPrev = this.rules;
this.rules = ruleService.getRules();
if (Objects.equals(this.rules, rulesPrev))
{
return;
}
updateRegisteredInterceptors();
}
private synchronized void updateRegisteredInterceptors()
{
final IModelValidationEngine engine = getEngine();
final BusinessRulesCollection rules = getRules();
final HashSet<String> registeredTableNamesNoLongerNeeded = new HashSet<>(registeredTableNames);
for (final AdTableId triggerTableId : rules.getTriggerTableIds())
{
final String triggerTableName = TableIdsCache.instance.getTableName(triggerTableId);
registeredTableNamesNoLongerNeeded.remove(triggerTableName);
if (registeredTableNames.contains(triggerTableName))
{
// already registered
|
continue;
}
engine.addModelChange(triggerTableName, this);
registeredTableNames.add(triggerTableName);
logger.info("Registered trigger for {}", triggerTableName);
}
//
// Remove no longer needed interceptors
for (final String triggerTableName : registeredTableNamesNoLongerNeeded)
{
engine.removeModelChange(triggerTableName, this);
registeredTableNames.remove(triggerTableName);
logger.info("Unregistered trigger for {}", triggerTableName);
}
}
@Override
public void onModelChange(@NonNull final Object model, @NonNull final ModelChangeType modelChangeType) throws Exception
{
final TriggerTiming timing = TriggerTiming.ofModelChangeType(modelChangeType).orElse(null);
if (timing == null)
{
return;
}
ruleService.fireTriggersForSourceModel(model, timing);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\business_rule\trigger\interceptor\BusinessRuleTriggerInterceptor.java
| 1
|
请完成以下Java代码
|
private BPartnerId getBPartnerId(@NonNull final OrgId orgId,
@NonNull final JsonVendor vendor)
{
final String bpartnerIdentifierStr = vendor.getBpartnerIdentifier();
if (Check.isBlank(bpartnerIdentifierStr))
{
throw new MissingPropertyException("vendor.bpartnerIdentifier", vendor);
}
final ExternalIdentifier bpartnerIdentifier = ExternalIdentifier.of(bpartnerIdentifierStr);
final BPartnerId bPartnerId;
try
{
bPartnerId = jsonRetrieverService.resolveBPartnerExternalIdentifier(bpartnerIdentifier, orgId)
.orElseThrow(() -> MissingResourceException.builder()
.resourceName("bpartnerIdentifier")
.resourceIdentifier(bpartnerIdentifier.getRawValue())
.parentResource(vendor)
.build());
}
catch (final AdempiereException e)
{
throw MissingResourceException.builder()
.resourceName("vendor.bpartnerIdentifier")
.resourceIdentifier(bpartnerIdentifier.getRawValue())
.cause(e)
.build();
}
return bPartnerId;
}
@NonNull
|
private Optional<UomId> getPriceUOMId(@NonNull final JsonPrice price)
{
return X12DE355.ofCodeOrOptional(price.getPriceUomCode())
.map(uomDAO::getByX12DE355)
.map(I_C_UOM::getC_UOM_ID)
.map(UomId::ofRepoId);
}
@Nullable
private CurrencyId getCurrencyId(@NonNull final JsonPrice price)
{
return Optional.ofNullable(price.getCurrencyCode())
.map(CurrencyCode::ofThreeLetterCode)
.map(currencyRepository::getCurrencyIdByCurrencyCode)
.orElse(null);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business.rest-api-impl\src\main\java\de\metas\rest_api\v2\order\CreatePurchaseCandidatesService.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private @Nullable CloudPlatform deduceCloudPlatform(Environment environment, Binder binder) {
for (CloudPlatform candidate : CloudPlatform.values()) {
if (candidate.isEnforced(binder)) {
return candidate;
}
}
return CloudPlatform.getActive(environment);
}
/**
* Return a new {@link ConfigDataActivationContext} with specific profiles.
* @param profiles the profiles
* @return a new {@link ConfigDataActivationContext} with specific profiles
*/
ConfigDataActivationContext withProfiles(Profiles profiles) {
return new ConfigDataActivationContext(this.cloudPlatform, profiles);
}
/**
* Return the active {@link CloudPlatform} or {@code null}.
* @return the active cloud platform
|
*/
@Nullable CloudPlatform getCloudPlatform() {
return this.cloudPlatform;
}
/**
* Return profile information if it is available.
* @return profile information or {@code null}
*/
@Nullable Profiles getProfiles() {
return this.profiles;
}
@Override
public String toString() {
ToStringCreator creator = new ToStringCreator(this);
creator.append("cloudPlatform", this.cloudPlatform);
creator.append("profiles", this.profiles);
return creator.toString();
}
}
|
repos\spring-boot-4.0.1\core\spring-boot\src\main\java\org\springframework\boot\context\config\ConfigDataActivationContext.java
| 2
|
请完成以下Java代码
|
public CaseInstanceStartEventSubscriptionDeletionBuilder addCorrelationParameterValues(Map<String, Object> parameters) {
correlationParameterValues.putAll(parameters);
return this;
}
public String getCaseDefinitionId() {
return caseDefinitionId;
}
public String getTenantId() {
return tenantId;
}
public boolean hasCorrelationParameterValues() {
return correlationParameterValues.size() > 0;
}
|
public Map<String, Object> getCorrelationParameterValues() {
return correlationParameterValues;
}
@Override
public void deleteSubscriptions() {
checkValidInformation();
cmmnRuntimeService.deleteCaseInstanceStartEventSubscriptions(this);
}
protected void checkValidInformation() {
if (StringUtils.isEmpty(caseDefinitionId)) {
throw new FlowableIllegalArgumentException("The case definition must be provided using the exact id of the version the subscription was registered for.");
}
}
}
|
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\runtime\CaseInstanceStartEventSubscriptionDeletionBuilderImpl.java
| 1
|
请完成以下Java代码
|
public class BBANStructureEntryBuilder implements IBBANStructureEntryBuilder
{
private BBANCodeEntryType codeType;
private EntryCharacterType characterType;
private int length;
private String seqNo;
private IBBANStructureBuilder parent;
private BBANStructureEntry entry;
public BBANStructureEntryBuilder(BBANStructureBuilder parent)
{
this.parent = parent;
entry = new BBANStructureEntry();
}
@Override
public BBANStructureEntry create()
{
entry.setCharacterType(characterType);
entry.setCodeType(codeType);
entry.setLength(length);
entry.setSeqNo(seqNo);
return entry;
}
@Override
public IBBANStructureEntryBuilder setCodeType(BBANCodeEntryType codeType)
{
this.codeType = codeType;
return this;
}
@Override
public IBBANStructureEntryBuilder setCharacterType(EntryCharacterType characterType)
{
this.characterType = characterType;
|
return this;
}
@Override
public IBBANStructureEntryBuilder setLength(int length)
{
this.length = length;
return this;
}
@Override
public IBBANStructureEntryBuilder setSeqNo(String seqNo)
{
this.seqNo = seqNo;
return this;
}
public void create(BBANStructure _BBANStructure)
{
_BBANStructure.addEntry(entry);
}
public final IBBANStructureBuilder getParent()
{
return parent;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.sepa\base\src\main\java\de\metas\payment\sepa\api\impl\BBANStructureEntryBuilder.java
| 1
|
请完成以下Java代码
|
public List<Book> processReaderDataFromReaderList() {
Mono<List<Reader>> response = webClient.get()
.accept(MediaType.APPLICATION_JSON)
.retrieve()
.bodyToMono(new ParameterizedTypeReference<List<Reader>>() {});
List<Reader> readers = response.block();
return readers.stream()
.map(Reader::getFavouriteBook)
.collect(Collectors.toList());
}
@Override
public List<String> processNestedReaderDataFromReaderArray() {
Mono<Reader[]> response = webClient.get()
.accept(MediaType.APPLICATION_JSON)
.retrieve()
.bodyToMono(Reader[].class).log();
Reader[] readers = response.block();
return Arrays.stream(readers)
.flatMap(reader -> reader.getBooksRead().stream())
.map(Book::getAuthor)
.collect(Collectors.toList());
|
}
@Override
public List<String> processNestedReaderDataFromReaderList() {
Mono<List<Reader>> response = webClient.get()
.accept(MediaType.APPLICATION_JSON)
.retrieve()
.bodyToMono(new ParameterizedTypeReference<List<Reader>>() {});
List<Reader> readers = response.block();
return readers.stream()
.flatMap(reader -> reader.getBooksRead().stream())
.map(Book::getAuthor)
.collect(Collectors.toList());
}
}
|
repos\tutorials-master\spring-reactive-modules\spring-reactive-client\src\main\java\com\baeldung\webclient\json\ReaderConsumerServiceImpl.java
| 1
|
请完成以下Java代码
|
private static BigDecimal convert(Properties ctx, int C_UOM_ID, int C_UOM_To_ID, BigDecimal qty)
{
final I_C_UOM uomFrom = MUOM.get(ctx, C_UOM_ID);
final I_C_UOM uomTo = MUOM.get(ctx, C_UOM_To_ID);
// return convert(ctx, uomFrom, uomTo, qty);
return Services.get(IUOMConversionBL.class).convert(uomFrom, uomTo, qty).orElse(null);
}
/**
* Convert qty to target UOM and round.
*
* @param ctx context
* @param C_UOM_ID from UOM
* @param qty qty
* @return minutes - 0 if not found
*/
public static int convertToMinutes(Properties ctx, int C_UOM_ID, BigDecimal qty)
{
if (qty == null)
return 0;
int C_UOM_To_ID = MUOM.getMinute_UOM_ID(ctx);
if (C_UOM_ID == C_UOM_To_ID)
return qty.intValue();
//
BigDecimal result = convert(ctx, C_UOM_ID, C_UOM_To_ID, qty);
if (result == null)
return 0;
return result.intValue();
} // convert
@Deprecated
public static BigDecimal convert(int C_UOM_From_ID, int C_UOM_To_ID, BigDecimal qty, boolean StdPrecision)
{
final Properties ctx = Env.getCtx();
final I_C_UOM uomFrom = MUOM.get(ctx, C_UOM_From_ID);
final I_C_UOM uomTo = MUOM.get(ctx, C_UOM_To_ID);
// return convert(ctx, uomFrom, uomTo, qty, StdPrecision);
|
return Services.get(IUOMConversionBL.class).convert(uomFrom, uomTo, qty, StdPrecision);
}
@Deprecated
public static BigDecimal convertFromProductUOM(
final Properties ctx,
final int M_Product_ID,
final int C_UOM_Dest_ID,
final BigDecimal qtyToConvert)
{
final ProductId productId = ProductId.ofRepoIdOrNull(M_Product_ID);
final I_C_UOM uomDest = MUOM.get(ctx, C_UOM_Dest_ID);
final BigDecimal qtyConv = Services.get(IUOMConversionBL.class).convertFromProductUOM(productId, uomDest, qtyToConvert);
return qtyConv;
}
@Deprecated
public static BigDecimal convertToProductUOM(
final Properties ctx,
final int M_Product_ID,
final int C_UOM_Source_ID,
final BigDecimal qtyToConvert)
{
final ProductId productId = ProductId.ofRepoIdOrNull(M_Product_ID);
final UomId fromUomId = UomId.ofRepoIdOrNull(C_UOM_Source_ID);
return Services.get(IUOMConversionBL.class).convertToProductUOM(productId, qtyToConvert, fromUomId);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\uom\LegacyUOMConversionUtils.java
| 1
|
请完成以下Java代码
|
private OAuth2AccessTokenResponse getTokenResponse(OAuth2AuthorizedClient authorizedClient,
OAuth2RefreshTokenGrantRequest refreshTokenGrantRequest) {
try {
return this.accessTokenResponseClient.getTokenResponse(refreshTokenGrantRequest);
}
catch (OAuth2AuthorizationException ex) {
throw new ClientAuthorizationException(ex.getError(),
authorizedClient.getClientRegistration().getRegistrationId(), ex);
}
}
private boolean hasTokenExpired(OAuth2Token token) {
return this.clock.instant().isAfter(token.getExpiresAt().minus(this.clockSkew));
}
/**
* Sets the client used when requesting an access token credential at the Token
* Endpoint for the {@code refresh_token} grant.
* @param accessTokenResponseClient the client used when requesting an access token
* credential at the Token Endpoint for the {@code refresh_token} grant
*/
public void setAccessTokenResponseClient(
OAuth2AccessTokenResponseClient<OAuth2RefreshTokenGrantRequest> accessTokenResponseClient) {
Assert.notNull(accessTokenResponseClient, "accessTokenResponseClient cannot be null");
this.accessTokenResponseClient = accessTokenResponseClient;
}
/**
* Sets the maximum acceptable clock skew, which is used when checking the
* {@link OAuth2AuthorizedClient#getAccessToken() access token} expiry. The default is
* 60 seconds.
*
|
* <p>
* An access token is considered expired if
* {@code OAuth2AccessToken#getExpiresAt() - clockSkew} is before the current time
* {@code clock#instant()}.
* @param clockSkew the maximum acceptable clock skew
*/
public void setClockSkew(Duration clockSkew) {
Assert.notNull(clockSkew, "clockSkew cannot be null");
Assert.isTrue(clockSkew.getSeconds() >= 0, "clockSkew must be >= 0");
this.clockSkew = clockSkew;
}
/**
* Sets the {@link Clock} used in {@link Instant#now(Clock)} when checking the access
* token expiry.
* @param clock the clock
*/
public void setClock(Clock clock) {
Assert.notNull(clock, "clock cannot be null");
this.clock = clock;
}
@Override
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
Assert.notNull(applicationEventPublisher, "applicationEventPublisher cannot be null");
this.applicationEventPublisher = applicationEventPublisher;
}
}
|
repos\spring-security-main\oauth2\oauth2-client\src\main\java\org\springframework\security\oauth2\client\RefreshTokenOAuth2AuthorizedClientProvider.java
| 1
|
请完成以下Java代码
|
public class Producer implements Runnable {
private static final Logger LOG = LoggerFactory.getLogger(Producer.class);
private final TransferQueue<String> transferQueue;
private final String name;
final Integer numberOfMessagesToProduce;
final AtomicInteger numberOfProducedMessages = new AtomicInteger();
Producer(TransferQueue<String> transferQueue, String name, Integer numberOfMessagesToProduce) {
this.transferQueue = transferQueue;
this.name = name;
this.numberOfMessagesToProduce = numberOfMessagesToProduce;
}
@Override
public void run() {
|
for (int i = 0; i < numberOfMessagesToProduce; i++) {
try {
LOG.debug("Producer: " + name + " is waiting to transfer...");
boolean added = transferQueue.tryTransfer("A" + i, 4000, TimeUnit.MILLISECONDS);
if (added) {
numberOfProducedMessages.incrementAndGet();
LOG.debug("Producer: " + name + " transferred element: A" + i);
} else {
LOG.debug("can not add an element due to the timeout");
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
|
repos\tutorials-master\core-java-modules\core-java-concurrency-collections-2\src\main\java\com\baeldung\transferqueue\Producer.java
| 1
|
请完成以下Java代码
|
public class CmsSubjectCategory implements Serializable {
private Long id;
private String name;
@ApiModelProperty(value = "分类图标")
private String icon;
@ApiModelProperty(value = "专题数量")
private Integer subjectCount;
private Integer showStatus;
private Integer sort;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public Integer getSubjectCount() {
return subjectCount;
}
public void setSubjectCount(Integer subjectCount) {
this.subjectCount = subjectCount;
}
public Integer getShowStatus() {
return showStatus;
}
public void setShowStatus(Integer showStatus) {
this.showStatus = showStatus;
|
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", name=").append(name);
sb.append(", icon=").append(icon);
sb.append(", subjectCount=").append(subjectCount);
sb.append(", showStatus=").append(showStatus);
sb.append(", sort=").append(sort);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
|
repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\CmsSubjectCategory.java
| 1
|
请完成以下Java代码
|
public static void main(String[] args) {
try {
displayFactorial(10);
getFactorial(10).get();
String result = cacheExchangeRates();
if (result != cacheExchangeRates()) {
System.out.println(result);
}
divideByZero();
} catch(Exception e) {
e.printStackTrace();
}
divideByZeroQuietly();
try {
processFile();
} catch(Exception e) {
e.printStackTrace();
}
}
@Loggable
@Async
public static void displayFactorial(int number) {
long result = factorial(number);
System.out.println(result);
}
@Loggable
@Async
public static Future<Long> getFactorial(int number) {
Future<Long> factorialFuture = CompletableFuture.supplyAsync(() -> factorial(number));
return factorialFuture;
}
/**
* Finds factorial of a number
* @param number
* @return
*/
public static long factorial(int number) {
long result = 1;
for(int i=number;i>0;i--) {
result *= i;
}
return result;
}
@Loggable
@Cacheable(lifetime = 2, unit = TimeUnit.SECONDS)
public static String cacheExchangeRates() {
String result = null;
try {
URL exchangeRateUrl = new URI("https://api.exchangeratesapi.io/latest").toURL();
URLConnection con = exchangeRateUrl.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
result = in.readLine();
|
} catch (IOException | URISyntaxException e) {
e.printStackTrace();
}
return result;
}
@LogExceptions
public static void divideByZero() {
int x = 1/0;
}
@RetryOnFailure(attempts = 2, types = { NumberFormatException.class})
@Quietly
public static void divideByZeroQuietly() {
int x = 1/0;
}
@UnitedThrow(IllegalStateException.class)
public static void processFile() throws IOException, InterruptedException {
BufferedReader reader = new BufferedReader(new FileReader("baeldung.txt"));
reader.readLine();
Thread thread = new Thread();
thread.wait(2000);
}
}
|
repos\tutorials-master\libraries-6\src\main\java\com\baeldung\jcabi\JcabiAspectJ.java
| 1
|
请完成以下Spring Boot application配置
|
# For MVC multipart
spring.servlet.multipart.max-file-size=10MB
spring.servlet.multipart.max-request-size=10MB
spring.servlet.multipart.file-size-threshold=0
# For Reactive multipart
spring.webflux.multipart.max-file-size=
|
10MB
spring.webflux.multipart.max-request-size=10MB
# spring.main.web-application-type=reactive
|
repos\tutorials-master\spring-web-modules\spring-rest-http-3\src\main\resources\application.properties
| 2
|
请完成以下Java代码
|
public final void fireTableRowsUpdated(final Collection<ModelType> rows)
{
if (rows == null || rows.isEmpty())
{
return;
}
// NOTE: because we are working with small amounts of rows,
// it's pointless to figure out which are the row indexes of those rows
// so it's better to fire a full data change event.
// In future we can optimize this.
fireTableDataChanged();
}
/**
* @return foreground color to be used when rendering the given cell or <code>null</code> if no suggestion
*/
protected Color getCellForegroundColor(final int modelRowIndex, final int modelColumnIndex)
{
return null;
}
public List<ModelType> getSelectedRows(final ListSelectionModel selectionModel, final Function<Integer, Integer> convertRowIndexToModel)
{
final int rowMinView = selectionModel.getMinSelectionIndex();
final int rowMaxView = selectionModel.getMaxSelectionIndex();
if (rowMinView < 0 || rowMaxView < 0)
{
return ImmutableList.of();
}
final ImmutableList.Builder<ModelType> selection = ImmutableList.builder();
for (int rowView = rowMinView; rowView <= rowMaxView; rowView++)
{
if (selectionModel.isSelectedIndex(rowView))
{
final int rowModel = convertRowIndexToModel.apply(rowView);
selection.add(getRow(rowModel));
}
|
}
return selection.build();
}
public ModelType getSelectedRow(final ListSelectionModel selectionModel, final Function<Integer, Integer> convertRowIndexToModel)
{
final int rowIndexView = selectionModel.getMinSelectionIndex();
if (rowIndexView < 0)
{
return null;
}
final int rowIndexModel = convertRowIndexToModel.apply(rowIndexView);
return getRow(rowIndexModel);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\compiere\swing\table\AnnotatedTableModel.java
| 1
|
请完成以下Java代码
|
public void setRequestCache(ServerRequestCache requestCache) {
Assert.notNull(requestCache, "requestCache cannot be null");
this.requestCache = requestCache;
}
@Override
public Mono<Void> onAuthenticationSuccess(WebFilterExchange webFilterExchange, Authentication authentication) {
ServerWebExchange exchange = webFilterExchange.getExchange();
return this.requestCache.getRedirectUri(exchange)
.defaultIfEmpty(this.location)
.flatMap((location) -> this.redirectStrategy.sendRedirect(exchange, location));
}
/**
* Where the user is redirected to upon authentication success
* @param location the location to redirect to. The default is "/"
*/
|
public void setLocation(URI location) {
Assert.notNull(location, "location cannot be null");
this.location = location;
}
/**
* The RedirectStrategy to use.
* @param redirectStrategy the strategy to use. Default is DefaultRedirectStrategy.
*/
public void setRedirectStrategy(ServerRedirectStrategy redirectStrategy) {
Assert.notNull(redirectStrategy, "redirectStrategy cannot be null");
this.redirectStrategy = redirectStrategy;
}
}
|
repos\spring-security-main\web\src\main\java\org\springframework\security\web\server\authentication\RedirectServerAuthenticationSuccessHandler.java
| 1
|
请完成以下Java代码
|
public class ChargeType2Choice {
@XmlElement(name = "Cd")
@XmlSchemaType(name = "string")
protected ChargeType1Code cd;
@XmlElement(name = "Prtry")
protected GenericIdentification3 prtry;
/**
* Gets the value of the cd property.
*
* @return
* possible object is
* {@link ChargeType1Code }
*
*/
public ChargeType1Code getCd() {
return cd;
}
/**
* Sets the value of the cd property.
*
* @param value
* allowed object is
* {@link ChargeType1Code }
*
*/
public void setCd(ChargeType1Code value) {
|
this.cd = value;
}
/**
* Gets the value of the prtry property.
*
* @return
* possible object is
* {@link GenericIdentification3 }
*
*/
public GenericIdentification3 getPrtry() {
return prtry;
}
/**
* Sets the value of the prtry property.
*
* @param value
* allowed object is
* {@link GenericIdentification3 }
*
*/
public void setPrtry(GenericIdentification3 value) {
this.prtry = value;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.camt53\src\main\java-xjc\de\metas\banking\camt53\jaxb\camt053_001_02\ChargeType2Choice.java
| 1
|
请完成以下Java代码
|
public int getExternalSystem_Config_RabbitMQ_HTTP_ID()
{
return get_ValueAsInt(COLUMNNAME_ExternalSystem_Config_RabbitMQ_HTTP_ID);
}
@Override
public void setExternalSystemValue (final String ExternalSystemValue)
{
set_Value (COLUMNNAME_ExternalSystemValue, ExternalSystemValue);
}
@Override
public String getExternalSystemValue()
{
return get_ValueAsString(COLUMNNAME_ExternalSystemValue);
}
@Override
public void setIsAutoSendWhenCreatedByUserGroup (final boolean IsAutoSendWhenCreatedByUserGroup)
{
set_Value (COLUMNNAME_IsAutoSendWhenCreatedByUserGroup, IsAutoSendWhenCreatedByUserGroup);
}
@Override
public boolean isAutoSendWhenCreatedByUserGroup()
{
return get_ValueAsBoolean(COLUMNNAME_IsAutoSendWhenCreatedByUserGroup);
}
@Override
public void setIsSyncBPartnersToRabbitMQ (final boolean IsSyncBPartnersToRabbitMQ)
{
set_Value (COLUMNNAME_IsSyncBPartnersToRabbitMQ, IsSyncBPartnersToRabbitMQ);
}
@Override
public boolean isSyncBPartnersToRabbitMQ()
{
return get_ValueAsBoolean(COLUMNNAME_IsSyncBPartnersToRabbitMQ);
}
@Override
public void setIsSyncExternalReferencesToRabbitMQ (final boolean IsSyncExternalReferencesToRabbitMQ)
{
set_Value (COLUMNNAME_IsSyncExternalReferencesToRabbitMQ, IsSyncExternalReferencesToRabbitMQ);
}
@Override
public boolean isSyncExternalReferencesToRabbitMQ()
{
return get_ValueAsBoolean(COLUMNNAME_IsSyncExternalReferencesToRabbitMQ);
}
@Override
public void setRemoteURL (final java.lang.String RemoteURL)
|
{
set_Value (COLUMNNAME_RemoteURL, RemoteURL);
}
@Override
public String getRemoteURL()
{
return get_ValueAsString(COLUMNNAME_RemoteURL);
}
@Override
public void setRouting_Key (final String Routing_Key)
{
set_Value (COLUMNNAME_Routing_Key, Routing_Key);
}
@Override
public String getRouting_Key()
{
return get_ValueAsString(COLUMNNAME_Routing_Key);
}
@Override
public void setAuthToken (final String AuthToken)
{
set_Value (COLUMNNAME_AuthToken, AuthToken);
}
@Override
public String getAuthToken()
{
return get_ValueAsString(COLUMNNAME_AuthToken);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.externalsystem\src\main\java-gen\de\metas\externalsystem\model\X_ExternalSystem_Config_RabbitMQ_HTTP.java
| 1
|
请完成以下Java代码
|
public String getName() {
return "juel";
}
@Override
public Object renderStartForm(StartFormData startForm) {
if (startForm.getFormKey() == null) {
return null;
}
String formTemplateString = getFormTemplateString(startForm, startForm.getFormKey());
ScriptingEngines scriptingEngines = Context.getProcessEngineConfiguration().getScriptingEngines();
return scriptingEngines.evaluate(formTemplateString, ScriptingEngines.DEFAULT_SCRIPTING_LANGUAGE, null);
}
@Override
public Object renderTaskForm(TaskFormData taskForm) {
if (taskForm.getFormKey() == null) {
return null;
}
String formTemplateString = getFormTemplateString(taskForm, taskForm.getFormKey());
ScriptingEngines scriptingEngines = Context.getProcessEngineConfiguration().getScriptingEngines();
|
TaskEntity task = (TaskEntity) taskForm.getTask();
return scriptingEngines.evaluate(formTemplateString, ScriptingEngines.DEFAULT_SCRIPTING_LANGUAGE, task.getExecution());
}
protected String getFormTemplateString(FormData formInstance, String formKey) {
String deploymentId = formInstance.getDeploymentId();
ResourceEntity resourceStream = Context
.getCommandContext()
.getResourceEntityManager()
.findResourceByDeploymentIdAndResourceName(deploymentId, formKey);
if (resourceStream == null) {
throw new ActivitiObjectNotFoundException("Form with formKey '" + formKey + "' does not exist", String.class);
}
return new String(resourceStream.getBytes(), StandardCharsets.UTF_8);
}
}
|
repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\form\JuelFormEngine.java
| 1
|
请完成以下Java代码
|
public void setPhone (java.lang.String Phone)
{
set_Value (COLUMNNAME_Phone, Phone);
}
/** Get Telefon.
@return Beschreibt eine Telefon Nummer
*/
@Override
public java.lang.String getPhone ()
{
return (java.lang.String)get_Value(COLUMNNAME_Phone);
}
/** Set Verarbeitet.
@param Processed
Checkbox sagt aus, ob der Beleg verarbeitet wurde.
*/
@Override
public void setProcessed (boolean Processed)
{
set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed));
}
/** Get Verarbeitet.
@return Checkbox sagt aus, ob der Beleg verarbeitet wurde.
*/
@Override
public boolean isProcessed ()
{
Object oo = get_Value(COLUMNNAME_Processed);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
|
return false;
}
/** Set Role name.
@param RoleName Role name */
@Override
public void setRoleName (java.lang.String RoleName)
{
set_Value (COLUMNNAME_RoleName, RoleName);
}
/** Get Role name.
@return Role name */
@Override
public java.lang.String getRoleName ()
{
return (java.lang.String)get_Value(COLUMNNAME_RoleName);
}
/** Set UserValue.
@param UserValue UserValue */
@Override
public void setUserValue (java.lang.String UserValue)
{
set_Value (COLUMNNAME_UserValue, UserValue);
}
/** Get UserValue.
@return UserValue */
@Override
public java.lang.String getUserValue ()
{
return (java.lang.String)get_Value(COLUMNNAME_UserValue);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_I_User.java
| 1
|
请完成以下Java代码
|
public BPartnerId getBPartnerId()
{
return BPartnerId.ofRepoId(bpartner.getIdAsInt());
}
}
@FunctionalInterface
public interface PricingConditionsBreaksExtractor
{
Stream<PricingConditionsBreak> streamPricingConditionsBreaks(PricingConditions pricingConditions);
}
@lombok.Value
@lombok.Builder
public static final class SourceDocumentLine
{
@Nullable
OrderLineId orderLineId;
@NonNull
SOTrx soTrx;
@NonNull
BPartnerId bpartnerId;
@NonNull
ProductId productId;
@NonNull
ProductCategoryId productCategoryId;
@NonNull
Money priceEntered;
@lombok.Builder.Default
@NonNull
Percent discount = Percent.ZERO;
@Nullable
PaymentTermId paymentTermId;
@Nullable
|
PricingConditionsBreakId pricingConditionsBreakId;
}
@lombok.Value
@lombok.Builder
private static final class LastInOutDateRequest
{
@NonNull
BPartnerId bpartnerId;
@NonNull
ProductId productId;
@NonNull
SOTrx soTrx;
}
//
//
//
//
//
public static class PricingConditionsRowsLoaderBuilder
{
public PricingConditionsRowData load()
{
return build().load();
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\order\pricingconditions\view\PricingConditionsRowsLoader.java
| 1
|
请完成以下Java代码
|
public Object aroundMethod(ProceedingJoinPoint joinPoint)throws Throwable {
//System.out.println("环绕通知>>>>>>>>>");
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
Method method = signature.getMethod();
TenantLog log = method.getAnnotation(TenantLog.class);
if(log != null){
int opType = log.value();
Integer logType = null;
String content = null;
Integer tenantId = null;
//获取参数
Object[] args = joinPoint.getArgs();
if(args.length>0){
for(Object obj: args){
if(obj instanceof SysTenantPack){
// logType=3 租户操作日志
logType = CommonConstant.LOG_TYPE_3;
SysTenantPack pack = (SysTenantPack)obj;
if(opType==2){
content = "创建了角色权限 "+ pack.getPackName();
}
tenantId = pack.getTenantId();
break;
}else if(obj instanceof SysTenantPackUser){
logType = CommonConstant.LOG_TYPE_3;
SysTenantPackUser packUser = (SysTenantPackUser)obj;
if(opType==2){
content = "将 "+packUser.getRealname()+" 添加到角色 "+ packUser.getPackName();
}else if(opType==4){
content = "移除了 "+packUser.getPackName()+" 成员 "+ packUser.getRealname();
}
tenantId = packUser.getTenantId();
}
}
}
if(logType!=null){
LogDTO dto = new LogDTO();
dto.setLogType(logType);
dto.setLogContent(content);
dto.setOperateType(opType);
dto.setTenantId(tenantId);
|
//获取登录用户信息
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(sysUser!=null){
dto.setUserid(sysUser.getUsername());
dto.setUsername(sysUser.getRealname());
}
dto.setCreateTime(new Date());
//保存系统日志
baseCommonService.addLog(dto);
}
}
return joinPoint.proceed();
}
@AfterThrowing("tenantLogPointCut()")
public void afterThrowing()throws Throwable{
System.out.println("异常通知");
}
}
|
repos\JeecgBoot-main\jeecg-boot\jeecg-module-system\jeecg-system-biz\src\main\java\org\jeecg\modules\aop\TenantPackUserLogAspect.java
| 1
|
请完成以下Java代码
|
public Map<String, String> getExtensionProperties() {
return extensionProperties;
}
/**
* Construct representation of locked ExternalTask from corresponding entity.
* During mapping variables will be collected,during collection variables will not be deserialized
* and scope will not be set to local.
*
* @see {@link org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope#collectVariables(VariableMapImpl, Collection, boolean, boolean)}
*
* @param externalTaskEntity - source persistent entity to use for fields
* @param variablesToFetch - list of variable names to fetch, if null then all variables will be fetched
* @param isLocal - if true only local variables will be collected
*
* @return object with all fields copied from the ExternalTaskEntity, error details fetched from the
* database and variables attached
*/
public static LockedExternalTaskImpl fromEntity(ExternalTaskEntity externalTaskEntity, List<String> variablesToFetch, boolean isLocal, boolean deserializeVariables, boolean includeExtensionProperties) {
LockedExternalTaskImpl result = new LockedExternalTaskImpl();
result.id = externalTaskEntity.getId();
result.topicName = externalTaskEntity.getTopicName();
result.workerId = externalTaskEntity.getWorkerId();
result.lockExpirationTime = externalTaskEntity.getLockExpirationTime();
result.createTime = externalTaskEntity.getCreateTime();
result.retries = externalTaskEntity.getRetries();
result.errorMessage = externalTaskEntity.getErrorMessage();
result.errorDetails = externalTaskEntity.getErrorDetails();
result.processInstanceId = externalTaskEntity.getProcessInstanceId();
result.executionId = externalTaskEntity.getExecutionId();
result.activityId = externalTaskEntity.getActivityId();
result.activityInstanceId = externalTaskEntity.getActivityInstanceId();
|
result.processDefinitionId = externalTaskEntity.getProcessDefinitionId();
result.processDefinitionKey = externalTaskEntity.getProcessDefinitionKey();
result.processDefinitionVersionTag = externalTaskEntity.getProcessDefinitionVersionTag();
result.tenantId = externalTaskEntity.getTenantId();
result.priority = externalTaskEntity.getPriority();
result.businessKey = externalTaskEntity.getBusinessKey();
ExecutionEntity execution = externalTaskEntity.getExecution();
result.variables = new VariableMapImpl();
execution.collectVariables(result.variables, variablesToFetch, isLocal, deserializeVariables);
if(includeExtensionProperties) {
result.extensionProperties = (Map<String, String>) execution.getActivity().getProperty(BpmnProperties.EXTENSION_PROPERTIES.getName());
}
if(result.extensionProperties == null) {
result.extensionProperties = Collections.emptyMap();
}
return result;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\externaltask\LockedExternalTaskImpl.java
| 1
|
请完成以下Java代码
|
public abstract class Event extends FlowNode {
protected List<EventDefinition> eventDefinitions = new ArrayList<EventDefinition>();
public List<EventDefinition> getEventDefinitions() {
return eventDefinitions;
}
public void setEventDefinitions(List<EventDefinition> eventDefinitions) {
this.eventDefinitions = eventDefinitions;
}
public void addEventDefinition(EventDefinition eventDefinition) {
eventDefinitions.add(eventDefinition);
}
public void setValues(Event otherEvent) {
super.setValues(otherEvent);
|
eventDefinitions = new ArrayList<EventDefinition>();
if (otherEvent.getEventDefinitions() != null && !otherEvent.getEventDefinitions().isEmpty()) {
for (EventDefinition eventDef : otherEvent.getEventDefinitions()) {
eventDefinitions.add(eventDef.clone());
}
}
}
public boolean isLinkEvent() {
if (this.getEventDefinitions().size() == 1) {
return this.getEventDefinitions().getFirst() instanceof LinkEventDefinition;
}
return false;
}
}
|
repos\Activiti-develop\activiti-core\activiti-bpmn-model\src\main\java\org\activiti\bpmn\model\Event.java
| 1
|
请完成以下Java代码
|
public BankStatementReconciliationView createView(final @NonNull CreateViewRequest request)
{
throw new UnsupportedOperationException();
}
public BankStatementReconciliationView createView(@NonNull final BanksStatementReconciliationViewCreateRequest request)
{
final BankStatementLineAndPaymentsRows rows = retrieveRowsData(request);
final BankStatementReconciliationView view = BankStatementReconciliationView.builder()
.bankStatementViewId(ViewId.random(WINDOW_ID))
.rows(rows)
.paymentToReconcilateProcesses(getPaymentToReconcilateProcesses())
.build();
put(view);
return view;
}
private BankStatementLineAndPaymentsRows retrieveRowsData(final BanksStatementReconciliationViewCreateRequest request)
{
final List<BankStatementLineRow> bankStatementLineRows = rowsRepo.getBankStatementLineRowsByIds(request.getBankStatementLineIds());
final List<PaymentToReconcileRow> paymentToReconcileRows = rowsRepo.getPaymentToReconcileRowsByIds(request.getPaymentIds());
return BankStatementLineAndPaymentsRows.builder()
.bankStatementLineRows(BankStatementLineRows.builder()
.repository(rowsRepo)
.rows(bankStatementLineRows)
.build())
.paymentToReconcileRows(PaymentToReconcileRows.builder()
.repository(rowsRepo)
.rows(paymentToReconcileRows)
.build())
.build();
}
@Override
public WindowId getWindowId()
{
return WINDOW_ID;
}
@Override
public void put(final IView view)
{
views.put(view);
}
@Nullable
@Override
public BankStatementReconciliationView getByIdOrNull(final ViewId viewId)
{
return BankStatementReconciliationView.cast(views.getByIdOrNull(viewId));
}
@Override
public void closeById(final ViewId viewId, final ViewCloseAction closeAction)
{
views.closeById(viewId, closeAction);
}
@Override
|
public Stream<IView> streamAllViews()
{
return views.streamAllViews();
}
@Override
public void invalidateView(final ViewId viewId)
{
views.invalidateView(viewId);
}
private List<RelatedProcessDescriptor> getPaymentToReconcilateProcesses()
{
return ImmutableList.of(
createProcessDescriptor(PaymentsToReconcileView_Reconcile.class));
}
private final RelatedProcessDescriptor createProcessDescriptor(@NonNull final Class<?> processClass)
{
return RelatedProcessDescriptor.builder()
.processId(adProcessDAO.retrieveProcessIdByClass(processClass))
.anyTable()
.anyWindow()
.displayPlace(DisplayPlace.ViewQuickActions)
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\bankstatement_reconciliation\BankStatementReconciliationViewFactory.java
| 1
|
请完成以下Spring Boot application配置
|
server.port=9096
server.address=127.0.0.1
# ensure h2 database rce
spring.jpa.database = MYSQL
spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect
# enable h2 console jndi rce
#spring.h2.console.path=/h2-console
spring.h2.console.enabled=true
# vulnerable configuration set 0: spring boot 1.0 - 1.4
# all spring boot versions 1.0 - 1.4 expose actuators by default without any parameters
# no configuration required to expose them
# safe configuration set 0: spring boot 1.0 - 1.4
#management.security.enabled=true
# vulnerable configuration set 1: spring boot 1.5+
# spring boot 1.5+ requires management.security.enabled=false to expose sensitive actuators
#management.security.enabled=false
# safe configuration set 1: spring boot 1.5+
# when 'management.security.enabled=false' but all se
|
nsitive actuators explicitly disabled
#management.security.enabled=false
## vulnerable configuration set 2: spring boot 2+
#management.security.enabled=false
#management.endpoint.refresh.enabled=true
#management.endpoints.web.exposure.include=env,restart,refresh
management.endpoints.web.exposure.include=*
management.endpoint.restart.enabled=true
|
repos\SpringBootVulExploit-master\repository\springboot-h2-database-rce\src\main\resources\application.properties
| 2
|
请完成以下Java代码
|
public String getVariableName() {
return variableName;
}
public void setVariableName(String variableName) {
this.variableName = variableName;
}
@Override
public String getTypeName() {
return typedValueField.getTypeName();
}
public void setTypeName(String typeName) {
typedValueField.setSerializerName(typeName);
}
@Override
public Object getValue() {
return typedValueField.getValue();
}
@Override
public TypedValue getTypedValue() {
return typedValueField.getTypedValue(false);
}
public TypedValue getTypedValue(boolean deserializeValue) {
return typedValueField.getTypedValue(deserializeValue, false);
}
@Override
public String getErrorMessage() {
return typedValueField.getErrorMessage();
}
@Override
public String getName() {
return variableName;
}
@Override
public String getTextValue() {
return textValue;
}
@Override
public void setTextValue(String textValue) {
this.textValue = textValue;
}
@Override
public String getTextValue2() {
return textValue2;
}
@Override
public void setTextValue2(String textValue2) {
this.textValue2 = textValue2;
}
@Override
public Long getLongValue() {
return longValue;
}
@Override
public void setLongValue(Long longValue) {
this.longValue = longValue;
}
@Override
public Double getDoubleValue() {
return doubleValue;
}
@Override
public void setDoubleValue(Double doubleValue) {
this.doubleValue = doubleValue;
}
|
public String getByteArrayValueId() {
return byteArrayField.getByteArrayId();
}
public void setByteArrayValueId(String byteArrayId) {
byteArrayField.setByteArrayId(byteArrayId);
}
@Override
public byte[] getByteArrayValue() {
return byteArrayField.getByteArrayValue();
}
@Override
public void setByteArrayValue(byte[] bytes) {
byteArrayField.setByteArrayValue(bytes);
}
public void setValue(TypedValue typedValue) {
typedValueField.setValue(typedValue);
}
public String getSerializerName() {
return typedValueField.getSerializerName();
}
public void setSerializerName(String serializerName) {
typedValueField.setSerializerName(serializerName);
}
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getRootProcessInstanceId() {
return rootProcessInstanceId;
}
public void setRootProcessInstanceId(String rootProcessInstanceId) {
this.rootProcessInstanceId = rootProcessInstanceId;
}
public void delete() {
byteArrayField.deleteByteArrayValue();
Context
.getCommandContext()
.getDbEntityManager()
.delete(this);
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\history\event\HistoricDecisionOutputInstanceEntity.java
| 1
|
请完成以下Java代码
|
public <T> I_C_Letter createLetter(final T item, final ILetterProducer<T> producer)
{
DB.saveConstraints();
DB.getConstraints().addAllowedTrxNamePrefix("POSave");
try
{
final Properties ctx = InterfaceWrapperHelper.getCtx(item);
// NOTE: we are working out of trx because we want to produce the letters one by one and build a huge transaction
final String trxName = ITrx.TRXNAME_None;
final I_C_Letter letter = InterfaceWrapperHelper.create(ctx, I_C_Letter.class, trxName);
if (!producer.createLetter(letter, item))
{
return null;
}
setLocationContactAndOrg(letter);
final int boilerPlateID = producer.getBoilerplateID(item);
if (boilerPlateID <= 0)
{
logger.warn("No default text template for org {}", letter.getAD_Org_ID());
return null;
}
final I_AD_BoilerPlate textTemplate = InterfaceWrapperHelper.create(ctx, boilerPlateID, I_AD_BoilerPlate.class, trxName);
setAD_BoilerPlate(letter, textTemplate);
final BoilerPlateContext attributes = producer.createAttributes(item);
setLetterBodyParsed(letter, attributes);
// 04238 : We need to flag the letter for enqueue.
letter.setIsMembershipBadgeToPrint(true);
// mo73_05916 : Add record and table ID
letter.setAD_Table_ID(InterfaceWrapperHelper.getModelTableId(item));
|
letter.setRecord_ID(InterfaceWrapperHelper.getId(item));
InterfaceWrapperHelper.save(letter);
return letter;
}
finally
{
DB.restoreConstraints();
}
}
@Override
public I_AD_BoilerPlate getById(int boilerPlateId)
{
return loadOutOfTrx(boilerPlateId, I_AD_BoilerPlate.class);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\letters\api\impl\TextTemplateBL.java
| 1
|
请完成以下Java代码
|
public void setPostingType (String PostingType)
{
set_Value (COLUMNNAME_PostingType, PostingType);
}
/** Get PostingType.
@return The type of posted amount for the transaction
*/
public String getPostingType ()
{
return (String)get_Value(COLUMNNAME_PostingType);
}
/** Set Process Now.
@param Processing Process Now */
public void setProcessing (boolean Processing)
|
{
set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing));
}
/** Get Process Now.
@return Process Now */
public boolean isProcessing ()
{
Object oo = get_Value(COLUMNNAME_Processing);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_A_Asset_Acct.java
| 1
|
请完成以下Java代码
|
public static SubscriptionProgressQueryBuilder term(@NonNull final I_C_Flatrate_Term term)
{
return builder().term(term);
}
@NonNull
I_C_Flatrate_Term term;
Timestamp eventDateNotBefore;
Timestamp eventDateNotAfter;
@Default
int seqNoNotLessThan = 0;
@Default
int seqNoLessThan = 0;
/** never {@code null}. Empty means "don't filter by status altogether". */
@Singular
List<String> excludedStatuses;
/** never {@code null}. Empty means "don't filter by status altogether". */
@Singular
List<String> includedStatuses;
/** never {@code null}. Empty means "don't filter by status altogether". */
@Singular
List<String> includedContractStatuses;
}
/**
* Loads all {@link I_C_SubscriptionProgress} records that have event type
* {@link X_C_SubscriptionProgress#EVENTTYPE_Lieferung} and status {@link X_C_SubscriptionProgress#STATUS_Geplant}
* or {@link X_C_SubscriptionProgress#STATUS_Verzoegert}, ordered by
* {@link I_C_SubscriptionProgress#COLUMNNAME_EventDate} and {@link I_C_SubscriptionProgress#COLUMNNAME_SeqNo}.
*
* @param date
* the records' event date is before or equal.
* @param trxName
* @return
*/
List<I_C_SubscriptionProgress> retrievePlannedAndDelayedDeliveries(Properties ctx, Timestamp date, String trxName);
/**
*
|
* @param ol
* @return {@code true} if there is at lease one term that references the given <code>ol</code> via its <code>C_OrderLine_Term_ID</code> column.
*/
boolean existsTermForOl(I_C_OrderLine ol);
/**
* Retrieves the terms that are connection to the given <code>olCand</code> via an active
* <code>C_Contract_Term_Alloc</code> record.
*
* @param olCand
* @return
*/
List<I_C_Flatrate_Term> retrieveTermsForOLCand(I_C_OLCand olCand);
/**
* Insert a new {@link I_C_SubscriptionProgress} after the given predecessor. All values from the predecessor are
* copied to the new one, only <code>SeqNo</code> is set to the predecessor's <code>SeqNo+1</code>. The
* <code>SeqNo</code>s of all existing {@link I_C_SubscriptionProgress} s that are already after
* <code>predecessor</code> are increased by one.
*
* @param predecessor
* @param trxName
* @return
*/
I_C_SubscriptionProgress insertNewDelivery(I_C_SubscriptionProgress predecessor);
<T extends I_C_OLCand> List<T> retrieveOLCands(I_C_Flatrate_Term term, Class<T> clazz);
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\subscription\ISubscriptionDAO.java
| 1
|
请完成以下Java代码
|
public static EngineInfo retry(String resourceUrl) {
LOGGER.debug("retying initializing of resource {}", resourceUrl);
try {
return initEventRegistryEngineFromResource(new URL(resourceUrl));
} catch (MalformedURLException e) {
throw new FlowableException("invalid url: " + resourceUrl, e);
}
}
/**
* provides access to event registry engine to application clients in a managed server environment.
*/
public static Map<String, EventRegistryEngine> getEventRegistryEngines() {
return eventRegistryEngines;
}
/**
* closes all event registry engines. This method should be called when the server shuts down.
*/
public static synchronized void destroy() {
if (isInitialized()) {
Map<String, EventRegistryEngine> engines = new HashMap<>(eventRegistryEngines);
eventRegistryEngines = new HashMap<>();
for (String eventRegistryEngineName : engines.keySet()) {
EventRegistryEngine eventRegistryEngine = engines.get(eventRegistryEngineName);
try {
|
eventRegistryEngine.close();
} catch (Exception e) {
LOGGER.error("exception while closing {}", (eventRegistryEngineName == null ? "the default event registry engine" :
"event registry engine " + eventRegistryEngineName), e);
}
}
eventRegistryEngineInfosByName.clear();
eventRegistryEngineInfosByResourceUrl.clear();
eventRegistryEngineInfos.clear();
setInitialized(false);
}
}
public static boolean isInitialized() {
return isInitialized;
}
public static void setInitialized(boolean isInitialized) {
EventRegistryEngines.isInitialized = isInitialized;
}
}
|
repos\flowable-engine-main\modules\flowable-event-registry\src\main\java\org\flowable\eventregistry\impl\EventRegistryEngines.java
| 1
|
请完成以下Java代码
|
public long findUniqueTaskWorkerCount(Date startTime, Date endTime) {
Map<String, Object> parameters = new HashMap<>();
parameters.put("startTime", startTime);
parameters.put("endTime", endTime);
return (Long) getDbEntityManager().selectOne(SELECT_UNIQUE_TASK_WORKER, parameters);
}
public void deleteTaskMetricsByTimestamp(Date timestamp) {
Map<String, Object> parameters = Collections.singletonMap("timestamp", timestamp);
getDbEntityManager().delete(TaskMeterLogEntity.class, DELETE_TASK_METER_BY_TIMESTAMP, parameters);
}
public void deleteTaskMetricsById(List<String> taskMetricIds) {
getDbEntityManager().deletePreserveOrder(TaskMeterLogEntity.class, DELETE_TASK_METER_BY_IDS, taskMetricIds);
}
public DbOperation deleteTaskMetricsByRemovalTime(Date currentTimestamp, Integer timeToLive, int minuteFrom, int minuteTo, int batchSize) {
Map<String, Object> parameters = new HashMap<>();
// data inserted prior to now minus timeToLive-days can be removed
Date removalTime = Date.from(currentTimestamp.toInstant().minus(timeToLive, ChronoUnit.DAYS));
parameters.put("removalTime", removalTime);
if (minuteTo - minuteFrom + 1 < 60) {
parameters.put("minuteFrom", minuteFrom);
parameters.put("minuteTo", minuteTo);
}
parameters.put("batchSize", batchSize);
return getDbEntityManager()
.deletePreserveOrder(TaskMeterLogEntity.class, DELETE_TASK_METER_BY_REMOVAL_TIME,
new ListQueryParameterObject(parameters, 0, batchSize));
}
|
@SuppressWarnings("unchecked")
public List<String> findTaskMetricsForCleanup(int batchSize, Integer timeToLive, int minuteFrom, int minuteTo) {
Map<String, Object> queryParameters = new HashMap<>();
queryParameters.put("currentTimestamp", ClockUtil.getCurrentTime());
queryParameters.put("timeToLive", timeToLive);
if (minuteTo - minuteFrom + 1 < 60) {
queryParameters.put("minuteFrom", minuteFrom);
queryParameters.put("minuteTo", minuteTo);
}
ListQueryParameterObject parameterObject = new ListQueryParameterObject(queryParameters, 0, batchSize);
parameterObject.getOrderingProperties().add(new QueryOrderingProperty(new QueryPropertyImpl("TIMESTAMP_"), Direction.ASCENDING));
return (List<String>) getDbEntityManager().selectList(SELECT_TASK_METER_FOR_CLEANUP, parameterObject);
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\MeterLogManager.java
| 1
|
请完成以下Java代码
|
public static HistoryManager getHistoryManager(CommandContext commandContext) {
return getProcessEngineConfiguration(commandContext).getHistoryManager();
}
public static HistoricDetailEntityManager getHistoricDetailEntityManager() {
return getHistoricDetailEntityManager(getCommandContext());
}
public static HistoricDetailEntityManager getHistoricDetailEntityManager(CommandContext commandContext) {
return getProcessEngineConfiguration(commandContext).getHistoricDetailEntityManager();
}
public static AttachmentEntityManager getAttachmentEntityManager() {
return getAttachmentEntityManager(getCommandContext());
}
public static AttachmentEntityManager getAttachmentEntityManager(CommandContext commandContext) {
return getProcessEngineConfiguration(commandContext).getAttachmentEntityManager();
}
public static EventLogEntryEntityManager getEventLogEntryEntityManager() {
return getEventLogEntryEntityManager(getCommandContext());
}
public static EventLogEntryEntityManager getEventLogEntryEntityManager(CommandContext commandContext) {
return getProcessEngineConfiguration(commandContext).getEventLogEntryEntityManager();
}
|
public static FlowableEventDispatcher getEventDispatcher() {
return getEventDispatcher(getCommandContext());
}
public static FlowableEventDispatcher getEventDispatcher(CommandContext commandContext) {
return getProcessEngineConfiguration(commandContext).getEventDispatcher();
}
public static FailedJobCommandFactory getFailedJobCommandFactory() {
return getFailedJobCommandFactory(getCommandContext());
}
public static FailedJobCommandFactory getFailedJobCommandFactory(CommandContext commandContext) {
return getProcessEngineConfiguration(commandContext).getFailedJobCommandFactory();
}
public static ProcessInstanceHelper getProcessInstanceHelper() {
return getProcessInstanceHelper(getCommandContext());
}
public static ProcessInstanceHelper getProcessInstanceHelper(CommandContext commandContext) {
return getProcessEngineConfiguration(commandContext).getProcessInstanceHelper();
}
public static CommandContext getCommandContext() {
return Context.getCommandContext();
}
}
|
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\util\CommandContextUtil.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public ReceiptEntity getReceiptEntity() {
return receiptEntity;
}
public void setReceiptEntity(ReceiptEntity receiptEntity) {
this.receiptEntity = receiptEntity;
}
public LocationEntity getLocationEntity() {
return locationEntity;
}
public void setLocationEntity(LocationEntity locationEntity) {
this.locationEntity = locationEntity;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getExpressNo() {
return expressNo;
}
public void setExpressNo(String expressNo) {
this.expressNo = expressNo;
}
public UserEntity getBuyer() {
return buyer;
}
|
public void setBuyer(UserEntity buyer) {
this.buyer = buyer;
}
@Override
public String toString() {
return "OrdersEntity{" +
"id='" + id + '\'' +
", buyer=" + buyer +
", company=" + company +
", productOrderList=" + productOrderList +
", orderStateEnum=" + orderStateEnum +
", orderStateTimeList=" + orderStateTimeList +
", payModeEnum=" + payModeEnum +
", totalPrice='" + totalPrice + '\'' +
", receiptEntity=" + receiptEntity +
", locationEntity=" + locationEntity +
", remark='" + remark + '\'' +
", expressNo='" + expressNo + '\'' +
'}';
}
}
|
repos\SpringBoot-Dubbo-Docker-Jenkins-master\Gaoxi-Common-Service-Facade\src\main\java\com\gaoxi\entity\order\OrdersEntity.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
final class PermitAllSupport {
private PermitAllSupport() {
}
static void permitAll(HttpSecurityBuilder<? extends HttpSecurityBuilder<?>> http, String... urls) {
for (String url : urls) {
if (url != null) {
permitAll(http, new ExactUrlRequestMatcher(url));
}
}
}
@SuppressWarnings("unchecked")
static void permitAll(HttpSecurityBuilder<? extends HttpSecurityBuilder<?>> http,
RequestMatcher... requestMatchers) {
AuthorizeHttpRequestsConfigurer<?> httpConfigurer = http.getConfigurer(AuthorizeHttpRequestsConfigurer.class);
Assert.state(httpConfigurer != null,
"permitAll only works with HttpSecurity.authorizeHttpRequests(). Please define one.");
for (RequestMatcher matcher : requestMatchers) {
if (matcher != null) {
httpConfigurer.addFirst(matcher, SingleResultAuthorizationManager.permitAll());
}
}
}
private static final class ExactUrlRequestMatcher implements RequestMatcher {
private String processUrl;
private ExactUrlRequestMatcher(String processUrl) {
this.processUrl = processUrl;
}
@Override
|
public boolean matches(HttpServletRequest request) {
String uri = request.getRequestURI();
String query = request.getQueryString();
if (query != null) {
uri += "?" + query;
}
if ("".equals(request.getContextPath())) {
return uri.equals(this.processUrl);
}
return uri.equals(request.getContextPath() + this.processUrl);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("ExactUrl [processUrl='").append(this.processUrl).append("']");
return sb.toString();
}
}
}
|
repos\spring-security-main\config\src\main\java\org\springframework\security\config\annotation\web\configurers\PermitAllSupport.java
| 2
|
请完成以下Java代码
|
public class Node {
private String text;
private List<Node> children;
private int position;
public Node(String word, int position) {
this.text = word;
this.position = position;
this.children = new ArrayList<>();
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public int getPosition() {
return position;
}
public void setPosition(int position) {
this.position = position;
}
public List<Node> getChildren() {
return children;
}
public void setChildren(List<Node> children) {
this.children = children;
}
|
public String printTree(String depthIndicator) {
String str = "";
String positionStr = position > -1 ? "[" + String.valueOf(position) + "]" : "";
str += depthIndicator + text + positionStr + "\n";
for (int i = 0; i < children.size(); i++) {
str += children.get(i)
.printTree(depthIndicator + "\t");
}
return str;
}
@Override
public String toString() {
return printTree("");
}
}
|
repos\tutorials-master\algorithms-modules\algorithms-searching\src\main\java\com\baeldung\algorithms\suffixtree\Node.java
| 1
|
请完成以下Java代码
|
private static List<Term> segSentence(String text)
{
String sText = CharTable.convert(text);
List<Term> termList = SEGMENT.seg(sText);
int offset = 0;
for (Term term : termList)
{
term.offset = offset;
term.word = text.substring(offset, offset + term.length());
offset += term.length();
}
return termList;
}
public static List<Term> segment(String text)
{
List<Term> termList = new LinkedList<Term>();
for (String sentence : SentencesUtil.toSentenceList(text))
{
termList.addAll(segSentence(sentence));
}
return termList;
}
/**
* 分词
*
* @param text 文本
* @return 分词结果
*/
public static List<Term> segment(char[] text)
{
return segment(CharTable.convert(text));
}
/**
* 切分为句子形式
*
* @param text 文本
* @return 句子列表
|
*/
public static List<List<Term>> seg2sentence(String text)
{
List<List<Term>> resultList = new LinkedList<List<Term>>();
{
for (String sentence : SentencesUtil.toSentenceList(text))
{
resultList.add(segment(sentence));
}
}
return resultList;
}
/**
* 分词断句 输出句子形式
*
* @param text 待分词句子
* @param shortest 是否断句为最细的子句(将逗号也视作分隔符)
* @return 句子列表,每个句子由一个单词列表组成
*/
public static List<List<Term>> seg2sentence(String text, boolean shortest)
{
return SEGMENT.seg2sentence(text, shortest);
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\tokenizer\TraditionalChineseTokenizer.java
| 1
|
请完成以下Java代码
|
public class DynamicAccessDecisionManager implements AccessDecisionManager {
@Override
public void decide(Authentication authentication, Object object,
Collection<ConfigAttribute> configAttributes) throws AccessDeniedException, InsufficientAuthenticationException {
// 当接口未被配置资源时直接放行
if (CollUtil.isEmpty(configAttributes)) {
return;
}
Iterator<ConfigAttribute> iterator = configAttributes.iterator();
while (iterator.hasNext()) {
ConfigAttribute configAttribute = iterator.next();
//将访问所需资源或用户拥有资源进行比对
String needAuthority = configAttribute.getAttribute();
for (GrantedAuthority grantedAuthority : authentication.getAuthorities()) {
if (needAuthority.trim().equals(grantedAuthority.getAuthority())) {
return;
}
|
}
}
throw new AccessDeniedException("抱歉,您没有访问权限");
}
@Override
public boolean supports(ConfigAttribute configAttribute) {
return true;
}
@Override
public boolean supports(Class<?> aClass) {
return true;
}
}
|
repos\mall-master\mall-security\src\main\java\com\macro\mall\security\component\DynamicAccessDecisionManager.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Optional<Instant> getNextImportStartingTimestamp()
{
if (this.skipNextImportStartingTimestamp || nextImportStartingTimestamp == null)
{
return Optional.empty();
}
return Optional.of(nextImportStartingTimestamp.getTimestamp());
}
@NonNull
public JsonShippingCost getShippingCostNotNull()
{
if (shippingCost == null)
{
throw new RuntimeException("shippingCost cannot be null at this stage!");
}
return shippingCost;
}
@Nullable
public JsonExternalSystemShopware6ConfigMapping getMatchingShopware6Mapping()
{
if (shopware6ConfigMappings == null
|| Check.isEmpty(shopware6ConfigMappings.getJsonExternalSystemShopware6ConfigMappingList())
|| bPartnerCustomerGroup == null)
{
return null;
}
return shopware6ConfigMappings.getJsonExternalSystemShopware6ConfigMappingList()
.stream()
.filter(mapping -> mapping.isGroupMatching(bPartnerCustomerGroup.getName()))
.min(Comparator.comparingInt(JsonExternalSystemShopware6ConfigMapping::getSeqNo))
.orElse(null);
}
@NonNull
public ExternalIdentifier getBPExternalIdentifier()
{
final Customer customer = getOrderNotNull().getCustomer();
return customer.getExternalIdentifier(metasfreshIdJsonPath, shopwareIdJsonPath);
}
@NonNull
public ExternalIdentifier getUserId()
{
final Customer customer = getOrderNotNull().getCustomer();
return customer.getShopwareId(shopwareIdJsonPath);
}
@Nullable
public String getExtendedShippingLocationBPartnerName()
{
if (orderShippingAddress == null)
{
throw new RuntimeException("orderShippingAddress cannot be null at this stage!");
}
final BiFunction<String, String, String> prepareNameSegment = (segment, separator) -> Optional.ofNullable(segment)
.map(StringUtils::trimBlankToNull)
.map(s -> s + separator)
.orElse("");
final String locationBPartnerName =
prepareNameSegment.apply(orderShippingAddress.getCompany(), "\n")
+ prepareNameSegment.apply(orderShippingAddress.getDepartment(), "\n")
|
+ prepareNameSegment.apply(getSalutationDisplayNameById(orderShippingAddress.getSalutationId()), " ")
+ prepareNameSegment.apply(orderShippingAddress.getTitle(), " ")
+ prepareNameSegment.apply(orderShippingAddress.getFirstName(), " ")
+ prepareNameSegment.apply(orderShippingAddress.getLastName(), "");
return StringUtils.trimBlankToNull(locationBPartnerName);
}
@NonNull
public JsonAddress getOrderShippingAddressNotNull()
{
return Check.assumeNotNull(orderShippingAddress, "orderShippingAddress cannot be null at this stage!");
}
@Nullable
private String getSalutationDisplayNameById(@Nullable final String salutationId)
{
if (Check.isBlank(salutationId))
{
return null;
}
return salutationInfoProvider.getDisplayNameBySalutationId(salutationId);
}
public void incrementPageIndex()
{
this.ordersResponsePageIndex++;
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\de-metas-camel-shopware6\src\main\java\de\metas\camel\externalsystems\shopware6\order\ImportOrdersRouteContext.java
| 2
|
请完成以下Java代码
|
protected void prepare()
{
if (I_C_Printing_Queue.Table_Name.equals(getTableName()))
{
p_C_Printing_Queue_ID = getRecord_ID();
}
else
{
throw new AdempiereException("@NotSupported@ @TableName@: " + getTableName());
}
Check.assume(p_C_Printing_Queue_ID > 0, "C_Printing_Queue_ID specified");
}
@Override
protected List<IPrintingQueueSource> createPrintingQueueSources(final Properties ctxToUse)
{
// out of transaction because methods which are polling the printing queue are working out of transaction
final String trxName = ITrx.TRXNAME_None;
final I_C_Printing_Queue item = InterfaceWrapperHelper.create(ctxToUse, p_C_Printing_Queue_ID, I_C_Printing_Queue.class, trxName);
Check.assumeNotNull(item, "C_Printing_Queue for {} exists", p_C_Printing_Queue_ID);
|
final UserId adUserToPrintId = Env.getLoggedUserId(ctxToUse); // logged in user
final SingletonPrintingQueueSource queue = new SingletonPrintingQueueSource(item, adUserToPrintId);
// 04015 : This is a test process. We shall not mark the item as printed
queue.setPersistPrintedFlag(false);
return ImmutableList.<IPrintingQueueSource> of(queue);
}
@Override
protected int createSelection()
{
throw new IllegalStateException("Method createSelection() shall never been called because we provided an IPrintingQueueSource");
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.printing\de.metas.printing.base\src\main\java\de\metas\printing\process\C_Print_Job_TestPrintQueueItem.java
| 1
|
请完成以下Java代码
|
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
public int getAge() {
return age;
}
public List<PhoneNumber> getPhoneNumbers() {
return phoneNumbers;
}
public Address getAddress() {
return address;
|
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
Person person = (Person) o;
return age == person.age && Objects.equals(firstName, person.firstName) && Objects.equals(lastName, person.lastName) && Objects.equals(phoneNumbers, person.phoneNumbers) && Objects.equals(address, person.address);
}
@Override
public int hashCode() {
return Objects.hash(firstName, lastName, age, phoneNumbers, address);
}
}
|
repos\tutorials-master\core-java-modules\core-java-lang-6\src\main\java\com\baeldung\compareobjects\Person.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void init() {
log.debug("Registering JVM gauges");
metricRegistry.register(PROP_METRIC_REG_JVM_MEMORY, new MemoryUsageGaugeSet());
metricRegistry.register(PROP_METRIC_REG_JVM_GARBAGE, new GarbageCollectorMetricSet());
metricRegistry.register(PROP_METRIC_REG_JVM_THREADS, new ThreadStatesGaugeSet());
metricRegistry.register(PROP_METRIC_REG_JVM_FILES, new FileDescriptorRatioGauge());
metricRegistry.register(PROP_METRIC_REG_JVM_BUFFERS, new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer()));
metricRegistry.register(PROP_METRIC_REG_JVM_ATTRIBUTE_SET, new JvmAttributeGaugeSet());
if (hikariDataSource != null) {
log.debug("Monitoring the datasource");
// remove the factory created by HikariDataSourceMetricsPostProcessor until JHipster migrate to Micrometer
hikariDataSource.setMetricsTrackerFactory(null);
hikariDataSource.setMetricRegistry(metricRegistry);
}
if (jHipsterProperties.getMetrics().getJmx().isEnabled()) {
log.debug("Initializing Metrics JMX reporting");
JmxReporter jmxReporter = JmxReporter.forRegistry(metricRegistry).build();
|
jmxReporter.start();
}
if (jHipsterProperties.getMetrics().getLogs().isEnabled()) {
log.info("Initializing Metrics Log reporting");
Marker metricsMarker = MarkerFactory.getMarker("metrics");
final Slf4jReporter reporter = Slf4jReporter.forRegistry(metricRegistry)
.outputTo(LoggerFactory.getLogger("metrics"))
.markWith(metricsMarker)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.build();
reporter.start(jHipsterProperties.getMetrics().getLogs().getReportFrequency(), TimeUnit.SECONDS);
}
}
}
|
repos\tutorials-master\jhipster-modules\jhipster-uaa\gateway\src\main\java\com\baeldung\jhipster\gateway\config\MetricsConfiguration.java
| 2
|
请完成以下Java代码
|
public Set<ProductId> retrieveUsedProductsByInventoryIds(@NonNull final Collection<InventoryId> inventoryIds)
{
if (inventoryIds.isEmpty())
{
return ImmutableSet.of();
}
final List<ProductId> productIds = queryBL.createQueryBuilder(I_M_InventoryLine.class)
.addOnlyActiveRecordsFilter()
.addInArrayFilter(I_M_InventoryLine.COLUMN_M_Inventory_ID, inventoryIds)
.create()
.listDistinct(I_M_Product.COLUMNNAME_M_Product_ID, ProductId.class);
return ImmutableSet.copyOf(productIds);
}
@Override
public Optional<Instant> getMinInventoryDate(@NonNull final Collection<InventoryId> inventoryIds)
{
if (inventoryIds.isEmpty())
{
return Optional.empty();
}
return queryBL.createQueryBuilder(I_M_Inventory.class)
.addInArrayFilter(I_M_Inventory.COLUMN_M_Inventory_ID, inventoryIds)
.addOnlyActiveRecordsFilter()
.orderBy(I_M_Inventory.COLUMN_MovementDate)
.create()
.stream()
.limit(1)
.map(inventory -> inventory.getMovementDate().toInstant())
.findFirst();
}
@Override
public void save(I_M_Inventory inventory)
{
saveRecord(inventory);
}
@Override
public void save(I_M_InventoryLine inventoryLine)
{
saveRecord(inventoryLine);
}
@Override
|
public List<I_M_Inventory> list(@NonNull InventoryQuery query)
{
return toSqlQuery(query).list();
}
@Override
public Stream<I_M_Inventory> stream(@NonNull InventoryQuery query)
{
return toSqlQuery(query).stream();
}
private IQuery<I_M_Inventory> toSqlQuery(@NonNull InventoryQuery query)
{
return queryBL.createQueryBuilder(I_M_Inventory.class)
.orderBy(I_M_Inventory.COLUMN_MovementDate)
.orderBy(I_M_Inventory.COLUMN_M_Inventory_ID)
.setLimit(query.getLimit())
.addOnlyActiveRecordsFilter()
.addInArrayFilter(I_M_Inventory.COLUMNNAME_AD_User_Responsible_ID, query.getOnlyResponsibleIds())
.addInArrayFilter(I_M_Inventory.COLUMNNAME_M_Warehouse_ID, query.getOnlyWarehouseIds())
.addInArrayFilter(I_M_Inventory.COLUMNNAME_DocStatus, query.getOnlyDocStatuses())
.create();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\inventory\impl\InventoryDAO.java
| 1
|
请完成以下Java代码
|
public void handleRemaining(Exception thrownException, List<ConsumerRecord<?, ?>> records,
Consumer<?, ?> consumer, MessageListenerContainer container) {
CommonErrorHandler handler = findDelegate(thrownException);
if (handler != null) {
handler.handleRemaining(thrownException, records, consumer, container);
}
else {
this.defaultErrorHandler.handleRemaining(thrownException, records, consumer, container);
}
}
@Override
public void handleBatch(Exception thrownException, ConsumerRecords<?, ?> data, Consumer<?, ?> consumer,
MessageListenerContainer container, Runnable invokeListener) {
CommonErrorHandler handler = findDelegate(thrownException);
if (handler != null) {
handler.handleBatch(thrownException, data, consumer, container, invokeListener);
}
else {
this.defaultErrorHandler.handleBatch(thrownException, data, consumer, container, invokeListener);
}
}
@Override
public void handleOtherException(Exception thrownException, Consumer<?, ?> consumer,
MessageListenerContainer container, boolean batchListener) {
CommonErrorHandler handler = findDelegate(thrownException);
if (handler != null) {
handler.handleOtherException(thrownException, consumer, container, batchListener);
}
else {
this.defaultErrorHandler.handleOtherException(thrownException, consumer, container, batchListener);
}
}
@Override
public boolean handleOne(Exception thrownException, ConsumerRecord<?, ?> record, Consumer<?, ?> consumer,
MessageListenerContainer container) {
CommonErrorHandler handler = findDelegate(thrownException);
if (handler != null) {
return handler.handleOne(thrownException, record, consumer, container);
}
else {
|
return this.defaultErrorHandler.handleOne(thrownException, record, consumer, container);
}
}
@Nullable
private CommonErrorHandler findDelegate(Throwable thrownException) {
Throwable cause = findCause(thrownException);
if (cause != null) {
Class<? extends Throwable> causeClass = cause.getClass();
for (Entry<Class<? extends Throwable>, CommonErrorHandler> entry : this.delegates.entrySet()) {
if (entry.getKey().isAssignableFrom(causeClass)) {
return entry.getValue();
}
}
}
return null;
}
@Nullable
private Throwable findCause(Throwable thrownException) {
if (this.causeChainTraversing) {
return traverseCauseChain(thrownException);
}
return shallowTraverseCauseChain(thrownException);
}
@Nullable
private Throwable shallowTraverseCauseChain(Throwable thrownException) {
Throwable cause = thrownException;
if (cause instanceof ListenerExecutionFailedException) {
cause = thrownException.getCause();
}
return cause;
}
@Nullable
private Throwable traverseCauseChain(Throwable thrownException) {
Throwable cause = thrownException;
while (cause != null && cause.getCause() != null) {
if (this.exceptionMatcher.match(cause)) {
return cause;
}
cause = cause.getCause();
}
return cause;
}
}
|
repos\spring-kafka-main\spring-kafka\src\main\java\org\springframework\kafka\listener\CommonDelegatingErrorHandler.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class ViewService {
@Resource
private MongoTemplate mongoTemplate;
/**
* 创建视图
*
* @return 创建视图结果
*/
public Object createView() {
// 设置视图名
String newViewName = "usersView";
// 设置获取数据的集合名称
String collectionName = "users";
// 定义视图的管道,可是设置视图显示的内容多个筛选条件
List<Bson> pipeline = new ArrayList<>();
// 设置条件,用于筛选集合中的文档数据,只有符合条件的才会映射到视图中
pipeline.add(Document.parse("{\"$match\":{\"sex\":\"女\"}}"));
// 执行创建视图
mongoTemplate.getDb().createView(newViewName, collectionName, pipeline);
// 检测新的集合是否存在,返回创建结果
return mongoTemplate.collectionExists(newViewName) ? "创建视图成功" : "创建视图失败";
}
|
/**
* 删除视图
*
* @return 删除视图结果
*/
public Object dropView() {
// 设置待删除的视图名称
String viewName = "usersView";
// 检测视图是否存在
if (mongoTemplate.collectionExists(viewName)) {
// 删除视图
mongoTemplate.getDb().getCollection(viewName).drop();
return "删除视图成功";
}
// 检测新的集合是否存在,返回创建结果
return !mongoTemplate.collectionExists(viewName) ? "删除视图成功" : "删除视图失败";
}
}
|
repos\springboot-demo-master\mongodb\src\main\java\demo\et\mongodb\service\ViewService.java
| 2
|
请完成以下Java代码
|
public Integer parse(Decision decision, String definitionKey, boolean skipEnforceTtl) {
String historyTimeToLiveString = decision.getCamundaHistoryTimeToLiveString();
return parseAndValidate(historyTimeToLiveString, definitionKey, skipEnforceTtl);
}
/**
* Parses the given HistoryTimeToLive String expression and then executes any applicable validation before returning
* the parsed value.
*
* @param historyTimeToLiveString the history time to live string expression in ISO-8601 format
* @param definitionKey the correlated definition key that this historyTimeToLive was fetched from
* (process definition key for processes, decision definition key for decisions, case definition key for cases).
* @param skipEnforceTtl skips enforcing the TTL.
* @return the parsed integer value of history time to live
* @throws NotValidException in case enforcement of non-null values is on and the parsed result was null
*/
protected Integer parseAndValidate(String historyTimeToLiveString, String definitionKey, boolean skipEnforceTtl) throws NotValidException {
HTTLParsedResult result = new HTTLParsedResult(historyTimeToLiveString);
if (!skipEnforceTtl) {
if (result.isInValidAgainstConfig()) {
throw LOG.logErrorNoTTLConfigured();
}
if (result.hasLongerModelValueThanGlobalConfig()) {
LOG.logModelHTTLLongerThanGlobalConfiguration(definitionKey);
}
}
return result.valueAsInteger;
}
|
protected class HTTLParsedResult {
protected final boolean systemDefaultConfigWillBeUsed;
protected final String value;
protected final Integer valueAsInteger;
public HTTLParsedResult(String historyTimeToLiveString) {
this.systemDefaultConfigWillBeUsed = (historyTimeToLiveString == null);
this.value = systemDefaultConfigWillBeUsed ? httlConfigValue : historyTimeToLiveString;
this.valueAsInteger = ParseUtil.parseHistoryTimeToLive(value);
}
protected boolean isInValidAgainstConfig() {
return enforceNonNullValue && (valueAsInteger == null);
}
protected boolean hasLongerModelValueThanGlobalConfig() {
return !systemDefaultConfigWillBeUsed // only values originating from models make sense to be logged
&& valueAsInteger != null
&& httlConfigValue != null && !httlConfigValue.isEmpty()
&& valueAsInteger > ParseUtil.parseHistoryTimeToLive(httlConfigValue);
}
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\HistoryTimeToLiveParser.java
| 1
|
请完成以下Java代码
|
default URL getClientRegistrationEndpoint() {
return getClaimAsURL(OAuth2AuthorizationServerMetadataClaimNames.REGISTRATION_ENDPOINT);
}
/**
* Returns the Proof Key for Code Exchange (PKCE) {@code code_challenge_method} values
* supported {@code (code_challenge_methods_supported)}.
* @return the {@code code_challenge_method} values supported
*/
default List<String> getCodeChallengeMethods() {
return getClaimAsStringList(OAuth2AuthorizationServerMetadataClaimNames.CODE_CHALLENGE_METHODS_SUPPORTED);
}
/**
* Returns {@code true} to indicate support for mutual-TLS client certificate-bound
* access tokens {@code (tls_client_certificate_bound_access_tokens)}.
* @return {@code true} to indicate support for mutual-TLS client certificate-bound
* access tokens, {@code false} otherwise
*/
default boolean isTlsClientCertificateBoundAccessTokens() {
|
return Boolean.TRUE.equals(getClaimAsBoolean(
OAuth2AuthorizationServerMetadataClaimNames.TLS_CLIENT_CERTIFICATE_BOUND_ACCESS_TOKENS));
}
/**
* Returns the {@link JwsAlgorithms JSON Web Signature (JWS) algorithms} supported for
* DPoP Proof JWTs {@code (dpop_signing_alg_values_supported)}.
* @return the {@link JwsAlgorithms JSON Web Signature (JWS) algorithms} supported for
* DPoP Proof JWTs
*/
default List<String> getDPoPSigningAlgorithms() {
return getClaimAsStringList(OAuth2AuthorizationServerMetadataClaimNames.DPOP_SIGNING_ALG_VALUES_SUPPORTED);
}
}
|
repos\spring-security-main\oauth2\oauth2-authorization-server\src\main\java\org\springframework\security\oauth2\server\authorization\OAuth2AuthorizationServerMetadataClaimAccessor.java
| 1
|
请完成以下Java代码
|
public Builder setTooltipIconName(final String tooltipIconName)
{
this.tooltipIconName = tooltipIconName;
return this;
}
public Builder setPublicField(final boolean publicField)
{
this.publicField = publicField;
return this;
}
public boolean isPublicField()
{
return publicField;
}
private Builder setConsumed()
{
consumed = true;
return this;
}
public boolean isConsumed()
{
return consumed;
}
public Builder setListNullItemCaption(@NonNull final ITranslatableString listNullItemCaption)
{
this.listNullItemCaption = listNullItemCaption;
return this;
}
public Builder setEmptyFieldText(final ITranslatableString emptyFieldText)
{
this.emptyFieldText = emptyFieldText;
return this;
}
public Builder trackField(final DocumentFieldDescriptor.Builder field)
{
documentFieldBuilder = field;
return this;
}
public boolean isSpecialFieldToExcludeFromLayout()
{
return documentFieldBuilder != null && documentFieldBuilder.isSpecialFieldToExcludeFromLayout();
}
public Builder setDevices(@NonNull final DeviceDescriptorsList devices)
{
this._devices = devices;
return this;
}
|
private DeviceDescriptorsList getDevices()
{
return _devices;
}
public Builder setSupportZoomInto(final boolean supportZoomInto)
{
this.supportZoomInto = supportZoomInto;
return this;
}
private boolean isSupportZoomInto()
{
return supportZoomInto;
}
public Builder setForbidNewRecordCreation(final boolean forbidNewRecordCreation)
{
this.forbidNewRecordCreation = forbidNewRecordCreation;
return this;
}
private boolean isForbidNewRecordCreation()
{
return forbidNewRecordCreation;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\descriptor\DocumentLayoutElementFieldDescriptor.java
| 1
|
请完成以下Java代码
|
public Integer getLockTimeInMillis() {
return lockTimeInMillis;
}
public void setLockTimeInMillis(Integer lockTimeInMillis) {
this.lockTimeInMillis = lockTimeInMillis;
}
public Integer getMaxJobsPerAcquisition() {
return maxJobsPerAcquisition;
}
public void setMaxJobsPerAcquisition(Integer maxJobsPerAcquisition) {
this.maxJobsPerAcquisition = maxJobsPerAcquisition;
}
public Integer getWaitTimeInMillis() {
return waitTimeInMillis;
}
public void setWaitTimeInMillis(Integer waitTimeInMillis) {
this.waitTimeInMillis = waitTimeInMillis;
}
public Long getMaxWait() {
return maxWait;
}
public void setMaxWait(Long maxWait) {
this.maxWait = maxWait;
}
public Integer getBackoffTimeInMillis() {
return backoffTimeInMillis;
}
public void setBackoffTimeInMillis(Integer backoffTimeInMillis) {
this.backoffTimeInMillis = backoffTimeInMillis;
}
public Long getMaxBackoff() {
return maxBackoff;
}
|
public void setMaxBackoff(Long maxBackoff) {
this.maxBackoff = maxBackoff;
}
public Integer getBackoffDecreaseThreshold() {
return backoffDecreaseThreshold;
}
public void setBackoffDecreaseThreshold(Integer backoffDecreaseThreshold) {
this.backoffDecreaseThreshold = backoffDecreaseThreshold;
}
public Float getWaitIncreaseFactor() {
return waitIncreaseFactor;
}
public void setWaitIncreaseFactor(Float waitIncreaseFactor) {
this.waitIncreaseFactor = waitIncreaseFactor;
}
@Override
public String toString() {
return joinOn(this.getClass())
.add("enabled=" + enabled)
.add("deploymentAware=" + deploymentAware)
.add("corePoolSize=" + corePoolSize)
.add("maxPoolSize=" + maxPoolSize)
.add("keepAliveSeconds=" + keepAliveSeconds)
.add("queueCapacity=" + queueCapacity)
.add("lockTimeInMillis=" + lockTimeInMillis)
.add("maxJobsPerAcquisition=" + maxJobsPerAcquisition)
.add("waitTimeInMillis=" + waitTimeInMillis)
.add("maxWait=" + maxWait)
.add("backoffTimeInMillis=" + backoffTimeInMillis)
.add("maxBackoff=" + maxBackoff)
.add("backoffDecreaseThreshold=" + backoffDecreaseThreshold)
.add("waitIncreaseFactor=" + waitIncreaseFactor)
.toString();
}
}
|
repos\camunda-bpm-platform-master\spring-boot-starter\starter\src\main\java\org\camunda\bpm\spring\boot\starter\property\JobExecutionProperty.java
| 1
|
请完成以下Java代码
|
public void setHelp (String Help)
{
set_Value (COLUMNNAME_Help, Help);
}
/** Get Comment/Help.
@return Comment or Hint
*/
public String getHelp ()
{
return (String)get_Value(COLUMNNAME_Help);
}
/** Set Knowledge Category.
@param K_Category_ID
Knowledge Category
*/
public void setK_Category_ID (int K_Category_ID)
{
if (K_Category_ID < 1)
set_ValueNoCheck (COLUMNNAME_K_Category_ID, null);
else
set_ValueNoCheck (COLUMNNAME_K_Category_ID, Integer.valueOf(K_Category_ID));
}
/** Get Knowledge Category.
@return Knowledge Category
*/
public int getK_Category_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_K_Category_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
|
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_K_Category.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private PrintFormatId getPrintFormatIdOrNull(final ReportContext reportContext)
{
for (final ProcessInfoParameter param : reportContext.getProcessInfoParameters())
{
final String parameterName = param.getParameterName();
if (PARAM_AD_PRINTFORMAT_ID.equals(parameterName))
{
return PrintFormatId.ofRepoIdOrNull(param.getParameterAsInt());
}
}
return null;
}
private List<File> getDevelopmentWorkspaceReportsDirs()
{
final File developmentWorkspaceDir = developerModeBL.getDevelopmentWorkspaceDir().orElse(null);
if (developmentWorkspaceDir != null)
{
return DevelopmentWorkspaceJasperDirectoriesFinder.getReportsDirectoriesForWorkspace(developmentWorkspaceDir);
}
else
{
|
logger.warn("No development workspace directory configured. Not considering workspace reports directories");
return ImmutableList.of();
}
}
private ImmutableList<File> getConfiguredReportsDirs()
{
final String reportsDirs = StringUtils.trimBlankToNull(sysConfigBL.getValue(SYSCONFIG_ReportsDirs));
if (reportsDirs == null)
{
return ImmutableList.of();
}
return Splitter.on(",")
.omitEmptyStrings()
.splitToList(reportsDirs.trim())
.stream()
.map(File::new)
.collect(ImmutableList.toImmutableList());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.report\metasfresh-report-service\src\main\java\de\metas\report\server\AbstractReportEngine.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class JsonDistributionJobStep
{
@NonNull DistributionJobStepId id;
@NonNull String productName;
@NonNull String uom;
@NonNull BigDecimal qtyToMove;
//
// Pick From
@NonNull JsonLocatorInfo pickFromLocator;
@NonNull JsonHUInfo pickFromHU;
@NonNull BigDecimal qtyPicked;
//
// Drop To
@NonNull JsonLocatorInfo dropToLocator;
boolean droppedToLocator;
public static JsonDistributionJobStep of(
@NonNull final DistributionJobStep step,
@NonNull final DistributionJobLine line,
@NonNull final JsonOpts jsonOpts)
{
final String adLanguage = jsonOpts.getAdLanguage();
return builder()
.id(step.getId())
|
.productName(line.getProduct().getCaption().translate(adLanguage))
.uom(step.getQtyToMoveTarget().getUOMSymbol())
.qtyToMove(step.getQtyToMoveTarget().toBigDecimal())
//
// Pick From
.pickFromLocator(JsonLocatorInfo.of(line.getPickFromLocator()))
.pickFromHU(JsonHUInfo.of(step.getPickFromHU().getQrCode().toRenderedJson()))
.qtyPicked(step.getQtyPicked().toBigDecimal())
//
// Drop To
.dropToLocator(JsonLocatorInfo.of(line.getDropToLocator()))
.droppedToLocator(step.isDroppedToLocator())
//
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.distribution.rest-api\src\main\java\de\metas\distribution\mobileui\rest_api\json\JsonDistributionJobStep.java
| 2
|
请完成以下Java代码
|
final class JarUri {
private static final String JAR_SCHEME = "jar:";
private static final String JAR_EXTENSION = ".jar";
private final String uri;
private final String description;
private JarUri(String uri) {
this.uri = uri;
this.description = extractDescription(uri);
}
private String extractDescription(String uri) {
uri = uri.substring(JAR_SCHEME.length());
int firstDotJar = uri.indexOf(JAR_EXTENSION);
String firstJar = getFilename(uri.substring(0, firstDotJar + JAR_EXTENSION.length()));
uri = uri.substring(firstDotJar + JAR_EXTENSION.length());
int lastDotJar = uri.lastIndexOf(JAR_EXTENSION);
if (lastDotJar == -1) {
return firstJar;
}
return firstJar + uri.substring(0, lastDotJar + JAR_EXTENSION.length());
}
private String getFilename(String string) {
int lastSlash = string.lastIndexOf('/');
return (lastSlash == -1) ? string : string.substring(lastSlash + 1);
}
String getDescription() {
|
return this.description;
}
String getDescription(String existing) {
return existing + " from " + this.description;
}
@Override
public String toString() {
return this.uri;
}
static @Nullable JarUri from(URI uri) {
return from(uri.toString());
}
static @Nullable JarUri from(String uri) {
if (uri.startsWith(JAR_SCHEME) && uri.contains(JAR_EXTENSION)) {
return new JarUri(uri);
}
return null;
}
}
|
repos\spring-boot-4.0.1\core\spring-boot\src\main\java\org\springframework\boot\origin\JarUri.java
| 1
|
请完成以下Java代码
|
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** ModerationType AD_Reference_ID=395 */
public static final int MODERATIONTYPE_AD_Reference_ID=395;
/** Not moderated = N */
public static final String MODERATIONTYPE_NotModerated = "N";
/** Before Publishing = B */
public static final String MODERATIONTYPE_BeforePublishing = "B";
/** After Publishing = A */
public static final String MODERATIONTYPE_AfterPublishing = "A";
/** Set Moderation Type.
@param ModerationType
Type of moderation
*/
public void setModerationType (String ModerationType)
{
set_Value (COLUMNNAME_ModerationType, ModerationType);
}
/** Get Moderation Type.
@return Type of moderation
*/
public String getModerationType ()
{
return (String)get_Value(COLUMNNAME_ModerationType);
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
|
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_CM_ChatType.java
| 1
|
请完成以下Java代码
|
public class PPOrderCandidateAdvisedEvent extends AbstractPPOrderCandidateEvent
{
public static PPOrderCandidateAdvisedEvent cast(@NonNull final AbstractPPOrderCandidateEvent ppOrderCandidateEvent)
{
return (PPOrderCandidateAdvisedEvent)ppOrderCandidateEvent;
}
public static final String TYPE = "PPOrderCandidateAdvisedEvent";
/**
* If {@code true}, then this event advises the recipient to directly request an actual PP_Order to be created from the candidate.
*/
private final boolean directlyCreatePPOrder;
/**
* If {@code false}, then this event advises the recipient to not attempt to identify and update an existing supply candidate, but create a new one.
*/
private final boolean tryUpdateExistingCandidate;
@JsonCreator
@Builder(toBuilder = true)
public PPOrderCandidateAdvisedEvent(
@JsonProperty("eventDescriptor") @NonNull final EventDescriptor eventDescriptor,
@JsonProperty("ppOrderCandidate") @NonNull final PPOrderCandidate ppOrderCandidate,
@JsonProperty("supplyRequiredDescriptor") @Nullable final SupplyRequiredDescriptor supplyRequiredDescriptor,
@JsonProperty("directlyCreatePPOrder") final boolean directlyCreatePPOrder,
@JsonProperty("tryUpdateExistingCandidate") final boolean tryUpdateExistingCandidate)
{
super(eventDescriptor, ppOrderCandidate, supplyRequiredDescriptor);
this.directlyCreatePPOrder = directlyCreatePPOrder;
this.tryUpdateExistingCandidate = tryUpdateExistingCandidate;
}
public void validate()
|
{
final SupplyRequiredDescriptor supplyRequiredDescriptor = getSupplyRequiredDescriptor();
Check.errorIf(supplyRequiredDescriptor == null, "The given ppOrderCandidateAdvisedEvent has no supplyRequiredDescriptor");
final PPOrderCandidate ppOrderCandidate = getPpOrderCandidate();
Check.errorIf(ppOrderCandidate.getPpOrderCandidateId() != null,
"The given ppOrderCandidateAdvisedEvent's ppOrderCandidate may not yet have an ID; ppOrderCandidate={}", ppOrderCandidate);
final int productPlanningId = ppOrderCandidate.getPpOrderData().getProductPlanningId();
Check.errorIf(productPlanningId <= 0,
"The given ppOrderCandidateAdvisedEvent event needs to have a ppOrderCandidate with a product planning Id; productPlanningId={}", productPlanningId);
}
@Override
public String getEventName() {return TYPE;}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.material\event\src\main\java\de\metas\material\event\pporder\PPOrderCandidateAdvisedEvent.java
| 1
|
请完成以下Java代码
|
public Object execute(CommandContext commandContext) {
ensureNotNull("decisionDefinitionId", decisionDefinitionId);
DecisionDefinitionEntity decisionDefinition = commandContext
.getDecisionDefinitionManager()
.findDecisionDefinitionById(decisionDefinitionId);
ensureNotNull("No decision definition found with id: " + decisionDefinitionId, "decisionDefinition", decisionDefinition);
for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkDeleteHistoricDecisionInstance(decisionDefinition.getKey());
}
long numInstances = getDecisionInstanceCount(commandContext);
writeUserOperationLog(commandContext, numInstances);
commandContext
.getHistoricDecisionInstanceManager()
.deleteHistoricDecisionInstancesByDecisionDefinitionId(decisionDefinitionId);
return null;
}
protected void writeUserOperationLog(CommandContext commandContext, long numInstances) {
List<PropertyChange> propertyChanges = new ArrayList<PropertyChange>();
propertyChanges.add(new PropertyChange("nrOfInstances", null, numInstances));
|
propertyChanges.add(new PropertyChange("async", null, false));
commandContext.getOperationLogManager()
.logDecisionInstanceOperation(UserOperationLogEntry.OPERATION_TYPE_DELETE_HISTORY,
null,
propertyChanges);
}
protected long getDecisionInstanceCount(CommandContext commandContext) {
HistoricDecisionInstanceQueryImpl historicDecisionInstanceQuery = new HistoricDecisionInstanceQueryImpl();
historicDecisionInstanceQuery.decisionDefinitionId(decisionDefinitionId);
return commandContext.getHistoricDecisionInstanceManager()
.findHistoricDecisionInstanceCountByQueryCriteria(historicDecisionInstanceQuery);
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\dmn\cmd\DeleteHistoricDecisionInstanceByDefinitionIdCmd.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void updateAllTaskRelatedEntityCountFlags(boolean newValue) {
getDbSqlSession().directUpdate("updateTaskRelatedEntityCountEnabled", newValue);
}
@Override
public void deleteTasksByExecutionId(String executionId) {
DbSqlSession dbSqlSession = getDbSqlSession();
if (isEntityInserted(dbSqlSession, "execution", executionId)) {
deleteCachedEntities(dbSqlSession, tasksByExecutionIdMatcher, executionId);
} else {
bulkDelete("deleteTasksByExecutionId", tasksByExecutionIdMatcher, executionId);
}
}
@Override
protected IdGenerator getIdGenerator() {
return taskServiceConfiguration.getIdGenerator();
}
|
protected void setSafeInValueLists(TaskQueryImpl taskQuery) {
if (taskQuery.getCandidateGroups() != null) {
taskQuery.setSafeCandidateGroups(createSafeInValuesList(taskQuery.getCandidateGroups()));
}
if (taskQuery.getInvolvedGroups() != null) {
taskQuery.setSafeInvolvedGroups(createSafeInValuesList(taskQuery.getInvolvedGroups()));
}
if (taskQuery.getScopeIds() != null) {
taskQuery.setSafeScopeIds(createSafeInValuesList(taskQuery.getScopeIds()));
}
if (taskQuery.getOrQueryObjects() != null && !taskQuery.getOrQueryObjects().isEmpty()) {
for (TaskQueryImpl orTaskQuery : taskQuery.getOrQueryObjects()) {
setSafeInValueLists(orTaskQuery);
}
}
}
}
|
repos\flowable-engine-main\modules\flowable-task-service\src\main\java\org\flowable\task\service\impl\persistence\entity\data\impl\MybatisTaskDataManager.java
| 2
|
请完成以下Java代码
|
public void setW_CounterCount_ID (int W_CounterCount_ID)
{
if (W_CounterCount_ID < 1)
set_ValueNoCheck (COLUMNNAME_W_CounterCount_ID, null);
else
set_ValueNoCheck (COLUMNNAME_W_CounterCount_ID, Integer.valueOf(W_CounterCount_ID));
}
/** Get Counter Count.
@return Web Counter Count Management
*/
public int getW_CounterCount_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_W_CounterCount_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Web Counter.
@param W_Counter_ID
Individual Count hit
*/
public void setW_Counter_ID (int W_Counter_ID)
|
{
if (W_Counter_ID < 1)
set_ValueNoCheck (COLUMNNAME_W_Counter_ID, null);
else
set_ValueNoCheck (COLUMNNAME_W_Counter_ID, Integer.valueOf(W_Counter_ID));
}
/** Get Web Counter.
@return Individual Count hit
*/
public int getW_Counter_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_W_Counter_ID);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_W_Counter.java
| 1
|
请完成以下Java代码
|
protected final ConfigurationPropertyName getPrefix() {
return this.prefix;
}
@Override
public @Nullable ConfigurationProperty getConfigurationProperty(ConfigurationPropertyName name) {
ConfigurationProperty configurationProperty = this.source.getConfigurationProperty(getPrefixedName(name));
if (configurationProperty == null) {
return null;
}
return ConfigurationProperty.of(configurationProperty.getSource(), name, configurationProperty.getValue(),
configurationProperty.getOrigin());
}
private ConfigurationPropertyName getPrefixedName(ConfigurationPropertyName name) {
return this.prefix.append(name);
|
}
@Override
public ConfigurationPropertyState containsDescendantOf(ConfigurationPropertyName name) {
return this.source.containsDescendantOf(getPrefixedName(name));
}
@Override
public @Nullable Object getUnderlyingSource() {
return this.source.getUnderlyingSource();
}
protected ConfigurationPropertySource getSource() {
return this.source;
}
}
|
repos\spring-boot-4.0.1\core\spring-boot\src\main\java\org\springframework\boot\context\properties\source\PrefixedConfigurationPropertySource.java
| 1
|
请完成以下Java代码
|
public String getOutputLabel() {
return outputLabelAttribute.getValue(this);
}
public void setOutputLabel(String outputLabel) {
outputLabelAttribute.setValue(this, outputLabel);
}
public Collection<Input> getInputs() {
return inputCollection.get(this);
}
public Collection<Output> getOutputs() {
return outputCollection.get(this);
}
public Collection<Rule> getRules() {
return ruleCollection.get(this);
}
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(DecisionTable.class, DMN_ELEMENT_DECISION_TABLE)
.namespaceUri(LATEST_DMN_NS)
.extendsType(Expression.class)
.instanceProvider(new ModelTypeInstanceProvider<DecisionTable>() {
public DecisionTable newInstance(ModelTypeInstanceContext instanceContext) {
return new DecisionTableImpl(instanceContext);
}
});
hitPolicyAttribute = typeBuilder.namedEnumAttribute(DMN_ATTRIBUTE_HIT_POLICY, HitPolicy.class)
.defaultValue(HitPolicy.UNIQUE)
.build();
aggregationAttribute = typeBuilder.enumAttribute(DMN_ATTRIBUTE_AGGREGATION, BuiltinAggregator.class)
.build();
|
preferredOrientationAttribute = typeBuilder.namedEnumAttribute(DMN_ATTRIBUTE_PREFERRED_ORIENTATION, DecisionTableOrientation.class)
.defaultValue(DecisionTableOrientation.Rule_as_Row)
.build();
outputLabelAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_OUTPUT_LABEL)
.build();
SequenceBuilder sequenceBuilder = typeBuilder.sequence();
inputCollection = sequenceBuilder.elementCollection(Input.class)
.build();
outputCollection = sequenceBuilder.elementCollection(Output.class)
.required()
.build();
ruleCollection = sequenceBuilder.elementCollection(Rule.class)
.build();
typeBuilder.build();
}
}
|
repos\camunda-bpm-platform-master\model-api\dmn-model\src\main\java\org\camunda\bpm\model\dmn\impl\instance\DecisionTableImpl.java
| 1
|
请完成以下Java代码
|
public boolean isMultiInstance() {
Boolean isMultiInstance = (Boolean) getProperty(BpmnParse.PROPERTYNAME_IS_MULTI_INSTANCE);
return Boolean.TRUE.equals(isMultiInstance);
}
public boolean isTriggeredByEvent() {
Boolean isTriggeredByEvent = getProperties().get(BpmnProperties.TRIGGERED_BY_EVENT);
return Boolean.TRUE.equals(isTriggeredByEvent);
}
//============================================================================
//===============================DELEGATES====================================
//============================================================================
/**
* The delegate for the async before attribute update.
*/
protected AsyncBeforeUpdate delegateAsyncBeforeUpdate;
/**
* The delegate for the async after attribute update.
*/
protected AsyncAfterUpdate delegateAsyncAfterUpdate;
public AsyncBeforeUpdate getDelegateAsyncBeforeUpdate() {
return delegateAsyncBeforeUpdate;
}
public void setDelegateAsyncBeforeUpdate(AsyncBeforeUpdate delegateAsyncBeforeUpdate) {
this.delegateAsyncBeforeUpdate = delegateAsyncBeforeUpdate;
}
public AsyncAfterUpdate getDelegateAsyncAfterUpdate() {
return delegateAsyncAfterUpdate;
}
public void setDelegateAsyncAfterUpdate(AsyncAfterUpdate delegateAsyncAfterUpdate) {
this.delegateAsyncAfterUpdate = delegateAsyncAfterUpdate;
|
}
/**
* Delegate interface for the asyncBefore property update.
*/
public interface AsyncBeforeUpdate {
/**
* Method which is called if the asyncBefore property should be updated.
*
* @param asyncBefore the new value for the asyncBefore flag
* @param exclusive the exclusive flag
*/
public void updateAsyncBefore(boolean asyncBefore, boolean exclusive);
}
/**
* Delegate interface for the asyncAfter property update
*/
public interface AsyncAfterUpdate {
/**
* Method which is called if the asyncAfter property should be updated.
*
* @param asyncAfter the new value for the asyncBefore flag
* @param exclusive the exclusive flag
*/
public void updateAsyncAfter(boolean asyncAfter, boolean exclusive);
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\pvm\process\ActivityImpl.java
| 1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.