instruction
string | input
string | output
string | source_file
string | priority
int64 |
|---|---|---|---|---|
请完成以下Java代码
|
public class X509IssuerSerialType {
@XmlElement(name = "X509IssuerName", namespace = "http://www.w3.org/2000/09/xmldsig#", required = true)
protected String x509IssuerName;
@XmlElement(name = "X509SerialNumber", namespace = "http://www.w3.org/2000/09/xmldsig#", required = true)
protected BigInteger x509SerialNumber;
/**
* Gets the value of the x509IssuerName property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getX509IssuerName() {
return x509IssuerName;
}
/**
* Sets the value of the x509IssuerName property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setX509IssuerName(String value) {
this.x509IssuerName = value;
}
/**
* Gets the value of the x509SerialNumber property.
*
* @return
* possible object is
* {@link BigInteger }
|
*
*/
public BigInteger getX509SerialNumber() {
return x509SerialNumber;
}
/**
* Sets the value of the x509SerialNumber property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setX509SerialNumber(BigInteger value) {
this.x509SerialNumber = value;
}
}
|
repos\metasfresh-new_dawn_uat\backend\vertical-healthcare_ch\forum_datenaustausch_ch.invoice_440_request\src\main\java-xjc\de\metas\vertical\healthcare_ch\forum_datenaustausch_ch\invoice_440\request\X509IssuerSerialType.java
| 1
|
请完成以下Java代码
|
protected void createHUDocumentsFromTypedModel(final HUDocumentsCollector documentsCollector, final I_M_HU hu)
{
final ZonedDateTime dateTrx = SystemTime.asZonedDateTimeAtStartOfDay();
//
// Storage Factory
final IHUStorageDAO storageDAO = new SaveDecoupledHUStorageDAO();
final IHUStorageFactory storageFactory = new DefaultHUStorageFactory(storageDAO);
//
// Iterate HU Structure and create one HU Document for each Handling Unit
final HUIterator iterator = new HUIterator();
iterator.setDate(dateTrx);
iterator.setStorageFactory(storageFactory);
iterator.setListener(new HUIteratorListenerAdapter()
{
final Map<Integer, List<IHUDocumentLine>> huId2documentLines = new HashMap<>();
@Override
public Result beforeHU(final IMutable<I_M_HU> hu)
{
final int huId = hu.getValue().getM_HU_ID();
huId2documentLines.put(huId, new ArrayList<IHUDocumentLine>());
return Result.CONTINUE;
}
/**
* Create HU document from current document lines
*/
@Override
public Result afterHU(final I_M_HU hu)
{
final int huId = hu.getM_HU_ID();
final List<IHUDocumentLine> documentLines = huId2documentLines.remove(huId);
// allow empty documents because it's more obvious for user
// if (documentLines.isEmpty())
// {
// return Result.CONTINUE;
// }
final IHUDocument doc = createHUDocument(hu, documentLines);
documentsCollector.getHUDocuments().add(doc);
return Result.CONTINUE;
}
/**
* Create a document line for each IProductStorage.
*/
@Override
|
public Result beforeHUItemStorage(final IMutable<IHUItemStorage> itemStorageMutable)
{
final int huId = itemStorageMutable.getValue().getM_HU_Item().getM_HU_ID();
final List<IHUDocumentLine> documentLines = huId2documentLines.get(huId);
final IHUItemStorage itemStorage = itemStorageMutable.getValue();
final I_M_HU_Item item = iterator.getCurrentHUItem();
final List<IProductStorage> productStorages = itemStorage.getProductStorages(iterator.getDate());
for (final IProductStorage productStorage : productStorages)
{
final HandlingUnitHUDocumentLine documentLine = createHUDocumentLine(item, productStorage);
documentLines.add(documentLine);
}
return Result.SKIP_DOWNSTREAM;
}
});
iterator.iterate(hu);
}
protected IHUDocument createHUDocument(final I_M_HU hu, final List<IHUDocumentLine> documentLines)
{
final I_M_HU innerHU = getInnerHU(hu);
return new HandlingUnitHUDocument(hu, innerHU, documentLines);
}
protected I_M_HU getInnerHU(final I_M_HU hu)
{
// If HU has no parent (i.e. it's a top level HU) then there is nothing to take out
if (hu.getM_HU_Item_Parent_ID() <= 0)
{
return null;
}
else
{
return hu;
}
}
protected HandlingUnitHUDocumentLine createHUDocumentLine(final I_M_HU_Item item, final IProductStorage productStorage)
{
return new HandlingUnitHUDocumentLine(item, productStorage);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\document\impl\HandlingUnitHUDocumentFactory.java
| 1
|
请完成以下Java代码
|
protected void ensureCamundaAdminGroupExists(ProcessEngine processEngine) {
final IdentityService identityService = processEngine.getIdentityService();
final AuthorizationService authorizationService = processEngine.getAuthorizationService();
// create group
if(identityService.createGroupQuery().groupId(Groups.CAMUNDA_ADMIN).count() == 0) {
Group camundaAdminGroup = identityService.newGroup(Groups.CAMUNDA_ADMIN);
camundaAdminGroup.setName("camunda BPM Administrators");
camundaAdminGroup.setType(Groups.GROUP_TYPE_SYSTEM);
identityService.saveGroup(camundaAdminGroup);
}
// create ADMIN authorizations on all built-in resources
for (Resource resource : Resources.values()) {
if(authorizationService.createAuthorizationQuery().groupIdIn(Groups.CAMUNDA_ADMIN).resourceType(resource).resourceId(ANY).count() == 0) {
AuthorizationEntity userAdminAuth = new AuthorizationEntity(AUTH_TYPE_GRANT);
userAdminAuth.setGroupId(Groups.CAMUNDA_ADMIN);
userAdminAuth.setResource(resource);
userAdminAuth.setResourceId(ANY);
userAdminAuth.addPermission(ALL);
authorizationService.saveAuthorization(userAdminAuth);
}
}
}
|
protected void ensureSetupAvailable(ProcessEngine processEngine) {
if (processEngine.getIdentityService().isReadOnly()
|| (processEngine.getIdentityService().createUserQuery().memberOfGroup(Groups.CAMUNDA_ADMIN).count() > 0)) {
throw LOGGER.setupActionNotAvailable();
}
}
protected ProcessEngine lookupProcessEngine(String engineName) {
ServiceLoader<ProcessEngineProvider> serviceLoader = ServiceLoader.load(ProcessEngineProvider.class);
Iterator<ProcessEngineProvider> iterator = serviceLoader.iterator();
if (iterator.hasNext()) {
ProcessEngineProvider provider = iterator.next();
return provider.getProcessEngine(engineName);
} else {
throw LOGGER.processEngineProviderNotFound();
}
}
}
|
repos\camunda-bpm-platform-master\webapps\assembly\src\main\java\org\camunda\bpm\admin\impl\web\SetupResource.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class QRCodeConfigurationId implements RepoIdAware
{
@JsonCreator
public static QRCodeConfigurationId ofRepoId(final int repoId)
{
return new QRCodeConfigurationId(repoId);
}
public static QRCodeConfigurationId ofRepoIdOrNull(final int repoId)
{
return repoId > 0 ? new QRCodeConfigurationId(repoId) : null;
}
@NonNull
public static Optional<QRCodeConfigurationId> ofRepoIdOptional(final int repoId)
{
return Optional.ofNullable(ofRepoIdOrNull(repoId));
}
|
int repoId;
private QRCodeConfigurationId(final int repoId)
{
this.repoId = Check.assumeGreaterThanZero(repoId, "QRCode_Configuration_ID");
}
@JsonValue
@Override
public int getRepoId()
{
return repoId;
}
public static int toRepoId(final QRCodeConfigurationId qrCodeConfigurationId)
{
return qrCodeConfigurationId != null ? qrCodeConfigurationId.getRepoId() : -1;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\qrcodes\model\QRCodeConfigurationId.java
| 2
|
请完成以下Java代码
|
public void setSecurityContextHolderStrategy(SecurityContextHolderStrategy securityContextHolderStrategy) {
this.authentication = getAuthentication(securityContextHolderStrategy);
}
/**
* Use this {@link AuthorizationEventPublisher} to publish the
* {@link AuthorizationManager} result.
* @param eventPublisher
*/
public void setAuthorizationEventPublisher(AuthorizationEventPublisher eventPublisher) {
Assert.notNull(eventPublisher, "eventPublisher cannot be null");
this.eventPublisher = eventPublisher;
}
private Supplier<Authentication> getAuthentication(SecurityContextHolderStrategy strategy) {
return () -> {
Authentication authentication = strategy.getContext().getAuthentication();
if (authentication == null) {
throw new AuthenticationCredentialsNotFoundException(
"An Authentication object was not found in the SecurityContext");
|
}
return authentication;
};
}
private static class NoopAuthorizationEventPublisher implements AuthorizationEventPublisher {
@Override
public <T> void publishAuthorizationEvent(Supplier<Authentication> authentication, T object,
@Nullable AuthorizationResult result) {
}
}
}
|
repos\spring-security-main\messaging\src\main\java\org\springframework\security\messaging\access\intercept\AuthorizationChannelInterceptor.java
| 1
|
请完成以下Java代码
|
public void setVariable(String key, Object value) {
if (delegate != VariableContainer.empty()) {
this.delegate.setVariable(key, value);
} else {
setTransientVariable(key, value);
}
}
/**
* Sets a transient variable, which is local to this variable container.
* Transient variables take precedence over variables
* for the delegate VariableContainer.
* Therefore, transient variables do shadow potentially available variables with
* the same name in the delegate.
*
* @param key the variable name
* @param value the variable value
* @see #addTransientVariable(String, Object)
*/
@Override
public void setTransientVariable(String key, Object value) {
this.transientVariables.put(key, value);
}
/**
* Convenience method which returns <code>this</code> for method concatenation.
* Same as {@link #setTransientVariable(String, Object)}
*/
public MapDelegateVariableContainer addTransientVariable(String key, Object variable) {
setTransientVariable(key, variable);
return this;
}
/**
* Clears all transient variables of this variable container (not touching the delegate).
*/
public void clearTransientVariables() {
this.transientVariables.clear();
}
/**
* @return all available transient variables
*/
public Map<String, Object> getTransientVariables(){
return this.transientVariables;
}
|
public MapDelegateVariableContainer removeTransientVariable(String key){
this.transientVariables.remove(key);
return this;
}
@Override
public String getTenantId() {
return this.delegate.getTenantId();
}
@Override
public Set<String> getVariableNames() {
if (delegate == null || delegate == VariableContainer.empty()) {
return this.transientVariables.keySet();
}
if (transientVariables.isEmpty()) {
return delegate.getVariableNames();
}
Set<String> keys = new LinkedHashSet<>(delegate.getVariableNames());
keys.addAll(transientVariables.keySet());
return keys;
}
@Override
public String toString() {
return new StringJoiner(", ", getClass().getSimpleName() + "[", "]")
.add("delegate=" + delegate)
.add("tenantId=" + getTenantId())
.toString();
}
}
|
repos\flowable-engine-main\modules\flowable-engine-common\src\main\java\org\flowable\common\engine\impl\variable\MapDelegateVariableContainer.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void initDataManagers() {
if (batchDataManager == null) {
batchDataManager = new MybatisBatchDataManager(this);
}
if (batchPartDataManager == null) {
batchPartDataManager = new MybatisBatchPartDataManager(this);
}
}
public void initEntityManagers() {
if (batchEntityManager == null) {
batchEntityManager = new BatchEntityManagerImpl(this, batchDataManager);
}
if (batchPartEntityManager == null) {
batchPartEntityManager = new BatchPartEntityManagerImpl(this, batchPartDataManager);
}
}
// getters and setters
// //////////////////////////////////////////////////////
public BatchServiceConfiguration getIdentityLinkServiceConfiguration() {
return this;
}
public BatchService getBatchService() {
return batchService;
}
public BatchServiceConfiguration setBatchService(BatchService batchService) {
this.batchService = batchService;
return this;
}
public BatchDataManager getBatchDataManager() {
return batchDataManager;
}
public BatchServiceConfiguration setBatchDataManager(BatchDataManager batchDataManager) {
this.batchDataManager = batchDataManager;
return this;
}
|
public BatchPartDataManager getBatchPartDataManager() {
return batchPartDataManager;
}
public BatchServiceConfiguration setBatchPartDataManager(BatchPartDataManager batchPartDataManager) {
this.batchPartDataManager = batchPartDataManager;
return this;
}
public BatchEntityManager getBatchEntityManager() {
return batchEntityManager;
}
public BatchServiceConfiguration setBatchEntityManager(BatchEntityManager batchEntityManager) {
this.batchEntityManager = batchEntityManager;
return this;
}
public BatchPartEntityManager getBatchPartEntityManager() {
return batchPartEntityManager;
}
public BatchServiceConfiguration setBatchPartEntityManager(BatchPartEntityManager batchPartEntityManager) {
this.batchPartEntityManager = batchPartEntityManager;
return this;
}
@Override
public ObjectMapper getObjectMapper() {
return objectMapper;
}
@Override
public BatchServiceConfiguration setObjectMapper(ObjectMapper objectMapper) {
this.objectMapper = objectMapper;
return this;
}
}
|
repos\flowable-engine-main\modules\flowable-batch-service\src\main\java\org\flowable\batch\service\BatchServiceConfiguration.java
| 2
|
请完成以下Java代码
|
public String toString() {
return "MutableMoney [amount=" + amount + ", currency=" + currency + "]";
}
public long getAmount() {
return amount;
}
public void setAmount(long amount) {
this.amount = amount;
}
public String getCurrency() {
return currency;
}
|
public void setCurrency(String currency) {
this.currency = currency;
}
private long amount;
private String currency;
public MutableMoney(long amount, String currency) {
super();
this.amount = amount;
this.currency = currency;
}
}
|
repos\tutorials-master\google-auto-project\src\main\java\com\baeldung\autovalue\MutableMoney.java
| 1
|
请完成以下Java代码
|
public void setIsDepreciated (boolean IsDepreciated)
{
set_Value (COLUMNNAME_IsDepreciated, Boolean.valueOf(IsDepreciated));
}
/** Get Depreciate.
@return The asset will be depreciated
*/
public boolean isDepreciated ()
{
Object oo = get_Value(COLUMNNAME_IsDepreciated);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set PostingType.
@param PostingType
The type of posted amount for the transaction
*/
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 Processed.
@param Processed
The document has been processed
*/
public void setProcessed (boolean Processed)
{
set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed));
}
/** Get Processed.
@return The document has been processed
*/
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;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_A_Depreciation_Exp.java
| 1
|
请完成以下Java代码
|
public int getAD_PrintColor_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_PrintColor_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Validation code.
@param Code
Validation Code
*/
public void setCode (String Code)
{
set_Value (COLUMNNAME_Code, Code);
}
/** Get Validation code.
@return Validation Code
*/
public String getCode ()
{
return (String)get_Value(COLUMNNAME_Code);
}
/** Set Default.
@param IsDefault
Default value
*/
public void setIsDefault (boolean IsDefault)
{
set_Value (COLUMNNAME_IsDefault, Boolean.valueOf(IsDefault));
}
/** Get Default.
@return Default value
*/
public boolean isDefault ()
{
Object oo = get_Value(COLUMNNAME_IsDefault);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
|
}
/** 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_AD_PrintColor.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private static ClassLoader decideClassloader(@Nullable ClassLoader classLoader) {
if (classLoader == null) {
return ImportCandidates.class.getClassLoader();
}
return classLoader;
}
private static Enumeration<URL> findUrlsInClasspath(ClassLoader classLoader, String location) {
try {
return classLoader.getResources(location);
}
catch (IOException ex) {
throw new IllegalArgumentException("Failed to load configurations from location [" + location + "]", ex);
}
}
|
@SuppressWarnings({ "unchecked", "rawtypes" })
private static Map<String, String> readReplacements(URL url) {
try (BufferedReader reader = new BufferedReader(
new InputStreamReader(new UrlResource(url).getInputStream(), StandardCharsets.UTF_8))) {
Properties properties = new Properties();
properties.load(reader);
return (Map) properties;
}
catch (IOException ex) {
throw new IllegalArgumentException("Unable to load replacements from location [" + url + "]", ex);
}
}
}
|
repos\spring-boot-4.0.1\core\spring-boot-autoconfigure\src\main\java\org\springframework\boot\autoconfigure\AutoConfigurationReplacements.java
| 2
|
请完成以下Java代码
|
public class ActivateProcessDefinitionCmd extends AbstractSetProcessDefinitionStateCmd {
public ActivateProcessDefinitionCmd(
ProcessDefinitionEntity processDefinitionEntity,
boolean includeProcessInstances,
Date executionDate,
String tenantId
) {
super(processDefinitionEntity, includeProcessInstances, executionDate, tenantId);
}
public ActivateProcessDefinitionCmd(
String processDefinitionId,
String processDefinitionKey,
boolean includeProcessInstances,
Date executionDate,
|
String tenantId
) {
super(processDefinitionId, processDefinitionKey, includeProcessInstances, executionDate, tenantId);
}
protected SuspensionState getProcessDefinitionSuspensionState() {
return SuspensionState.ACTIVE;
}
protected String getDelayedExecutionJobHandlerType() {
return TimerActivateProcessDefinitionHandler.TYPE;
}
protected AbstractSetProcessInstanceStateCmd getProcessInstanceChangeStateCmd(ProcessInstance processInstance) {
return new ActivateProcessInstanceCmd(processInstance.getId());
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\cmd\ActivateProcessDefinitionCmd.java
| 1
|
请完成以下Java代码
|
private void deleteLines(@NonNull final I_DD_Order order)
{
queryBL.createQueryBuilder(I_DD_OrderLine.class)
.addEqualsFilter(I_DD_OrderLine.COLUMNNAME_DD_Order_ID, order.getDD_Order_ID())
.create()
.deleteDirectly();
}
public void updateForwardPPOrderByIds(@NonNull final Set<DDOrderId> ddOrderIds, @Nullable final PPOrderId newPPOrderId)
{
if (ddOrderIds.isEmpty())
{
return;
}
queryBL.createQueryBuilder(I_DD_Order.class)
.addInArrayFilter(I_DD_Order.COLUMNNAME_DD_Order_ID, ddOrderIds)
.addNotEqualsFilter(I_DD_Order.COLUMNNAME_Forward_PP_Order_ID, newPPOrderId)
.create()
.update(ddOrder -> {
ddOrder.setForward_PP_Order_ID(PPOrderId.toRepoId(newPPOrderId));
return IQueryUpdater.MODEL_UPDATED;
});
}
public Set<ProductId> getProductIdsByDDOrderIds(final Collection<DDOrderId> ddOrderIds)
{
|
if (ddOrderIds.isEmpty())
{
return ImmutableSet.of();
}
final List<ProductId> productIds = queryBL.createQueryBuilder(I_DD_OrderLine.class)
.addInArrayFilter(I_DD_Order.COLUMNNAME_DD_Order_ID, ddOrderIds)
.addOnlyActiveRecordsFilter()
.create()
.listDistinct(I_DD_OrderLine.COLUMNNAME_M_Product_ID, ProductId.class);
return ImmutableSet.copyOf(productIds);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\de\metas\distribution\ddorder\lowlevel\DDOrderLowLevelDAO.java
| 1
|
请完成以下Java代码
|
public void handleEvent(EventSubscriptionEntity eventSubscription, Object payload, CommandContext commandContext) {
if (eventSubscription.getExecutionId() != null) {
super.handleEvent(eventSubscription, payload, commandContext);
} else if (eventSubscription.getProcessDefinitionId() != null) {
// Find initial flow element matching the signal start event
String processDefinitionId = eventSubscription.getProcessDefinitionId();
org.flowable.bpmn.model.Process process = ProcessDefinitionUtil.getProcess(processDefinitionId);
ProcessDefinition processDefinition = ProcessDefinitionUtil.getProcessDefinition(processDefinitionId);
if (processDefinition.isSuspended()) {
throw new FlowableException("Could not handle signal: process definition with id: " + processDefinitionId + " is suspended for " + eventSubscription);
}
// Start process instance via the flow element linked to the event
FlowElement flowElement = process.getFlowElement(eventSubscription.getActivityId(), true);
if (flowElement == null) {
throw new FlowableException("Could not find matching FlowElement for " + eventSubscription);
}
ProcessInstanceHelper processInstanceHelper = CommandContextUtil.getProcessEngineConfiguration(commandContext).getProcessInstanceHelper();
processInstanceHelper.createAndStartProcessInstanceWithInitialFlowElement(processDefinition, null, null, null, flowElement, process,
getPayloadAsMap(payload), null, null, null, true);
} else if (eventSubscription.getScopeId() != null && ScopeTypes.CMMN.equals(eventSubscription.getScopeType())) {
CommandContextUtil.getProcessEngineConfiguration(commandContext).getCaseInstanceService().handleSignalEvent(eventSubscription, getPayloadAsMap(payload));
|
} else {
throw new FlowableException("Invalid signal handling: no execution nor process definition set for " + eventSubscription);
}
}
protected Map<String, Object> getPayloadAsMap(Object payload) {
Map<String, Object> variables = null;
if (payload instanceof Map) {
variables = (Map<String, Object>) payload;
}
return variables;
}
}
|
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\event\SignalEventHandler.java
| 1
|
请完成以下Java代码
|
public Builder setDocTypeName(final String docTypeName)
{
this.docTypeName = docTypeName;
return this;
}
public Builder setDateInvoiced(final Date dateInvoiced)
{
this.dateInvoiced = dateInvoiced;
return this;
}
public Builder setDateAcct(final Date dateAcct)
{
this.dateAcct = dateAcct;
return this;
}
public Builder setC_BPartner_ID(final int C_BPartner_ID)
{
this.C_BPartner_ID = C_BPartner_ID;
return this;
}
public Builder setBPartnerName(final String BPartnerName)
{
this.BPartnerName = BPartnerName;
return this;
}
public Builder setCurrencyISOCode(final CurrencyCode currencyISOCode)
{
this.currencyISOCode = currencyISOCode;
return this;
}
public Builder setGrandTotal(final BigDecimal grandTotal)
{
this.grandTotal = grandTotal;
return this;
}
public Builder setGrandTotalConv(final BigDecimal grandTotalConv)
{
this.grandTotalConv = grandTotalConv;
return this;
}
public Builder setOpenAmtConv(final BigDecimal openAmtConv)
{
this.openAmtConv = openAmtConv;
return this;
}
public Builder setDiscount(final BigDecimal discount)
{
this.discount = discount;
return this;
}
public Builder setPaymentRequestAmt(final BigDecimal paymentRequestAmt)
{
Check.assumeNotNull(paymentRequestAmt, "paymentRequestAmt not null");
|
this.paymentRequestAmtSupplier = Suppliers.ofInstance(paymentRequestAmt);
return this;
}
public Builder setPaymentRequestAmt(final Supplier<BigDecimal> paymentRequestAmtSupplier)
{
this.paymentRequestAmtSupplier = paymentRequestAmtSupplier;
return this;
}
public Builder setMultiplierAP(final BigDecimal multiplierAP)
{
this.multiplierAP = multiplierAP;
return this;
}
public Builder setIsPrepayOrder(final boolean isPrepayOrder)
{
this.isPrepayOrder = isPrepayOrder;
return this;
}
public Builder setPOReference(final String POReference)
{
this.POReference = POReference;
return this;
}
public Builder setCreditMemo(final boolean creditMemo)
{
this.creditMemo = creditMemo;
return this;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.swingui\src\main\java\de\metas\banking\payment\paymentallocation\model\InvoiceRow.java
| 1
|
请完成以下Java代码
|
public class X_ExternalSystem_RuntimeParameter extends org.compiere.model.PO implements I_ExternalSystem_RuntimeParameter, org.compiere.model.I_Persistent
{
private static final long serialVersionUID = -312206168L;
/** Standard Constructor */
public X_ExternalSystem_RuntimeParameter (final Properties ctx, final int ExternalSystem_RuntimeParameter_ID, @Nullable final String trxName)
{
super (ctx, ExternalSystem_RuntimeParameter_ID, trxName);
}
/** Load Constructor */
public X_ExternalSystem_RuntimeParameter (final Properties ctx, final ResultSet rs, @Nullable final String trxName)
{
super (ctx, rs, trxName);
}
/** Load Meta Data */
@Override
protected org.compiere.model.POInfo initPO(final Properties ctx)
{
return org.compiere.model.POInfo.getPOInfo(Table_Name);
}
@Override
public void setExternal_Request (final String External_Request)
{
set_Value (COLUMNNAME_External_Request, External_Request);
}
@Override
public String getExternal_Request()
{
return get_ValueAsString(COLUMNNAME_External_Request);
}
@Override
public I_ExternalSystem_Config getExternalSystem_Config()
{
return get_ValueAsPO(COLUMNNAME_ExternalSystem_Config_ID, I_ExternalSystem_Config.class);
}
@Override
public void setExternalSystem_Config(final I_ExternalSystem_Config ExternalSystem_Config)
{
set_ValueFromPO(COLUMNNAME_ExternalSystem_Config_ID, I_ExternalSystem_Config.class, ExternalSystem_Config);
}
@Override
public void setExternalSystem_Config_ID (final int ExternalSystem_Config_ID)
{
if (ExternalSystem_Config_ID < 1)
set_Value (COLUMNNAME_ExternalSystem_Config_ID, null);
else
set_Value (COLUMNNAME_ExternalSystem_Config_ID, ExternalSystem_Config_ID);
}
@Override
|
public int getExternalSystem_Config_ID()
{
return get_ValueAsInt(COLUMNNAME_ExternalSystem_Config_ID);
}
@Override
public void setExternalSystem_RuntimeParameter_ID (final int ExternalSystem_RuntimeParameter_ID)
{
if (ExternalSystem_RuntimeParameter_ID < 1)
set_ValueNoCheck (COLUMNNAME_ExternalSystem_RuntimeParameter_ID, null);
else
set_ValueNoCheck (COLUMNNAME_ExternalSystem_RuntimeParameter_ID, ExternalSystem_RuntimeParameter_ID);
}
@Override
public int getExternalSystem_RuntimeParameter_ID()
{
return get_ValueAsInt(COLUMNNAME_ExternalSystem_RuntimeParameter_ID);
}
@Override
public void setName (final String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
@Override
public String getName()
{
return get_ValueAsString(COLUMNNAME_Name);
}
@Override
public void setValue (final @Nullable String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
@Override
public String getValue()
{
return get_ValueAsString(COLUMNNAME_Value);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.externalsystem\src\main\java-gen\de\metas\externalsystem\model\X_ExternalSystem_RuntimeParameter.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter {
// @Autowired
// private TokenStore redisTokenStore;
@Autowired
private TokenStore jwtTokenStore;
@Autowired
private JwtAccessTokenConverter jwtAccessTokenConverter;
@Autowired
private AuthenticationManager authenticationManager;
@Autowired
private TokenEnhancer tokenEnhancer;
@Autowired
private UserDetailService userDetailService;
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) {
TokenEnhancerChain enhancerChain = new TokenEnhancerChain();
List<TokenEnhancer> enhancers = new ArrayList<>();
enhancers.add(tokenEnhancer);
enhancers.add(jwtAccessTokenConverter);
enhancerChain.setTokenEnhancers(enhancers);
endpoints.authenticationManager(authenticationManager)
.tokenStore(jwtTokenStore)
|
.accessTokenConverter(jwtAccessTokenConverter)
.userDetailsService(userDetailService);
}
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
clients.inMemory()
.withClient("test1")
.secret(new BCryptPasswordEncoder().encode("test1111"))
.authorizedGrantTypes("password", "refresh_token")
.accessTokenValiditySeconds(3600)
.refreshTokenValiditySeconds(864000)
.scopes("all", "a", "b", "c")
.and()
.withClient("test2")
.secret(new BCryptPasswordEncoder().encode("test2222"))
.accessTokenValiditySeconds(7200);
}
}
|
repos\SpringAll-master\65.Spring-Security-OAuth2-Config\src\main\java\cc\mrbird\security\config\AuthorizationServerConfig.java
| 2
|
请完成以下Java代码
|
public List<ListenableFuture<String>> removeAll(TenantId tenantId, EntityId entityId, AttributeScope attributeScope, List<String> keys) {
List<ListenableFuture<String>> futuresList = new ArrayList<>(keys.size());
for (String key : keys) {
futuresList.add(service.submit(() -> {
attributeKvRepository.delete(entityId.getId(), attributeScope.getId(), keyDictionaryDao.getOrSaveKeyId(key));
return key;
}));
}
return futuresList;
}
@Override
public List<ListenableFuture<TbPair<String, Long>>> removeAllWithVersions(TenantId tenantId, EntityId entityId, AttributeScope attributeScope, List<String> keys) {
List<ListenableFuture<TbPair<String, Long>>> futuresList = new ArrayList<>(keys.size());
for (String key : keys) {
futuresList.add(service.submit(() -> {
Long version = transactionTemplate.execute(status -> jdbcTemplate.query("DELETE FROM attribute_kv WHERE entity_id = ? AND attribute_type = ? " +
"AND attribute_key = ? RETURNING nextval('attribute_kv_version_seq')",
rs -> rs.next() ? rs.getLong(1) : null, entityId.getId(), attributeScope.getId(), keyDictionaryDao.getOrSaveKeyId(key)));
return TbPair.of(key, version);
}));
}
return futuresList;
|
}
@Transactional
@Override
public List<Pair<AttributeScope, String>> removeAllByEntityId(TenantId tenantId, EntityId entityId) {
return jdbcTemplate.queryForList("DELETE FROM attribute_kv WHERE entity_id = ? " +
"RETURNING attribute_type, attribute_key", entityId.getId()).stream()
.map(row -> Pair.of(AttributeScope.valueOf((Integer) row.get(ModelConstants.ATTRIBUTE_TYPE_COLUMN)),
keyDictionaryDao.getKey((Integer) row.get(ModelConstants.ATTRIBUTE_KEY_COLUMN))))
.collect(Collectors.toList());
}
private AttributeKvCompositeKey getAttributeKvCompositeKey(EntityId entityId, Integer attributeType, Integer attributeKey) {
return new AttributeKvCompositeKey(
entityId.getId(),
attributeType,
attributeKey);
}
}
|
repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\sql\attributes\JpaAttributeDao.java
| 1
|
请完成以下Java代码
|
public void onNext(String item) {
buffer.add(item);
// if buffer is full, process the items.
if (buffer.size() >= BUFFER_SIZE) {
processBuffer();
}
//request more items.
subscription.request(1);
}
private void processBuffer() {
if (buffer.isEmpty())
return;
// Process all items in the buffer. Here, we just print it and sleep for 1 second.
System.out.print("Processed items: ");
buffer.stream()
.forEach(item -> {
System.out.print(" " + item);
});
System.out.println();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
|
e.printStackTrace();
}
counter = counter + buffer.size();
buffer.clear();
}
@Override
public void onError(Throwable t) {
t.printStackTrace();
}
@Override
public void onComplete() {
completed = true;
// process any remaining items in buffer before
processBuffer();
subscription.cancel();
}
}
|
repos\tutorials-master\core-java-modules\core-java-9-new-features\src\main\java\com\baeldung\java9\reactive\BaeldungBatchSubscriberImpl.java
| 1
|
请完成以下Java代码
|
public void SetIsManualDiscount(final I_C_OrderLine orderLine)
{
orderLine.setIsManualDiscount(true);
}
/**
* Sets {@code C_OrderLine.IsManualPrice='Y'}, but only if the user "manually" edited the price.
*/
@CalloutMethod(columnNames = { I_C_OrderLine.COLUMNNAME_PriceEntered }, skipIfCopying = true, skipIfIndirectlyCalled = true)
public void setIsManualPriceFlag(final I_C_OrderLine orderLine)
{
orderLine.setIsManualPrice(true);
}
@CalloutMethod(columnNames = {
I_C_OrderLine.COLUMNNAME_C_BPartner_ID,
I_C_OrderLine.COLUMNNAME_C_BPartner_Location_ID },
skipIfCopying = true)
public void updateBPartnerAddress(final I_C_OrderLine orderLine)
|
{
documentLocationBL.updateRenderedAddressAndCapturedLocation(OrderLineDocumentLocationAdapterFactory.locationAdapter(orderLine));
}
@CalloutMethod(columnNames = I_C_OrderLine.COLUMNNAME_AD_User_ID, skipIfCopying = true)
public void updateRenderedAddress(final I_C_OrderLine orderLine)
{
documentLocationBL.updateRenderedAddress(OrderLineDocumentLocationAdapterFactory.locationAdapter(orderLine));
}
@CalloutMethod(columnNames = { I_C_OrderLine.COLUMNNAME_C_BPartner_ID },
skipIfCopying = true)
public void updateBPartnerLocation(final I_C_OrderLine orderLine)
{
orderLineBL.setBPLocation(orderLine);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\order\callout\C_OrderLine.java
| 1
|
请完成以下Java代码
|
public class ExternalWorkerServiceTaskExport extends AbstractPlanItemDefinitionExport<ExternalWorkerServiceTask> {
@Override
public String getPlanItemDefinitionXmlElementValue(ExternalWorkerServiceTask casePageTask) {
return ELEMENT_TASK;
}
@Override
public void writePlanItemDefinitionSpecificAttributes(ExternalWorkerServiceTask externalWorkerServiceTask, XMLStreamWriter xtw) throws Exception {
super.writePlanItemDefinitionSpecificAttributes(externalWorkerServiceTask, xtw);
TaskExport.writeCommonTaskAttributes(externalWorkerServiceTask, xtw);
xtw.writeAttribute(FLOWABLE_EXTENSIONS_PREFIX, FLOWABLE_EXTENSIONS_NAMESPACE, ATTRIBUTE_TYPE, ExternalWorkerServiceTask.TYPE);
if (!externalWorkerServiceTask.isAsync() ) {
// Write the exclusive only if not async (otherwise it is added in the TaskExport)
xtw.writeAttribute(FLOWABLE_EXTENSIONS_PREFIX, FLOWABLE_EXTENSIONS_NAMESPACE, ATTRIBUTE_IS_EXCLUSIVE, String.valueOf(externalWorkerServiceTask.isExclusive()));
}
if (StringUtils.isNotEmpty(externalWorkerServiceTask.getTopic())) {
xtw.writeAttribute(FLOWABLE_EXTENSIONS_PREFIX, FLOWABLE_EXTENSIONS_NAMESPACE, ATTRIBUTE_EXTERNAL_WORKER_TOPIC,
externalWorkerServiceTask.getTopic());
}
|
}
@Override
protected boolean writePlanItemDefinitionExtensionElements(CmmnModel model, ExternalWorkerServiceTask planItemDefinition, boolean didWriteExtensionElement, XMLStreamWriter xtw) throws Exception {
boolean extensionElementWritten = super.writePlanItemDefinitionExtensionElements(model, planItemDefinition, didWriteExtensionElement, xtw);
extensionElementWritten = CmmnXmlUtil.writeIOParameters(ELEMENT_EXTERNAL_WORKER_IN_PARAMETER, planItemDefinition.getInParameters(), extensionElementWritten, xtw);
extensionElementWritten = CmmnXmlUtil.writeIOParameters(ELEMENT_EXTERNAL_WORKER_OUT_PARAMETER, planItemDefinition.getOutParameters(), extensionElementWritten, xtw);
return extensionElementWritten;
}
@Override
protected Class<? extends ExternalWorkerServiceTask> getExportablePlanItemDefinitionClass() {
return ExternalWorkerServiceTask.class;
}
}
|
repos\flowable-engine-main\modules\flowable-cmmn-converter\src\main\java\org\flowable\cmmn\converter\export\ExternalWorkerServiceTaskExport.java
| 1
|
请完成以下Java代码
|
public boolean containsRawMaterialsIssueStep(final PPOrderIssueScheduleId issueScheduleId)
{
return steps.stream().anyMatch(step -> PPOrderIssueScheduleId.equals(step.getId(), issueScheduleId));
}
@NonNull
public ITranslatableString getProductValueAndProductName()
{
final TranslatableStringBuilder message = TranslatableStrings.builder()
.append(getProductValue())
.append(" ")
.append(getProductName());
return message.build();
}
|
@NonNull
public Quantity getQtyLeftToIssue()
{
return qtyToIssue.subtract(qtyIssued);
}
public boolean isAllowManualIssue()
{
return !issueMethod.isIssueOnlyForReceived();
}
public boolean isIssueOnlyForReceived() {return issueMethod.isIssueOnlyForReceived();}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing.rest-api\src\main\java\de\metas\manufacturing\job\model\RawMaterialsIssueLine.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private void filterActiveServices(@NonNull final Exchange exchange)
{
final JsonExternalStatusResponse externalStatusInfoResponse = exchange.getIn().getBody(JsonExternalStatusResponse.class);
exchange.getIn().setBody(externalStatusInfoResponse.getExternalStatusResponses()
.stream()
.filter(response -> response.getExpectedStatus().equals(JsonExternalStatus.Active))
.collect(ImmutableList.toImmutableList()));
}
private void createEnableServiceRequest(@NonNull final Exchange exchange)
{
final JsonExternalStatusResponseItem externalStatusResponse = exchange.getIn().getBody(JsonExternalStatusResponseItem.class);
final Optional<IExternalSystemService> matchedExternalService = externalSystemServices.stream()
.filter(externalService -> externalService.getServiceValue().equals(externalStatusResponse.getServiceValue()))
.findFirst();
|
if (matchedExternalService.isEmpty())
{
log.warn("*** No Service found for value = " + externalStatusResponse.getServiceValue() + " !");
return;
}
final InvokeExternalSystemActionCamelRequest camelRequest = InvokeExternalSystemActionCamelRequest.builder()
.externalSystemChildValue(externalStatusResponse.getExternalSystemChildValue())
.externalSystemConfigType(externalStatusResponse.getExternalSystemConfigType())
.command(matchedExternalService.get().getEnableCommand())
.build();
exchange.getIn().setBody(camelRequest, InvokeExternalSystemActionCamelRequest.class);
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\core\src\main\java\de\metas\camel\externalsystems\core\restapi\ExternalSystemRestAPIHandler.java
| 2
|
请完成以下Java代码
|
public class CustomAuthenticationFilter extends UsernamePasswordAuthenticationFilter {
public static final String SPRING_SECURITY_FORM_DOMAIN_KEY = "domain";
@Override
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response)
throws AuthenticationException {
if (!request.getMethod().equals("POST")) {
throw new AuthenticationServiceException("Authentication method not supported: "
+ request.getMethod());
}
CustomAuthenticationToken authRequest = getAuthRequest(request);
setDetails(request, authRequest);
return this.getAuthenticationManager().authenticate(authRequest);
}
private CustomAuthenticationToken getAuthRequest(HttpServletRequest request) {
String username = obtainUsername(request);
String password = obtainPassword(request);
String domain = obtainDomain(request);
if (username == null) {
|
username = "";
}
if (password == null) {
password = "";
}
if (domain == null) {
domain = "";
}
return new CustomAuthenticationToken(username, password, domain);
}
private String obtainDomain(HttpServletRequest request) {
return request.getParameter(SPRING_SECURITY_FORM_DOMAIN_KEY);
}
}
|
repos\tutorials-master\spring-security-modules\spring-security-web-login-2\src\main\java\com\baeldung\loginextrafieldscustom\CustomAuthenticationFilter.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class PublisherService {
private final PublisherRepository publisherRepository;
public PublisherService(PublisherRepository publisherRepository) {
this.publisherRepository = publisherRepository;
}
public Publishers save(Publishers publishers) {
return publisherRepository.save(publishers);
}
public List<Publishers> findAll() {
return publisherRepository.findAll();
}
public Publishers findById(int id) {
return publisherRepository.findById(id)
|
.orElseThrow(() -> new RuntimeException("Publisher not found"));
}
public void delete(int id) {
publisherRepository.deleteById(id);
}
public Publishers update(Publishers publishers) {
return publisherRepository.save(publishers);
}
public List<Publishers> findAllByLocation(String location) {
return publisherRepository.findAllByLocation(location);
}
public List<Publishers> findPublishersWithMinJournalsInLocation(int minJournals, String location) {
return publisherRepository.findPublishersWithMinJournalsInLocation(minJournals, location);
}
}
|
repos\tutorials-master\persistence-modules\spring-persistence-simple\src\main\java\com\baeldung\spring\jpa\guide\service\PublisherService.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public void incrementBufferHead()
{
if (bufferHead == maxSentenceSize)
bufferHead = -1;
else
bufferHead++;
}
public void setBufferHead(int bufferHead)
{
this.bufferHead = bufferHead;
}
@Override
public State clone()
{
State state = new State(arcs.length - 1);
state.stack = new ArrayDeque<Integer>(stack);
for (int dependent = 0; dependent < arcs.length; dependent++)
{
if (arcs[dependent] != null)
{
Edge head = arcs[dependent];
state.arcs[dependent] = head;
int h = head.headIndex;
if (rightMostArcs[h] != 0)
{
state.rightMostArcs[h] = rightMostArcs[h];
state.rightValency[h] = rightValency[h];
|
state.rightDepLabels[h] = rightDepLabels[h];
}
if (leftMostArcs[h] != 0)
{
state.leftMostArcs[h] = leftMostArcs[h];
state.leftValency[h] = leftValency[h];
state.leftDepLabels[h] = leftDepLabels[h];
}
}
}
state.rootIndex = rootIndex;
state.bufferHead = bufferHead;
state.maxSentenceSize = maxSentenceSize;
state.emptyFlag = emptyFlag;
return state;
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\dependency\perceptron\transition\configuration\State.java
| 2
|
请完成以下Java代码
|
private static ImmutableMap<String, String> normalizeTrlsMap(@Nullable final Map<String, String> trls)
{
if (trls == null || trls.isEmpty())
{
return ImmutableMap.of();
}
else if (trls.containsValue(null))
{
ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
trls.forEach((adLanguage, trl) -> builder.put(adLanguage, trl != null ? trl : ""));
return builder.build();
}
else
{
return ImmutableMap.copyOf(trls);
}
}
@Override
@Deprecated
public String toString()
{
return defaultValue;
}
@Override
public String translate(final String adLanguage)
|
{
return trlMap.getOrDefault(adLanguage, defaultValue);
}
@Override
public String getDefaultValue()
{
return defaultValue;
}
@Override
public Set<String> getAD_Languages()
{
return trlMap.keySet();
}
@JsonIgnore // needed for snapshot testing
public boolean isEmpty()
{
return defaultValue.isEmpty()
&& trlMap.values().stream().allMatch(String::isEmpty);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\i18n\ImmutableTranslatableString.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private Map<EdgeId, Long> getLagByEdgeId(Map<EdgeId, MsgCounters> countersByEdge) {
Map<EdgeId, String> edgeToTopicMap = countersByEdge.entrySet().stream()
.collect(Collectors.toMap(
Map.Entry::getKey,
e -> topicService.buildEdgeEventNotificationsTopicPartitionInfo(e.getValue().getTenantId(), e.getKey()).getTopic()
));
Map<String, Long> lagByTopic = kafkaAdmin.get().getTotalLagForGroupsBulk(new HashSet<>(edgeToTopicMap.values()));
return edgeToTopicMap.entrySet().stream()
.collect(Collectors.toMap(
Map.Entry::getKey,
e -> lagByTopic.getOrDefault(e.getValue(), 0L)
));
}
private void saveTs(TenantId tenantId, EdgeId edgeId, List<TsKvEntry> statsEntries) {
try {
ListenableFuture<TimeseriesSaveResult> future = tsService.save(
tenantId,
edgeId,
statsEntries,
TimeUnit.DAYS.toSeconds(edgesStatsTtlDays)
);
|
Futures.addCallback(future, new FutureCallback<>() {
@Override
public void onSuccess(TimeseriesSaveResult result) {
log.debug("Successfully saved edge time-series stats: {} for edge: {}", statsEntries, edgeId);
}
@Override
public void onFailure(Throwable t) {
log.warn("Failed to save edge time-series stats for edge: {}", edgeId, t);
}
}, MoreExecutors.directExecutor());
} finally {
statsCounterService.clear(edgeId);
}
}
private BasicTsKvEntry entry(long ts, String key, long value) {
return new BasicTsKvEntry(ts, new LongDataEntry(key, value));
}
}
|
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\edge\stats\EdgeStatsService.java
| 2
|
请完成以下Java代码
|
public List<IWord> flow(List<IWord> input)
{
return input;
}
}
);
add(analyzer);
}
/**
* 获取代理的词法分析器
*
* @return
*/
public LexicalAnalyzer getAnalyzer()
{
for (Pipe<List<IWord>, List<IWord>> pipe : this)
{
if (pipe instanceof LexicalAnalyzerPipe)
{
return ((LexicalAnalyzerPipe) pipe).analyzer;
}
}
return null;
}
@Override
public void segment(String sentence, String normalized, List<String> wordList)
{
LexicalAnalyzer analyzer = getAnalyzer();
if (analyzer == null)
throw new IllegalStateException("流水线中没有LexicalAnalyzerPipe");
analyzer.segment(sentence, normalized, wordList);
}
@Override
public List<String> segment(String sentence)
{
LexicalAnalyzer analyzer = getAnalyzer();
if (analyzer == null)
throw new IllegalStateException("流水线中没有LexicalAnalyzerPipe");
return analyzer.segment(sentence);
}
@Override
public String[] recognize(String[] wordArray, String[] posArray)
{
LexicalAnalyzer analyzer = getAnalyzer();
if (analyzer == null)
throw new IllegalStateException("流水线中没有LexicalAnalyzerPipe");
return analyzer.recognize(wordArray, posArray);
}
|
@Override
public String[] tag(String... words)
{
LexicalAnalyzer analyzer = getAnalyzer();
if (analyzer == null)
throw new IllegalStateException("流水线中没有LexicalAnalyzerPipe");
return analyzer.tag(words);
}
@Override
public String[] tag(List<String> wordList)
{
LexicalAnalyzer analyzer = getAnalyzer();
if (analyzer == null)
throw new IllegalStateException("流水线中没有LexicalAnalyzerPipe");
return analyzer.tag(wordList);
}
@Override
public NERTagSet getNERTagSet()
{
LexicalAnalyzer analyzer = getAnalyzer();
if (analyzer == null)
throw new IllegalStateException("流水线中没有LexicalAnalyzerPipe");
return analyzer.getNERTagSet();
}
@Override
public Sentence analyze(String sentence)
{
return new Sentence(flow(sentence));
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\tokenizer\pipe\LexicalAnalyzerPipeline.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class CompleteDistributionWFActivityHandler implements WFActivityHandler, UserConfirmationSupport
{
public static final WFActivityType HANDLED_ACTIVITY_TYPE = WFActivityType.ofString("distribution.complete");
@NonNull private final DistributionRestService distributionRestService;
@Override
public WFActivityType getHandledActivityType()
{
return HANDLED_ACTIVITY_TYPE;
}
@Override
public UIComponent getUIComponent(
final @NonNull WFProcess wfProcess,
final @NonNull WFActivity wfActivity,
final @NonNull JsonOpts jsonOpts)
{
return UserConfirmationSupportUtil.createUIComponent(
UserConfirmationSupportUtil.UIComponentProps.builderFrom(wfActivity)
.question(TranslatableStrings.adMessage(ARE_YOU_SURE).translate(jsonOpts.getAdLanguage()))
.build());
}
|
@Override
public WFActivityStatus computeActivityState(final WFProcess wfProcess, final WFActivity completeDistributionWFActivity)
{
final DistributionJob job = DistributionMobileApplication.getDistributionJob(wfProcess);
return computeActivityState(job);
}
public static WFActivityStatus computeActivityState(final DistributionJob job)
{
return job.isClosed() ? WFActivityStatus.COMPLETED : WFActivityStatus.NOT_STARTED;
}
@Override
public WFProcess userConfirmed(final UserConfirmationRequest request)
{
request.assertActivityType(HANDLED_ACTIVITY_TYPE);
return DistributionMobileApplication.mapDocument(request.getWfProcess(), distributionRestService::complete);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.distribution.rest-api\src\main\java\de\metas\distribution\mobileui\workflows_api\activity_handlers\CompleteDistributionWFActivityHandler.java
| 2
|
请完成以下Spring Boot application配置
|
#
# these properties are local to my dev environment
#
server.port=8181
spring.rabbitmq.host=localhost
# spring.rabbitmq.host=192.168.99.100 # note: 192.168.99.100 is probably the correct IP if it runs in minikube on your local virtualbox
spring.rabbitmq.port=${RABBITMQ_PORT:30050}
spring.rabbitmq.username=guest
spring.rabbitmq.password=guest
# set those two properties via ENV vars in order to enable ssl when connecting to rabbitMQ
# spring.rabbitm
|
q.ssl.enabled=true
# spring.rabbitmq.ssl.validate-server-certificate=false
#spring.boot.admin.url=http://localhost:30060
management.security.enabled=false
spring.boot.admin.client.prefer-ip=true
|
repos\metasfresh-new_dawn_uat\misc\dev-support\application.properties\metasfresh\backend\de.metas.report\metasfresh-report-service-standalone\src\main\resources\application.properties
| 2
|
请完成以下Java代码
|
public String getMemberIcon() {
return memberIcon;
}
public void setMemberIcon(String memberIcon) {
this.memberIcon = memberIcon;
}
public Integer getReplayCount() {
return replayCount;
}
public void setReplayCount(Integer replayCount) {
this.replayCount = replayCount;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
@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(", productId=").append(productId);
|
sb.append(", memberNickName=").append(memberNickName);
sb.append(", productName=").append(productName);
sb.append(", star=").append(star);
sb.append(", memberIp=").append(memberIp);
sb.append(", createTime=").append(createTime);
sb.append(", showStatus=").append(showStatus);
sb.append(", productAttribute=").append(productAttribute);
sb.append(", collectCouont=").append(collectCouont);
sb.append(", readCount=").append(readCount);
sb.append(", pics=").append(pics);
sb.append(", memberIcon=").append(memberIcon);
sb.append(", replayCount=").append(replayCount);
sb.append(", content=").append(content);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
|
repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\PmsComment.java
| 1
|
请完成以下Java代码
|
public String getProperty(final String key)
{
if (key == null)
{
return "";
}
if (props == null)
{
return "";
}
final String value = props.getProperty(key, "");
if (Check.isEmpty(value))
{
return "";
}
return value;
}
/**
* Get Property as Boolean
*
|
* @param key Key
* @return Value
*/
public boolean isPropertyBool(final String key)
{
final String value = getProperty(key);
return DisplayType.toBooleanNonNull(value, false);
}
public void updateContext(final Properties ctx)
{
Env.setContext(ctx, "#ShowTrl", true);
Env.setContext(ctx, "#ShowAdvanced", true);
Env.setAutoCommit(ctx, isPropertyBool(P_AUTO_COMMIT));
Env.setAutoNew(ctx, isPropertyBool(P_AUTO_NEW));
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\session\UserPreference.java
| 1
|
请完成以下Java代码
|
public class X_AD_Role_OrgAccess extends org.compiere.model.PO implements I_AD_Role_OrgAccess, org.compiere.model.I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 936006794L;
/** Standard Constructor */
public X_AD_Role_OrgAccess (Properties ctx, int AD_Role_OrgAccess_ID, String trxName)
{
super (ctx, AD_Role_OrgAccess_ID, trxName);
/** if (AD_Role_OrgAccess_ID == 0)
{
setAD_Role_ID (0);
setAD_Role_OrgAccess_ID (0);
setIsReadOnly (false);
} */
}
/** Load Constructor */
public X_AD_Role_OrgAccess (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** Load Meta Data */
@Override
protected org.compiere.model.POInfo initPO (Properties ctx)
{
org.compiere.model.POInfo poi = org.compiere.model.POInfo.getPOInfo (ctx, Table_Name, get_TrxName());
return poi;
}
@Override
public org.compiere.model.I_AD_Role getAD_Role() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_AD_Role_ID, org.compiere.model.I_AD_Role.class);
}
@Override
public void setAD_Role(org.compiere.model.I_AD_Role AD_Role)
{
set_ValueFromPO(COLUMNNAME_AD_Role_ID, org.compiere.model.I_AD_Role.class, AD_Role);
}
/** Set Rolle.
@param AD_Role_ID
Responsibility Role
*/
@Override
public void setAD_Role_ID (int AD_Role_ID)
{
if (AD_Role_ID < 0)
set_ValueNoCheck (COLUMNNAME_AD_Role_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_Role_ID, Integer.valueOf(AD_Role_ID));
}
/** Get Rolle.
@return Responsibility Role
|
*/
@Override
public int getAD_Role_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Role_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set AD_Role_OrgAccess.
@param AD_Role_OrgAccess_ID AD_Role_OrgAccess */
@Override
public void setAD_Role_OrgAccess_ID (int AD_Role_OrgAccess_ID)
{
if (AD_Role_OrgAccess_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_Role_OrgAccess_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_Role_OrgAccess_ID, Integer.valueOf(AD_Role_OrgAccess_ID));
}
/** Get AD_Role_OrgAccess.
@return AD_Role_OrgAccess */
@Override
public int getAD_Role_OrgAccess_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Role_OrgAccess_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Schreibgeschützt.
@param IsReadOnly
Field is read only
*/
@Override
public void setIsReadOnly (boolean IsReadOnly)
{
set_Value (COLUMNNAME_IsReadOnly, Boolean.valueOf(IsReadOnly));
}
/** Get Schreibgeschützt.
@return Field is read only
*/
@Override
public boolean isReadOnly ()
{
Object oo = get_Value(COLUMNNAME_IsReadOnly);
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_AD_Role_OrgAccess.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class BookController {
private static final String BOOK_FORM_PATH_NAME = "bookForm";
private static final String BOOK_LIST_PATH_NAME = "bookList";
private static final String REDIRECT_TO_BOOK_URL = "redirect:/book";
@Autowired
BookService bookService;
/**
* 获取 Book 列表
* 处理 "/book" 的 GET 请求,用来获取 Book 列表
*/
@RequestMapping(method = RequestMethod.GET)
public String getBookList(ModelMap map) {
map.addAttribute("bookList",bookService.findAll());
return BOOK_LIST_PATH_NAME;
}
/**
* 获取创建 Book 表单
*/
@RequestMapping(value = "/create", method = RequestMethod.GET)
public String createBookForm(ModelMap map) {
map.addAttribute("book", new Book());
map.addAttribute("action", "create");
return BOOK_FORM_PATH_NAME;
}
/**
* 创建 Book
* 处理 "/book/create" 的 POST 请求,用来新建 Book 信息
* 通过 @ModelAttribute 绑定表单实体参数,也通过 @RequestParam 传递参数
*/
@RequestMapping(value = "/create", method = RequestMethod.POST)
public String postBook(@ModelAttribute Book book) {
bookService.insertByBook(book);
return REDIRECT_TO_BOOK_URL;
}
/**
* 获取更新 Book 表单
* 处理 "/book/update/{id}" 的 GET 请求,通过 URL 中的 id 值获取 Book 信息
* URL 中的 id ,通过 @PathVariable 绑定参数
*/
@RequestMapping(value = "/update/{id}", method = RequestMethod.GET)
public String getUser(@PathVariable Long id, ModelMap map) {
map.addAttribute("book", bookService.findById(id));
map.addAttribute("action", "update");
return BOOK_FORM_PATH_NAME;
}
|
/**
* 更新 Book
* 处理 "/update" 的 PUT 请求,用来更新 Book 信息
*/
@RequestMapping(value = "/update", method = RequestMethod.POST)
public String putBook(@ModelAttribute Book book) {
bookService.update(book);
return REDIRECT_TO_BOOK_URL;
}
/**
* 删除 Book
* 处理 "/book/{id}" 的 GET 请求,用来删除 Book 信息
*/
@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
public String deleteBook(@PathVariable Long id) {
bookService.delete(id);
return REDIRECT_TO_BOOK_URL;
}
}
|
repos\springboot-learning-example-master\chapter-5-spring-boot-data-jpa\src\main\java\demo\springboot\web\BookController.java
| 2
|
请完成以下Java代码
|
public String getEntityType ()
{
return (String)get_Value(COLUMNNAME_EntityType);
}
/** Set Included_Val_Rule_ID.
@param Included_Val_Rule_ID
Validation rule to be included.
*/
public void setIncluded_Val_Rule_ID (int Included_Val_Rule_ID)
{
if (Included_Val_Rule_ID < 1)
set_ValueNoCheck (COLUMNNAME_Included_Val_Rule_ID, null);
else
set_ValueNoCheck (COLUMNNAME_Included_Val_Rule_ID, Integer.valueOf(Included_Val_Rule_ID));
}
/** Get Included_Val_Rule_ID.
@return Validation rule to be included.
*/
public int getIncluded_Val_Rule_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Included_Val_Rule_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Reihenfolge.
|
@param SeqNo
Zur Bestimmung der Reihenfolge der Einträge; die kleinste Zahl kommt zuerst
*/
public void setSeqNo (String SeqNo)
{
set_Value (COLUMNNAME_SeqNo, SeqNo);
}
/** Get Reihenfolge.
@return Zur Bestimmung der Reihenfolge der Einträge; die kleinste Zahl kommt zuerst
*/
public String getSeqNo ()
{
return (String)get_Value(COLUMNNAME_SeqNo);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Val_Rule_Included.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class Book {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String name;
public Book() {
}
public Book(String name) {
this.name = name;
}
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;
}
@Override
public String toString() {
return "Book [id=" + id + ", name=" + name + "]";
}
}
|
repos\tutorials-master\persistence-modules\spring-boot-persistence-2\src\main\java\com\baeldung\spring\oracle\pooling\entity\Book.java
| 2
|
请完成以下Java代码
|
protected void onAfterInit()
{
// Do not initialize if the printing module is disabled
if (!checkPrintingEnabled())
{
return;
}
Services.get(IPrintingQueueBL.class).registerHandler(DocumentPrintingQueueHandler.instance);
// task 09833
// Register the Default Printing Info ctx provider
Services.get(INotificationBL.class).setDefaultCtxProvider(DefaultPrintingRecordTextProvider.instance);
Services.get(IAsyncBatchListeners.class).registerAsyncBatchNoticeListener(new PDFPrintingAsyncBatchListener(), Printing_Constants.C_Async_Batch_InternalName_PDFPrinting);
Services.get(IAsyncBatchListeners.class).registerAsyncBatchNoticeListener(new AutomaticallyInvoicePdfPrintinAsyncBatchListener(), Async_Constants.C_Async_Batch_InternalName_AutomaticallyInvoicePdfPrinting);
}
@Override
protected List<Topic> getAvailableUserNotificationsTopics()
|
{
return ImmutableList.of(Printing_Constants.USER_NOTIFICATIONS_TOPIC);
}
@Override
public void onUserLogin(final int AD_Org_ID, final int AD_Role_ID, final int AD_User_ID)
{
// make sure that the host key is set in the context
if (checkPrintingEnabled())
{
final Properties ctx = Env.getCtx();
final MFSession session = Services.get(ISessionBL.class).getCurrentSession(ctx);
session.getOrCreateHostKey(ctx);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.printing\de.metas.printing.base\src\main\java\de\metas\printing\model\validator\Main.java
| 1
|
请完成以下Java代码
|
public boolean put(K key, V value) {
this.lock.writeLock().lock();
try {
CacheElement<K, V> item = new CacheElement<K, V>(key, value);
LinkedListNode<CacheElement<K, V>> newNode;
if (this.linkedListNodeMap.containsKey(key)) {
LinkedListNode<CacheElement<K, V>> node = this.linkedListNodeMap.get(key);
newNode = doublyLinkedList.updateAndMoveToFront(node, item);
} else {
if (this.size() >= this.size) {
this.evictElement();
}
newNode = this.doublyLinkedList.add(item);
}
if (newNode.isEmpty()) {
return false;
}
this.linkedListNodeMap.put(key, newNode);
return true;
} finally {
this.lock.writeLock().unlock();
}
}
@Override
public Optional<V> get(K key) {
this.lock.readLock().lock();
try {
LinkedListNode<CacheElement<K, V>> linkedListNode = this.linkedListNodeMap.get(key);
if (linkedListNode != null && !linkedListNode.isEmpty()) {
linkedListNodeMap.put(key, this.doublyLinkedList.moveToFront(linkedListNode));
return Optional.of(linkedListNode.getElement().getValue());
}
return Optional.empty();
} finally {
this.lock.readLock().unlock();
}
}
@Override
public int size() {
this.lock.readLock().lock();
try {
return doublyLinkedList.size();
} finally {
this.lock.readLock().unlock();
}
}
@Override
public boolean isEmpty() {
return size() == 0;
}
@Override
public void clear() {
|
this.lock.writeLock().lock();
try {
linkedListNodeMap.clear();
doublyLinkedList.clear();
} finally {
this.lock.writeLock().unlock();
}
}
private boolean evictElement() {
this.lock.writeLock().lock();
try {
LinkedListNode<CacheElement<K, V>> linkedListNode = doublyLinkedList.removeTail();
if (linkedListNode.isEmpty()) {
return false;
}
linkedListNodeMap.remove(linkedListNode.getElement().getKey());
return true;
} finally {
this.lock.writeLock().unlock();
}
}
}
|
repos\tutorials-master\data-structures\src\main\java\com\baeldung\lrucache\LRUCache.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private void setAllowBeanDefinitionOverriding(Map<String, Object> defaultProperties) {
defaultProperties.put(ALLOW_BEAN_DEFINITION_OVERRIDING_PROPERTY, Boolean.TRUE.toString());
}
/**
* Copy from BusEnvironmentPostProcessor#addOrReplace(MutablePropertySources, Map)
*
* @param propertySources {@link MutablePropertySources}
* @param map Default Dubbo Properties
*/
private void addOrReplace(MutablePropertySources propertySources,
Map<String, Object> map) {
MapPropertySource target = null;
if (propertySources.contains(PROPERTY_SOURCE_NAME)) {
PropertySource<?> source = propertySources.get(PROPERTY_SOURCE_NAME);
if (source instanceof MapPropertySource) {
target = (MapPropertySource) source;
|
for (String key : map.keySet()) {
if (!target.containsProperty(key)) {
target.getSource().put(key, map.get(key));
}
}
}
}
if (target == null) {
target = new MapPropertySource(PROPERTY_SOURCE_NAME, map);
}
if (!propertySources.contains(PROPERTY_SOURCE_NAME)) {
propertySources.addLast(target);
}
}
}
|
repos\dubbo-spring-boot-project-master\dubbo-spring-boot-compatible\autoconfigure\src\main\java\org\apache\dubbo\spring\boot\env\DubboDefaultPropertiesEnvironmentPostProcessor.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public void setHandlerType(String handlerType) {
this.handlerType = handlerType;
}
@ApiModelProperty(example = "cmmn-trigger-timer")
public String getHandlerType() {
return handlerType;
}
@ApiModelProperty(example = "3")
public Integer getRetries() {
return retries;
}
public void setRetries(Integer retries) {
this.retries = retries;
}
@ApiModelProperty(example = "null")
public String getExceptionMessage() {
return exceptionMessage;
}
public void setExceptionMessage(String exceptionMessage) {
this.exceptionMessage = exceptionMessage;
}
@ApiModelProperty(example = "2023-06-04T22:05:05.474+0000")
public Date getDueDate() {
return dueDate;
}
public void setDueDate(Date dueDate) {
this.dueDate = dueDate;
}
@ApiModelProperty(example = "2023-06-03T22:05:05.474+0000")
public Date getCreateTime() {
|
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@ApiModelProperty(example = "node1")
public String getLockOwner() {
return lockOwner;
}
public void setLockOwner(String lockOwner) {
this.lockOwner = lockOwner;
}
@ApiModelProperty(example = "2023-06-03T22:05:05.474+0000")
public Date getLockExpirationTime() {
return lockExpirationTime;
}
public void setLockExpirationTime(Date lockExpirationTime) {
this.lockExpirationTime = lockExpirationTime;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
@ApiModelProperty(example = "null")
public String getTenantId() {
return tenantId;
}
}
|
repos\flowable-engine-main\modules\flowable-cmmn-rest\src\main\java\org\flowable\cmmn\rest\service\api\management\JobResponse.java
| 2
|
请完成以下Spring Boot application配置
|
spring.datasource.url=jdbc:mysql://localhost:3306/bookstoredb?createDatabaseIfNotExist=true
spring.datasource.username=root
spring.datasource.password=root
spring.jpa.hibernate.ddl-auto=create
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.open-in-view=false
logging.level.ROOT=INFO
logging.le
|
vel.org.springframework.orm.jpa=DEBUG
logging.level.org.springframework.transaction=DEBUG
# global transaction timeout
# spring.transaction.default-timeout=10
|
repos\Hibernate-SpringBoot-master\HibernateSpringBootTransactionTimeout\src\main\resources\application.properties
| 2
|
请完成以下Java代码
|
public void deleteOrderBOMLinesByOrderId(@NonNull final PPOrderId orderId)
{
final List<I_PP_Order_BOMLine> lines = queryBL
.createQueryBuilder(I_PP_Order_BOMLine.class)
.addEqualsFilter(I_PP_Order_BOMLine.COLUMN_PP_Order_ID, orderId)
// .addOnlyActiveRecordsFilter()
.create()
.list();
for (final I_PP_Order_BOMLine line : lines)
{
line.setProcessed(false);
InterfaceWrapperHelper.delete(line);
}
}
@Override
public int retrieveNextLineNo(@NonNull final PPOrderId orderId)
{
Integer maxLine = queryBL
.createQueryBuilder(I_PP_Order_BOMLine.class)
.addEqualsFilter(I_PP_Order_BOMLine.COLUMNNAME_PP_Order_ID, orderId)
.create()
.aggregate(I_PP_Order_BOMLine.COLUMNNAME_Line, Aggregate.MAX, Integer.class);
if (maxLine == null)
{
maxLine = 0;
}
final int nextLine = maxLine + 10;
return nextLine;
}
@Override
public void save(@NonNull final I_PP_Order_BOM orderBOM)
{
saveRecord(orderBOM);
}
@Override
public void save(@NonNull final I_PP_Order_BOMLine orderBOMLine)
{
saveRecord(orderBOMLine);
}
@Override
|
public void deleteByOrderId(@NonNull final PPOrderId orderId)
{
final I_PP_Order_BOM orderBOM = getByOrderIdOrNull(orderId);
if (orderBOM != null)
{
InterfaceWrapperHelper.delete(orderBOM);
}
}
@Override
public void markBOMLinesAsProcessed(@NonNull final PPOrderId orderId)
{
for (final I_PP_Order_BOMLine orderBOMLine : retrieveOrderBOMLines(orderId))
{
orderBOMLine.setProcessed(true);
save(orderBOMLine);
}
}
@Override
public void markBOMLinesAsNotProcessed(@NonNull final PPOrderId orderId)
{
for (final I_PP_Order_BOMLine orderBOMLine : retrieveOrderBOMLines(orderId))
{
orderBOMLine.setProcessed(false);
save(orderBOMLine);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.material\planning\src\main\java\de\metas\material\planning\pporder\impl\PPOrderBOMDAO.java
| 1
|
请完成以下Java代码
|
protected void suspending(CmmnActivityExecution execution) {
String id = execution.getId();
Context
.getCommandContext()
.getTaskManager()
.updateTaskSuspensionStateByCaseExecutionId(id, SuspensionState.SUSPENDED);
}
protected void resuming(CmmnActivityExecution execution) {
String id = execution.getId();
Context
.getCommandContext()
.getTaskManager()
.updateTaskSuspensionStateByCaseExecutionId(id, SuspensionState.ACTIVE);
}
protected TaskEntity getTask(CmmnActivityExecution execution) {
return Context
.getCommandContext()
.getTaskManager()
.findTaskByCaseExecutionId(execution.getId());
}
protected String getTypeName() {
return "human task";
}
|
// getters/setters /////////////////////////////////////////////////
public TaskDecorator getTaskDecorator() {
return taskDecorator;
}
public void setTaskDecorator(TaskDecorator taskDecorator) {
this.taskDecorator = taskDecorator;
}
public TaskDefinition getTaskDefinition() {
return taskDecorator.getTaskDefinition();
}
public ExpressionManager getExpressionManager() {
return taskDecorator.getExpressionManager();
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmmn\behavior\HumanTaskActivityBehavior.java
| 1
|
请完成以下Java代码
|
public ResponseEntity<BaseResponse> doBind(@RequestHeader(name="Content-Type", defaultValue = "application/json") String contentType,
@RequestHeader(name="Authorization", defaultValue="token") String token,
@RequestBody BindParam bindParam) {
_logger.info("请求绑定网点接口 start....");
BaseResponse result = new BaseResponse();
result.setSuccess(true);
result.setMsg("绑定网点成功");
return new ResponseEntity<>(result, HttpStatus.OK);
}
/**
* 报告位置接口
*
* @return 报告结果
*/
@ApiOperation(value = "报告位置接口", notes = "终端设备定时报告位置信息", produces = "application/json")
@RequestMapping(value = "/report", method = RequestMethod.POST)
public BaseResponse report(@RequestHeader(name="Content-Type", defaultValue = "application/json") String contentType,
@RequestHeader(name="Authorization", defaultValue="token") String token,
@RequestBody ReportParam param) {
_logger.info("定时报告接口 start....");
BaseResponse result = new BaseResponse();
result.setSuccess(true);
result.setMsg("心跳报告成功");
return result;
}
/**
* 版本检查接口
*
* @return 版本检查结果
*/
@ApiOperation(value = "APP版本更新检查", notes = "APP版本更新检查", produces = "application/json")
@RequestMapping(value = "/version", method = RequestMethod.POST)
|
public VersionResult version(@RequestHeader(name="Content-Type", defaultValue = "application/json") String contentType,
@RequestHeader(name="Authorization", defaultValue="token") String token,
@RequestBody VersionParam param) {
_logger.info("版本检查接口 start....");
VersionResult result = new VersionResult();
result.setAppName("AppName");
result.setDownloadUrl("http://www.baidu.com/");
result.setFindNew(true);
result.setPublishtime(new Date());
result.setTips("tips");
result.setVersion("v1.2");
return result;
}
}
|
repos\SpringBootBucket-master\springboot-swagger2\src\main\java\com\xncoding\jwt\api\PublicController.java
| 1
|
请完成以下Java代码
|
public class AddIdentityLinkForProcessInstanceCmd implements Command<Void>, Serializable {
private static final long serialVersionUID = 1L;
protected String processInstanceId;
protected String userId;
protected String groupId;
protected String type;
public AddIdentityLinkForProcessInstanceCmd(String processInstanceId, String userId, String groupId, String type) {
validateParams(processInstanceId, userId, groupId, type);
this.processInstanceId = processInstanceId;
this.userId = userId;
this.groupId = groupId;
this.type = type;
}
protected void validateParams(String processInstanceId, String userId, String groupId, String type) {
if (processInstanceId == null) {
throw new FlowableIllegalArgumentException("processInstanceId is null");
}
if (type == null) {
throw new FlowableIllegalArgumentException("type is required when adding a new process instance identity link");
}
if (userId == null && groupId == null) {
throw new FlowableIllegalArgumentException("userId and groupId cannot both be null");
}
|
}
@Override
public Void execute(CommandContext commandContext) {
ExecutionEntityManager executionEntityManager = CommandContextUtil.getExecutionEntityManager(commandContext);
ExecutionEntity processInstance = executionEntityManager.findById(processInstanceId);
if (processInstance == null) {
throw new FlowableObjectNotFoundException("Cannot find process instance with id " + processInstanceId, ExecutionEntity.class);
}
if (Flowable5Util.isFlowable5ProcessDefinitionId(commandContext, processInstance.getProcessDefinitionId())) {
Flowable5CompatibilityHandler compatibilityHandler = Flowable5Util.getFlowable5CompatibilityHandler();
compatibilityHandler.addIdentityLinkForProcessInstance(processInstanceId, userId, groupId, type);
return null;
}
IdentityLinkUtil.createProcessInstanceIdentityLink(processInstance, userId, groupId, type);
CommandContextUtil.getHistoryManager(commandContext).createProcessInstanceIdentityLinkComment(processInstance, userId, groupId, type, true);
return null;
}
}
|
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\cmd\AddIdentityLinkForProcessInstanceCmd.java
| 1
|
请完成以下Java代码
|
public void setC_Queue_WorkPackage(de.metas.async.model.I_C_Queue_WorkPackage C_Queue_WorkPackage)
{
set_ValueFromPO(COLUMNNAME_C_Queue_WorkPackage_ID, de.metas.async.model.I_C_Queue_WorkPackage.class, C_Queue_WorkPackage);
}
/** Set WorkPackage Queue.
@param C_Queue_WorkPackage_ID WorkPackage Queue */
@Override
public void setC_Queue_WorkPackage_ID (int C_Queue_WorkPackage_ID)
{
if (C_Queue_WorkPackage_ID < 1)
set_Value (COLUMNNAME_C_Queue_WorkPackage_ID, null);
else
set_Value (COLUMNNAME_C_Queue_WorkPackage_ID, Integer.valueOf(C_Queue_WorkPackage_ID));
}
/** Get WorkPackage Queue.
@return WorkPackage Queue */
@Override
public int getC_Queue_WorkPackage_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Queue_WorkPackage_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set WorkPackage Notified.
@param C_Queue_WorkPackage_Notified_ID WorkPackage Notified */
@Override
public void setC_Queue_WorkPackage_Notified_ID (int C_Queue_WorkPackage_Notified_ID)
{
if (C_Queue_WorkPackage_Notified_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_Queue_WorkPackage_Notified_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_Queue_WorkPackage_Notified_ID, Integer.valueOf(C_Queue_WorkPackage_Notified_ID));
}
|
/** Get WorkPackage Notified.
@return WorkPackage Notified */
@Override
public int getC_Queue_WorkPackage_Notified_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Queue_WorkPackage_Notified_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Notified.
@param IsNotified Notified */
@Override
public void setIsNotified (boolean IsNotified)
{
set_Value (COLUMNNAME_IsNotified, Boolean.valueOf(IsNotified));
}
/** Get Notified.
@return Notified */
@Override
public boolean isNotified ()
{
Object oo = get_Value(COLUMNNAME_IsNotified);
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.async\src\main\java-gen\de\metas\async\model\X_C_Queue_WorkPackage_Notified.java
| 1
|
请完成以下Java代码
|
public String[] tag(List<String> wordList)
{
String[] words = new String[wordList.size()];
wordList.toArray(words);
return tag(words);
}
@Override
public String[] tag(String... words)
{
return perceptronPOSTagger.tag(createInstance(words));
}
private POSInstance createInstance(String[] words)
{
final FeatureTemplate[] featureTemplateArray = model.getFeatureTemplateArray();
final String[][] table = new String[words.length][5];
for (int i = 0; i < words.length; i++)
{
extractFeature(words[i], table[i]);
}
return new POSInstance(words, model.featureMap)
{
@Override
protected int[] extractFeature(String[] words, FeatureMap featureMap, int position)
{
StringBuilder sbFeature = new StringBuilder();
List<Integer> featureVec = new LinkedList<Integer>();
for (int i = 0; i < featureTemplateArray.length; i++)
{
|
Iterator<int[]> offsetIterator = featureTemplateArray[i].offsetList.iterator();
Iterator<String> delimiterIterator = featureTemplateArray[i].delimiterList.iterator();
delimiterIterator.next(); // ignore U0 之类的id
while (offsetIterator.hasNext())
{
int[] offset = offsetIterator.next();
int t = offset[0] + position;
int j = offset[1];
if (t < 0)
sbFeature.append(FeatureIndex.BOS[-(t + 1)]);
else if (t >= words.length)
sbFeature.append(FeatureIndex.EOS[t - words.length]);
else
sbFeature.append(table[t][j]);
if (delimiterIterator.hasNext())
sbFeature.append(delimiterIterator.next());
else
sbFeature.append(i);
}
addFeatureThenClear(sbFeature, featureVec, featureMap);
}
return toFeatureArray(featureVec);
}
};
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\model\crf\CRFPOSTagger.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
protected void registerIntegrationPropertiesPropertySource(ConfigurableEnvironment environment, Resource resource) {
PropertiesPropertySourceLoader loader = new PropertiesPropertySourceLoader();
try {
OriginTrackedMapPropertySource propertyFileSource = (OriginTrackedMapPropertySource) loader
.load("META-INF/spring.integration.properties", resource)
.get(0);
environment.getPropertySources().addLast(new IntegrationPropertiesPropertySource(propertyFileSource));
}
catch (IOException ex) {
throw new IllegalStateException("Failed to load integration properties from " + resource, ex);
}
}
private static final class IntegrationPropertiesPropertySource extends PropertySource<Map<String, Object>>
implements OriginLookup<String> {
private static final String PREFIX = "spring.integration.";
private static final Map<String, String> KEYS_MAPPING;
static {
Map<String, String> mappings = new HashMap<>();
mappings.put(PREFIX + "channel.auto-create", IntegrationProperties.CHANNELS_AUTOCREATE);
mappings.put(PREFIX + "channel.max-unicast-subscribers",
IntegrationProperties.CHANNELS_MAX_UNICAST_SUBSCRIBERS);
mappings.put(PREFIX + "channel.max-broadcast-subscribers",
IntegrationProperties.CHANNELS_MAX_BROADCAST_SUBSCRIBERS);
mappings.put(PREFIX + "error.require-subscribers", IntegrationProperties.ERROR_CHANNEL_REQUIRE_SUBSCRIBERS);
mappings.put(PREFIX + "error.ignore-failures", IntegrationProperties.ERROR_CHANNEL_IGNORE_FAILURES);
|
mappings.put(PREFIX + "endpoint.default-timeout", IntegrationProperties.ENDPOINTS_DEFAULT_TIMEOUT);
mappings.put(PREFIX + "endpoint.throw-exception-on-late-reply",
IntegrationProperties.THROW_EXCEPTION_ON_LATE_REPLY);
mappings.put(PREFIX + "endpoint.read-only-headers", IntegrationProperties.READ_ONLY_HEADERS);
mappings.put(PREFIX + "endpoint.no-auto-startup", IntegrationProperties.ENDPOINTS_NO_AUTO_STARTUP);
KEYS_MAPPING = Collections.unmodifiableMap(mappings);
}
private final OriginTrackedMapPropertySource delegate;
IntegrationPropertiesPropertySource(OriginTrackedMapPropertySource delegate) {
super("META-INF/spring.integration.properties", delegate.getSource());
this.delegate = delegate;
}
@Override
public @Nullable Object getProperty(String name) {
String mapped = KEYS_MAPPING.get(name);
return (mapped != null) ? this.delegate.getProperty(mapped) : null;
}
@Override
public @Nullable Origin getOrigin(String key) {
String mapped = KEYS_MAPPING.get(key);
return (mapped != null) ? this.delegate.getOrigin(mapped) : null;
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-integration\src\main\java\org\springframework\boot\integration\autoconfigure\IntegrationPropertiesEnvironmentPostProcessor.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
Output div(Output x, Output y) {
return binaryOp("Div", x, y);
}
Output sub(Output x, Output y) {
return binaryOp("Sub", x, y);
}
Output resizeBilinear(Output images, Output size) {
return binaryOp("ResizeBilinear", images, size);
}
Output expandDims(Output input, Output dim) {
return binaryOp("ExpandDims", input, dim);
}
Output cast(Output value, DataType dtype) {
return g.opBuilder("Cast", "Cast", scope).addInput(value).setAttr("DstT", dtype).build().output(0);
}
Output decodeJpeg(Output contents, long channels) {
return g.opBuilder("DecodeJpeg", "DecodeJpeg", scope)
.addInput(contents)
.setAttr("channels", channels)
.build()
.output(0);
}
Output<? extends TType> constant(String name, Tensor t) {
return g.opBuilder("Const", name, scope)
.setAttr("dtype", t.dataType())
|
.setAttr("value", t)
.build()
.output(0);
}
private Output binaryOp(String type, Output in1, Output in2) {
return g.opBuilder(type, type, scope).addInput(in1).addInput(in2).build().output(0);
}
private final Graph g;
}
@PreDestroy
public void close() {
session.close();
}
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class LabelWithProbability {
private String label;
private float probability;
private long elapsed;
}
}
|
repos\springboot-demo-master\Tensorflow\src\main\java\com\et\tf\service\ClassifyImageService.java
| 2
|
请完成以下Java代码
|
public class SystecResultStringElement
{
private final String name;
private final int startByte;
private final int length;
private final Format format;
public SystecResultStringElement(final String name, final int startByte, final int length, final Format format)
{
this.name = name;
this.startByte = startByte;
this.length = length;
this.format = format;
}
public String getName()
{
return name;
}
public int getStartByte()
{
return startByte;
}
|
public int getLength()
{
return length;
}
public Format getFormat()
{
return format;
}
@Override
public String toString()
{
return String.format("SystecResultStringElement [name=%s, startByte=%s, length=%s, format=%s]", name, startByte, length, format);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.device.scales\src\main\java\de\metas\device\scales\impl\systec\SystecResultStringElement.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class DatabaseItemWriterDemo {
@Autowired
private JobBuilderFactory jobBuilderFactory;
@Autowired
private StepBuilderFactory stepBuilderFactory;
@Autowired
private ListItemReader<TestData> simpleReader;
@Autowired
private DataSource dataSource;
@Bean
public Job datasourceItemWriterJob() {
return jobBuilderFactory.get("datasourceItemWriterJob")
.start(step())
.build();
}
private Step step() {
return stepBuilderFactory.get("step")
.<TestData, TestData>chunk(2)
.reader(simpleReader)
.writer(dataSourceItemWriter())
.build();
}
private ItemWriter<TestData> dataSourceItemWriter() {
// ItemWriter的实现类之一,mysql数据库数据写入使用JdbcBatchItemWriter,
|
// 其他实现:MongoItemWriter,Neo4jItemWriter等
JdbcBatchItemWriter<TestData> writer = new JdbcBatchItemWriter<>();
writer.setDataSource(dataSource); // 设置数据源
String sql = "insert into TEST(id,field1,field2,field3) values (:id,:field1,:field2,:field3)";
writer.setSql(sql); // 设置插入sql脚本
// 映射TestData对象属性到占位符中的属性
BeanPropertyItemSqlParameterSourceProvider<TestData> provider = new BeanPropertyItemSqlParameterSourceProvider<>();
writer.setItemSqlParameterSourceProvider(provider);
writer.afterPropertiesSet(); // 设置一些额外属性
return writer;
}
}
|
repos\SpringAll-master\69.spring-batch-itemwriter\src\main\java\cc\mrbird\batch\job\DatabaseItemWriterDemo.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public Binding fanoutBinding1(Queue directOneQueue, FanoutExchange fanoutExchange) {
return BindingBuilder.bind(directOneQueue).to(fanoutExchange);
}
/**
* 分列模式绑定队列2
*
* @param queueTwo 绑定队列2
* @param fanoutExchange 分列模式交换器
*/
@Bean
public Binding fanoutBinding2(Queue queueTwo, FanoutExchange fanoutExchange) {
return BindingBuilder.bind(queueTwo).to(fanoutExchange);
}
/**
* 主题模式队列
* <li>路由格式必须以 . 分隔,比如 user.email 或者 user.aaa.email</li>
* <li>通配符 * ,代表一个占位符,或者说一个单词,比如路由为 user.*,那么 user.email 可以匹配,但是 user.aaa.email 就匹配不了</li>
* <li>通配符 # ,代表一个或多个占位符,或者说一个或多个单词,比如路由为 user.#,那么 user.email 可以匹配,user.aaa.email 也可以匹配</li>
*/
@Bean
public TopicExchange topicExchange() {
return new TopicExchange(RabbitConsts.TOPIC_MODE_QUEUE);
}
/**
* 主题模式绑定分列模式
*
* @param fanoutExchange 分列模式交换器
* @param topicExchange 主题模式交换器
*/
@Bean
public Binding topicBinding1(FanoutExchange fanoutExchange, TopicExchange topicExchange) {
return BindingBuilder.bind(fanoutExchange).to(topicExchange).with(RabbitConsts.TOPIC_ROUTING_KEY_ONE);
}
/**
* 主题模式绑定队列2
*
* @param queueTwo 队列2
* @param topicExchange 主题模式交换器
*/
@Bean
|
public Binding topicBinding2(Queue queueTwo, TopicExchange topicExchange) {
return BindingBuilder.bind(queueTwo).to(topicExchange).with(RabbitConsts.TOPIC_ROUTING_KEY_TWO);
}
/**
* 主题模式绑定队列3
*
* @param queueThree 队列3
* @param topicExchange 主题模式交换器
*/
@Bean
public Binding topicBinding3(Queue queueThree, TopicExchange topicExchange) {
return BindingBuilder.bind(queueThree).to(topicExchange).with(RabbitConsts.TOPIC_ROUTING_KEY_THREE);
}
/**
* 延迟队列
*/
@Bean
public Queue delayQueue() {
return new Queue(RabbitConsts.DELAY_QUEUE, true);
}
/**
* 延迟队列交换器, x-delayed-type 和 x-delayed-message 固定
*/
@Bean
public CustomExchange delayExchange() {
Map<String, Object> args = Maps.newHashMap();
args.put("x-delayed-type", "direct");
return new CustomExchange(RabbitConsts.DELAY_MODE_QUEUE, "x-delayed-message", true, false, args);
}
/**
* 延迟队列绑定自定义交换器
*
* @param delayQueue 队列
* @param delayExchange 延迟交换器
*/
@Bean
public Binding delayBinding(Queue delayQueue, CustomExchange delayExchange) {
return BindingBuilder.bind(delayQueue).to(delayExchange).with(RabbitConsts.DELAY_QUEUE).noargs();
}
}
|
repos\spring-boot-demo-master\demo-mq-rabbitmq\src\main\java\com\xkcoding\mq\rabbitmq\config\RabbitMqConfig.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public void setCorePoolSize(int corePoolSize) {
threadPoolExecutor.setCorePoolSize(corePoolSize);
}
public void setMaximumPoolSize(int maximumPoolSize) {
threadPoolExecutor.setMaximumPoolSize(maximumPoolSize);
}
public int getMaximumPoolSize() {
return threadPoolExecutor.getMaximumPoolSize();
}
public void setKeepAliveTime(long time, TimeUnit unit) {
threadPoolExecutor.setKeepAliveTime(time, unit);
}
public void purgeThreadPool() {
threadPoolExecutor.purge();
}
public int getPoolSize() {
return threadPoolExecutor.getPoolSize();
}
public int getActiveCount() {
return threadPoolExecutor.getActiveCount();
}
public int getLargestPoolSize() {
return threadPoolExecutor.getLargestPoolSize();
}
public long getTaskCount() {
return threadPoolExecutor.getTaskCount();
}
|
public long getCompletedTaskCount() {
return threadPoolExecutor.getCompletedTaskCount();
}
public int getQueueCount() {
return threadPoolQueue.size();
}
public int getQueueAddlCapacity() {
return threadPoolQueue.remainingCapacity();
}
public ThreadPoolExecutor getThreadPoolExecutor() {
return threadPoolExecutor;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\container\impl\jmx\services\JmxManagedThreadPool.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class TableAttachmentListenerRepository
{
private final CCache<AdTableId, ImmutableList<AttachmentListenerSettings>> cache = CCache.<AdTableId, ImmutableList<AttachmentListenerSettings>> builder()
.cacheName("listenersByAdTableId")
.cacheMapType(CCache.CacheMapType.LRU)
.initialCapacity(100)
.tableName(I_AD_Table_AttachmentListener.Table_Name)
.build();
public ImmutableList<AttachmentListenerSettings> getById(@NonNull final AdTableId adTableId)
{
return cache.getOrLoad(adTableId, this::retrieveAttachmentListenerSettings);
}
/**
* Queries {@link I_AD_Table_AttachmentListener} for listeners linked to the given {@link AdTableId}.
*
* @param adTableId DB identifier of the table.
* @return list of {@link AttachmentListenerSettings} ordered by {@link I_AD_Table_AttachmentListener#getSeqNo()}.
*/
private ImmutableList<AttachmentListenerSettings> retrieveAttachmentListenerSettings(final AdTableId adTableId )
{
return Services.get(IQueryBL.class)
.createQueryBuilder(I_AD_Table_AttachmentListener.class, Env.getCtx(), ITrx.TRXNAME_None)
.addOnlyActiveRecordsFilter()
.addEqualsFilter(I_AD_Table_AttachmentListener.COLUMNNAME_AD_Table_ID, adTableId.getRepoId())
|
.orderBy(I_AD_Table_AttachmentListener.COLUMNNAME_SeqNo)
.create()
.list()
.stream()
.map(this::buildAttachmentListenerSettings)
.collect(ImmutableList.toImmutableList());
}
private AttachmentListenerSettings buildAttachmentListenerSettings( final I_AD_Table_AttachmentListener record )
{
return AttachmentListenerSettings.builder()
.isSendNotification(record.isSendNotification())
.listenerJavaClassId(JavaClassId.ofRepoId(record.getAD_JavaClass_ID()))
.adMessageId(AdMessageId.ofRepoIdOrNull(record.getAD_Message_ID()))
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\attachments\listener\TableAttachmentListenerRepository.java
| 2
|
请完成以下Java代码
|
public java.sql.Timestamp getPhonecallTimeMax ()
{
return (java.sql.Timestamp)get_Value(COLUMNNAME_PhonecallTimeMax);
}
/** Set Erreichbar von.
@param PhonecallTimeMin Erreichbar von */
@Override
public void setPhonecallTimeMin (java.sql.Timestamp PhonecallTimeMin)
{
set_Value (COLUMNNAME_PhonecallTimeMin, PhonecallTimeMin);
}
/** Get Erreichbar von.
@return Erreichbar von */
@Override
public java.sql.Timestamp getPhonecallTimeMin ()
{
return (java.sql.Timestamp)get_Value(COLUMNNAME_PhonecallTimeMin);
}
/** Set Reihenfolge.
@param SeqNo
Zur Bestimmung der Reihenfolge der Einträge; die kleinste Zahl kommt zuerst
*/
@Override
public void setSeqNo (int SeqNo)
|
{
set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo));
}
/** Get Reihenfolge.
@return Zur Bestimmung der Reihenfolge der Einträge; die kleinste Zahl kommt zuerst
*/
@Override
public int getSeqNo ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo);
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_C_Phonecall_Schema_Version_Line.java
| 1
|
请完成以下Java代码
|
public class BreadthFirstSearchAlgorithm {
private static final Logger LOGGER = LoggerFactory.getLogger(BreadthFirstSearchAlgorithm.class);
public static <T> Optional<Tree<T>> search(T value, Tree<T> root) {
Queue<Tree<T>> queue = new ArrayDeque<>();
queue.add(root);
Tree<T> currentNode;
while (!queue.isEmpty()) {
currentNode = queue.remove();
LOGGER.debug("Visited node with value: {}", currentNode.getValue());
if (currentNode.getValue().equals(value)) {
return Optional.of(currentNode);
} else {
queue.addAll(currentNode.getChildren());
}
}
return Optional.empty();
}
public static <T> Optional<Node<T>> search(T value, Node<T> start) {
|
Queue<Node<T>> queue = new ArrayDeque<>();
queue.add(start);
Node<T> currentNode;
Set<Node<T>> alreadyVisited = new HashSet<>();
while (!queue.isEmpty()) {
currentNode = queue.remove();
LOGGER.debug("Visited node with value: {}", currentNode.getValue());
if (currentNode.getValue().equals(value)) {
return Optional.of(currentNode);
} else {
alreadyVisited.add(currentNode);
queue.addAll(currentNode.getNeighbors());
queue.removeAll(alreadyVisited);
}
}
return Optional.empty();
}
}
|
repos\tutorials-master\algorithms-modules\algorithms-searching\src\main\java\com\baeldung\algorithms\breadthfirstsearch\BreadthFirstSearchAlgorithm.java
| 1
|
请完成以下Java代码
|
public void setReadOnly(boolean readOnly)
{
m_readOnly = readOnly;
}
/**
* Set Color Column
* @param colorColumn color
*/
public void setColorColumn(boolean colorColumn)
{
m_colorColumn = colorColumn;
}
/**
* ColorColumn
* @return true if color column
*/
public boolean isColorColumn()
{
return m_colorColumn;
}
/**
* Add ID column SQL for the displayed column
* The Class for this should be KeyNamePair
* @param keyPairColSQL
*/
public ColumnInfo setKeyPairColSQL(String keyPairColSQL)
{
m_keyPairColSQL = keyPairColSQL;
if (m_keyPairColSQL == null)
m_keyPairColSQL = "";
return this;
}
/**
* Get Key Pair Col SQL
* @return sql
*/
public String getKeyPairColSQL()
{
return m_keyPairColSQL;
}
/**
* Key Pair Col
* @return column
*/
public boolean isKeyPairCol()
{
return m_keyPairColSQL.length() > 0;
}
public ColumnInfo setDisplayType(final int displayType)
{
this.m_displayType = displayType;
return this;
}
public int getDisplayType()
{
return m_displayType;
}
public Map<String, Object> getEditorProperties()
{
return m_editorProperties;
}
private IInfoColumnController columnController = null;
public IInfoColumnController getColumnController()
{
return columnController;
}
public void setColumnController(IInfoColumnController columnController)
{
this.columnController = columnController;
}
final List<Info_Column> dependentColumns = new ArrayList<Info_Column>();
public List<Info_Column> getDependentColumns()
{
return dependentColumns;
}
private int widthMin = -1;
public ColumnInfo setWidthMin(final int widthMin)
{
this.widthMin = widthMin;
return this;
}
public int getWidthMin(final int widthMinDefault)
{
if (widthMin < 0)
{
return widthMinDefault;
}
return widthMin;
}
private String columnName = null;
/**
* Sets internal (not translated) name of this column.
*
* @param columnName
* @return this
*/
public ColumnInfo setColumnName(final String columnName)
{
|
this.columnName = columnName;
return this;
}
/**
*
* @return internal (not translated) column name
*/
public String getColumnName()
{
return columnName;
}
private int precision = -1;
/**
* Sets precision to be used in case it's a number.
*
* If not set, default displayType's precision will be used.
*
* @param precision
* @return this
*/
public ColumnInfo setPrecision(final int precision)
{
this.precision = precision;
return this;
}
/**
*
* @return precision to be used in case it's a number
*/
public int getPrecision()
{
return this.precision;
}
public ColumnInfo setSortNo(final int sortNo)
{
this.sortNo = sortNo;
return this;
}
/**
* Gets SortNo.
*
* @return
* @see I_AD_Field#COLUMNNAME_SortNo.
*/
public int getSortNo()
{
return sortNo;
}
@Override
public String toString()
{
return ObjectUtils.toString(this);
}
} // infoColumn
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\minigrid\ColumnInfo.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void deleteBySlug(String slug) {
bus.executeCommand(new DeleteArticle(slug));
}
@Override
public FavoriteArticleResult favorite(String slug) {
return bus.executeCommand(new FavoriteArticle(slug));
}
@Override
public UnfavoriteArticleResult unfavorite(String slug) {
return bus.executeCommand(new UnfavoriteArticle(slug));
}
@Override
|
public GetCommentsResult findAllComments(String slug) {
return bus.executeQuery(new GetComments(slug));
}
@Override
public AddCommentResult addComment(String slug, @Valid AddComment command) {
return bus.executeCommand(command.withSlug(slug));
}
@Override
public void deleteComment(String slug, Long id) {
bus.executeCommand(new DeleteComment(slug, id));
}
}
|
repos\realworld-backend-spring-master\service\src\main\java\com\github\al\realworld\infrastructure\web\ArticleController.java
| 2
|
请完成以下Java代码
|
public class HistoricCaseActivityStatisticsImpl implements HistoricCaseActivityStatistics {
protected String id;
protected long available;
protected long enabled;
protected long disabled;
protected long active;
protected long completed;
protected long terminated;
public String getId() {
return id;
}
public long getAvailable() {
return available;
}
public long getEnabled() {
return enabled;
}
|
public long getDisabled() {
return disabled;
}
public long getActive() {
return active;
}
public long getCompleted() {
return completed;
}
public long getTerminated() {
return terminated;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\HistoricCaseActivityStatisticsImpl.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Producer createProducer() {
// 创建默认的 Producer
Producer<?, ?> producer = super.createProducer();
// 创建可链路追踪的 Producer
return kafkaTracing.producer(producer);
}
};
// 设置事务前缀
String transactionIdPrefix = properties.getProducer().getTransactionIdPrefix();
if (transactionIdPrefix != null) {
factory.setTransactionIdPrefix(transactionIdPrefix);
}
return factory;
}
@Bean
public ConsumerFactory<?, ?> kafkaConsumerFactory(KafkaProperties properties, KafkaTracing kafkaTracing) {
// 创建 DefaultKafkaConsumerFactory 对象
return new DefaultKafkaConsumerFactory(properties.buildConsumerProperties()) {
|
@Override
public Consumer<?, ?> createConsumer(String groupId, String clientIdPrefix, String clientIdSuffix) {
return this.createConsumer(groupId, clientIdPrefix, clientIdSuffix, null);
}
@Override
public Consumer<?, ?> createConsumer(String groupId, String clientIdPrefix, final String clientIdSuffixArg, Properties properties) {
// 创建默认的 Consumer
Consumer<?, ?> consumer = super.createConsumer(groupId, clientIdPrefix, clientIdSuffixArg, properties);
// 创建可链路追踪的 Consumer
return kafkaTracing.consumer(consumer);
}
};
}
}
|
repos\SpringBoot-Labs-master\lab-40\lab-40-kafka\src\main\java\cn\iocoder\springboot\lab40\zipkindemo\config\ZipkinConfiguration.java
| 2
|
请完成以下Java代码
|
public String getName() {
return this.headerName;
}
/**
* Gets the values of the header. Cannot be null, empty, or contain null values.
* @return the values of the header
*/
public List<String> getValues() {
return this.headerValues;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
Header other = (Header) obj;
if (!this.headerName.equals(other.headerName)) {
|
return false;
}
return this.headerValues.equals(other.headerValues);
}
@Override
public int hashCode() {
return this.headerName.hashCode() + this.headerValues.hashCode();
}
@Override
public String toString() {
return "Header [name: " + this.headerName + ", values: " + this.headerValues + "]";
}
}
|
repos\spring-security-main\web\src\main\java\org\springframework\security\web\header\Header.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Access matcher(PayloadExchangeMatcher matcher) {
return new Access(matcher);
}
public final class Access {
private final PayloadExchangeMatcher matcher;
private Access(PayloadExchangeMatcher matcher) {
this.matcher = matcher;
}
public AuthorizePayloadsSpec authenticated() {
return access(AuthenticatedReactiveAuthorizationManager.authenticated());
}
public AuthorizePayloadsSpec hasAuthority(String authority) {
return access(AuthorityReactiveAuthorizationManager.hasAuthority(authority));
}
public AuthorizePayloadsSpec hasRole(String role) {
return access(AuthorityReactiveAuthorizationManager.hasRole(role));
}
public AuthorizePayloadsSpec hasAnyRole(String... roles) {
return access(AuthorityReactiveAuthorizationManager.hasAnyRole(roles));
}
public AuthorizePayloadsSpec permitAll() {
return access((a, ctx) -> Mono.just(new AuthorizationDecision(true)));
}
public AuthorizePayloadsSpec hasAnyAuthority(String... authorities) {
return access(AuthorityReactiveAuthorizationManager.hasAnyAuthority(authorities));
}
|
public AuthorizePayloadsSpec access(
ReactiveAuthorizationManager<PayloadExchangeAuthorizationContext> authorization) {
AuthorizePayloadsSpec.this.authzBuilder
.add(new PayloadExchangeMatcherEntry<>(this.matcher, authorization));
return AuthorizePayloadsSpec.this;
}
public AuthorizePayloadsSpec denyAll() {
return access((a, ctx) -> Mono.just(new AuthorizationDecision(false)));
}
}
}
}
|
repos\spring-security-main\config\src\main\java\org\springframework\security\config\annotation\rsocket\RSocketSecurity.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class TestData {
private static final Logger log = LoggerFactory.getLogger(TestData.class);
@Autowired
@Qualifier("jdbcBookRepository")
private BookRepository bookRepository;
@Autowired
private JdbcTemplate jdbcTemplate;
private static final String SQL_CREATE_TABLE = ""
+ " CREATE TABLE BOOKS"
+ " ("
+ " ID number GENERATED ALWAYS as IDENTITY(START with 1 INCREMENT by 1),"
+ " NAME varchar2(100) NOT NULL,"
+ " PRICE number(15, 2) NOT NULL,"
+ " CONSTRAINT book_pk PRIMARY KEY (ID)"
+ " )";
public void start() {
createTestData(true);
}
void createTestData(boolean dropTable) {
log.info("Creating tables for testing...1");
if (dropTable) {
jdbcTemplate.execute("DROP TABLE BOOKS");
}
jdbcTemplate.execute(SQL_CREATE_TABLE);
|
List<Book> books = Arrays.asList(
new Book("Thinking in Java", new BigDecimal("46.32")),
new Book("Mkyong in Java", new BigDecimal("1.99")),
new Book("Getting Clojure", new BigDecimal("37.3")),
new Book("Head First Android Development", new BigDecimal("41.19"))
);
log.info("[SAVE]");
books.forEach(book -> {
log.info("Saving...{}", book.getName());
bookRepository.save(book);
});
}
}
|
repos\spring-boot-master\spring-jdbc\src\main\java\com\mkyong\sp\TestData.java
| 2
|
请完成以下Java代码
|
public String getTenantId() {
return tenantId;
}
public String getTenantIdLike() {
return tenantIdLike;
}
public boolean isWithoutTenantId() {
return withoutTenantId;
}
public String getAuthorizationUserId() {
return authorizationUserId;
}
public String getProcDefId() {
return procDefId;
}
public String getEventSubscriptionName() {
return eventSubscriptionName;
|
}
public String getEventSubscriptionType() {
return eventSubscriptionType;
}
public ProcessDefinitionQueryImpl startableByUser(String userId) {
if (userId == null) {
throw new ActivitiIllegalArgumentException("userId is null");
}
this.authorizationUserId = userId;
return this;
}
public ProcessDefinitionQuery startableByGroups(List<String> groupIds) {
authorizationGroups = groupIds;
return this;
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\ProcessDefinitionQueryImpl.java
| 1
|
请完成以下Java代码
|
public void afterPropertiesSet() throws Exception {
Assert.notNull(this.resourceLoader, "resourceLoader cannot be null");
Resource webXml = this.resourceLoader.getResource("/WEB-INF/web.xml");
Document doc = getDocument(webXml.getInputStream());
NodeList webApp = doc.getElementsByTagName("web-app");
Assert.isTrue(webApp.getLength() == 1, () -> "Failed to find 'web-app' element in resource" + webXml);
NodeList securityRoles = ((Element) webApp.item(0)).getElementsByTagName("security-role");
List<String> roleNames = getRoleNames(webXml, securityRoles);
this.mappableAttributes = Collections.unmodifiableSet(new HashSet<>(roleNames));
}
private List<String> getRoleNames(Resource webXml, NodeList securityRoles) {
ArrayList<String> roleNames = new ArrayList<>();
for (int i = 0; i < securityRoles.getLength(); i++) {
Element securityRoleElement = (Element) securityRoles.item(i);
NodeList roles = securityRoleElement.getElementsByTagName("role-name");
if (roles.getLength() > 0) {
String roleName = roles.item(0).getTextContent().trim();
roleNames.add(roleName);
this.logger.info("Retrieved role-name '" + roleName + "' from web.xml");
}
else {
this.logger.info("No security-role elements found in " + webXml);
}
}
return roleNames;
}
/**
* @return Document for the specified InputStream
*/
private Document getDocument(InputStream aStream) {
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
DocumentBuilder builder = factory.newDocumentBuilder();
builder.setEntityResolver(new MyEntityResolver());
return builder.parse(aStream);
}
catch (FactoryConfigurationError | IOException | SAXException | ParserConfigurationException ex) {
throw new RuntimeException("Unable to parse document object", ex);
|
}
finally {
try {
aStream.close();
}
catch (IOException ex) {
this.logger.warn("Failed to close input stream for web.xml", ex);
}
}
}
/**
* We do not need to resolve external entities, so just return an empty String.
*/
private static final class MyEntityResolver implements EntityResolver {
@Override
public InputSource resolveEntity(String publicId, String systemId) {
return new InputSource(new StringReader(""));
}
}
}
|
repos\spring-security-main\web\src\main\java\org\springframework\security\web\authentication\preauth\j2ee\WebXmlMappableAttributesRetriever.java
| 1
|
请完成以下Java代码
|
public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
log.info("有新的客户端链接:[{}]", ctx.channel().id().asLongText());
// 添加到channelGroup 通道组
NettyConfig.getChannelGroup().add(ctx.channel());
}
/**
* 读取数据
*/
@Override
protected void channelRead0(ChannelHandlerContext ctx, TextWebSocketFrame msg) throws Exception {
log.info("服务器收到消息:{}", msg.text());
// 获取用户ID,关联channel
JSONObject jsonObject = JSONUtil.parseObj(msg.text());
String uid = jsonObject.getStr("uid");
NettyConfig.getChannelMap().put(uid, ctx.channel());
// 将用户ID作为自定义属性加入到channel中,方便随时channel中获取用户ID
AttributeKey<String> key = AttributeKey.valueOf("userId");
ctx.channel().attr(key).setIfAbsent(uid);
// 回复消息
ctx.channel().writeAndFlush(new TextWebSocketFrame("服务器收到消息啦"));
}
@Override
public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
log.info("用户下线了:{}", ctx.channel().id().asLongText());
// 删除通道
NettyConfig.getChannelGroup().remove(ctx.channel());
removeUserId(ctx);
|
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
log.info("异常:{}", cause.getMessage());
// 删除通道
NettyConfig.getChannelGroup().remove(ctx.channel());
removeUserId(ctx);
ctx.close();
}
/**
* 删除用户与channel的对应关系
*/
private void removeUserId(ChannelHandlerContext ctx) {
AttributeKey<String> key = AttributeKey.valueOf("userId");
String userId = ctx.channel().attr(key).get();
NettyConfig.getChannelMap().remove(userId);
}
}
|
repos\springboot-demo-master\netty\src\main\java\com\et\netty\handler\WebSocketHandler.java
| 1
|
请完成以下Java代码
|
public int getInsufficientQtyAvailableForSalesColor_ID()
{
return get_ValueAsInt(COLUMNNAME_InsufficientQtyAvailableForSalesColor_ID);
}
@Override
public void setIsAsync (final boolean IsAsync)
{
set_Value (COLUMNNAME_IsAsync, IsAsync);
}
@Override
public boolean isAsync()
{
return get_ValueAsBoolean(COLUMNNAME_IsAsync);
}
@Override
public void setIsFeatureActivated (final boolean IsFeatureActivated)
{
set_Value (COLUMNNAME_IsFeatureActivated, IsFeatureActivated);
}
@Override
public boolean isFeatureActivated()
{
return get_ValueAsBoolean(COLUMNNAME_IsFeatureActivated);
}
@Override
public void setIsQtyPerWarehouse (final boolean IsQtyPerWarehouse)
{
set_Value (COLUMNNAME_IsQtyPerWarehouse, IsQtyPerWarehouse);
}
@Override
public boolean isQtyPerWarehouse()
{
return get_ValueAsBoolean(COLUMNNAME_IsQtyPerWarehouse);
}
@Override
public void setMD_AvailableForSales_Config_ID (final int MD_AvailableForSales_Config_ID)
{
if (MD_AvailableForSales_Config_ID < 1)
set_ValueNoCheck (COLUMNNAME_MD_AvailableForSales_Config_ID, null);
else
set_ValueNoCheck (COLUMNNAME_MD_AvailableForSales_Config_ID, MD_AvailableForSales_Config_ID);
}
@Override
public int getMD_AvailableForSales_Config_ID()
{
|
return get_ValueAsInt(COLUMNNAME_MD_AvailableForSales_Config_ID);
}
@Override
public void setSalesOrderLookBehindHours (final int SalesOrderLookBehindHours)
{
set_Value (COLUMNNAME_SalesOrderLookBehindHours, SalesOrderLookBehindHours);
}
@Override
public int getSalesOrderLookBehindHours()
{
return get_ValueAsInt(COLUMNNAME_SalesOrderLookBehindHours);
}
@Override
public void setShipmentDateLookAheadHours (final int ShipmentDateLookAheadHours)
{
set_Value (COLUMNNAME_ShipmentDateLookAheadHours, ShipmentDateLookAheadHours);
}
@Override
public int getShipmentDateLookAheadHours()
{
return get_ValueAsInt(COLUMNNAME_ShipmentDateLookAheadHours);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.material\cockpit\src\main\java-gen\de\metas\material\cockpit\model\X_MD_AvailableForSales_Config.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String getCustomResourcePrefixPath() {
return customResourcePrefixPath;
}
public void setCustomResourcePrefixPath(String customResourcePrefixPath) {
this.customResourcePrefixPath = customResourcePrefixPath;
}
public Elasticsearch getElasticsearch() {
return elasticsearch;
}
public void setElasticsearch(Elasticsearch elasticsearch) {
this.elasticsearch = elasticsearch;
}
public Firewall getFirewall() {
return firewall;
}
public void setFirewall(Firewall firewall) {
this.firewall = firewall;
}
public String getSignatureSecret() {
return signatureSecret;
}
public void setSignatureSecret(String signatureSecret) {
this.signatureSecret = signatureSecret;
}
public Shiro getShiro() {
return shiro;
}
public void setShiro(Shiro shiro) {
this.shiro = shiro;
}
public Path getPath() {
return path;
}
public void setPath(Path path) {
this.path = path;
}
public DomainUrl getDomainUrl() {
|
return domainUrl;
}
public void setDomainUrl(DomainUrl domainUrl) {
this.domainUrl = domainUrl;
}
public String getSignUrls() {
return signUrls;
}
public void setSignUrls(String signUrls) {
this.signUrls = signUrls;
}
public String getFileViewDomain() {
return fileViewDomain;
}
public void setFileViewDomain(String fileViewDomain) {
this.fileViewDomain = fileViewDomain;
}
public String getUploadType() {
return uploadType;
}
public void setUploadType(String uploadType) {
this.uploadType = uploadType;
}
public WeiXinPay getWeiXinPay() {
return weiXinPay;
}
public void setWeiXinPay(WeiXinPay weiXinPay) {
this.weiXinPay = weiXinPay;
}
public BaiduApi getBaiduApi() {
return baiduApi;
}
public void setBaiduApi(BaiduApi baiduApi) {
this.baiduApi = baiduApi;
}
}
|
repos\JeecgBoot-main\jeecg-boot\jeecg-boot-base-core\src\main\java\org\jeecg\config\JeecgBaseConfig.java
| 2
|
请完成以下Java代码
|
public static ResultType get(String code) {
BeanUtil.requireNonNull(code, "code is null");
ResultType[] list = values();
for (ResultType resultType : list) {
if (code.equals(resultType.getCode().toString())) {
return resultType;
}
}
return null;
}
/**
* 获得结果码
*
* @return 结果码
*/
public Integer getCode() {
return code;
}
|
/**
* 获得结果描述
*
* @return 结果描述
*/
public String getDescription() {
return description;
}
@Override
public String toString() {
return "ResultType{" +
"code=" + code +
", description='" + description + '\'' +
'}';
}
}
|
repos\spring-boot-quick-master\quick-wx-public\src\main\java\com\wx\pn\api\enums\ResultType.java
| 1
|
请完成以下Java代码
|
public int getM_Shipper_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Shipper_ID);
}
@Override
public void setM_Warehouse_ID (final int M_Warehouse_ID)
{
if (M_Warehouse_ID < 1)
set_Value (COLUMNNAME_M_Warehouse_ID, null);
else
set_Value (COLUMNNAME_M_Warehouse_ID, M_Warehouse_ID);
}
@Override
public int getM_Warehouse_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Warehouse_ID);
}
@Override
public void setName (final java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
@Override
public java.lang.String getName()
{
return get_ValueAsString(COLUMNNAME_Name);
}
/**
* PaymentRule AD_Reference_ID=195
* Reference name: _Payment Rule
*/
public static final int PAYMENTRULE_AD_Reference_ID=195;
/** Cash = B */
public static final String PAYMENTRULE_Cash = "B";
/** CreditCard = K */
public static final String PAYMENTRULE_CreditCard = "K";
/** DirectDeposit = T */
public static final String PAYMENTRULE_DirectDeposit = "T";
|
/** Check = S */
public static final String PAYMENTRULE_Check = "S";
/** OnCredit = P */
public static final String PAYMENTRULE_OnCredit = "P";
/** DirectDebit = D */
public static final String PAYMENTRULE_DirectDebit = "D";
/** Mixed = M */
public static final String PAYMENTRULE_Mixed = "M";
/** PayPal = L */
public static final String PAYMENTRULE_PayPal = "L";
/** Rückerstattung = E */
public static final String PAYMENTRULE_Reimbursement = "E";
/** Verrechnung = F */
public static final String PAYMENTRULE_Settlement = "F";
@Override
public void setPaymentRule (final java.lang.String PaymentRule)
{
set_Value (COLUMNNAME_PaymentRule, PaymentRule);
}
@Override
public java.lang.String getPaymentRule()
{
return get_ValueAsString(COLUMNNAME_PaymentRule);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.salescandidate.base\src\main\java-gen\de\metas\ordercandidate\model\X_C_OLCandProcessor.java
| 1
|
请完成以下Java代码
|
public class X_C_BPartner_Report_Text extends org.compiere.model.PO implements I_C_BPartner_Report_Text, org.compiere.model.I_Persistent
{
private static final long serialVersionUID = 998540969L;
/**
* Standard Constructor
*/
public X_C_BPartner_Report_Text(final Properties ctx, final int C_BPartner_Report_Text_ID, @Nullable final String trxName)
{
super(ctx, C_BPartner_Report_Text_ID, trxName);
}
/**
* Load Constructor
*/
public X_C_BPartner_Report_Text(final Properties ctx, final ResultSet rs, @Nullable final String trxName)
{
super(ctx, rs, trxName);
}
/**
* Load Meta Data
*/
@Override
protected org.compiere.model.POInfo initPO(final Properties ctx)
{
return org.compiere.model.POInfo.getPOInfo(Table_Name);
}
@Override
public void setAdditionalText(final @Nullable String AdditionalText)
{
set_Value(COLUMNNAME_AdditionalText, AdditionalText);
}
@Override
public @NotNull String getAdditionalText()
{
return get_ValueAsString(COLUMNNAME_AdditionalText);
}
@Override
public I_C_BPartner_DocType getC_BPartner_DocType()
{
return get_ValueAsPO(COLUMNNAME_C_BPartner_DocType_ID, I_C_BPartner_DocType.class);
}
@Override
public void setC_BPartner_DocType(final I_C_BPartner_DocType C_BPartner_DocType)
{
set_ValueFromPO(COLUMNNAME_C_BPartner_DocType_ID, I_C_BPartner_DocType.class, C_BPartner_DocType);
}
@Override
public void setC_BPartner_DocType_ID(final int C_BPartner_DocType_ID)
{
if (C_BPartner_DocType_ID < 1)
set_Value(COLUMNNAME_C_BPartner_DocType_ID, null);
else
set_Value(COLUMNNAME_C_BPartner_DocType_ID, C_BPartner_DocType_ID);
}
@Override
public int getC_BPartner_DocType_ID()
{
return get_ValueAsInt(COLUMNNAME_C_BPartner_DocType_ID);
}
@Override
|
public void setC_BPartner_ID(final int C_BPartner_ID)
{
if (C_BPartner_ID < 1)
set_Value(COLUMNNAME_C_BPartner_ID, null);
else
set_Value(COLUMNNAME_C_BPartner_ID, C_BPartner_ID);
}
@Override
public int getC_BPartner_ID()
{
return get_ValueAsInt(COLUMNNAME_C_BPartner_ID);
}
@Override
public void setC_BPartner_Report_Text_ID(final int C_BPartner_Report_Text_ID)
{
if (C_BPartner_Report_Text_ID < 1)
set_ValueNoCheck(COLUMNNAME_C_BPartner_Report_Text_ID, null);
else
set_ValueNoCheck(COLUMNNAME_C_BPartner_Report_Text_ID, C_BPartner_Report_Text_ID);
}
@Override
public int getC_BPartner_Report_Text_ID()
{
return get_ValueAsInt(COLUMNNAME_C_BPartner_Report_Text_ID);
}
@Override
public void setValue(final String Value)
{
set_Value(COLUMNNAME_Value, Value);
}
@Override
public String getValue()
{
return get_ValueAsString(COLUMNNAME_Value);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.fresh\de.metas.fresh.base\src\main\java\de\metas\fresh\partnerreporttext\model\X_C_BPartner_Report_Text.java
| 1
|
请完成以下Java代码
|
public class CustomFunctionTransformer extends JavaFunctionProvider {
protected static final ScalaFeelLogger LOGGER = ScalaFeelLogger.LOGGER;
protected Map<String, JavaFunction> functions;
protected ValueMapper valueMapper;
public CustomFunctionTransformer(List<FeelCustomFunctionProvider> functionProviders,
ValueMapper valueMapper) {
this.functions = new HashMap<>();
this.valueMapper = valueMapper;
if (functionProviders != null) {
transformFunctions(functionProviders);
}
}
protected void transformFunctions(List<FeelCustomFunctionProvider> functionProviders) {
functionProviders.forEach(functionProvider -> {
Collection<String> functionNames = functionProvider.getFunctionNames();
functionNames.forEach(functionName -> {
CustomFunction customFunction = functionProvider.resolveFunction(functionName)
.orElseThrow(LOGGER::customFunctionNotFoundException);
List<String> params = customFunction.getParams();
Function<List<Val>, Val> function = transformFunction(customFunction);
boolean hasVarargs = customFunction.hasVarargs();
JavaFunction javaFunction = new JavaFunction(params, function, hasVarargs);
this.functions.put(functionName, javaFunction);
});
});
}
protected Function<List<Val>, Val> transformFunction(CustomFunction function) {
return args -> {
List<Object> unpackedArgs = unpackVals(args);
|
Function<List<Object>, Object> functionHandler = function.getFunction();
Object result = functionHandler.apply(unpackedArgs);
return toVal(result);
};
}
protected List<Object> unpackVals(List<Val> args) {
return args.stream()
.map(this::unpackVal)
.collect(Collectors.toList());
}
protected Val toVal(Object rawResult) {
return valueMapper.toVal(rawResult);
}
protected Object unpackVal(Val arg) {
return valueMapper.unpackVal(arg);
}
@Override
public Optional<JavaFunction> resolveFunction(String functionName) {
return Optional.ofNullable(functions.get(functionName));
}
@Override
public Collection<String> getFunctionNames() {
return functions.keySet();
}
}
|
repos\camunda-bpm-platform-master\engine-dmn\feel-scala\src\main\java\org\camunda\bpm\dmn\feel\impl\scala\function\CustomFunctionTransformer.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class ConfigurationMetadataGroup implements Serializable {
private final String id;
private final Map<String, ConfigurationMetadataSource> sources = new HashMap<>();
private final Map<String, ConfigurationMetadataProperty> properties = new HashMap<>();
public ConfigurationMetadataGroup(String id) {
this.id = id;
}
/**
* Return the id of the group, used as a common prefix for all properties associated
* to it.
* @return the id of the group
*/
public String getId() {
return this.id;
}
/**
* Return the {@link ConfigurationMetadataSource sources} defining the properties of
* this group.
* @return the sources of the group
*/
public Map<String, ConfigurationMetadataSource> getSources() {
return this.sources;
}
|
/**
* Return the {@link ConfigurationMetadataProperty properties} defined in this group.
* <p>
* A property may appear more than once for a given source, potentially with
* conflicting type or documentation. This is a "merged" view of the properties of
* this group.
* @return the properties of the group
* @see ConfigurationMetadataSource#getProperties()
*/
public Map<String, ConfigurationMetadataProperty> getProperties() {
return this.properties;
}
}
|
repos\spring-boot-4.0.1\configuration-metadata\spring-boot-configuration-metadata\src\main\java\org\springframework\boot\configurationmetadata\ConfigurationMetadataGroup.java
| 2
|
请完成以下Java代码
|
static Passenger from(String firstName, String lastName, Integer seatNumber) {
return new Passenger(firstName, lastName, seatNumber);
}
@Override
public boolean equals(Object object) {
if (this == object)
return true;
if (object == null || getClass() != object.getClass())
return false;
Passenger passenger = (Passenger) object;
return getSeatNumber() == passenger.getSeatNumber() && Objects.equals(getFirstName(), passenger.getFirstName())
&& Objects.equals(getLastName(), passenger.getLastName());
}
@Override
public int hashCode() {
return Objects.hash(getFirstName(), getLastName(), getSeatNumber());
}
@Override
public String toString() {
final StringBuilder toStringBuilder = new StringBuilder(getClass().getSimpleName());
toStringBuilder.append("{ id=").append(id);
toStringBuilder.append(", firstName='").append(firstName).append('\'');
toStringBuilder.append(", lastName='").append(lastName).append('\'');
toStringBuilder.append(", seatNumber=").append(seatNumber);
toStringBuilder.append('}');
return toStringBuilder.toString();
|
}
Long getId() {
return id;
}
String getFirstName() {
return firstName;
}
String getLastName() {
return lastName;
}
Integer getSeatNumber() {
return seatNumber;
}
}
|
repos\tutorials-master\persistence-modules\spring-data-jpa-query\src\main\java\com\baeldung\boot\passenger\Passenger.java
| 1
|
请完成以下Java代码
|
public static void applyFieldDeclaration(List<FieldDeclaration> fieldDeclarations, Object target) {
if (fieldDeclarations != null) {
for (FieldDeclaration declaration : fieldDeclarations) {
applyFieldDeclaration(declaration, target);
}
}
}
public static void applyFieldDeclaration(FieldDeclaration declaration, Object target) {
Method setterMethod = ReflectUtil.getSetter(
declaration.getName(),
target.getClass(),
declaration.getValue().getClass()
);
if (setterMethod != null) {
try {
setterMethod.invoke(target, declaration.getValue());
} catch (IllegalArgumentException e) {
throw new ActivitiException(
"Error while invoking '" + declaration.getName() + "' on class " + target.getClass().getName(),
e
);
} catch (IllegalAccessException e) {
throw new ActivitiException(
"Illegal access when calling '" +
declaration.getName() +
"' on class " +
target.getClass().getName(),
e
);
} catch (InvocationTargetException e) {
throw new ActivitiException(
"Exception while invoking '" + declaration.getName() + "' on class " + target.getClass().getName(),
e
);
}
} else {
Field field = ReflectUtil.getField(declaration.getName(), target);
if (field == null) {
throw new ActivitiIllegalArgumentException(
"Field definition uses non-existing field '" +
declaration.getName() +
"' on class " +
target.getClass().getName()
);
}
|
// Check if the delegate field's type is correct
if (!fieldTypeCompatible(declaration, field)) {
throw new ActivitiIllegalArgumentException(
"Incompatible type set on field declaration '" +
declaration.getName() +
"' for class " +
target.getClass().getName() +
". Declared value has type " +
declaration.getValue().getClass().getName() +
", while expecting " +
field.getType().getName()
);
}
ReflectUtil.setField(field, target, declaration.getValue());
}
}
public static boolean fieldTypeCompatible(FieldDeclaration declaration, Field field) {
if (declaration.getValue() != null) {
return field.getType().isAssignableFrom(declaration.getValue().getClass());
} else {
// Null can be set any field type
return true;
}
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\bpmn\helper\ClassDelegateUtil.java
| 1
|
请完成以下Java代码
|
public PropertySource<Iterable<ConfigurationPropertySource>> getDelegate() {
return delegate;
}
/** {@inheritDoc} */
@Override
public void refresh() {
}
/** {@inheritDoc} */
@Override
public Object getProperty(String name) {
ConfigurationProperty configurationProperty = findConfigurationProperty(name);
return (configurationProperty != null) ? configurationProperty.getValue() : null;
}
/** {@inheritDoc} */
@Override
public Origin getOrigin(String name) {
return Origin.from(findConfigurationProperty(name));
}
private ConfigurationProperty findConfigurationProperty(String name) {
try {
return findConfigurationProperty(ConfigurationPropertyName.of(name));
}
catch (InvalidConfigurationPropertyNameException ex) {
|
// simulate non-exposed version of ConfigurationPropertyName.of(name, nullIfInvalid)
if(ex.getInvalidCharacters().size() == 1 && ex.getInvalidCharacters().get(0).equals('.')) {
return null;
}
throw ex;
}
}
private ConfigurationProperty findConfigurationProperty(ConfigurationPropertyName name) {
if (name == null) {
return null;
}
for (ConfigurationPropertySource configurationPropertySource : getSource()) {
if (!configurationPropertySource.getUnderlyingSource().getClass().equals(EncryptableConfigurationPropertySourcesPropertySource.class)) {
ConfigurationProperty configurationProperty = configurationPropertySource.getConfigurationProperty(name);
if (configurationProperty != null) {
return configurationProperty;
}
}
}
return null;
}
}
|
repos\jasypt-spring-boot-master\jasypt-spring-boot\src\main\java\com\ulisesbocchio\jasyptspringboot\wrapper\EncryptableConfigurationPropertySourcesPropertySource.java
| 1
|
请完成以下Java代码
|
public String getSerializerName() {
return serializerName;
}
public void setSerializerName(String serializerName) {
this.serializerName = serializerName;
}
public void addImplicitUpdateListener(TypedValueUpdateListener listener) {
updateListeners.add(listener);
}
/**
* @return the type name of the value
*/
public String getTypeName() {
if (serializerName == null) {
return ValueType.NULL.getName();
} else {
return getSerializer().getType().getName();
|
}
}
/**
* If the variable value could not be loaded, this returns the error message.
*
* @return an error message indicating why the variable value could not be loaded.
*/
public String getErrorMessage() {
return errorMessage;
}
@Override
public void postLoad() {
}
public void clear() {
cachedValue = null;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\util\TypedValueField.java
| 1
|
请完成以下Java代码
|
public class Role {
private static final long serialVersionUID = 1L;
/**
* 主键ID
*/
private Integer id;
/**
* 角色名称
*/
private String role;
/**
* 角色说明
*/
private String description;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新时间
*/
private Date updatedTime;
/**
* 获取 主键ID.
*
* @return 主键ID.
*/
public Integer getId() {
return id;
}
/**
* 设置 主键ID.
*
* @param id 主键ID.
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取 角色名称.
*
* @return 角色名称.
*/
public String getRole() {
return role;
}
/**
* 设置 角色名称.
*
* @param role 角色名称.
*/
public void setRole(String role) {
this.role = role;
}
/**
* 获取 角色说明.
*
* @return 角色说明.
*/
public String getDescription() {
return description;
|
}
/**
* 设置 角色说明.
*
* @param description 角色说明.
*/
public void setDescription(String description) {
this.description = description;
}
/**
* 获取 创建时间.
*
* @return 创建时间.
*/
public Date getCreatedTime() {
return createdTime;
}
/**
* 设置 创建时间.
*
* @param createdTime 创建时间.
*/
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
/**
* 获取 更新时间.
*
* @return 更新时间.
*/
public Date getUpdatedTime() {
return updatedTime;
}
/**
* 设置 更新时间.
*
* @param updatedTime 更新时间.
*/
public void setUpdatedTime(Date updatedTime) {
this.updatedTime = updatedTime;
}
protected Serializable pkVal() {
return this.id;
}
}
|
repos\SpringBootBucket-master\springboot-jwt\src\main\java\com\xncoding\jwt\dao\domain\Role.java
| 1
|
请完成以下Java代码
|
public void addTreeListener(ITreeListener listener, boolean isWeak)
{
if (!listeners.contains(listener))
listeners.add(listener, isWeak);
}
public void removeTreeListener(ITreeListener listener)
{
listeners.remove(listener);
}
@Override
public void onNodeInserted(PO po)
{
for (ITreeListener listener : listeners)
{
listener.onNodeInserted(po);
}
}
@Override
|
public void onNodeDeleted(PO po)
{
for (ITreeListener listener : listeners)
{
listener.onNodeDeleted(po);
}
}
@Override
public void onParentChanged(int AD_Table_ID, int nodeId, int newParentId, int oldParentId, String trxName)
{
if (newParentId == oldParentId)
return;
for (ITreeListener listener : listeners)
{
listener.onParentChanged(AD_Table_ID, nodeId, newParentId, oldParentId, trxName);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\model\tree\TreeListenerSupport.java
| 1
|
请完成以下Java代码
|
public I_M_Material_Tracking getMaterialTrackingOrNull(@Nullable final AttributeSetInstanceId asiId)
{
if (asiId == null || asiId.isNone())
{
return null;
}
final I_M_AttributeInstance materialTrackingAttributeInstance = getMaterialTrackingAttributeInstanceOrNull(asiId, false); // createIfNotFound=false
if (materialTrackingAttributeInstance == null)
{
return null;
}
final AttributeValueId materialTrackingAttributeValueId = AttributeValueId.ofRepoIdOrNull(materialTrackingAttributeInstance.getM_AttributeValue_ID());
if (materialTrackingAttributeValueId == null)
{
return null;
}
final IMaterialTrackingDAO materialTrackingDAO = Services.get(IMaterialTrackingDAO.class);
return materialTrackingDAO.retrieveMaterialTrackingByAttributeValue(materialTrackingAttributeValueId);
}
@Override
public I_M_Material_Tracking getMaterialTracking(final IContextAware context, final IAttributeSet attributeSet)
{
final int materialTrackingId = getMaterialTrackingId(context, attributeSet);
if (materialTrackingId <= 0)
{
return null;
}
final I_M_Material_Tracking materialTracking = InterfaceWrapperHelper.create(context.getCtx(), materialTrackingId, I_M_Material_Tracking.class, context.getTrxName());
Check.assume(materialTracking != null && materialTracking.getM_Material_Tracking_ID() == materialTrackingId,
"Material tracking record shall exist for ID={}", materialTrackingId);
return materialTracking;
}
@Override
public boolean isMaterialTrackingSet(final IContextAware context, final IAttributeSet attributeSet)
{
final int materialTrackingId = getMaterialTrackingId(context, attributeSet);
return materialTrackingId > 0;
}
private int getMaterialTrackingId(final IContextAware context, final IAttributeSet attributeSet)
{
if (!attributeSet.hasAttribute(M_Attribute_Value_MaterialTracking))
{
return -1;
|
}
final Object materialTrackingIdObj = attributeSet.getValue(M_Attribute_Value_MaterialTracking);
if (materialTrackingIdObj == null)
{
return -1;
}
final String materialTrackingIdStr = materialTrackingIdObj.toString();
return getMaterialTrackingIdFromMaterialTrackingIdStr(materialTrackingIdStr);
}
@Override
public boolean hasMaterialTrackingAttribute(@NonNull final AttributeSetInstanceId asiId)
{
if (asiId.isNone())
{
return false;
}
final Optional<AttributeId> materialTrackingAttributeId = getMaterialTrackingAttributeId();
if (!materialTrackingAttributeId.isPresent())
{
return false;
}
final IAttributeSetInstanceBL asiBL = Services.get(IAttributeSetInstanceBL.class);
final I_M_AttributeInstance materialTrackingAttributeInstance = asiBL.getAttributeInstance(asiId, materialTrackingAttributeId.get());
return materialTrackingAttributeInstance != null;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.materialtracking\src\main\java\de\metas\materialtracking\impl\MaterialTrackingAttributeBL.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private AccessDeniedHandler accessDeniedHandler;
// role admin allow to access / admin/**
//roles user allow to access /user/**
// custom 403 access denied handler
@Override
protected void configure(HttpSecurity http) throws Exception{
http
.csrf().disable()
.authorizeRequests()
.antMatchers("/", "/home**", "/about**").permitAll()
.antMatchers("/user/**").hasAnyRole("USER")
.antMatchers("/admin").access("hasAnyAuthority('ADMIN')")
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll()
.and()
.logout()
.permitAll()
.and()
.exceptionHandling().accessDeniedHandler(accessDeniedHandler);
// http
// .csrf().disable()
// .authorizeRequests()
//
|
// .antMatchers("/login**", "/").permitAll()
// .antMatchers("/user/**").access("hasAnyAuthority('USER')")
// .antMatchers("/admin/**").access("hasAnyAuthority('ADMIN')")
//
// .anyRequest().fullyAuthenticated()
// .and()
// .formLogin();
//
}
// Create two users, admin and user
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication()
.withUser("user").password("12345").roles("USER")
.and()
.withUser("admin").password("admin12345").roles("ADMIN");
}
}
|
repos\SpringBoot-Projects-FullStack-master\Part-6 Spring Boot Security\12.SpringSecuritySimpleExample\src\main\java\spring\security\config\SpringSecurityConfig.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
class ClonedWFNodesInfo
{
private static final String DYNATTR_ClonedWFStepsInfo = "ClonedWFStepsInfo";
public static ClonedWFNodesInfo getOrCreate(I_AD_Workflow targetWorkflow)
{
return InterfaceWrapperHelper.computeDynAttributeIfAbsent(targetWorkflow, DYNATTR_ClonedWFStepsInfo, ClonedWFNodesInfo::new);
}
@Nullable
static ClonedWFNodesInfo getOrNull(final I_AD_Workflow targetWorkflow)
{
return InterfaceWrapperHelper.getDynAttribute(targetWorkflow, DYNATTR_ClonedWFStepsInfo);
}
private final HashMap<WFNodeId, WFNodeId> original2targetWFStepIds = new HashMap<>();
|
public void addOriginalToClonedWFStepMapping(@NonNull final WFNodeId originalWFStepId, @NonNull final WFNodeId targetWFStepId)
{
original2targetWFStepIds.put(originalWFStepId, targetWFStepId);
}
public WFNodeId getTargetWFStepId(@NonNull final WFNodeId originalWFStepId)
{
final WFNodeId targetWFStepId = original2targetWFStepIds.get(originalWFStepId);
if (targetWFStepId == null)
{
throw new AdempiereException("No target workflow step found for " + originalWFStepId);
}
return targetWFStepId;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\workflow\service\impl\ClonedWFNodesInfo.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
private Map<String, String> createMap()
{
if (bundle == null)
{
return ImmutableMap.of();
}
final Set<String> keysSet = bundle.keySet();
if (keysSet == null || keysSet.isEmpty())
{
return ImmutableMap.of();
}
final Map<String, String> map = new HashMap<>();
for (final String key : keysSet)
{
final Object valueObj = bundle.getObject(key);
if (valueObj == null)
{
continue;
}
if (!(valueObj instanceof String))
{
continue;
}
final String valueStr = valueObj.toString();
map.put(key, valueStr);
}
return ImmutableMap.copyOf(map);
}
private final Map<String, String> getMap()
{
return mapSupplier.get();
}
@Override
public int size()
{
return getMap().size();
}
@Override
public boolean isEmpty()
{
return getMap().isEmpty();
}
@Override
public boolean containsKey(final Object key)
{
return getMap().containsKey(key);
}
@Override
public boolean containsValue(final Object value)
{
return getMap().containsValue(value);
}
@Override
public String get(final Object key)
{
return getMap().get(key);
|
}
@Override
public String put(final String key, final String value)
{
throw new UnsupportedOperationException();
}
@Override
public String remove(final Object key)
{
throw new UnsupportedOperationException();
}
@Override
public void putAll(final Map<? extends String, ? extends String> m)
{
throw new UnsupportedOperationException();
}
@Override
public void clear()
{
throw new UnsupportedOperationException();
}
@Override
public Set<String> keySet()
{
return getMap().keySet();
}
@Override
public Collection<String> values()
{
return getMap().values();
}
@Override
public Set<java.util.Map.Entry<String, String>> entrySet()
{
return getMap().entrySet();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.report\metasfresh-report-service\src\main\java\de\metas\report\xls\engine\ResourceBundleMapWrapper.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class MongoConfig extends AbstractMongoClientConfiguration {
private final List<Converter<?, ?>> converters = new ArrayList<Converter<?, ?>>();
@Override
protected String getDatabaseName() {
return "test";
}
@Override
public MongoClient mongoClient() {
final ConnectionString connectionString = new ConnectionString("mongodb://localhost:27017/test");
final MongoClientSettings mongoClientSettings = MongoClientSettings.builder()
.applyConnectionString(connectionString)
.build();
return MongoClients.create(mongoClientSettings);
}
@Override
public Collection<String> getMappingBasePackages() {
return Collections.singleton("com.baeldung");
}
|
@Override
public MongoCustomConversions customConversions() {
converters.add(new UserWriterConverter());
return new MongoCustomConversions(converters);
}
@Bean
MongoTransactionManager transactionManager(MongoDatabaseFactory dbFactory) {
return new MongoTransactionManager(dbFactory);
}
@Override
protected boolean autoIndexCreation() {
return true;
}
}
|
repos\tutorials-master\persistence-modules\spring-data-mongodb\src\main\java\com\baeldung\config\MongoConfig.java
| 2
|
请完成以下Java代码
|
protected boolean afterSave (boolean newRecord, boolean success)
{
if (success)
updateAchievementGoals();
return success;
} // afterSave
/**
* After Delete
* @param success success
* @return success
*/
@Override
protected boolean afterDelete (boolean success)
{
|
if (success)
updateAchievementGoals();
return success;
} // afterDelete
/**
* Update Goals with Achievement
*/
private void updateAchievementGoals()
{
MMeasure measure = MMeasure.get (getCtx(), getPA_Measure_ID());
measure.updateGoals();
} // updateAchievementGoals
} // MAchievement
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java-legacy\org\compiere\model\MAchievement.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class Course {
@Id
private Long id;
private String name;
@ManyToMany
@JoinTable(name = "course_student",
joinColumns = @JoinColumn(name = "course_id"),
inverseJoinColumns = @JoinColumn(name = "student_id"))
private List<Student> students;
public List<Student> getStudents() {
return students;
}
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 void setStudents(List<Student> students) {
this.students = students;
}
}
|
repos\tutorials-master\persistence-modules\hibernate-mapping\src\main\java\com\baeldung\associations\biredirectional\Course.java
| 2
|
请完成以下Java代码
|
public ValueExpression getVariable(int index) {
return variables[index];
}
/**
* Test if given index is bound to a variable.
* This method performs an index check.
* @param index identifier index
* @return <code>true</code> if the given index is bound to a variable
*/
public boolean isVariableBound(int index) {
return (index >= 0 && index < variables.length && variables[index] != null);
}
/**
* Apply type conversion.
* @param value value to convert
* @param type target type
* @return converted value
* @throws ELException
*/
public <T> T convert(Object value, Class<T> type) {
return converter.convert(value, type);
}
@Override
public boolean equals(Object obj) {
if (obj instanceof Bindings) {
Bindings other = (Bindings) obj;
return (
Arrays.equals(functions, other.functions) &&
Arrays.equals(variables, other.variables) &&
converter.equals(other.converter)
);
}
return false;
}
@Override
public int hashCode() {
return (Arrays.hashCode(functions) ^ Arrays.hashCode(variables) ^ converter.hashCode());
}
private void writeObject(ObjectOutputStream out) throws IOException, ClassNotFoundException {
out.defaultWriteObject();
|
MethodWrapper[] wrappers = new MethodWrapper[functions.length];
for (int i = 0; i < wrappers.length; i++) {
wrappers[i] = new MethodWrapper(functions[i]);
}
out.writeObject(wrappers);
}
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
MethodWrapper[] wrappers = (MethodWrapper[]) in.readObject();
if (wrappers.length == 0) {
functions = NO_FUNCTIONS;
} else {
functions = new Method[wrappers.length];
for (int i = 0; i < functions.length; i++) {
functions[i] = wrappers[i].method;
}
}
}
}
|
repos\Activiti-develop\activiti-core-common\activiti-juel-jakarta\src\main\java\org\activiti\core\el\juel\tree\Bindings.java
| 1
|
请完成以下Java代码
|
public class JobDefinitionDto {
protected String id;
protected String processDefinitionId;
protected String processDefinitionKey;
protected String jobType;
protected String jobConfiguration;
protected String activityId;
protected boolean suspended;
protected Long overridingJobPriority;
protected String tenantId;
protected String deploymentId;
public JobDefinitionDto() { }
public String getId() {
return id;
}
public String getProcessDefinitionId() {
return processDefinitionId;
}
public String getProcessDefinitionKey() {
return processDefinitionKey;
}
public String getJobType() {
return jobType;
}
public String getJobConfiguration() {
return jobConfiguration;
}
public String getActivityId() {
return activityId;
}
public boolean isSuspended() {
return suspended;
|
}
public Long getOverridingJobPriority() {
return overridingJobPriority;
}
public String getTenantId() {
return tenantId;
}
public String getDeploymentId() {
return deploymentId;
}
public static JobDefinitionDto fromJobDefinition(JobDefinition definition) {
JobDefinitionDto dto = new JobDefinitionDto();
dto.id = definition.getId();
dto.processDefinitionId = definition.getProcessDefinitionId();
dto.processDefinitionKey = definition.getProcessDefinitionKey();
dto.jobType = definition.getJobType();
dto.jobConfiguration = definition.getJobConfiguration();
dto.activityId = definition.getActivityId();
dto.suspended = definition.isSuspended();
dto.overridingJobPriority = definition.getOverridingJobPriority();
dto.tenantId = definition.getTenantId();
dto.deploymentId = definition.getDeploymentId();
return dto;
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\management\JobDefinitionDto.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class ConfigureNotifyKeyspaceEventsAction implements ConfigureRedisAction {
static final String CONFIG_NOTIFY_KEYSPACE_EVENTS = "notify-keyspace-events";
/*
* @see
* org.springframework.session.data.redis.config.ConfigureRedisAction#configure(org.
* springframework.data.redis.connection.RedisConnection)
*/
@Override
public void configure(RedisConnection connection) {
String notifyOptions = getNotifyOptions(connection);
String customizedNotifyOptions = notifyOptions;
if (!customizedNotifyOptions.contains("E")) {
customizedNotifyOptions += "E";
}
boolean A = customizedNotifyOptions.contains("A");
if (!(A || customizedNotifyOptions.contains("g"))) {
customizedNotifyOptions += "g";
}
if (!(A || customizedNotifyOptions.contains("x"))) {
customizedNotifyOptions += "x";
}
if (!notifyOptions.equals(customizedNotifyOptions)) {
|
connection.serverCommands().setConfig(CONFIG_NOTIFY_KEYSPACE_EVENTS, customizedNotifyOptions);
}
}
private String getNotifyOptions(RedisConnection connection) {
try {
Properties config = connection.serverCommands().getConfig(CONFIG_NOTIFY_KEYSPACE_EVENTS);
if (config.isEmpty()) {
return "";
}
return config.getProperty(config.stringPropertyNames().iterator().next());
}
catch (InvalidDataAccessApiUsageException ex) {
throw new IllegalStateException(
"Unable to configure Redis to keyspace notifications. See https://docs.spring.io/spring-session/docs/current/reference/html5/#api-redisindexedsessionrepository-sessiondestroyedevent",
ex);
}
}
}
|
repos\spring-session-main\spring-session-data-redis\src\main\java\org\springframework\session\data\redis\config\ConfigureNotifyKeyspaceEventsAction.java
| 2
|
请完成以下Java代码
|
private final class ICTrxItemExceptionHandler extends FailTrxItemExceptionHandler
{
private final ICUpdateResult result;
public ICTrxItemExceptionHandler(@NonNull final ICUpdateResult result)
{
this.result = result;
}
/**
* Resets the given IC to its old values, and sets an error flag in it.
*/
@Override
public void onItemError(final Throwable e, final Object item)
{
|
result.incrementErrorsCount();
final I_C_Invoice_Candidate ic = InterfaceWrapperHelper.create(item, I_C_Invoice_Candidate.class);
// gh #428: don't discard changes that were already made, because they might include a change of QtyInvoice.
// in that case, a formerly Processed IC might need to be flagged as unprocessed.
// if we discard all changes in this case, then we will have IsError='Y' and also an error message in the IC,
// but the user will probably ignore it, because the IC is still flagged as processed.
invoiceCandBL.setError(ic, e);
// invoiceCandBL.discardChangesAndSetError(ic, e);
invoiceCandDAO.save(ic);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\invoicecandidate\api\impl\InvoiceCandInvalidUpdater.java
| 1
|
请完成以下Java代码
|
public Integer getCollectTopicCount() {
return collectTopicCount;
}
public void setCollectTopicCount(Integer collectTopicCount) {
this.collectTopicCount = collectTopicCount;
}
public Integer getCollectCommentCount() {
return collectCommentCount;
}
public void setCollectCommentCount(Integer collectCommentCount) {
this.collectCommentCount = collectCommentCount;
}
public Integer getInviteFriendCount() {
return inviteFriendCount;
}
public void setInviteFriendCount(Integer inviteFriendCount) {
this.inviteFriendCount = inviteFriendCount;
}
public Date getRecentOrderTime() {
return recentOrderTime;
}
public void setRecentOrderTime(Date recentOrderTime) {
this.recentOrderTime = recentOrderTime;
}
@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(", memberId=").append(memberId);
sb.append(", consumeAmount=").append(consumeAmount);
sb.append(", orderCount=").append(orderCount);
sb.append(", couponCount=").append(couponCount);
sb.append(", commentCount=").append(commentCount);
sb.append(", returnOrderCount=").append(returnOrderCount);
sb.append(", loginCount=").append(loginCount);
sb.append(", attendCount=").append(attendCount);
sb.append(", fansCount=").append(fansCount);
sb.append(", collectProductCount=").append(collectProductCount);
sb.append(", collectSubjectCount=").append(collectSubjectCount);
sb.append(", collectTopicCount=").append(collectTopicCount);
sb.append(", collectCommentCount=").append(collectCommentCount);
sb.append(", inviteFriendCount=").append(inviteFriendCount);
sb.append(", recentOrderTime=").append(recentOrderTime);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
|
repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\UmsMemberStatisticsInfo.java
| 1
|
请完成以下Java代码
|
protected SSLSocketFactory createSslSocketFactory() {
try {
SSLContext sslContext = SSLContext.getInstance("TLS");
KeyManagerFactory keyManagerFactory = createAndInitKeyManagerFactory();
TrustManagerFactory trustManagerFactory = createAndInitTrustManagerFactory();
sslContext.init(keyManagerFactory == null ? null : keyManagerFactory.getKeyManagers(), trustManagerFactory.getTrustManagers(), null);
return sslContext.getSocketFactory();
} catch (Exception e) {
throw new RuntimeException("Creating TLS factory failed!", e);
}
}
private TrustManagerFactory createAndInitTrustManagerFactory() throws Exception {
List<X509Certificate> caCerts = SslUtil.readCertFileByPath(redisSslCredentials.getCertFile());
KeyStore caKeyStore = KeyStore.getInstance(KeyStore.getDefaultType());
caKeyStore.load(null, null);
for (X509Certificate caCert : caCerts) {
caKeyStore.setCertificateEntry("redis-caCert-cert-" + caCert.getSubjectX500Principal().getName(), caCert);
}
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
trustManagerFactory.init(caKeyStore);
return trustManagerFactory;
}
private KeyManagerFactory createAndInitKeyManagerFactory() throws Exception {
KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
kmf.init(loadKeyStore(), null);
return kmf;
}
private KeyStore loadKeyStore() throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException {
if (redisSslCredentials.getUserCertFile().isBlank() || redisSslCredentials.getUserKeyFile().isBlank()) {
|
return null;
}
List<X509Certificate> certificates = SslUtil.readCertFileByPath(redisSslCredentials.getCertFile());
PrivateKey privateKey = SslUtil.readPrivateKeyByFilePath(redisSslCredentials.getUserKeyFile(), null);
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
keyStore.load(null);
List<X509Certificate> unique = certificates.stream().distinct().toList();
for (X509Certificate cert : unique) {
keyStore.setCertificateEntry("redis-cert" + cert.getSubjectX500Principal().getName(), cert);
}
if (privateKey != null) {
CertificateFactory factory = CertificateFactory.getInstance("X.509");
CertPath certPath = factory.generateCertPath(certificates);
List<? extends Certificate> path = certPath.getCertificates();
Certificate[] x509Certificates = path.toArray(new Certificate[0]);
keyStore.setKeyEntry("redis-private-key", privateKey, null, x509Certificates);
}
return keyStore;
}
}
|
repos\thingsboard-master\common\cache\src\main\java\org\thingsboard\server\cache\TBRedisCacheConfiguration.java
| 1
|
请完成以下Java代码
|
public void setM_Product_AlbertaTherapy_ID (final int M_Product_AlbertaTherapy_ID)
{
if (M_Product_AlbertaTherapy_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Product_AlbertaTherapy_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Product_AlbertaTherapy_ID, M_Product_AlbertaTherapy_ID);
}
@Override
public int getM_Product_AlbertaTherapy_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_AlbertaTherapy_ID);
}
@Override
public void setM_Product_ID (final int M_Product_ID)
{
if (M_Product_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Product_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Product_ID, M_Product_ID);
}
@Override
public int getM_Product_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_ID);
}
/**
* Therapy AD_Reference_ID=541282
* Reference name: Therapy
*/
public static final int THERAPY_AD_Reference_ID=541282;
/** Unknown = 0 */
public static final String THERAPY_Unknown = "0";
/** ParenteralNutrition = 1 */
public static final String THERAPY_ParenteralNutrition = "1";
/** EnteralNutrition = 2 */
public static final String THERAPY_EnteralNutrition = "2";
/** Stoma = 3 */
public static final String THERAPY_Stoma = "3";
/** Tracheostoma = 4 */
public static final String THERAPY_Tracheostoma = "4";
/** Inkontinenz ableitend = 5 */
public static final String THERAPY_InkontinenzAbleitend = "5";
/** Wundversorgung = 6 */
public static final String THERAPY_Wundversorgung = "6";
/** IV-Therapien = 7 */
public static final String THERAPY_IV_Therapien = "7";
|
/** Beatmung = 8 */
public static final String THERAPY_Beatmung = "8";
/** Sonstiges = 9 */
public static final String THERAPY_Sonstiges = "9";
/** OSA = 10 */
public static final String THERAPY_OSA = "10";
/** Hustenhilfen = 11 */
public static final String THERAPY_Hustenhilfen = "11";
/** Absaugung = 12 */
public static final String THERAPY_Absaugung = "12";
/** Patientenüberwachung = 13 */
public static final String THERAPY_Patientenueberwachung = "13";
/** Sauerstoff = 14 */
public static final String THERAPY_Sauerstoff = "14";
/** Inhalations- und Atemtherapie = 15 */
public static final String THERAPY_Inhalations_UndAtemtherapie = "15";
/** Lagerungshilfsmittel = 16 */
public static final String THERAPY_Lagerungshilfsmittel = "16";
/** Schmerztherapie = 17 */
public static final String THERAPY_Schmerztherapie = "17";
@Override
public void setTherapy (final String Therapy)
{
set_Value (COLUMNNAME_Therapy, Therapy);
}
@Override
public String getTherapy()
{
return get_ValueAsString(COLUMNNAME_Therapy);
}
@Override
public void setValue (final @Nullable String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
@Override
public String getValue()
{
return get_ValueAsString(COLUMNNAME_Value);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.healthcare.alberta\src\main\java-gen\de\metas\vertical\healthcare\alberta\model\X_M_Product_AlbertaTherapy.java
| 1
|
请完成以下Java代码
|
protected void initializeCommand(CaseExecutionCommandBuilder commandBuilder, CaseExecutionTriggerDto triggerDto, String transition) {
Map<String, TriggerVariableValueDto> variables = triggerDto.getVariables();
if (variables != null && !variables.isEmpty()) {
initializeCommandWithVariables(commandBuilder, variables, transition);
}
List<VariableNameDto> deletions = triggerDto.getDeletions();
if (deletions != null && !deletions.isEmpty()) {
initializeCommandWithDeletions(commandBuilder, deletions, transition);
}
}
protected void initializeCommandWithVariables(CaseExecutionCommandBuilder commandBuilder, Map<String, TriggerVariableValueDto> variables, String transition) {
for(String variableName : variables.keySet()) {
try {
TriggerVariableValueDto variableValue = variables.get(variableName);
if (variableValue.isLocal()) {
commandBuilder.setVariableLocal(variableName, variableValue.toTypedValue(engine, objectMapper));
} else {
commandBuilder.setVariable(variableName, variableValue.toTypedValue(engine, objectMapper));
}
} catch (RestException e) {
String errorMessage = String.format("Cannot %s case instance %s due to invalid variable %s: %s", transition, caseInstanceId, variableName, e.getMessage());
|
throw new RestException(e.getStatus(), e, errorMessage);
}
}
}
protected void initializeCommandWithDeletions(CaseExecutionCommandBuilder commandBuilder, List<VariableNameDto> deletions, String transition) {
for (VariableNameDto variableName : deletions) {
if (variableName.isLocal()) {
commandBuilder.removeVariableLocal(variableName.getName());
} else {
commandBuilder.removeVariable(variableName.getName());
}
}
}
public VariableResource getVariablesResource() {
return new CaseExecutionVariablesResource(engine, caseInstanceId, objectMapper);
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\sub\runtime\impl\CaseInstanceResourceImpl.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Map<String, String> getProperties() {
return this.properties;
}
public @Nullable String getJndiName() {
return this.jndiName;
}
public void setJndiName(@Nullable String jndiName) {
this.jndiName = jndiName;
}
public Ssl getSsl() {
return this.ssl;
}
public static class Ssl {
/**
* Whether to enable SSL support. If enabled, 'mail.(protocol).ssl.enable'
* property is set to 'true'.
*/
private boolean enabled;
/**
* SSL bundle name. If set, 'mail.(protocol).ssl.socketFactory' property is set to
* an SSLSocketFactory obtained from the corresponding SSL bundle.
* <p>
* Note that the STARTTLS command can use the corresponding SSLSocketFactory, even
* if the 'mail.(protocol).ssl.enable' property is not set.
|
*/
private @Nullable String bundle;
public boolean isEnabled() {
return this.enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public @Nullable String getBundle() {
return this.bundle;
}
public void setBundle(@Nullable String bundle) {
this.bundle = bundle;
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-mail\src\main\java\org\springframework\boot\mail\autoconfigure\MailProperties.java
| 2
|
请完成以下Java代码
|
private HuId getParentHUIdOfSelectedRow()
{
final HUEditorRow huRow = getSelectedRow();
final I_M_HU hu = huRow.getM_HU();
if (hu == null)
{
return null;
}
return handlingUnitsDAO.retrieveParentId(hu);
}
public LookupValuesList getM_HU_PI_Item_IDs()
{
final ActionType actionType = getActionType();
if (actionType != ActionType.TU_To_NewLUs)
{
return LookupValuesList.EMPTY;
}
final List<I_M_HU_PI_Item> luPIItems = getAvailableLUPIItems();
return luPIItems.stream()
.filter(luPIItem -> luPIItem.getM_HU_PI_Version().isCurrent() && luPIItem.getM_HU_PI_Version().isActive() && luPIItem.getM_HU_PI_Version().getM_HU_PI().isActive())
.map(luPIItem -> IntegerLookupValue.of(luPIItem.getM_HU_PI_Item_ID(), WEBUI_ProcessHelper.buildHUPIItemString(luPIItem)))
.sorted(Comparator.comparing(IntegerLookupValue::getDisplayName))
.collect(LookupValuesList.collect());
}
public I_M_HU_PI_Item getDefaultM_LU_PI_ItemOrNull()
{
final List<I_M_HU_PI_Item> luPIItems = getAvailableLUPIItems();
final Optional<I_M_HU_PI_Item> defaultHUPIItem = luPIItems.stream()
.filter(luPIItem -> luPIItem.getM_HU_PI_Version().isCurrent() && luPIItem.getM_HU_PI_Version().isActive() && luPIItem.getM_HU_PI_Version().getM_HU_PI().isActive())
.sorted(Comparator.comparing(I_M_HU_PI_Item::getM_HU_PI_Item_ID)) // TODO what to order by ?
.findFirst();
return defaultHUPIItem.orElse(null);
}
private List<I_M_HU_PI_Item> getAvailableLUPIItems()
{
final HUEditorRow tuRow = getSelectedRow();
final I_M_HU tuHU = tuRow.getM_HU();
final I_M_HU_PI_Version effectivePIVersion = handlingUnitsBL.getEffectivePIVersion(tuHU);
Check.errorIf(effectivePIVersion == null, "tuHU is inconsistent; hu={}", tuHU);
return handlingUnitsDAO.retrieveParentPIItemsForParentPI(
effectivePIVersion.getM_HU_PI(),
null,
IHandlingUnitsBL.extractBPartnerIdOrNull(tuHU));
}
public boolean getShowWarehouseFlag()
|
{
final ActionType currentActionType = getActionType();
if (currentActionType == null)
{
return false;
}
final boolean isMoveToWarehouseAllowed = _isMoveToDifferentWarehouseEnabled && statusBL.isStatusActive(getSelectedRow().getM_HU());
if (!isMoveToWarehouseAllowed)
{
return false;
}
final boolean showWarehouse;
switch (currentActionType)
{
case CU_To_NewCU:
case CU_To_NewTUs:
case TU_To_NewLUs:
case TU_To_NewTUs:
showWarehouse = true;
break;
default:
showWarehouse = false;
}
return showWarehouse;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\handlingunits\process\WebuiHUTransformParametersFiller.java
| 1
|
请完成以下Java代码
|
public StockQtyAndUOMQty getAllocatedQty(@NonNull final I_C_Invoice_Candidate ic, @NonNull final IInvoiceLineRW il)
{
return getAllocatedQty(ic, ic.getC_Invoice_Candidate_ID(), il);
}
/**
* This method does the actual work for {@link #getAllocatedQty(I_C_Invoice_Candidate, IInvoiceLineRW)}. For an explanation of why the method is here, see
* {@link #addAssociation(I_C_Invoice_Candidate, int, IInvoiceLineRW, StockQtyAndUOMQty)}.
*/
StockQtyAndUOMQty getAllocatedQty(final I_C_Invoice_Candidate ic, final int icId, final IInvoiceLineRW il)
{
Check.assume(isAssociated(icId, il), ic + " with ID=" + icId + " is associated with " + il);
return candIdAndLine2AllocatedQty.get(icId).get(il);
}
|
@Override
public String toString()
{
return "InvoiceCandAggregateImpl [allLines=" + allLines + "]";
}
@Override
public void negateLineAmounts()
{
for (final IInvoiceLineRW line : getAllLines())
{
line.negateAmounts();
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\invoicecandidate\api\impl\InvoiceCandAggregateImpl.java
| 1
|
请完成以下Java代码
|
public long executeCount(CommandContext commandContext) {
checkQueryOk();
ensureVariablesInitialized();
return commandContext
.getCaseExecutionManager()
.findCaseExecutionCountByQueryCriteria(this);
}
public List<CaseExecution> executeList(CommandContext commandContext, Page page) {
checkQueryOk();
ensureVariablesInitialized();
List<CaseExecution> result = commandContext
.getCaseExecutionManager()
.findCaseExecutionsByQueryCriteria(this, page);
for (CaseExecution caseExecution : result) {
CaseExecutionEntity caseExecutionEntity = (CaseExecutionEntity) caseExecution;
// initializes the name, type and description
// of the activity on current case execution
caseExecutionEntity.getActivity();
}
return result;
}
// getters /////////////////////////////////////////////
public String getCaseDefinitionId() {
return caseDefinitionId;
}
public String getCaseDefinitionKey() {
return caseDefinitionKey;
}
public String getActivityId() {
return activityId;
}
public String getCaseExecutionId() {
return caseExecutionId;
}
public String getCaseInstanceId() {
return caseInstanceId;
}
public String getBusinessKey() {
return businessKey;
}
public CaseExecutionState getState() {
return state;
}
|
public boolean isCaseInstancesOnly() {
return false;
}
public String getSuperProcessInstanceId() {
return superProcessInstanceId;
}
public String getSubProcessInstanceId() {
return subProcessInstanceId;
}
public String getSuperCaseInstanceId() {
return superCaseInstanceId;
}
public String getSubCaseInstanceId() {
return subCaseInstanceId;
}
public String getDeploymentId() {
return deploymentId;
}
public Boolean isRequired() {
return required;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmmn\entity\runtime\CaseExecutionQueryImpl.java
| 1
|
请完成以下Java代码
|
public long findHistoricVariableInstanceCountByQueryCriteria(
HistoricVariableInstanceQueryImpl historicProcessVariableQuery
) {
return (Long) getDbSqlSession().selectOne(
"selectHistoricVariableInstanceCountByQueryCriteria",
historicProcessVariableQuery
);
}
@Override
@SuppressWarnings("unchecked")
public List<HistoricVariableInstance> findHistoricVariableInstancesByQueryCriteria(
HistoricVariableInstanceQueryImpl historicProcessVariableQuery,
Page page
) {
return getDbSqlSession().selectList(
"selectHistoricVariableInstanceByQueryCriteria",
historicProcessVariableQuery,
page
);
}
@Override
public HistoricVariableInstanceEntity findHistoricVariableInstanceByVariableInstanceId(String variableInstanceId) {
return (HistoricVariableInstanceEntity) getDbSqlSession().selectOne(
"selectHistoricVariableInstanceByVariableInstanceId",
variableInstanceId
);
}
|
@Override
@SuppressWarnings("unchecked")
public List<HistoricVariableInstance> findHistoricVariableInstancesByNativeQuery(
Map<String, Object> parameterMap,
int firstResult,
int maxResults
) {
return getDbSqlSession().selectListWithRawParameter(
"selectHistoricVariableInstanceByNativeQuery",
parameterMap,
firstResult,
maxResults
);
}
@Override
public long findHistoricVariableInstanceCountByNativeQuery(Map<String, Object> parameterMap) {
return (Long) getDbSqlSession().selectOne("selectHistoricVariableInstanceCountByNativeQuery", parameterMap);
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\persistence\entity\data\impl\MybatisHistoricVariableInstanceDataManager.java
| 1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.