instruction
string | input
string | output
string | source_file
string | priority
int64 |
|---|---|---|---|---|
请完成以下Java代码
|
public void setResourceId(String resourceId) {
this.resourceId = resourceId;
}
protected boolean isValidSortByValue(String value) {
return VALID_SORT_BY_VALUES.contains(value);
}
protected AuthorizationQuery createNewQuery(ProcessEngine engine) {
return engine.getAuthorizationService().createAuthorizationQuery();
}
protected void applyFilters(AuthorizationQuery query) {
if (id != null) {
query.authorizationId(id);
}
if (type != null) {
query.authorizationType(type);
}
if (userIdIn != null) {
query.userIdIn(userIdIn);
}
if (groupIdIn != null) {
query.groupIdIn(groupIdIn);
|
}
if (resourceType != null) {
query.resourceType(resourceType);
}
if (resourceId != null) {
query.resourceId(resourceId);
}
}
@Override
protected void applySortBy(AuthorizationQuery query, String sortBy, Map<String, Object> parameters, ProcessEngine engine) {
if (sortBy.equals(SORT_BY_RESOURCE_ID)) {
query.orderByResourceId();
} else if (sortBy.equals(SORT_BY_RESOURCE_TYPE)) {
query.orderByResourceType();
}
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\authorization\AuthorizationQueryDto.java
| 1
|
请完成以下Java代码
|
public class FirstDuplicate {
public int firstDuplicateBruteForce(int[] arr) {
int minIndex = arr.length;
for (int i = 0; i < arr.length - 1; i++) {
for (int j = i + 1; j < arr.length; j++) {
if (arr[i] == arr[j]) {
minIndex = Math.min(minIndex, j);
break;
}
}
}
return minIndex == arr.length ? -1 : minIndex;
}
public int firstDuplicateHashSet(int[] arr) {
HashSet<Integer> firstDuplicateSet = new HashSet<>();
for (int i = 0; i < arr.length; i++) {
|
if (firstDuplicateSet.contains(arr[i])) {
return i;
}
firstDuplicateSet.add(arr[i]);
}
return -1;
}
public int firstDuplicateArrayIndexing(int[] arr) {
for (int i = 0; i < arr.length; i++) {
int val = Math.abs(arr[i]) - 1;
if (arr[val] < 0) {
return i;
}
arr[val] = -arr[val];
}
return -1;
}
}
|
repos\tutorials-master\algorithms-modules\algorithms-miscellaneous-10\src\main\java\com\baeldung\algorithms\firstduplicate\FirstDuplicate.java
| 1
|
请完成以下Java代码
|
public class Address {
@DatabaseField(generatedId = true)
private long addressId;
@DatabaseField(canBeNull = false)
private String addressLine;
public Address() {
}
public Address(String addressLine) {
this.addressLine = addressLine;
}
public long getAddressId() {
|
return addressId;
}
public void setAddressId(long addressId) {
this.addressId = addressId;
}
public String getAddressLine() {
return addressLine;
}
public void setAddressLine(String addressLine) {
this.addressLine = addressLine;
}
}
|
repos\tutorials-master\libraries-data-db-2\src\main\java\com\baeldung\libraries\ormlite\Address.java
| 1
|
请完成以下Java代码
|
private PickedHuAndQty getPickedHuAndQty(@NonNull final PickingCandidate pc)
{
final HuId initialHuId = pc.getPickFrom().getHuId();
return initialHuId != null ? transactionedHus.get(initialHuId) : null;
}
@Nullable
private HuId getPickedHUId(@NonNull final PickingCandidate pc)
{
final PickedHuAndQty item = getPickedHuAndQty(pc);
final HuId initialHuId = pc.getPickFrom().getHuId(); // allow fallback on picking candidate HU as picked HU
return item != null ? item.getPickedHUId() : initialHuId;
}
private void validateClearedHUs(@NonNull final List<PickingCandidate> pickingCandidates, @NonNull final Set<HuId> additionalPickFromHuIds)
{
final ImmutableSet.Builder<HuId> huIdCollector = ImmutableSet.builder();
pickingCandidates
.stream()
|
.map(PickingCandidate::getPickFrom)
.map(PickFrom::getHuId)
.filter(Objects::nonNull)
.forEach(huIdCollector::add);
final ImmutableSet<HuId> husToValidate = huIdCollector.addAll(additionalPickFromHuIds).build();
final boolean anyNotClearedHUs = husToValidate.stream()
.anyMatch(huId -> !handlingUnitsBL.isHUHierarchyCleared(huId));
if (anyNotClearedHUs)
{
throw new AdempiereException(MSG_ONLY_CLEARED_HUs_CAN_BE_PICKED);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\picking\candidate\commands\ProcessHUsAndPickingCandidateCommand.java
| 1
|
请完成以下Java代码
|
private IHUDocumentFactory getHandlingUnitsHUDocumentFactory()
{
return new HandlingUnitHUDocumentFactory()
{
@Override
protected I_M_HU getInnerHU(final I_M_HU hu)
{
// NOTE: we are always returning the HU, even if it does not have a parent
return hu;
}
};
}
@Override
protected void createHUDocumentsFromTypedModel(final HUDocumentsCollector documentsCollector, final I_DD_Order ddOrder)
{
final IWarehouseDAO warehouseDAO = Services.get(IWarehouseDAO.class);
final IHandlingUnitsDAO handlingUnitsDAO = Services.get(IHandlingUnitsDAO.class);
final IHUDocumentFactory huFactory = getHandlingUnitsHUDocumentFactory();
final Set<Integer> seenHuIds = new HashSet<>();
final DDOrderLowLevelDAO ddOrderLowLevelDAO = SpringContextHolder.instance.getBean(DDOrderLowLevelDAO.class);
for (final I_DD_OrderLine line : ddOrderLowLevelDAO.retrieveLines(ddOrder))
{
//
// Create HUDocuments
final LocatorId locatorId = warehouseDAO.getLocatorIdByRepoId(line.getM_Locator_ID());
final Iterator<I_M_HU> hus = handlingUnitsDAO.retrieveTopLevelHUsForLocator(locatorId);
while (hus.hasNext())
{
final I_M_HU hu = hus.next();
final int huId = hu.getM_HU_ID();
if (!seenHuIds.add(huId))
{
// already added
continue;
}
final List<IHUDocument> lineDocuments = huFactory.createHUDocumentsFromModel(hu);
|
documentsCollector.getHUDocuments().addAll(lineDocuments);
}
//
// Create target Capacities
final Quantity qtyToDeliver = Quantitys.of(
line.getQtyOrdered().subtract(line.getQtyDelivered()),
UomId.ofRepoId(line.getC_UOM_ID()));
final Capacity targetCapacity = Capacity.createCapacity(
qtyToDeliver.toBigDecimal(), // qty
ProductId.ofRepoId(line.getM_Product_ID()),
qtyToDeliver.getUOM(),
false// allowNegativeCapacity
);
documentsCollector.getTargetCapacities().add(targetCapacity);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\distribution\ddorder\hu_spis\DDOrderHUDocumentFactory.java
| 1
|
请完成以下Java代码
|
public String getProcessDefinitionId() {
return processDefinitionId;
}
public String getActivityId() {
return activityId;
}
public boolean hasExecution() {
return this.execution != null;
}
public DelegateExecution getExecution() {
return execution;
}
public static MappingExecutionContext buildMappingExecutionContext(DelegateExecution delegateExecution) {
return new MappingExecutionContext(delegateExecution);
}
public static MappingExecutionContext buildMappingExecutionContext(String processDefinitionId, String activityId) {
return new MappingExecutionContext(processDefinitionId, activityId);
}
@Override
public boolean equals(Object o) {
if (this == o) {
|
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
MappingExecutionContext that = (MappingExecutionContext) o;
return (
Objects.equals(processDefinitionId, that.processDefinitionId) && Objects.equals(activityId, that.activityId)
);
}
@Override
public int hashCode() {
return Objects.hash(processDefinitionId, activityId);
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\bpmn\behavior\MappingExecutionContext.java
| 1
|
请完成以下Java代码
|
protected Calendar add(Calendar date, Duration duration) {
Calendar calendar = (Calendar) date.clone();
// duration.addTo does not account for daylight saving time (xerces),
// reversing order of addition fixes the problem
calendar.add(Calendar.SECOND, duration.getSeconds() * duration.getSign());
calendar.add(Calendar.MINUTE, duration.getMinutes() * duration.getSign());
calendar.add(Calendar.HOUR, duration.getHours() * duration.getSign());
calendar.add(Calendar.DAY_OF_MONTH, duration.getDays() * duration.getSign());
calendar.add(Calendar.MONTH, duration.getMonths() * duration.getSign());
calendar.add(Calendar.YEAR, duration.getYears() * duration.getSign());
return calendar;
}
protected Calendar parseDate(String date) throws Exception {
Calendar dateCalendar = null;
try {
dateCalendar = ISODateTimeFormat.dateTimeParser()
.withZone(DateTimeZone.forTimeZone(clockReader.getCurrentTimeZone()))
|
.parseDateTime(date)
.toCalendar(null);
} catch (IllegalArgumentException e) {
// try to parse a java.util.date to string back to a java.util.date
dateCalendar = new GregorianCalendar();
DateFormat DATE_FORMAT = new SimpleDateFormat("EEE MMM dd kk:mm:ss z yyyy", Locale.ENGLISH);
dateCalendar.setTime(DATE_FORMAT.parse(date));
}
return dateCalendar;
}
protected Duration parsePeriod(String period) throws Exception {
return datatypeFactory.newDuration(period);
}
protected boolean isDuration(String time) {
return time.startsWith("P");
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\calendar\DurationHelper.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
static ObjectPostProcessor<ReactiveAuthorizationManager<ServerWebExchange>> webAuthorizationManagerPostProcessor(
ObjectProvider<ObservationRegistry> registry, ObjectProvider<SecurityObservationSettings> predicate) {
return new ObjectPostProcessor<>() {
@Override
public ReactiveAuthorizationManager postProcess(ReactiveAuthorizationManager object) {
ObservationRegistry r = registry.getIfUnique(() -> ObservationRegistry.NOOP);
boolean active = !r.isNoop() && predicate.getIfUnique(() -> all).shouldObserveAuthorizations();
return active ? new ObservationReactiveAuthorizationManager<>(r, object) : object;
}
};
}
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
static ObjectPostProcessor<ReactiveAuthenticationManager> reactiveAuthenticationManagerPostProcessor(
ObjectProvider<ObservationRegistry> registry, ObjectProvider<SecurityObservationSettings> predicate) {
return new ObjectPostProcessor<>() {
@Override
public ReactiveAuthenticationManager postProcess(ReactiveAuthenticationManager object) {
ObservationRegistry r = registry.getIfUnique(() -> ObservationRegistry.NOOP);
boolean active = !r.isNoop() && predicate.getIfUnique(() -> all).shouldObserveAuthentications();
return active ? new ObservationReactiveAuthenticationManager(r, object) : object;
}
};
|
}
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
static ObjectPostProcessor<WebFilterChainDecorator> filterChainDecoratorPostProcessor(
ObjectProvider<ObservationRegistry> registry, ObjectProvider<SecurityObservationSettings> predicate) {
return new ObjectPostProcessor<>() {
@Override
public WebFilterChainDecorator postProcess(WebFilterChainDecorator object) {
ObservationRegistry r = registry.getIfUnique(() -> ObservationRegistry.NOOP);
boolean active = !r.isNoop() && predicate.getIfUnique(() -> all).shouldObserveRequests();
return active ? new ObservationWebFilterChainDecorator(r) : object;
}
};
}
}
|
repos\spring-security-main\config\src\main\java\org\springframework\security\config\annotation\web\reactive\ReactiveObservationConfiguration.java
| 2
|
请完成以下Java代码
|
public ProcessInstanceBuilder transientVariables(Map<String, Object> transientVariables) {
if (this.transientVariables == null) {
this.transientVariables = new HashMap<>();
}
if (transientVariables != null) {
for (String variableName : transientVariables.keySet()) {
this.transientVariables.put(variableName, transientVariables.get(variableName));
}
}
return this;
}
@Override
public ProcessInstanceBuilder transientVariable(String variableName, Object value) {
if (this.transientVariables == null) {
this.transientVariables = new HashMap<>();
}
this.transientVariables.put(variableName, value);
return this;
}
@Override
public ProcessInstance start() {
return runtimeService.startProcessInstance(this);
}
public String getProcessDefinitionId() {
return processDefinitionId;
}
public String getProcessDefinitionKey() {
return processDefinitionKey;
}
public String getMessageName() {
return messageName;
}
|
public String getProcessInstanceName() {
return processInstanceName;
}
public String getBusinessKey() {
return businessKey;
}
public String getTenantId() {
return tenantId;
}
public Map<String, Object> getVariables() {
return variables;
}
public Map<String, Object> getTransientVariables() {
return transientVariables;
}
}
|
repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\runtime\ProcessInstanceBuilderImpl.java
| 1
|
请完成以下Java代码
|
public MFColor setLineWidth(final float width)
{
if (!isLine())
{
return this;
}
return toBuilder().lineWidth(width).build();
}
public MFColor setLineDistance(final int distance)
{
if (!isLine())
{
return this;
}
return toBuilder().lineDistance(distance).build();
}
public MFColor toFlatColor()
{
switch (getType())
{
case FLAT:
return this;
|
case GRADIENT:
return ofFlatColor(getGradientUpperColor());
case LINES:
return ofFlatColor(getLineBackColor());
case TEXTURE:
return ofFlatColor(getTextureTaintColor());
default:
throw new IllegalStateException("Type not supported: " + getType());
}
}
public String toHexString()
{
final Color awtColor = toFlatColor().getFlatColor();
return toHexString(awtColor.getRed(), awtColor.getGreen(), awtColor.getBlue());
}
public static String toHexString(final int red, final int green, final int blue)
{
Check.assume(red >= 0 && red <= 255, "Invalid red value: {}", red);
Check.assume(green >= 0 && green <= 255, "Invalid green value: {}", green);
Check.assume(blue >= 0 && blue <= 255, "Invalid blue value: {}", blue);
return String.format("#%02x%02x%02x", red, green, blue);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\util\MFColor.java
| 1
|
请完成以下Java代码
|
public void attachState(MigratingTransitionInstance owningActivityInstance) {
ExecutionEntity representativeExecution = owningActivityInstance.resolveRepresentativeExecution();
representativeExecution.addVariableInternal(variable);
}
@Override
public void migrateState() {
migrateHistory();
}
protected void migrateHistory() {
HistoryLevel historyLevel = Context.getProcessEngineConfiguration().getHistoryLevel();
if (historyLevel.isHistoryEventProduced(HistoryEventTypes.VARIABLE_INSTANCE_MIGRATE, this)) {
HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {
@Override
|
public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
return producer.createHistoricVariableMigrateEvt(variable);
}
});
}
}
@Override
public void migrateDependentEntities() {
// nothing to do
}
public String getVariableName() {
return variable.getName();
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\migration\instance\MigratingVariableInstance.java
| 1
|
请完成以下Java代码
|
public class DeleteIdentityLinkForProcessInstanceCmd implements Command<Object>, Serializable {
private static final long serialVersionUID = 1L;
protected String processInstanceId;
protected String userId;
protected String groupId;
protected String type;
public DeleteIdentityLinkForProcessInstanceCmd(
String processInstanceId,
String userId,
String groupId,
String type
) {
validateParams(userId, groupId, processInstanceId, type);
this.processInstanceId = processInstanceId;
this.userId = userId;
this.groupId = groupId;
this.type = type;
}
protected void validateParams(String userId, String groupId, String processInstanceId, String type) {
if (processInstanceId == null) {
throw new ActivitiIllegalArgumentException("processInstanceId is null");
}
if (type == null) {
throw new ActivitiIllegalArgumentException("type is required when deleting a process identity link");
|
}
if (userId == null && groupId == null) {
throw new ActivitiIllegalArgumentException("userId and groupId cannot both be null");
}
}
public Void execute(CommandContext commandContext) {
ExecutionEntity processInstance = commandContext.getExecutionEntityManager().findById(processInstanceId);
if (processInstance == null) {
throw new ActivitiObjectNotFoundException(
"Cannot find process instance with id " + processInstanceId,
ExecutionEntity.class
);
}
executeInternal(commandContext, processInstance);
return null;
}
protected void executeInternal(CommandContext commandContext, ExecutionEntity processInstance) {
commandContext.getIdentityLinkEntityManager().deleteIdentityLink(processInstance, userId, groupId, type);
commandContext
.getHistoryManager()
.createProcessInstanceIdentityLinkComment(processInstanceId, userId, groupId, type, false);
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\cmd\DeleteIdentityLinkForProcessInstanceCmd.java
| 1
|
请完成以下Java代码
|
public Optional<UserId> getUserIdIfExists()
{
return getOptionalPropertyAsInt(Env.CTXNAME_AD_User_ID)
.map(UserId::ofRepoId);
}
public void setSysAdmin(final boolean sysAdmin)
{
setProperty("#SysAdmin", sysAdmin);
}
public void setRole(
final RoleId roleId,
final String roleName)
{
setProperty(Env.CTXNAME_AD_Role_ID, RoleId.toRepoId(roleId));
setProperty(Env.CTXNAME_AD_Role_Name, roleName);
Ini.setProperty(Ini.P_ROLE, roleName);
}
public void setRoleUserLevel(final TableAccessLevel roleUserLevel)
{
setProperty(Env.CTXNAME_AD_Role_UserLevel, roleUserLevel.getUserLevelString()); // Format 'SCO'
}
public void setAllowLoginDateOverride(final boolean allowLoginDateOverride)
{
setProperty(Env.CTXNAME_IsAllowLoginDateOverride, allowLoginDateOverride);
}
public boolean isAllowLoginDateOverride()
{
return getPropertyAsBoolean(Env.CTXNAME_IsAllowLoginDateOverride);
}
public RoleId getRoleId()
{
return RoleId.ofRepoId(getMandatoryPropertyAsInt(Env.CTXNAME_AD_Role_ID));
}
public void setClient(final ClientId clientId, final String clientName)
{
setProperty(Env.CTXNAME_AD_Client_ID, ClientId.toRepoId(clientId));
setProperty(Env.CTXNAME_AD_Client_Name, clientName);
Ini.setProperty(Ini.P_CLIENT, clientName);
}
public ClientId getClientId()
{
return ClientId.ofRepoId(getMandatoryPropertyAsInt(Env.CTXNAME_AD_Client_ID));
}
public LocalDate getLoginDate()
{
return getPropertyAsLocalDate(Env.CTXNAME_Date);
}
public void setLoginDate(final LocalDate date)
{
setProperty(Env.CTXNAME_Date, date);
}
public void setOrg(final OrgId orgId, final String orgName)
{
setProperty(Env.CTXNAME_AD_Org_ID, OrgId.toRepoId(orgId));
setProperty(Env.CTXNAME_AD_Org_Name, orgName);
Ini.setProperty(Ini.P_ORG, orgName);
}
public void setUserOrgs(final String userOrgs)
{
setProperty(Env.CTXNAME_User_Org, userOrgs);
}
public OrgId getOrgId()
{
|
return OrgId.ofRepoId(getMandatoryPropertyAsInt(Env.CTXNAME_AD_Org_ID));
}
public void setWarehouse(final WarehouseId warehouseId, final String warehouseName)
{
setProperty(Env.CTXNAME_M_Warehouse_ID, WarehouseId.toRepoId(warehouseId));
Ini.setProperty(Ini.P_WAREHOUSE, warehouseName);
}
@Nullable
public WarehouseId getWarehouseId()
{
return WarehouseId.ofRepoIdOrNull(getPropertyAsInt(Env.CTXNAME_M_Warehouse_ID));
}
public void setPrinterName(final String printerName)
{
setProperty(Env.CTXNAME_Printer, printerName == null ? "" : printerName);
Ini.setProperty(Ini.P_PRINTER, printerName);
}
public void setAcctSchema(final AcctSchema acctSchema)
{
setProperty("$C_AcctSchema_ID", acctSchema.getId().getRepoId());
setProperty("$C_Currency_ID", acctSchema.getCurrencyId().getRepoId());
setProperty("$HasAlias", acctSchema.getValidCombinationOptions().isUseAccountAlias());
}
@Nullable
public AcctSchemaId getAcctSchemaId()
{
return AcctSchemaId.ofRepoIdOrNull(getPropertyAsInt("$C_AcctSchema_ID"));
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\util\LoginContext.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
CassandraConverter cassandraConverter(CassandraMappingContext mapping, CassandraCustomConversions conversions) {
MappingCassandraConverter converter = new MappingCassandraConverter(mapping);
converter.setCodecRegistry(() -> this.session.getContext().getCodecRegistry());
converter.setCustomConversions(conversions);
converter.setUserTypeResolver(new SimpleUserTypeResolver(this.session));
return converter;
}
@Bean
@ConditionalOnMissingBean(SessionFactory.class)
SessionFactoryFactoryBean cassandraSessionFactory(Environment environment, CassandraConverter converter) {
SessionFactoryFactoryBean session = new SessionFactoryFactoryBean();
session.setSession(this.session);
session.setConverter(converter);
Binder binder = Binder.get(environment);
binder.bind("spring.cassandra.schema-action", SchemaAction.class).ifBound(session::setSchemaAction);
return session;
}
@Bean
@ConditionalOnMissingBean(CqlOperations.class)
CqlTemplate cqlTemplate(SessionFactory sessionFactory) {
|
return new CqlTemplate(sessionFactory);
}
@Bean
@ConditionalOnMissingBean(CassandraOperations.class)
CassandraTemplate cassandraTemplate(CqlTemplate cqlTemplate, CassandraConverter converter) {
return new CassandraTemplate(cqlTemplate, converter);
}
@Bean
@ConditionalOnMissingBean
CassandraCustomConversions cassandraCustomConversions() {
return new CassandraCustomConversions(Collections.emptyList());
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-data-cassandra\src\main\java\org\springframework\boot\data\cassandra\autoconfigure\DataCassandraAutoConfiguration.java
| 2
|
请完成以下Java代码
|
public void setCommitRecovered(boolean commitRecovered) { // NOSONAR enhanced javadoc
super.setCommitRecovered(commitRecovered);
}
@Override
public boolean isAckAfterHandle() {
return this.ackAfterHandle;
}
@Override
public void setAckAfterHandle(boolean ackAfterHandle) {
this.ackAfterHandle = ackAfterHandle;
}
@Override
public boolean seeksAfterHandling() {
return isSeekAfterError();
}
@Override
public boolean deliveryAttemptHeader() {
return true;
}
@Override
public boolean handleOne(Exception thrownException, ConsumerRecord<?, ?> record, Consumer<?, ?> consumer,
MessageListenerContainer container) {
try {
return getFailureTracker().recovered(record, thrownException, container, consumer);
}
catch (Exception ex) {
if (SeekUtils.isBackoffException(thrownException)) {
this.logger.debug(ex, "Failed to handle " + KafkaUtils.format(record) + " with " + thrownException);
}
else {
this.logger.error(ex, "Failed to handle " + KafkaUtils.format(record) + " with " + thrownException);
}
return false;
}
}
@Override
public void handleRemaining(Exception thrownException, List<ConsumerRecord<?, ?>> records,
|
Consumer<?, ?> consumer, MessageListenerContainer container) {
SeekUtils.seekOrRecover(thrownException, records, consumer, container, isCommitRecovered(), // NOSONAR
getFailureTracker(), this.logger, getLogLevel());
}
@Override
public void handleBatch(Exception thrownException, ConsumerRecords<?, ?> data, Consumer<?, ?> consumer,
MessageListenerContainer container, Runnable invokeListener) {
doHandle(thrownException, data, consumer, container, invokeListener);
}
@Override
public <K, V> ConsumerRecords<K, V> handleBatchAndReturnRemaining(Exception thrownException,
ConsumerRecords<?, ?> data, Consumer<?, ?> consumer, MessageListenerContainer container,
Runnable invokeListener) {
return handle(thrownException, data, consumer, container, invokeListener);
}
@Override
public void handleOtherException(Exception thrownException, Consumer<?, ?> consumer,
MessageListenerContainer container, boolean batchListener) {
if (thrownException instanceof SerializationException) {
throw new IllegalStateException("This error handler cannot process 'SerializationException's directly; "
+ "please consider configuring an 'ErrorHandlingDeserializer' in the value and/or key "
+ "deserializer", thrownException);
}
else {
throw new IllegalStateException("This error handler cannot process '"
+ thrownException.getClass().getName()
+ "'s; no record information is available", thrownException);
}
}
@Override
public void onPartitionsAssigned(Consumer<?, ?> consumer, Collection<TopicPartition> partitions,
Runnable publishPause) {
getFallbackBatchHandler().onPartitionsAssigned(consumer, partitions, publishPause);
}
}
|
repos\spring-kafka-main\spring-kafka\src\main\java\org\springframework\kafka\listener\DefaultErrorHandler.java
| 1
|
请完成以下Java代码
|
public void setC_Flatrate_RefundConfig_ID (int C_Flatrate_RefundConfig_ID)
{
if (C_Flatrate_RefundConfig_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_Flatrate_RefundConfig_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_Flatrate_RefundConfig_ID, Integer.valueOf(C_Flatrate_RefundConfig_ID));
}
/** Get C_Flatrate_RefundConfig.
@return C_Flatrate_RefundConfig */
@Override
public int getC_Flatrate_RefundConfig_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Flatrate_RefundConfig_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Vertrag-Rechnungskandidat.
@param C_Invoice_Candidate_Term_ID Vertrag-Rechnungskandidat */
@Override
public void setC_Invoice_Candidate_Term_ID (int C_Invoice_Candidate_Term_ID)
{
|
if (C_Invoice_Candidate_Term_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_Invoice_Candidate_Term_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_Invoice_Candidate_Term_ID, Integer.valueOf(C_Invoice_Candidate_Term_ID));
}
/** Get Vertrag-Rechnungskandidat.
@return Vertrag-Rechnungskandidat */
@Override
public int getC_Invoice_Candidate_Term_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Invoice_Candidate_Term_ID);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java-gen\de\metas\contracts\model\X_C_Invoice_Candidate_Assignment_Aggregate_V.java
| 1
|
请完成以下Java代码
|
public org.compiere.model.I_AD_Session getAD_Session()
{
return get_ValueAsPO(COLUMNNAME_AD_Session_ID, org.compiere.model.I_AD_Session.class);
}
@Override
public void setAD_Session(org.compiere.model.I_AD_Session AD_Session)
{
set_ValueFromPO(COLUMNNAME_AD_Session_ID, org.compiere.model.I_AD_Session.class, AD_Session);
}
@Override
public void setAD_Session_ID (int AD_Session_ID)
{
if (AD_Session_ID < 1)
set_Value (COLUMNNAME_AD_Session_ID, null);
else
set_Value (COLUMNNAME_AD_Session_ID, Integer.valueOf(AD_Session_ID));
}
@Override
public int getAD_Session_ID()
{
return get_ValueAsInt(COLUMNNAME_AD_Session_ID);
}
@Override
public void setDateLastPoll (java.sql.Timestamp DateLastPoll)
{
set_Value (COLUMNNAME_DateLastPoll, DateLastPoll);
}
@Override
public java.sql.Timestamp getDateLastPoll()
|
{
return get_ValueAsTimestamp(COLUMNNAME_DateLastPoll);
}
@Override
public void setHostKey (java.lang.String HostKey)
{
set_Value (COLUMNNAME_HostKey, HostKey);
}
@Override
public java.lang.String getHostKey()
{
return (java.lang.String)get_Value(COLUMNNAME_HostKey);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.printing\de.metas.printing.base\src\main\java-gen\de\metas\printing\model\X_AD_Print_Clients.java
| 1
|
请完成以下Java代码
|
public class ProcessCompletedImpl
extends RuntimeEventImpl<ProcessInstance, ProcessRuntimeEvent.ProcessEvents>
implements ProcessCompletedEvent {
private final String actor;
public ProcessCompletedImpl(ProcessInstance entity) {
super(entity);
setProcessInstanceId(entity.getId());
this.actor = SERVICE_USER;
}
public ProcessCompletedImpl(ProcessInstance entity, String actor) {
super(entity);
setProcessInstanceId(entity.getId());
this.actor = actor;
}
|
@Override
public ProcessEvents getEventType() {
return ProcessEvents.PROCESS_COMPLETED;
}
@Override
public String toString() {
return "ProcessCompletedEventImpl{" + super.toString() + '}';
}
@Override
public String getActor() {
return actor;
}
}
|
repos\Activiti-develop\activiti-core\activiti-api-impl\activiti-api-process-runtime-impl\src\main\java\org\activiti\runtime\api\event\impl\ProcessCompletedImpl.java
| 1
|
请完成以下Java代码
|
public class LiteralExpressionImpl extends ExpressionImpl implements LiteralExpression {
protected static Attribute<String> expressionLanguageAttribute;
protected static ChildElement<Text> textChild;
protected static ChildElement<ImportedValues> importedValuesChild;
public LiteralExpressionImpl(ModelTypeInstanceContext instanceContext) {
super(instanceContext);
}
public String getExpressionLanguage() {
return expressionLanguageAttribute.getValue(this);
}
public void setExpressionLanguage(String expressionLanguage) {
expressionLanguageAttribute.setValue(this, expressionLanguage);
}
public Text getText() {
return textChild.getChild(this);
}
public void setText(Text text) {
textChild.setChild(this, text);
}
public ImportedValues getImportValues() {
return importedValuesChild.getChild(this);
}
public void setImportValues(ImportedValues importedValues) {
importedValuesChild.setChild(this, importedValues);
}
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(LiteralExpression.class, DMN_ELEMENT_LITERAL_EXPRESSION)
.namespaceUri(LATEST_DMN_NS)
.extendsType(Expression.class)
.instanceProvider(new ModelTypeInstanceProvider<LiteralExpression>() {
public LiteralExpression newInstance(ModelTypeInstanceContext instanceContext) {
return new LiteralExpressionImpl(instanceContext);
|
}
});
expressionLanguageAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_EXPRESSION_LANGUAGE)
.build();
SequenceBuilder sequenceBuilder = typeBuilder.sequence();
textChild = sequenceBuilder.element(Text.class)
.build();
importedValuesChild = sequenceBuilder.element(ImportedValues.class)
.build();
typeBuilder.build();
}
}
|
repos\camunda-bpm-platform-master\model-api\dmn-model\src\main\java\org\camunda\bpm\model\dmn\impl\instance\LiteralExpressionImpl.java
| 1
|
请完成以下Java代码
|
public void setPastDue61_90 (BigDecimal PastDue61_90)
{
set_Value (COLUMNNAME_PastDue61_90, PastDue61_90);
}
/** Get Past Due 61-90.
@return Past Due 61-90 */
public BigDecimal getPastDue61_90 ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PastDue61_90);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Past Due > 61.
@param PastDue61_Plus Past Due > 61 */
public void setPastDue61_Plus (BigDecimal PastDue61_Plus)
{
set_Value (COLUMNNAME_PastDue61_Plus, PastDue61_Plus);
}
/** Get Past Due > 61.
@return Past Due > 61 */
public BigDecimal getPastDue61_Plus ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PastDue61_Plus);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Past Due 8-30.
@param PastDue8_30 Past Due 8-30 */
public void setPastDue8_30 (BigDecimal PastDue8_30)
{
set_Value (COLUMNNAME_PastDue8_30, PastDue8_30);
}
/** Get Past Due 8-30.
@return Past Due 8-30 */
public BigDecimal getPastDue8_30 ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PastDue8_30);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Past Due > 91.
@param PastDue91_Plus Past Due > 91 */
public void setPastDue91_Plus (BigDecimal PastDue91_Plus)
{
set_Value (COLUMNNAME_PastDue91_Plus, PastDue91_Plus);
}
/** Get Past Due > 91.
@return Past Due > 91 */
public BigDecimal getPastDue91_Plus ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PastDue91_Plus);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Past Due.
|
@param PastDueAmt Past Due */
public void setPastDueAmt (BigDecimal PastDueAmt)
{
set_Value (COLUMNNAME_PastDueAmt, PastDueAmt);
}
/** Get Past Due.
@return Past Due */
public BigDecimal getPastDueAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PastDueAmt);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Statement date.
@param StatementDate
Date of the statement
*/
public void setStatementDate (Timestamp StatementDate)
{
set_Value (COLUMNNAME_StatementDate, StatementDate);
}
/** Get Statement date.
@return Date of the statement
*/
public Timestamp getStatementDate ()
{
return (Timestamp)get_Value(COLUMNNAME_StatementDate);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_T_Aging.java
| 1
|
请完成以下Java代码
|
public void onValueChanged(final IAttributeValueContext attributeValueContext,
final IAttributeSet attributeSet,
final org.compiere.model.I_M_Attribute attribute,
final Object valueOld,
final Object valueNew)
{
final BigDecimal valueOldBD = ConversionHelper.toBigDecimal(valueOld);
final BigDecimal valueNewBD = ConversionHelper.toBigDecimal(valueNew);
if (valueNewBD.signum() == 0 && valueOldBD.signum() == 0)
{
// nothing to change in this case
return;
}
// task 08782: goal of this parameter: we don't want to reset a pre-existing value unless the procuser is actually changed.
final boolean subProducerInitialized = valueNewBD.signum() != 0 && valueOldBD.signum() == 0;
final Properties ctx = InterfaceWrapperHelper.getCtx(attribute);
Services.get(ISubProducerAttributeBL.class).updateAttributesOnSubProducerChanged(ctx, attributeSet, subProducerInitialized);
}
@Override
public Object generateSeedValue(final IAttributeSet attributeSet, final org.compiere.model.I_M_Attribute attribute, final Object valueInitialDefault)
{
// we don't support a value different from null
Check.assumeNull(valueInitialDefault, "valueInitialDefault null");
return HUSubProducerBPartnerAttributeValuesProvider.staticNullValue();
}
@Override
public boolean isReadonlyUI(final IAttributeValueContext ctx, final IAttributeSet attributeSet, final org.compiere.model.I_M_Attribute attribute)
|
{
final I_M_HU hu = Services.get(IHUAttributesBL.class).getM_HU_OrNull(attributeSet);
if (hu == null)
{
// If there is no HU (e.g. ASI), consider it editable
return false;
}
final String huStatus = hu.getHUStatus();
if (!X_M_HU.HUSTATUS_Planning.equals(huStatus))
{
// Allow editing only Planning HUs
return true;
}
return false;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\org\adempiere\mm\attributes\spi\impl\HUSubProducerBPartnerAttributeHandler.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private static class ScriptName
{
public static ScriptName of(final IScript script)
{
final String projectName = script.getProjectName();
if (projectName == null)
{
throw new IllegalArgumentException("No projectName was set for " + script);
}
final String fileName = script.getFileName();
final String name = projectName + "->" + fileName;
return new ScriptName(projectName, name);
}
|
public static ScriptName ofProjectNameAndName(final String projectName, final String name)
{
return new ScriptName(projectName, name);
}
String projectName;
String name;
private ScriptName(final String projectName, final String name)
{
this.projectName = projectName;
this.name = name;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.migration\de.metas.migration.base\src\main\java\de\metas\migration\impl\SQLDatabaseScriptsRegistry.java
| 2
|
请完成以下Java代码
|
public void FastJson() {
for (int i = 0; i < count; i++) {
FastJsonUtil.bean2Json(p);
}
}
@Benchmark
public void Jackson() {
for (int i = 0; i < count; i++) {
JacksonUtil.bean2Json(p);
}
}
@Setup
public void prepare() {
List<Person> friends=new ArrayList<Person>();
friends.add(createAPerson("小明",null));
friends.add(createAPerson("Tony",null));
friends.add(createAPerson("陈小二",null));
p=createAPerson("邵同学",friends);
}
@TearDown
public void shutdown() {
}
private Person createAPerson(String name,List<Person> friends) {
Person newPerson=new Person();
|
newPerson.setName(name);
newPerson.setFullName(new FullName("zjj_first", "zjj_middle", "zjj_last"));
newPerson.setAge(24);
List<String> hobbies=new ArrayList<String>();
hobbies.add("篮球");
hobbies.add("游泳");
hobbies.add("coding");
newPerson.setHobbies(hobbies);
Map<String,String> clothes=new HashMap<String, String>();
clothes.put("coat", "Nike");
clothes.put("trousers", "adidas");
clothes.put("shoes", "安踏");
newPerson.setClothes(clothes);
newPerson.setFriends(friends);
return newPerson;
}
}
|
repos\SpringBootBucket-master\springboot-echarts\src\main\java\com\xncoding\benchmark\json\JsonSerializeBenchmark.java
| 1
|
请完成以下Java代码
|
public String getRegisterActivitySubtitle() {
return registerActivitySubtitle.getExpressionString();
}
public void setRegisterActivitySubtitle(String registerActivitySubtitle) {
this.registerActivitySubtitle = parser.parseExpression(registerActivitySubtitle,
ParserContext.TEMPLATE_EXPRESSION);
}
public String getStatusActivitySubtitle() {
return statusActivitySubtitle.getExpressionString();
}
public void setStatusActivitySubtitle(String statusActivitySubtitle) {
this.statusActivitySubtitle = parser.parseExpression(statusActivitySubtitle, ParserContext.TEMPLATE_EXPRESSION);
}
@Data
@Builder
public static class Message {
private final String summary;
private final String themeColor;
private final String title;
|
@Builder.Default
private final List<Section> sections = new ArrayList<>();
}
@Data
@Builder
public static class Section {
private final String activityTitle;
private final String activitySubtitle;
@Builder.Default
private final List<Fact> facts = new ArrayList<>();
}
public record Fact(String name, @Nullable String value) {
}
}
|
repos\spring-boot-admin-master\spring-boot-admin-server\src\main\java\de\codecentric\boot\admin\server\notify\MicrosoftTeamsNotifier.java
| 1
|
请完成以下Java代码
|
protected boolean afterSave (boolean newRecord,boolean success)
{
log.info("afterSave");
int p_A_Asset_ID = 0;
int total_unitsused = 0;
p_A_Asset_ID = getA_Asset_ID();
String sql = "SELECT SUM(USEUNITS) FROM A_Asset_use WHERE A_Asset_ID=? and usedate <= now()";
total_unitsused = DB.getSQLValue(null, sql, getA_Asset_ID());
MAsset asset = new MAsset (getCtx(), p_A_Asset_ID, null);
asset.setUseUnits(total_unitsused);
asset.setProcessing(false);
asset.save();
MAssetChange change = new MAssetChange (getCtx(), 0,null);
|
change.setA_Asset_ID(p_A_Asset_ID);
change.setChangeType("USE");
MRefList RefList = new MRefList (getCtx(), 0, null);
change.setTextDetails(RefList.getListDescription (getCtx(),"A_Update_Type" , "USE"));
change.setUseUnits(getUseUnits());
change.save();
return true;
} // afterSave
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java-legacy\org\compiere\model\MAssetUse.java
| 1
|
请完成以下Java代码
|
public CamundaBpmRunRestProperties getRest() {
return rest;
}
public void setRest(CamundaBpmRunRestProperties rest) {
this.rest = rest;
}
public CamundaBpmRunDeploymentProperties getDeployment() {
return deployment;
}
public void setDeployment(CamundaBpmRunDeploymentProperties deployment) {
this.deployment = deployment;
}
|
@Override
public String toString() {
return "CamundaBpmRunProperties [" +
"auth=" + auth +
", cors=" + cors +
", ldap=" + ldap +
", adminAuth=" + adminAuth +
", plugins=" + processEnginePlugins +
", rest=" + rest +
", deployment=" + deployment +
"]";
}
}
|
repos\camunda-bpm-platform-master\distro\run\core\src\main\java\org\camunda\bpm\run\property\CamundaBpmRunProperties.java
| 1
|
请完成以下Java代码
|
public void setC_PurchaseCandidate_ID (final int C_PurchaseCandidate_ID)
{
if (C_PurchaseCandidate_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_PurchaseCandidate_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_PurchaseCandidate_ID, C_PurchaseCandidate_ID);
}
@Override
public int getC_PurchaseCandidate_ID()
{
return get_ValueAsInt(COLUMNNAME_C_PurchaseCandidate_ID);
}
@Override
public void setDateOrdered (final @Nullable java.sql.Timestamp DateOrdered)
{
set_Value (COLUMNNAME_DateOrdered, DateOrdered);
}
@Override
public java.sql.Timestamp getDateOrdered()
{
return get_ValueAsTimestamp(COLUMNNAME_DateOrdered);
}
@Override
public void setDatePromised (final @Nullable java.sql.Timestamp DatePromised)
{
set_Value (COLUMNNAME_DatePromised, DatePromised);
}
@Override
public java.sql.Timestamp getDatePromised()
{
return get_ValueAsTimestamp(COLUMNNAME_DatePromised);
}
@Override
public void setRecord_ID (final int Record_ID)
{
if (Record_ID < 0)
set_Value (COLUMNNAME_Record_ID, null);
else
set_Value (COLUMNNAME_Record_ID, Record_ID);
|
}
@Override
public int getRecord_ID()
{
return get_ValueAsInt(COLUMNNAME_Record_ID);
}
@Override
public void setRemotePurchaseOrderId (final @Nullable java.lang.String RemotePurchaseOrderId)
{
set_Value (COLUMNNAME_RemotePurchaseOrderId, RemotePurchaseOrderId);
}
@Override
public java.lang.String getRemotePurchaseOrderId()
{
return get_ValueAsString(COLUMNNAME_RemotePurchaseOrderId);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.purchasecandidate.base\src\main\java-gen\de\metas\purchasecandidate\model\X_C_PurchaseCandidate_Alloc.java
| 1
|
请完成以下Java代码
|
default LocalDateTime getValueAsLocalDateTime(final AttributeCode attributeCode)
{
return TimeUtil.asLocalDateTime(getValueAsDate(attributeCode));
}
@Nullable
default LocalDateTime getValueAsLocalDateTime(final @NonNull String attributeKey)
{
return TimeUtil.asLocalDateTime(getValueAsDate(attributeKey));
}
@Nullable
default LocalDate getValueAsLocalDate(final AttributeCode attributeCode)
{
return TimeUtil.asLocalDate(getValueAsDate(attributeCode));
}
@Nullable
default LocalDate getValueAsLocalDate(final @NonNull String attributeKey)
{
return TimeUtil.asLocalDate(getValueAsDate(attributeKey));
}
@Nullable
String getValueAsString(AttributeCode attributeCode);
@Nullable
String getValueAsStringOrNull(AttributeCode attributeCode);
@Nullable
default String getValueAsString(@NonNull final String attributeKey)
{
return getValueAsString(AttributeCode.ofString(attributeKey));
}
@Nullable
default String getValueAsString(@NonNull final I_M_Attribute attribute)
{
return getValueAsString(AttributeCode.ofString(attribute.getValue()));
}
@Nullable
default AttributeValueId getAttributeValueIdOrNull(final AttributeCode attributeCode)
{
return null;
}
default boolean isValueSet(final Attribute attribute)
{
if (!hasAttribute(attribute))
{
return false;
}
final String value = getValueAsStringOrNull(attribute.getAttributeCode());
return value != null && !Check.isBlank(value);
}
|
/**
* Set attribute's value and propagate to its parent/child attribute sets.
*
* @throws AttributeNotFoundException if given attribute was not found or is not supported
*/
void setValue(AttributeCode attributeCode, Object value);
default void setValue(@NonNull final String attribute, final Object value)
{
setValue(AttributeCode.ofString(attribute), value);
}
void setValue(AttributeId attributeId, Object value);
default void setValue(final @NonNull I_M_Attribute attribute, final Object value)
{
setValue(attribute.getValue(), value);
}
/**
* @return {@link IAttributeValueCallout} instance; never return null
*/
IAttributeValueCallout getAttributeValueCallout(final I_M_Attribute attribute);
/**
* @return true if the given <code>attribute</code>'s value was newly generated
*/
boolean isNew(final I_M_Attribute attribute);
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\org\adempiere\mm\attributes\api\IAttributeSet.java
| 1
|
请完成以下Java代码
|
public boolean accept(final IValidationContext evalCtx, final NamePair item)
{
return true;
}
};
public static Composer compose()
{
return new Composer();
}
@EqualsAndHashCode
private static final class ComposedNamePairPredicate implements INamePairPredicate
{
private final ImmutableSet<INamePairPredicate> predicates;
private ComposedNamePairPredicate(final Set<INamePairPredicate> predicates)
{
// NOTE: we assume the predicates set is: not empty, has more than one element, does not contain nulls
this.predicates = ImmutableSet.copyOf(predicates);
}
@Override
public String toString()
{
return MoreObjects.toStringHelper("composite")
.addValue(predicates)
.toString();
}
@Override
public ImmutableSet<String> getParameters(@Nullable final String contextTableName)
{
return predicates.stream()
.flatMap(predicate -> predicate.getParameters(contextTableName).stream())
.collect(ImmutableSet.toImmutableSet());
}
@Override
public boolean accept(final IValidationContext evalCtx, final NamePair item)
{
for (final INamePairPredicate predicate : predicates)
{
if (predicate.accept(evalCtx, item))
{
return true;
}
}
return false;
|
}
}
public static class Composer
{
private Set<INamePairPredicate> collectedPredicates = null;
private Composer()
{
super();
}
public INamePairPredicate build()
{
if (collectedPredicates == null || collectedPredicates.isEmpty())
{
return ACCEPT_ALL;
}
else if (collectedPredicates.size() == 1)
{
return collectedPredicates.iterator().next();
}
else
{
return new ComposedNamePairPredicate(collectedPredicates);
}
}
public Composer add(@Nullable final INamePairPredicate predicate)
{
if (predicate == null || predicate == ACCEPT_ALL)
{
return this;
}
if (collectedPredicates == null)
{
collectedPredicates = new LinkedHashSet<>();
}
if (collectedPredicates.contains(predicate))
{
return this;
}
collectedPredicates.add(predicate);
return this;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\validationRule\NamePairPredicates.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public int getSessionTimeoutInSeconds() {
return sessionTimeoutInSeconds;
}
public void setSessionTimeoutInSeconds(int sessionTimeoutInSeconds) {
this.sessionTimeoutInSeconds = sessionTimeoutInSeconds;
}
public String getCookieDomain() {
return cookieDomain;
}
public void setCookieDomain(String cookieDomain) {
this.cookieDomain = cookieDomain;
}
}
public static class SignatureVerification {
/**
* Maximum refresh rate for public keys in ms.
* We won't fetch new public keys any faster than that to avoid spamming UAA in case
* we receive a lot of "illegal" tokens.
*/
private long publicKeyRefreshRateLimit = 10 * 1000L;
/**
* Maximum TTL for the public key in ms.
* The public key will be fetched again from UAA if it gets older than that.
* That way, we make sure that we get the newest keys always in case they are updated there.
*/
private long ttl = 24 * 60 * 60 * 1000L;
/**
* Endpoint where to retrieve the public key used to verify token signatures.
*/
private String publicKeyEndpointUri = "http://uaa/oauth/token_key";
public long getPublicKeyRefreshRateLimit() {
return publicKeyRefreshRateLimit;
}
public void setPublicKeyRefreshRateLimit(long publicKeyRefreshRateLimit) {
this.publicKeyRefreshRateLimit = publicKeyRefreshRateLimit;
}
|
public long getTtl() {
return ttl;
}
public void setTtl(long ttl) {
this.ttl = ttl;
}
public String getPublicKeyEndpointUri() {
return publicKeyEndpointUri;
}
public void setPublicKeyEndpointUri(String publicKeyEndpointUri) {
this.publicKeyEndpointUri = publicKeyEndpointUri;
}
}
}
|
repos\tutorials-master\jhipster-modules\jhipster-uaa\gateway\src\main\java\com\baeldung\jhipster\gateway\config\oauth2\OAuth2Properties.java
| 2
|
请完成以下Java代码
|
protected boolean fileExists(File file) {
return file != null && file.exists() && file.isFile() && file.canRead();
}
protected Expression getExpression(DelegateExecution execution, Expression var) {
String variable = (String) execution.getVariable(var.getExpressionText());
return Context.getProcessEngineConfiguration().getExpressionManager().createExpression(variable);
}
protected void handleException(
DelegateExecution execution,
String msg,
Exception e,
boolean doIgnoreException,
String exceptionVariable
|
) {
if (doIgnoreException) {
LOG.info("Ignoring email send error: " + msg, e);
if (exceptionVariable != null && exceptionVariable.length() > 0) {
execution.setVariable(exceptionVariable, msg);
}
} else {
if (e instanceof ActivitiException) {
throw (ActivitiException) e;
} else {
throw new ActivitiException(msg, e);
}
}
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\bpmn\behavior\MailActivityBehavior.java
| 1
|
请完成以下Java代码
|
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Date getPostedAt() {
return postedAt;
|
}
public void setPostedAt(Date postedAt) {
this.postedAt = postedAt;
}
public Date getLastUpdatedAt() {
return lastUpdatedAt;
}
public void setLastUpdatedAt(Date lastUpdatedAt) {
this.lastUpdatedAt = lastUpdatedAt;
}
public Set<Tag> getTags() {
return tags;
}
public void setTags(Set<Tag> tags) {
this.tags = tags;
}
}
|
repos\Spring-Boot-Advanced-Projects-main\springboot-hibernate-many-to-many-mapping\src\main\java\net\alanbinu\springboot\entity\Post.java
| 1
|
请完成以下Java代码
|
public boolean hasActiveAttribute(@NonNull final AttributeId attributeId)
{
final I_M_HU_PI_Attribute piAttribute = getByAttributeIdOrNull(attributeId);
return piAttribute != null && piAttribute.isActive();
}
public I_M_HU_PI_Attribute getByAttributeId(final AttributeId attributeId)
{
final I_M_HU_PI_Attribute piAttribute = getByAttributeIdOrNull(attributeId);
if (piAttribute == null)
{
throw new AdempiereException("No " + attributeId + " found. Available attributeIds are: " + getAttributeIds());
}
return piAttribute;
}
public Optional<I_M_HU_PI_Attribute> getByAttributeIdIfExists(final AttributeId attributeId)
{
final I_M_HU_PI_Attribute piAttribute = getByAttributeIdOrNull(attributeId);
return Optional.ofNullable(piAttribute);
}
private I_M_HU_PI_Attribute getByAttributeIdOrNull(final AttributeId attributeId)
{
return attributesByAttributeId.get(attributeId);
}
public PIAttributes addIfAbsent(@NonNull final PIAttributes from)
{
if (from.isEmpty())
{
return this;
}
if (this.isEmpty())
{
return from;
}
final LinkedHashMap<AttributeId, I_M_HU_PI_Attribute> piAttributesNew = new LinkedHashMap<>(attributesByAttributeId);
from.attributesByAttributeId.forEach(piAttributesNew::putIfAbsent);
return of(piAttributesNew.values());
}
public int getSeqNoByAttributeId(final AttributeId attributeId, final int seqNoIfNotFound)
|
{
final I_M_HU_PI_Attribute piAttribute = getByAttributeIdOrNull(attributeId);
if (piAttribute == null)
{
return seqNoIfNotFound;
}
return piAttribute.getSeqNo();
}
public ImmutableSet<AttributeId> getAttributeIds()
{
return attributesByAttributeId.keySet();
}
public boolean isEmpty()
{
return attributesByAttributeId.isEmpty();
}
public boolean isUseInASI(@NonNull final AttributeId attributeId)
{
return getByAttributeId(attributeId).isUseInASI();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\attribute\PIAttributes.java
| 1
|
请完成以下Java代码
|
public Object getParameterDefaultValue(@NonNull final IProcessDefaultParameter parameter)
{
if (Objects.equals(PARAM_QtyCUsPerTU, parameter.getColumnName()))
{
return retrieveQtyToPick().toBigDecimal();
}
else if (Objects.equals(PARAM_M_HU_PI_Item_Product_ID, parameter.getColumnName()))
{
final I_M_ShipmentSchedule shipmentSchedule = getCurrentShipmentSchedule();
final HUPIItemProductId piItemProductId = HUPIItemProductId.ofRepoIdOrNull(shipmentSchedule.getM_HU_PI_Item_Product_ID());
if (piItemProductId == null)
{
return IProcessDefaultParametersProvider.DEFAULT_VALUE_NOTAVAILABLE;
}
else
{
final IHUPIItemProductBL hupiItemProductBL = Services.get(IHUPIItemProductBL.class);
final ITranslatableString displayName = hupiItemProductBL.getDisplayName(piItemProductId);
return IntegerLookupValue.of(piItemProductId, displayName);
}
}
else
{
return DEFAULT_VALUE_NOTAVAILABLE;
}
|
}
/**
* Creates a new M_HU within the processe's interited trx.
*/
private static I_M_HU createTU(
@NonNull final I_M_HU_PI_Item_Product itemProduct,
@NonNull final LocatorId locatorId)
{
final IHandlingUnitsDAO handlingUnitsDAO = Services.get(IHandlingUnitsDAO.class);
final IHUTrxBL huTrxBL = Services.get(IHUTrxBL.class);
final I_M_HU_PI huPI = itemProduct.getM_HU_PI_Item().getM_HU_PI_Version().getM_HU_PI();
return huTrxBL.createHUContextProcessorExecutor()
.call(huContext -> handlingUnitsDAO.createHUBuilder(huContext)
.setM_HU_Item_Parent(null) // no parent
.setM_HU_PI_Item_Product(itemProduct)
.setLocatorId(locatorId)
// we are going to load from a "real" source HU onto this HU, so both shall be active. Otherwise it would look as if stuff was vanishing for the source HU
.setHUStatus(X_M_HU.HUSTATUS_Active)
.create(huPI));
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\picking\pickingslot\process\WEBUI_Picking_PickQtyToNewHU.java
| 1
|
请完成以下Java代码
|
public String getExecutionId() {
return ScopeTypes.BPMN.equals(scopeType) ? subScopeId : null;
}
public void setExecutionId(String executionId) {
setScopeType(ScopeTypes.BPMN);
setSubScopeId(executionId);
}
@Override
public String getProcessDefinitionId() {
return ScopeTypes.BPMN.equals(scopeType) ? scopeDefinitionId : null;
}
public void setProcessDefinitionId(String processDefinitionId) {
setScopeType(ScopeTypes.BPMN);
setScopeDefinitionId(processDefinitionId);
}
@Override
public String getProcessInstanceId() {
return ScopeTypes.BPMN.equals(scopeType) ? scopeId : null;
}
public void setProcessInstanceId(String processInstanceId) {
setScopeType(ScopeTypes.BPMN);
setScopeId(processInstanceId);
}
@Override
public String getScopeType() {
return scopeType;
}
public void setScopeType(String scopeType) {
this.scopeType = scopeType;
}
@Override
public String getScopeId() {
return scopeId;
}
public void setScopeId(String scopeId) {
|
this.scopeId = scopeId;
}
@Override
public String getSubScopeId() {
return subScopeId;
}
public void setSubScopeId(String subScopeId) {
this.subScopeId = subScopeId;
}
@Override
public String getScopeDefinitionId() {
return scopeDefinitionId;
}
public void setScopeDefinitionId(String scopeDefinitionId) {
this.scopeDefinitionId = scopeDefinitionId;
}
}
|
repos\flowable-engine-main\modules\flowable-engine-common\src\main\java\org\flowable\common\engine\impl\event\FlowableEngineEventImpl.java
| 1
|
请完成以下Java代码
|
public class HistoricProcessInstanceResourceImpl implements HistoricProcessInstanceResource {
private ProcessEngine engine;
private String processInstanceId;
public HistoricProcessInstanceResourceImpl(ProcessEngine engine, String processInstanceId) {
this.engine = engine;
this.processInstanceId = processInstanceId;
}
@Override
public HistoricProcessInstanceDto getHistoricProcessInstance() {
HistoryService historyService = engine.getHistoryService();
HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
if (instance == null) {
throw new InvalidRequestException(Status.NOT_FOUND, "Historic process instance with id " + processInstanceId + " does not exist");
}
return HistoricProcessInstanceDto.fromHistoricProcessInstance(instance);
|
}
@Override
public void deleteHistoricProcessInstance(Boolean failIfNotExists) {
HistoryService historyService = engine.getHistoryService();
try {
if(failIfNotExists == null || failIfNotExists) {
historyService.deleteHistoricProcessInstance(processInstanceId);
}else {
historyService.deleteHistoricProcessInstanceIfExists(processInstanceId);
}
} catch (AuthorizationException e) {
throw e;
} catch (ProcessEngineException e) {
throw new InvalidRequestException(Status.NOT_FOUND, e, "Historic process instance with id " + processInstanceId + " does not exist");
}
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\sub\history\impl\HistoricProcessInstanceResourceImpl.java
| 1
|
请完成以下Java代码
|
public int getIdAsInt()
{
Integer idInt = this.idInt;
if (idInt == null)
{
idInt = this.idInt = Integer.parseInt((String)id);
}
return idInt;
}
}
public static final class IntegerLookupValue extends LookupValue
{
/**
* Create a new value using the given {@code displayName} as a constant string that is valid in any language and thus never needs translation.
* Note: without "anyLanguage", you can run into trouble when combining {@link ProcessParamLookupValuesProvider} and {@link IProcessDefaultParametersProvider} in one {@link JavaProcess} implementation.
*/
public static IntegerLookupValue of(final int id, final String displayName)
{
return new IntegerLookupValue(
id,
TranslatableStrings.anyLanguage(displayName),
null /* helpText */,
null/* attributes */,
null/* active */);
}
public static IntegerLookupValue of(
final int id,
@Nullable final ITranslatableString displayName,
@Nullable final ITranslatableString helpText)
{
return new IntegerLookupValue(
id,
displayName,
helpText,
null/* attributes */,
null/* active */);
}
public static IntegerLookupValue of(
@NonNull final RepoIdAware id,
@Nullable final ITranslatableString displayName)
{
return new IntegerLookupValue(
id.getRepoId(),
displayName,
null/* helpText */,
null/* attributes */,
null/* active */);
}
public static IntegerLookupValue of(
@NonNull final RepoIdAware id,
@Nullable final ITranslatableString displayName,
@Nullable final ITranslatableString helpText)
{
return new IntegerLookupValue(
id.getRepoId(),
displayName,
helpText,
null/* attributes */,
null/* active */);
}
@Nullable
public static IntegerLookupValue of(final StringLookupValue stringLookupValue)
{
if (stringLookupValue == null)
{
return null;
}
return new IntegerLookupValue(
stringLookupValue.getIdAsInt(),
stringLookupValue.displayName,
stringLookupValue.description,
null /* attributes */,
stringLookupValue.getActive());
|
}
public static IntegerLookupValue unknown(final int id)
{
return new IntegerLookupValue(
id,
unknownCaption(id),
null/* description */,
null/* attributes */,
false/* not active */);
}
@Builder
private IntegerLookupValue(
final int id,
@Nullable final ITranslatableString displayName,
@Nullable final ITranslatableString description,
@Nullable @Singular final Map<String, Object> attributes,
@Nullable final Boolean active)
{
super(id,
displayName,
description,
attributes,
active);
}
@Override
public int getIdAsInt()
{
return (Integer)id;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\datatypes\LookupValue.java
| 1
|
请完成以下Java代码
|
public void setPP_Plant_To_ID (final int PP_Plant_To_ID)
{
if (PP_Plant_To_ID < 1)
set_Value (COLUMNNAME_PP_Plant_To_ID, null);
else
set_Value (COLUMNNAME_PP_Plant_To_ID, PP_Plant_To_ID);
}
@Override
public int getPP_Plant_To_ID()
{
return get_ValueAsInt(COLUMNNAME_PP_Plant_To_ID);
}
@Override
public void setPP_Product_Planning_ID (final int PP_Product_Planning_ID)
{
if (PP_Product_Planning_ID < 1)
set_Value (COLUMNNAME_PP_Product_Planning_ID, null);
else
set_Value (COLUMNNAME_PP_Product_Planning_ID, PP_Product_Planning_ID);
}
@Override
public int getPP_Product_Planning_ID()
{
return get_ValueAsInt(COLUMNNAME_PP_Product_Planning_ID);
}
@Override
public void setProcessed (final boolean Processed)
{
set_Value (COLUMNNAME_Processed, Processed);
}
@Override
public boolean isProcessed()
{
return get_ValueAsBoolean(COLUMNNAME_Processed);
}
@Override
public void setQtyEntered (final BigDecimal QtyEntered)
{
set_Value (COLUMNNAME_QtyEntered, QtyEntered);
}
@Override
public BigDecimal getQtyEntered()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyEntered);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setQtyEnteredTU (final @Nullable BigDecimal QtyEnteredTU)
{
set_Value (COLUMNNAME_QtyEnteredTU, QtyEnteredTU);
}
@Override
public BigDecimal getQtyEnteredTU()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyEnteredTU);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setQtyOrdered (final BigDecimal QtyOrdered)
{
set_Value (COLUMNNAME_QtyOrdered, QtyOrdered);
}
@Override
public BigDecimal getQtyOrdered()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyOrdered);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
|
public void setQtyProcessed (final BigDecimal QtyProcessed)
{
set_Value (COLUMNNAME_QtyProcessed, QtyProcessed);
}
@Override
public BigDecimal getQtyProcessed()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyProcessed);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setQtyToProcess (final BigDecimal QtyToProcess)
{
set_Value (COLUMNNAME_QtyToProcess, QtyToProcess);
}
@Override
public BigDecimal getQtyToProcess()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyToProcess);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setSupplyDate (final java.sql.Timestamp SupplyDate)
{
set_Value (COLUMNNAME_SupplyDate, SupplyDate);
}
@Override
public java.sql.Timestamp getSupplyDate()
{
return get_ValueAsTimestamp(COLUMNNAME_SupplyDate);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_DD_Order_Candidate.java
| 1
|
请完成以下Java代码
|
public void setT_PayDiscount_Rev_Acct (int T_PayDiscount_Rev_Acct)
{
set_Value (COLUMNNAME_T_PayDiscount_Rev_Acct, Integer.valueOf(T_PayDiscount_Rev_Acct));
}
/** Get Steuerkorrektur erhaltene Skonti.
@return Steuerabhängiges Konto zur Verbuchung erhaltener Skonti
*/
@Override
public int getT_PayDiscount_Rev_Acct ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_T_PayDiscount_Rev_Acct);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public org.compiere.model.I_C_ValidCombination getT_Receivables_A()
{
return get_ValueAsPO(COLUMNNAME_T_Receivables_Acct, org.compiere.model.I_C_ValidCombination.class);
}
@Override
public void setT_Receivables_A(org.compiere.model.I_C_ValidCombination T_Receivables_A)
{
set_ValueFromPO(COLUMNNAME_T_Receivables_Acct, org.compiere.model.I_C_ValidCombination.class, T_Receivables_A);
}
/** Set Steuerüberzahlungen.
@param T_Receivables_Acct
Konto für Steuerüberzahlungen
*/
@Override
public void setT_Receivables_Acct (int T_Receivables_Acct)
{
set_Value (COLUMNNAME_T_Receivables_Acct, Integer.valueOf(T_Receivables_Acct));
}
/** Get Steuerüberzahlungen.
@return Konto für Steuerüberzahlungen
*/
@Override
public int getT_Receivables_Acct ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_T_Receivables_Acct);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public org.compiere.model.I_C_ValidCombination getT_Revenue_A()
{
|
return get_ValueAsPO(COLUMNNAME_T_Revenue_Acct, org.compiere.model.I_C_ValidCombination.class);
}
@Override
public void setT_Revenue_A(org.compiere.model.I_C_ValidCombination T_Revenue_A)
{
set_ValueFromPO(COLUMNNAME_T_Revenue_Acct, org.compiere.model.I_C_ValidCombination.class, T_Revenue_A);
}
/** Set Erlös Konto.
@param T_Revenue_Acct
Steuerabhängiges Konto zur Verbuchung Erlöse
*/
@Override
public void setT_Revenue_Acct (int T_Revenue_Acct)
{
set_Value (COLUMNNAME_T_Revenue_Acct, Integer.valueOf(T_Revenue_Acct));
}
/** Get Erlös Konto.
@return Steuerabhängiges Konto zur Verbuchung Erlöse
*/
@Override
public int getT_Revenue_Acct ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_T_Revenue_Acct);
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_Tax_Acct.java
| 1
|
请完成以下Java代码
|
public String toString()
{
StringBuffer sb = new StringBuffer ("X_CM_AccessListBPGroup[")
.append(get_ID()).append("]");
return sb.toString();
}
public I_C_BP_Group getC_BP_Group() throws RuntimeException
{
return (I_C_BP_Group)MTable.get(getCtx(), I_C_BP_Group.Table_Name)
.getPO(getC_BP_Group_ID(), get_TrxName()); }
/** Set Business Partner Group.
@param C_BP_Group_ID
Business Partner Group
*/
public void setC_BP_Group_ID (int C_BP_Group_ID)
{
if (C_BP_Group_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_BP_Group_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_BP_Group_ID, Integer.valueOf(C_BP_Group_ID));
}
/** Get Business Partner Group.
@return Business Partner Group
*/
public int getC_BP_Group_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_BP_Group_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_CM_AccessProfile getCM_AccessProfile() throws RuntimeException
{
return (I_CM_AccessProfile)MTable.get(getCtx(), I_CM_AccessProfile.Table_Name)
.getPO(getCM_AccessProfile_ID(), get_TrxName()); }
|
/** Set Web Access Profile.
@param CM_AccessProfile_ID
Web Access Profile
*/
public void setCM_AccessProfile_ID (int CM_AccessProfile_ID)
{
if (CM_AccessProfile_ID < 1)
set_ValueNoCheck (COLUMNNAME_CM_AccessProfile_ID, null);
else
set_ValueNoCheck (COLUMNNAME_CM_AccessProfile_ID, Integer.valueOf(CM_AccessProfile_ID));
}
/** Get Web Access Profile.
@return Web Access Profile
*/
public int getCM_AccessProfile_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_CM_AccessProfile_ID);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_CM_AccessListBPGroup.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void setCaseDefinitionName(String caseDefinitionName) {
this.caseDefinitionName = caseDefinitionName;
}
@ApiModelProperty(example = "A case definition description")
public String getCaseDefinitionDescription() {
return caseDefinitionDescription;
}
public void setCaseDefinitionDescription(String caseDefinitionDescription) {
this.caseDefinitionDescription = caseDefinitionDescription;
}
@ApiModelProperty(example = "123")
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
@ApiModelProperty(example = "123")
public String getCallbackId() {
return callbackId;
}
public void setCallbackId(String callbackId) {
this.callbackId = callbackId;
}
@ApiModelProperty(example = "cmmn-1.1-to-cmmn-1.1-child-case")
public String getCallbackType() {
return callbackType;
}
public void setCallbackType(String callbackType) {
this.callbackType = callbackType;
}
@ApiModelProperty(example = "123")
public String getReferenceId() {
return referenceId;
}
public void setReferenceId(String referenceId) {
this.referenceId = referenceId;
}
@ApiModelProperty(example = "event-to-cmmn-1.1-case")
public String getReferenceType() {
return referenceType;
}
public void setReferenceType(String referenceType) {
this.referenceType = referenceType;
}
public List<RestVariable> getVariables() {
return variables;
|
}
public void setVariables(List<RestVariable> variables) {
this.variables = variables;
}
public void addVariable(RestVariable variable) {
variables.add(variable);
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
@ApiModelProperty(example = "null")
public String getTenantId() {
return tenantId;
}
public boolean isCompleted() {
return completed;
}
public void setCompleted(boolean completed) {
this.completed = completed;
}
}
|
repos\flowable-engine-main\modules\flowable-cmmn-rest\src\main\java\org\flowable\cmmn\rest\service\api\runtime\caze\CaseInstanceResponse.java
| 2
|
请完成以下Java代码
|
public void setId(Integer id) {
this.id = id;
}
public Integer getId() {
return id;
}
public void setArticleTitle(String articleTitle) {
this.articleTitle = articleTitle;
}
public String getArticleTitle() {
return articleTitle;
}
public void setArticleContent(String articleContent) {
this.articleContent = articleContent;
}
public String getArticleContent() {
return articleContent;
}
public void setAddName(String addName) {
this.addName = addName;
}
public String getAddName() {
return addName;
}
|
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
|
repos\spring-boot-projects-main\SpringBoot前后端分离实战项目源码\spring-boot-project-front-end&back-end\src\main\java\cn\lanqiao\springboot3\entity\Article.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class FilterChainMapBeanDefinitionDecorator implements BeanDefinitionDecorator {
@Override
@SuppressWarnings("unchecked")
public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder holder, ParserContext parserContext) {
BeanDefinition filterChainProxy = holder.getBeanDefinition();
ManagedList<BeanMetadataElement> securityFilterChains = new ManagedList<>();
Element elt = (Element) node;
MatcherType matcherType = MatcherType.fromElementOrMvc(elt);
List<Element> filterChainElts = DomUtils.getChildElementsByTagName(elt, Elements.FILTER_CHAIN);
for (Element chain : filterChainElts) {
String path = chain.getAttribute(HttpSecurityBeanDefinitionParser.ATT_PATH_PATTERN);
String filters = chain.getAttribute(HttpSecurityBeanDefinitionParser.ATT_FILTERS);
if (!StringUtils.hasText(path)) {
parserContext.getReaderContext()
.error("The attribute '" + HttpSecurityBeanDefinitionParser.ATT_PATH_PATTERN
+ "' must not be empty", elt);
}
if (!StringUtils.hasText(filters)) {
parserContext.getReaderContext()
.error("The attribute '" + HttpSecurityBeanDefinitionParser.ATT_FILTERS + "'must not be empty",
elt);
}
BeanDefinition matcher = matcherType.createMatcher(parserContext, path, null);
if (filters.equals(HttpSecurityBeanDefinitionParser.OPT_FILTERS_NONE)) {
securityFilterChains.add(createSecurityFilterChain(matcher, new ManagedList<>(0)));
}
else {
String[] filterBeanNames = StringUtils.tokenizeToStringArray(filters, ",");
ManagedList filterChain = new ManagedList(filterBeanNames.length);
for (String name : filterBeanNames) {
|
filterChain.add(new RuntimeBeanReference(name));
}
securityFilterChains.add(createSecurityFilterChain(matcher, filterChain));
}
}
filterChainProxy.getConstructorArgumentValues().addGenericArgumentValue(securityFilterChains);
return holder;
}
private BeanDefinition createSecurityFilterChain(BeanDefinition matcher, ManagedList<?> filters) {
BeanDefinitionBuilder sfc = BeanDefinitionBuilder.rootBeanDefinition(DefaultSecurityFilterChain.class);
sfc.addConstructorArgValue(matcher);
sfc.addConstructorArgValue(filters);
return sfc.getBeanDefinition();
}
}
|
repos\spring-security-main\config\src\main\java\org\springframework\security\config\http\FilterChainMapBeanDefinitionDecorator.java
| 2
|
请完成以下Java代码
|
public class SysTableWhiteList {
/**
* 主键id
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键id")
private java.lang.String id;
/**
* 允许的表名
*/
@Excel(name = "允许的表名", width = 15)
@Schema(description = "允许的表名")
private java.lang.String tableName;
/**
* 允许的字段名,多个用逗号分割
*/
@Excel(name = "允许的字段名", width = 15)
@Schema(description = "允许的字段名")
private java.lang.String fieldName;
/**
* 状态,1=启用,0=禁用
*/
@Excel(name = "状态", width = 15)
@Schema(description = "状态")
private java.lang.String status;
/**
* 创建人
*/
@Excel(name = "创建人", width = 15)
@Schema(description = "创建人")
private java.lang.String createBy;
/**
|
* 创建时间
*/
@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "创建时间")
private java.util.Date createTime;
/**
* 更新人
*/
@Excel(name = "更新人", width = 15)
@Schema(description = "更新人")
private java.lang.String updateBy;
/**
* 更新时间
*/
@Excel(name = "更新时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "更新时间")
private java.util.Date updateTime;
}
|
repos\JeecgBoot-main\jeecg-boot\jeecg-module-system\jeecg-system-biz\src\main\java\org\jeecg\modules\system\entity\SysTableWhiteList.java
| 1
|
请完成以下Java代码
|
public I_M_ReceiptSchedule getM_ReceiptSchedule()
{
return _receiptSchedule;
}
public int getSubProducer_BPartner_ID()
{
// updateIfStale(); // no need
return _subProducerBPartnerId;
}
public List<I_M_ReceiptSchedule_Alloc> getReceiptScheduleAllocs()
{
updateIfStale();
return _receiptScheduleAllocs;
}
|
public I_C_UOM getC_UOM()
{
return loadOutOfTrx(getM_ReceiptSchedule().getC_UOM_ID(), I_C_UOM.class);
}
public ReceiptQty getQtyAndQuality()
{
updateIfStale();
return _qtyAndQuality;
}
public I_M_QualityNote get_qualityNote()
{
return _qualityNote;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\inoutcandidate\spi\impl\HUReceiptLineCandidate.java
| 1
|
请完成以下Java代码
|
public void nullSafeSet(PreparedStatement st, Integer[] value, int index, SharedSessionContractImplementor session) throws SQLException {
if (st != null) {
if (value != null) {
Array array = session.getJdbcConnectionAccess().obtainConnection().createArrayOf("int", value);
st.setArray(index, array);
} else {
st.setNull(index, Types.ARRAY);
}
}
}
@Override
public Integer[] deepCopy(Integer[] value) {
return value != null ? Arrays.copyOf(value, value.length) : null;
}
@Override
public boolean isMutable() {
return false;
}
|
@Override
public Serializable disassemble(Integer[] value) {
return value;
}
@Override
public Integer[] assemble(Serializable cached, Object owner) {
return (Integer[]) cached;
}
@Override
public Integer[] replace(Integer[] detached, Integer[] managed, Object owner) {
return detached;
}
}
|
repos\tutorials-master\persistence-modules\hibernate-mapping\src\main\java\com\baeldung\hibernate\arraymapping\CustomIntegerArrayType.java
| 1
|
请完成以下Java代码
|
public class ImmutableFeatureMap extends FeatureMap
{
public Map<String, Integer> featureIdMap;
public ImmutableFeatureMap(Map<String, Integer> featureIdMap, TagSet tagSet)
{
super(tagSet);
this.featureIdMap = featureIdMap;
}
public ImmutableFeatureMap(Set<Map.Entry<String, Integer>> entrySet, TagSet tagSet)
{
super(tagSet);
this.featureIdMap = new HashMap<String, Integer>();
for (Map.Entry<String, Integer> entry : entrySet)
{
featureIdMap.put(entry.getKey(), entry.getValue());
}
}
@Override
|
public int idOf(String string)
{
Integer id = featureIdMap.get(string);
if (id == null) return -1;
return id;
}
@Override
public int size()
{
return featureIdMap.size();
}
@Override
public Set<Map.Entry<String, Integer>> entrySet()
{
return featureIdMap.entrySet();
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\model\perceptron\feature\ImmutableFeatureMap.java
| 1
|
请完成以下Java代码
|
public void onMessage(Message message) {
try {
ActiveMQTextMessage msg = (ActiveMQTextMessage) message;
final String msgText = msg.getText();
log.info("== receive bankOrderNo :" + msgText);
RpOrderResultQueryVo rpOrderResultQueryVo = new RpOrderResultQueryVo();
rpOrderResultQueryVo.setBankOrderNo(msgText);
rpOrderResultQueryVo.setStatus(NotifyStatusEnum.CREATED.name());
rpOrderResultQueryVo.setCreateTime(new Date());
rpOrderResultQueryVo.setEditTime(new Date());
rpOrderResultQueryVo.setLastNotifyTime(new Date());
rpOrderResultQueryVo.setNotifyTimes(0); // 初始化通知0次
rpOrderResultQueryVo.setLimitNotifyTimes(pollingParam.getMaxNotifyTimes()); // 最大通知次数
Map<Integer, Integer> notifyParams = pollingParam.getNotifyParams();
rpOrderResultQueryVo.setNotifyRule(JSONObject.toJSONString(notifyParams)); // 保存JSON
|
try {
pollingQueue.addToNotifyTaskDelayQueue(rpOrderResultQueryVo); // 添加到通知队列(第一次通知)
} catch (BizException e) {
log.error("BizException :", e);
} catch (Exception e) {
log.error(e);
}
} catch (Exception e) {
log.error(e);
}
}
}
|
repos\roncoo-pay-master\roncoo-pay-app-order-polling\src\main\java\com\roncoo\pay\app\polling\listener\PollingMessageListener.java
| 1
|
请完成以下Java代码
|
public class MybatisEventResourceDataManager extends AbstractEventDataManager<EventResourceEntity> implements EventResourceDataManager {
public MybatisEventResourceDataManager(EventRegistryEngineConfiguration eventRegistryConfiguration) {
super(eventRegistryConfiguration);
}
@Override
public Class<? extends EventResourceEntity> getManagedEntityClass() {
return EventResourceEntityImpl.class;
}
@Override
public EventResourceEntity create() {
return new EventResourceEntityImpl();
}
@Override
public void deleteResourcesByDeploymentId(String deploymentId) {
getDbSqlSession().delete("deleteEventResourcesByDeploymentId", deploymentId, getManagedEntityClass());
}
|
@Override
public EventResourceEntity findResourceByDeploymentIdAndResourceName(String deploymentId, String resourceName) {
Map<String, Object> params = new HashMap<>();
params.put("deploymentId", deploymentId);
params.put("resourceName", resourceName);
return (EventResourceEntity) getDbSqlSession().selectOne("selectEventResourceByDeploymentIdAndResourceName", params);
}
@Override
@SuppressWarnings("unchecked")
public List<EventResourceEntity> findResourcesByDeploymentId(String deploymentId) {
return getDbSqlSession().selectList("selectEventResourcesByDeploymentId", deploymentId);
}
}
|
repos\flowable-engine-main\modules\flowable-event-registry\src\main\java\org\flowable\eventregistry\impl\persistence\entity\data\impl\MybatisEventResourceDataManager.java
| 1
|
请完成以下Java代码
|
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getGenre() {
return genre;
}
public void setGenre(String genre) {
this.genre = genre;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
|
}
public int getRating() {
return rating;
}
public void setRating(int rating) {
this.rating = rating;
}
@Override
public String toString() {
return "Author{" + "id=" + id + ", age=" + age + ", name=" + name
+ ", genre=" + genre + ", rating=" + rating + '}';
}
}
|
repos\Hibernate-SpringBoot-master\HibernateSpringBootSearchViaSpecifications\src\main\java\com\bookstore\entity\Author.java
| 1
|
请完成以下Java代码
|
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
String loginName = (String) token.getPrincipal();
if (StringUtils.isEmpty(loginName.trim())) {
throw new UnknownAccountException();// 没找到帐号
}
// 根据登录名查询操作员
PmsOperator operator = pmsOperatorService.findOperatorByLoginName(loginName);
if (operator == null) {
throw new UnknownAccountException();// 没找到帐号
}
if (PublicStatusEnum.UNACTIVE.equals(operator.getStatus())) {
throw new LockedAccountException(); // 帐号锁定
}
// 交给AuthenticatingRealm使用CredentialsMatcher进行密码匹配,如果觉得人家的不好可以自定义实现
SimpleAuthenticationInfo authenticationInfo = new SimpleAuthenticationInfo(operator.getLoginName(), // 登录名
operator.getLoginPwd(), // 密码
ByteSource.Util.bytes(operator.getCredentialsSalt()), // salt=username+salt
getName() // realm name
);
return authenticationInfo;
}
@Override
public void clearCachedAuthorizationInfo(PrincipalCollection principals) {
super.clearCachedAuthorizationInfo(principals);
}
|
@Override
public void clearCachedAuthenticationInfo(PrincipalCollection principals) {
super.clearCachedAuthenticationInfo(principals);
}
@Override
public void clearCache(PrincipalCollection principals) {
super.clearCache(principals);
}
public void clearAllCachedAuthorizationInfo() {
getAuthorizationCache().clear();
}
public void clearAllCachedAuthenticationInfo() {
getAuthenticationCache().clear();
}
public void clearAllCache() {
clearAllCachedAuthenticationInfo();
clearAllCachedAuthorizationInfo();
}
}
|
repos\roncoo-pay-master\roncoo-pay-web-boss\src\main\java\com\roncoo\pay\permission\shiro\realm\OperatorRealm.java
| 1
|
请完成以下Java代码
|
public final class ChatServerMain {
public static final String HOST = "localhost";
public static final int PORT = 8081;
public static void main(String[] args) {
EventLoopGroup serverGroup = new NioEventLoopGroup(1);
EventLoopGroup clientGroup = new NioEventLoopGroup();
try {
ServerBootstrap bootstrap = new ServerBootstrap();
bootstrap.group(serverGroup, clientGroup)
.channel(NioServerSocketChannel.class)
.childHandler(new ChannelInitializer<SocketChannel>() {
@Override
public void initChannel(SocketChannel channel) throws Exception {
channel.pipeline()
.addFirst(new StringDecoder(), new ServerEventHandler(), new StringEncoder());
}
});
|
ChannelFuture future = bootstrap.bind(HOST, PORT)
.sync();
System.out.println("chat server started. ready to accept clients.");
future.addListener(new ChannelInfoListener("server online"));
future.channel()
.closeFuture()
.sync();
} catch (Throwable e) {
e.printStackTrace();
Thread.currentThread().interrupt();
} finally {
serverGroup.shutdownGracefully();
clientGroup.shutdownGracefully();
}
}
}
|
repos\tutorials-master\libraries-server-2\src\main\java\com\baeldung\netty\customhandlersandlisteners\ChatServerMain.java
| 1
|
请完成以下Java代码
|
public HistoricIdentityLinkLogQuery orderByTaskId() {
orderBy(HistoricIdentityLinkLogQueryProperty.TASK_ID);
return this;
}
@Override
public HistoricIdentityLinkLogQuery orderByProcessDefinitionId() {
orderBy(HistoricIdentityLinkLogQueryProperty.PROC_DEFINITION_ID);
return this;
}
@Override
public HistoricIdentityLinkLogQuery orderByProcessDefinitionKey() {
orderBy(HistoricIdentityLinkLogQueryProperty.PROC_DEFINITION_KEY);
return this;
}
@Override
public HistoricIdentityLinkLogQuery orderByOperationType() {
orderBy(HistoricIdentityLinkLogQueryProperty.OPERATION_TYPE);
return this;
}
@Override
public HistoricIdentityLinkLogQuery orderByAssignerId() {
|
orderBy(HistoricIdentityLinkLogQueryProperty.ASSIGNER_ID);
return this;
}
@Override
public HistoricIdentityLinkLogQuery orderByTenantId() {
orderBy(HistoricIdentityLinkLogQueryProperty.TENANT_ID);
return this;
}
@Override
public long executeCount(CommandContext commandContext) {
checkQueryOk();
return commandContext
.getHistoricIdentityLinkManager()
.findHistoricIdentityLinkLogCountByQueryCriteria(this);
}
@Override
public List<HistoricIdentityLinkLog> executeList(CommandContext commandContext, Page page) {
checkQueryOk();
return commandContext
.getHistoricIdentityLinkManager()
.findHistoricIdentityLinkLogByQueryCriteria(this, page);
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\HistoricIdentityLinkLogQueryImpl.java
| 1
|
请完成以下Java代码
|
static class TrustedIssuerJwtAuthenticationManagerResolver
implements ReactiveAuthenticationManagerResolver<String> {
private final Log logger = LogFactory.getLog(getClass());
private final Map<String, Mono<ReactiveAuthenticationManager>> authenticationManagers = new ConcurrentHashMap<>();
private final Predicate<String> trustedIssuer;
TrustedIssuerJwtAuthenticationManagerResolver(Predicate<String> trustedIssuer) {
this.trustedIssuer = trustedIssuer;
}
@Override
public Mono<ReactiveAuthenticationManager> resolve(String issuer) {
if (!this.trustedIssuer.test(issuer)) {
this.logger.debug("Did not resolve AuthenticationManager since issuer is not trusted");
|
return Mono.empty();
}
// @formatter:off
return this.authenticationManagers.computeIfAbsent(issuer,
(k) -> Mono.<ReactiveAuthenticationManager>fromCallable(() -> new JwtReactiveAuthenticationManager(ReactiveJwtDecoders.fromIssuerLocation(k)))
.doOnNext((manager) -> this.logger.debug(LogMessage.format("Resolved AuthenticationManager for issuer '%s'", issuer)))
.subscribeOn(Schedulers.boundedElastic())
.cache((manager) -> Duration.ofMillis(Long.MAX_VALUE), (ex) -> Duration.ZERO, () -> Duration.ZERO)
);
// @formatter:on
}
}
}
|
repos\spring-security-main\oauth2\oauth2-resource-server\src\main\java\org\springframework\security\oauth2\server\resource\authentication\JwtIssuerReactiveAuthenticationManagerResolver.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public final class Saml2ParameterNames {
/**
* {@code SAMLRequest} - used to request authentication or request logout
*/
public static final String SAML_REQUEST = "SAMLRequest";
/**
* {@code SAMLResponse} - used to respond to an authentication or logout request
*/
public static final String SAML_RESPONSE = "SAMLResponse";
/**
* {@code RelayState} - used to communicate shared state between the relying and
* asserting party
* @see <a target="_blank" href=
* "https://docs.oasis-open.org/security/saml/v2.0/saml-bindings-2.0-os.pdf#page=8">3.1.1
* Use of RelayState</a>
*/
public static final String RELAY_STATE = "RelayState";
|
/**
* {@code SigAlg} - used to communicate which signature algorithm to use to verify
* signature
*/
public static final String SIG_ALG = "SigAlg";
/**
* {@code Signature} - used to supply cryptographic signature on any SAML 2.0 payload
*/
public static final String SIGNATURE = "Signature";
private Saml2ParameterNames() {
}
}
|
repos\spring-security-main\saml2\saml2-service-provider\src\main\java\org\springframework\security\saml2\core\Saml2ParameterNames.java
| 2
|
请完成以下Java代码
|
public class TbCalculatedFieldEntityActorId implements TbActorId {
@Getter
private final EntityId entityId;
public TbCalculatedFieldEntityActorId(EntityId entityId) {
this.entityId = entityId;
}
@Override
public String toString() {
return entityId.getEntityType() + "|" + entityId.getId();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
|
TbCalculatedFieldEntityActorId that = (TbCalculatedFieldEntityActorId) o;
return entityId.equals(that.entityId);
}
@Override
public int hashCode() {
// Magic number to ensure that the hash does not match with the hash of other actor id - (TbEntityActorId)
return 42 + Objects.hash(entityId);
}
@Override
public EntityType getEntityType() {
return entityId.getEntityType();
}
}
|
repos\thingsboard-master\common\actor\src\main\java\org\thingsboard\server\actors\TbCalculatedFieldEntityActorId.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class DataExportAuditLogRepository
{
private final IQueryBL queryBL = Services.get(IQueryBL.class);
@NonNull
public DataExportAuditLog createNew(@NonNull final CreateDataExportAuditLogRequest logEntry)
{
final I_Data_Export_Audit_Log record = InterfaceWrapperHelper.newInstance(I_Data_Export_Audit_Log.class);
record.setData_Export_Audit_ID(logEntry.getDataExportAuditId().getRepoId());
record.setData_Export_Action(logEntry.getAction().getCode());
record.setExternalSystem_Config_ID(NumberUtils.asInteger(logEntry.getExternalSystemConfigId(), -1));
record.setAD_PInstance_ID(NumberUtils.asInteger(logEntry.getAdPInstanceId(), -1));
saveRecord(record);
return toDataExportAuditLog(record);
}
@NonNull
public ImmutableSet<Integer> getExternalSystemConfigIds(@NonNull final DataExportAuditId dataExportAuditId)
{
return queryBL.createQueryBuilder(I_Data_Export_Audit_Log.class)
.addOnlyActiveRecordsFilter()
.addEqualsFilter(I_Data_Export_Audit_Log.COLUMNNAME_Data_Export_Audit_ID, dataExportAuditId.getRepoId())
.addNotEqualsFilter(I_Data_Export_Audit_Log.COLUMNNAME_ExternalSystem_Config_ID, null)
.create()
.listDistinct(I_Data_Export_Audit_Log.COLUMNNAME_ExternalSystem_Config_ID, Integer.class)
.stream()
.filter(Objects::nonNull)
.collect(ImmutableSet.toImmutableSet());
}
@NonNull
|
public ImmutableList<DataExportAuditLog> getByDataExportAuditId(@NonNull final DataExportAuditId dataExportAuditId)
{
return queryBL.createQueryBuilder(I_Data_Export_Audit_Log.class)
.addOnlyActiveRecordsFilter()
.addEqualsFilter(I_Data_Export_Audit_Log.COLUMNNAME_Data_Export_Audit_ID, dataExportAuditId.getRepoId())
.create()
.stream()
.map(DataExportAuditLogRepository::toDataExportAuditLog)
.collect(ImmutableList.toImmutableList());
}
@NonNull
private static DataExportAuditLog toDataExportAuditLog(@NonNull final I_Data_Export_Audit_Log record)
{
return DataExportAuditLog.builder()
.dataExportAuditLogId(DataExportAuditLogId.ofRepoId(DataExportAuditId.ofRepoId(record.getData_Export_Audit_ID()), record.getData_Export_Audit_Log_ID()))
.action(Action.ofCode(record.getData_Export_Action()))
.externalSystemConfigId(ExternalSystemParentConfigId.ofRepoIdOrNull(record.getExternalSystem_Config_ID()))
.adPInstanceId(PInstanceId.ofRepoIdOrNull(record.getAD_PInstance_ID()))
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\audit\data\repository\DataExportAuditLogRepository.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
protected RestTemplate registerInterceptor(RestTemplate restTemplate,
ClientHttpRequestInterceptor clientHttpRequestInterceptor) {
restTemplate.getInterceptors().add(clientHttpRequestInterceptor);
return restTemplate;
}
public static class SecurityAwareClientHttpRequestInterceptor implements ClientHttpRequestInterceptor {
private final Environment environment;
public SecurityAwareClientHttpRequestInterceptor(Environment environment) {
Assert.notNull(environment, "Environment is required");
this.environment = environment;
}
protected boolean isAuthenticationEnabled() {
return StringUtils.hasText(getUsername()) && StringUtils.hasText(getPassword());
}
protected String getUsername() {
return this.environment.getProperty(SPRING_DATA_GEMFIRE_SECURITY_USERNAME_PROPERTY);
}
protected String getPassword() {
return this.environment.getProperty(SPRING_DATA_GEMFIRE_SECURITY_PASSWORD_PROPERTY);
}
|
@Override
public ClientHttpResponse intercept(HttpRequest request, byte[] body,
ClientHttpRequestExecution execution) throws IOException {
if (isAuthenticationEnabled()) {
HttpHeaders requestHeaders = request.getHeaders();
requestHeaders.add(GeodeConstants.USERNAME, getUsername());
requestHeaders.add(GeodeConstants.PASSWORD, getPassword());
}
return execution.execute(request, body);
}
}
}
|
repos\spring-boot-data-geode-main\spring-geode-project\spring-geode-autoconfigure\src\main\java\org\springframework\geode\boot\autoconfigure\support\HttpBasicAuthenticationSecurityConfiguration.java
| 2
|
请完成以下Java代码
|
public Object getValue(ELContext context, Object base, Object property) {
try {
Object result = getWrappedResolver().getValue(this.context, base, property);
context.setPropertyResolved(result != null);
return result;
} catch (IllegalStateException e) {
// dependent scoped / EJBs
Object result = ProgrammaticBeanLookup.lookup(property.toString(), getBeanManager());
context.setPropertyResolved(result != null);
return result;
}
}
@Override
public boolean isReadOnly(ELContext context, Object base, Object property) {
|
return getWrappedResolver().isReadOnly(this.context, base, property);
}
@Override
public void setValue(ELContext context, Object base, Object property, Object value) {
getWrappedResolver().setValue(this.context, base, property, value);
}
@Override
public Object invoke(ELContext context, Object base, Object method, java.lang.Class<?>[] paramTypes, Object[] params) {
Object result = getWrappedResolver().invoke(this.context, base, method, paramTypes, params);
context.setPropertyResolved(result != null);
return result;
}
}
|
repos\flowable-engine-main\modules\flowable-cdi\src\main\java\org\flowable\cdi\impl\el\CdiResolver.java
| 1
|
请完成以下Java代码
|
/* package */class ValueGetterMethodInfo extends AbstractModelMethodInfo
{
private static final Object DEFAULTVALUE_NotSupported = new Object();
private final String propertyName;
private final Class<?> returnType;
private final Object defaultValue;
public ValueGetterMethodInfo(final Method interfaceMethod, final String propertyName)
{
super(interfaceMethod);
this.propertyName = propertyName;
this.returnType = interfaceMethod.getReturnType();
//
// Default Value
if (returnType == int.class)
{
this.defaultValue = Integer.valueOf(0);
}
else if (returnType == BigDecimal.class)
{
this.defaultValue = BigDecimal.ZERO;
}
else if (PO.class.isAssignableFrom(returnType))
{
// TODO: figure out which is this case
this.defaultValue = DEFAULTVALUE_NotSupported;
}
else
{
this.defaultValue = null;
}
}
@Override
public Object invoke(final IModelInternalAccessor model, final Object[] methodArgs) throws Exception
{
Object value = null;
|
final int idx = model.getColumnIndex(propertyName);
if (idx >= 0)
{
value = model.getValue(propertyName, idx, returnType);
}
if (value != null)
{
return value;
}
if (defaultValue == DEFAULTVALUE_NotSupported)
{
throw new IllegalArgumentException("Method default value not supported - " + getInterfaceMethod());
}
return defaultValue;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\persistence\ValueGetterMethodInfo.java
| 1
|
请完成以下Java代码
|
public int getDefaultQueueSizeFullWaitTimeInMillis() {
return determineAsyncExecutor().getDefaultQueueSizeFullWaitTimeInMillis();
}
public void setDefaultQueueSizeFullWaitTimeInMillis(int defaultQueueSizeFullWaitTimeInMillis) {
for (AsyncExecutor asyncExecutor : tenantExecutors.values()) {
asyncExecutor.setDefaultQueueSizeFullWaitTimeInMillis(defaultQueueSizeFullWaitTimeInMillis);
}
}
public int getMaxAsyncJobsDuePerAcquisition() {
return determineAsyncExecutor().getMaxAsyncJobsDuePerAcquisition();
}
public void setMaxAsyncJobsDuePerAcquisition(int maxJobs) {
for (AsyncExecutor asyncExecutor : tenantExecutors.values()) {
asyncExecutor.setMaxAsyncJobsDuePerAcquisition(maxJobs);
}
}
public int getMaxTimerJobsPerAcquisition() {
return determineAsyncExecutor().getMaxTimerJobsPerAcquisition();
}
public void setMaxTimerJobsPerAcquisition(int maxJobs) {
for (AsyncExecutor asyncExecutor : tenantExecutors.values()) {
asyncExecutor.setMaxTimerJobsPerAcquisition(maxJobs);
}
}
public int getRetryWaitTimeInMillis() {
return determineAsyncExecutor().getRetryWaitTimeInMillis();
}
public void setRetryWaitTimeInMillis(int retryWaitTimeInMillis) {
for (AsyncExecutor asyncExecutor : tenantExecutors.values()) {
asyncExecutor.setRetryWaitTimeInMillis(retryWaitTimeInMillis);
}
}
|
@Override
public int getResetExpiredJobsInterval() {
return determineAsyncExecutor().getResetExpiredJobsInterval();
}
@Override
public void setResetExpiredJobsInterval(int resetExpiredJobsInterval) {
for (AsyncExecutor asyncExecutor : tenantExecutors.values()) {
asyncExecutor.setResetExpiredJobsInterval(resetExpiredJobsInterval);
}
}
@Override
public int getResetExpiredJobsPageSize() {
return determineAsyncExecutor().getResetExpiredJobsPageSize();
}
@Override
public void setResetExpiredJobsPageSize(int resetExpiredJobsPageSize) {
for (AsyncExecutor asyncExecutor : tenantExecutors.values()) {
asyncExecutor.setResetExpiredJobsPageSize(resetExpiredJobsPageSize);
}
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\asyncexecutor\multitenant\ExecutorPerTenantAsyncExecutor.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class SmsHomeBrandServiceImpl implements SmsHomeBrandService {
@Autowired
private SmsHomeBrandMapper homeBrandMapper;
@Override
public int create(List<SmsHomeBrand> homeBrandList) {
for (SmsHomeBrand smsHomeBrand : homeBrandList) {
smsHomeBrand.setRecommendStatus(1);
smsHomeBrand.setSort(0);
homeBrandMapper.insert(smsHomeBrand);
}
return homeBrandList.size();
}
@Override
public int updateSort(Long id, Integer sort) {
SmsHomeBrand homeBrand = new SmsHomeBrand();
homeBrand.setId(id);
homeBrand.setSort(sort);
return homeBrandMapper.updateByPrimaryKeySelective(homeBrand);
}
@Override
public int delete(List<Long> ids) {
SmsHomeBrandExample example = new SmsHomeBrandExample();
example.createCriteria().andIdIn(ids);
return homeBrandMapper.deleteByExample(example);
}
@Override
|
public int updateRecommendStatus(List<Long> ids, Integer recommendStatus) {
SmsHomeBrandExample example = new SmsHomeBrandExample();
example.createCriteria().andIdIn(ids);
SmsHomeBrand record = new SmsHomeBrand();
record.setRecommendStatus(recommendStatus);
return homeBrandMapper.updateByExampleSelective(record,example);
}
@Override
public List<SmsHomeBrand> list(String brandName, Integer recommendStatus, Integer pageSize, Integer pageNum) {
PageHelper.startPage(pageNum,pageSize);
SmsHomeBrandExample example = new SmsHomeBrandExample();
SmsHomeBrandExample.Criteria criteria = example.createCriteria();
if(!StrUtil.isEmpty(brandName)){
criteria.andBrandNameLike("%"+brandName+"%");
}
if(recommendStatus!=null){
criteria.andRecommendStatusEqualTo(recommendStatus);
}
example.setOrderByClause("sort desc");
return homeBrandMapper.selectByExample(example);
}
}
|
repos\mall-master\mall-admin\src\main\java\com\macro\mall\service\impl\SmsHomeBrandServiceImpl.java
| 2
|
请完成以下Java代码
|
public WFActivityType getHandledActivityType() {return HANDLED_ACTIVITY_TYPE;}
@Override
public UIComponent getUIComponent(final @NonNull WFProcess wfProcess, final @NonNull WFActivity wfActivity, final @NonNull JsonOpts jsonOpts)
{
final HUConsolidationJob job = getHUConsolidationJob(wfProcess);
return UIComponent.builderFrom(COMPONENT_TYPE, wfActivity)
.properties(Params.builder()
.valueObj("job", toJson(job))
// TODO
// .valueObj("lines", lines)
// .valueObj("qtyRejectedReasons", qtyRejectedReasons)
.build())
.build();
}
@Override
public WFActivityStatus computeActivityState(final WFProcess wfProcess, final WFActivity completeDistributionWFActivity)
{
final HUConsolidationJob job = getHUConsolidationJob(wfProcess);
return computeActivityState(job);
}
public static WFActivityStatus computeActivityState(final HUConsolidationJob ignoredJob)
{
// TODO
return WFActivityStatus.NOT_STARTED;
}
private JsonHUConsolidationJob toJson(@NonNull final HUConsolidationJob job)
{
final RenderedAddressProvider renderedAddressProvider = documentLocationBL.newRenderedAddressProvider();
final String shipToAddress = renderedAddressProvider.getAddress(job.getShipToBPLocationId());
return JsonHUConsolidationJob.builder()
.id(job.getId())
.shipToAddress(shipToAddress)
|
.pickingSlots(toJsonHUConsolidationJobPickingSlots(job.getPickingSlotIds()))
.currentTarget(JsonHUConsolidationTarget.ofNullable(job.getCurrentTarget()))
.build();
}
private ImmutableList<JsonHUConsolidationJobPickingSlot> toJsonHUConsolidationJobPickingSlots(final Set<PickingSlotId> pickingSlotIds)
{
if (pickingSlotIds.isEmpty())
{
return ImmutableList.of();
}
final Set<PickingSlotIdAndCaption> pickingSlotIdAndCaptions = pickingSlotService.getPickingSlotIdAndCaptions(pickingSlotIds);
final PickingSlotQueuesSummary summary = pickingSlotService.getNotEmptyQueuesSummary(PickingSlotQueueQuery.onlyPickingSlotIds(pickingSlotIds));
return pickingSlotIdAndCaptions.stream()
.map(pickingSlotIdAndCaption -> JsonHUConsolidationJobPickingSlot.builder()
.pickingSlotId(pickingSlotIdAndCaption.getPickingSlotId())
.pickingSlotQRCode(PickingSlotQRCode.ofPickingSlotIdAndCaption(pickingSlotIdAndCaption).toPrintableQRCode().toJsonDisplayableQRCode())
.countHUs(summary.getCountHUs(pickingSlotIdAndCaption.getPickingSlotId()).orElse(0))
.build())
.collect(ImmutableList.toImmutableList());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.hu_consolidation.mobile\src\main\java\de\metas\hu_consolidation\mobile\workflows_api\activity_handlers\HUConsolidateWFActivityHandler.java
| 1
|
请完成以下Java代码
|
public class SortedArrayChecker {
boolean isSorted(int[] array, int length) {
if (array == null || length < 2)
return true;
if (array[length - 2] > array[length - 1])
return false;
return isSorted(array, length - 1);
}
boolean isSorted(int[] array) {
for (int i = 0; i < array.length - 1; i++) {
if (array[i] > array[i + 1])
return false;
}
return true;
}
boolean isSorted(Comparable[] array, int length) {
if (array == null || length < 2)
return true;
if (array[length - 2].compareTo(array[length - 1]) > 0)
return false;
return isSorted(array, length - 1);
}
boolean isSorted(Comparable[] array) {
for (int i = 0; i < array.length - 1; ++i) {
if (array[i].compareTo(array[i + 1]) > 0)
return false;
}
|
return true;
}
boolean isSorted(Object[] array, Comparator comparator) {
for (int i = 0; i < array.length - 1; ++i) {
if (comparator.compare(array[i], (array[i + 1])) > 0)
return false;
}
return true;
}
boolean isSorted(Object[] array, Comparator comparator, int length) {
if (array == null || length < 2)
return true;
if (comparator.compare(array[length - 2], array[length - 1]) > 0)
return false;
return isSorted(array, comparator, length - 1);
}
}
|
repos\tutorials-master\core-java-modules\core-java-arrays-sorting\src\main\java\com\baeldung\array\SortedArrayChecker.java
| 1
|
请完成以下Java代码
|
public Optional<GeocodingConfig> getGeocodingConfig()
{
return cache.getOrLoad(0, this::retrieveGeocodingConfig);
}
private Optional<GeocodingConfig> retrieveGeocodingConfig()
{
final I_GeocodingConfig record = queryBL.createQueryBuilderOutOfTrx(I_GeocodingConfig.class)
.addOnlyActiveRecordsFilter()
.create()
.firstOnly(I_GeocodingConfig.class);
return toGeocodingConfig(record);
}
private static Optional<GeocodingConfig> toGeocodingConfig(@Nullable final I_GeocodingConfig record)
{
if (record == null)
{
return Optional.empty();
}
final GeocodingProviderName providerName = GeocodingProviderName.ofNullableCode(record.getGeocodingProvider());
final GoogleMapsConfig googleMapsConfig;
final OpenStreetMapsConfig openStreetMapsConfig;
if (providerName == null)
{
return Optional.empty();
}
else if (GeocodingProviderName.GOOGLE_MAPS.equals(providerName))
{
googleMapsConfig = GoogleMapsConfig.builder()
.apiKey(record.getgmaps_ApiKey())
.cacheCapacity(record.getcacheCapacity())
.build();
openStreetMapsConfig = null;
}
|
else if (GeocodingProviderName.OPEN_STREET_MAPS.equals(providerName))
{
googleMapsConfig = null;
openStreetMapsConfig = OpenStreetMapsConfig.builder()
.baseURL(record.getosm_baseURL())
.millisBetweenRequests(record.getosm_millisBetweenRequests())
.cacheCapacity(record.getcacheCapacity())
.build();
}
else
{
throw new AdempiereException("Unknown provider: " + providerName);
}
final GeocodingConfig geocodingConfig = GeocodingConfig.builder()
.providerName(providerName)
.googleMapsConfig(googleMapsConfig)
.openStreetMapsConfig(openStreetMapsConfig)
.build();
return Optional.of(geocodingConfig);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\location\geocoding\GeocodingConfigRepository.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Boolean getKeepSubSelectOrderBy() {
return keepSubSelectOrderBy;
}
public void setKeepSubSelectOrderBy(Boolean keepSubSelectOrderBy) {
this.keepSubSelectOrderBy = keepSubSelectOrderBy;
Optional.ofNullable(keepSubSelectOrderBy).ifPresent(v -> properties.setProperty("keepSubSelectOrderBy", v.toString()));
}
public String getSqlParser() {
return sqlParser;
}
public void setSqlParser(String sqlParser) {
this.sqlParser = sqlParser;
Optional.ofNullable(sqlParser).ifPresent(v -> properties.setProperty("sqlParser", v));
}
public Boolean getAsyncCount() {
return asyncCount;
}
public void setAsyncCount(Boolean asyncCount) {
this.asyncCount = asyncCount;
Optional.ofNullable(asyncCount).ifPresent(v -> properties.setProperty("asyncCount", v.toString()));
}
public String getCountSqlParser() {
return countSqlParser;
}
|
public void setCountSqlParser(String countSqlParser) {
this.countSqlParser = countSqlParser;
Optional.ofNullable(countSqlParser).ifPresent(v -> properties.setProperty("countSqlParser", v));
}
public String getOrderBySqlParser() {
return orderBySqlParser;
}
public void setOrderBySqlParser(String orderBySqlParser) {
this.orderBySqlParser = orderBySqlParser;
Optional.ofNullable(orderBySqlParser).ifPresent(v -> properties.setProperty("orderBySqlParser", v));
}
public String getSqlServerSqlParser() {
return sqlServerSqlParser;
}
public void setSqlServerSqlParser(String sqlServerSqlParser) {
this.sqlServerSqlParser = sqlServerSqlParser;
Optional.ofNullable(sqlServerSqlParser).ifPresent(v -> properties.setProperty("sqlServerSqlParser", v));
}
}
|
repos\pagehelper-spring-boot-master\pagehelper-spring-boot-autoconfigure\src\main\java\com\github\pagehelper\autoconfigure\PageHelperStandardProperties.java
| 2
|
请完成以下Java代码
|
public class Main extends AbstractModuleInterceptor
{
/**
* @task https://github.com/metasfresh/metasfresh/issues/969
*/
private static final String SYSCONFIG_DLM_PARTITIONER_INTERCEPTOR_ENABLED = "de.metas.dlm.PartitionerInterceptor.enabled";
@Override
protected void registerInterceptors(final IModelValidationEngine engine)
{
engine.addModelValidator(DLM_Partition_Config.INSTANCE);
engine.addModelValidator(DLM_Partition_Config_Line.INSTANCE);
final ISysConfigBL sysConfigBL = Services.get(ISysConfigBL.class);
if (sysConfigBL.getBooleanValue(SYSCONFIG_DLM_PARTITIONER_INTERCEPTOR_ENABLED, false))
{
// gh #969: only do partitioning if it's enabled
engine.addModelValidator(PartitionerInterceptor.INSTANCE);
}
}
@Override
protected void registerCallouts(final IProgramaticCalloutProvider calloutsRegistry)
{
calloutsRegistry.registerAnnotatedCallout(DLM_Partition_Config_Reference.INSTANCE);
}
|
@Override
public void onUserLogin(final int AD_Org_ID, final int AD_Role_ID, final int AD_User_ID)
{
DBException.registerExceptionWrapper(DLMReferenceExceptionWrapper.INSTANCE);
// gh #1411: only register the connection customizer if it was enabled.
final IDLMService dlmService = Services.get(IDLMService.class);
if (dlmService.isConnectionCustomizerEnabled(AD_User_ID))
{
Services.get(IConnectionCustomizerService.class).registerPermanentCustomizer(DLMPermanentIniCustomizer.INSTANCE);
}
Services.get(ICoordinatorService.class).registerInspector(LastUpdatedInspector.INSTANCE);
// gh #968: register handler to try to get back archived records, if PO could not load them
NoDataFoundHandlers.get().addHandler(UnArchiveRecordHandler.INSTANCE);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.dlm\base\src\main\java\de\metas\dlm\model\interceptor\Main.java
| 1
|
请完成以下Java代码
|
protected final IHUAttributePropagatorFactory getHUAttributePropagatorFactory()
{
Check.assumeNotNull(factory, "factory not null");
return factory;
}
/**
* Compares the given <code>otherPropagator</code>'s propagation with this instance's propagation type and returns <code>true</code> if they are equal.
*/
@Override
public boolean isCompatible(final IHUAttributePropagator otherPropagator)
{
// The parent propagator and "this" have compatible propagation types
if (Objects.equals(otherPropagator.getPropagationType(), getPropagationType()))
{
return true;
}
return false;
}
/**
* Directly set the attribute's value to the given storage without any propagation. Note that this might cause {@link IAttributeValueListener}s to be fired
*
|
* @param attributeValueContext context in which listeners set attribute value
* @param attributeSet the attribute storage which contains the {@link IAttributeValue} to modify.
* @param attribute the attribute whose {@link IAttributeValue} within the <code>attributeSet</code> shall be changes
* @param newValue the <code>IAttributeValue</code>'s new value
*
* @see IAttributeValue#setValue(Object)
*/
protected final void setStorageValue(final IAttributeValueContext attributeValueContext, final IAttributeStorage attributeSet, final I_M_Attribute attribute, final Object newValue)
{
final IAttributeValue attributeValue = attributeSet.getAttributeValue(attribute);
logger.debug("Setting INTERNAL attribute Value={} for {} on {}", new Object[] { newValue, attribute, attributeSet });
attributeValue.setValue(attributeValueContext, newValue);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\attribute\propagation\impl\AbstractHUAttributePropagator.java
| 1
|
请完成以下Java代码
|
public void addUser(Channel channel, String user) {
Channel existChannel = channels.get(channel.id());
if (existChannel == null) {
logger.error("[addUser][连接({}) 不存在]", channel.id());
return;
}
// 设置属性
channel.attr(CHANNEL_ATTR_KEY_USER).set(user);
// 添加到 userChannels
userChannels.put(user, channel);
}
/**
* 将 Channel 从 {@link #channels} 和 {@link #userChannels} 中移除
*
* @param channel Channel
*/
public void remove(Channel channel) {
// 移除 channels
channels.remove(channel.id());
// 移除 userChannels
if (channel.hasAttr(CHANNEL_ATTR_KEY_USER)) {
userChannels.remove(channel.attr(CHANNEL_ATTR_KEY_USER).get());
}
logger.info("[remove][一个连接({})离开]", channel.id());
}
/**
* 向指定用户发送消息
*
* @param user 用户
* @param invocation 消息体
*/
public void send(String user, Invocation invocation) {
// 获得用户对应的 Channel
Channel channel = userChannels.get(user);
if (channel == null) {
logger.error("[send][连接不存在]");
return;
}
if (!channel.isActive()) {
logger.error("[send][连接({})未激活]", channel.id());
return;
|
}
// 发送消息
channel.writeAndFlush(invocation);
}
/**
* 向所有用户发送消息
*
* @param invocation 消息体
*/
public void sendAll(Invocation invocation) {
for (Channel channel : channels.values()) {
if (!channel.isActive()) {
logger.error("[send][连接({})未激活]", channel.id());
return;
}
// 发送消息
channel.writeAndFlush(invocation);
}
}
}
|
repos\SpringBoot-Labs-master\lab-67\lab-67-netty-demo\lab-67-netty-demo-server\src\main\java\cn\iocoder\springboot\lab67\nettyserverdemo\server\NettyChannelManager.java
| 1
|
请完成以下Java代码
|
protected String doIt() throws Exception
{
final Iterator<I_C_Doc_Outbound_Log> docOutboundLogRecords = retrieveSelectedDocOutboundLogs();
while (docOutboundLogRecords.hasNext())
{
final I_C_Doc_Outbound_Log docOutboundLogRecord = docOutboundLogRecords.next();
for (final AttachmentEntry attachmentEntry : retrieveAllAttachments(docOutboundLogRecord))
{
storeAttachmentService.storeAttachment(attachmentEntry);
}
}
return MSG_OK;
}
private final Iterator<I_C_Doc_Outbound_Log> retrieveSelectedDocOutboundLogs()
{
final IQueryFilter<I_C_Doc_Outbound_Log> filter = getProcessInfo().getQueryFilterOrElse(ConstantQueryFilter.of(false));
final Stream<I_C_Doc_Outbound_Log> stream = queryBL
.createQueryBuilder(I_C_Doc_Outbound_Log.class)
.addOnlyActiveRecordsFilter()
.filter(filter)
.create()
.iterateAndStream()
.filter(this::hasAttachmentToStore);
return stream.iterator();
}
|
private boolean hasAttachmentToStore(@NonNull final I_C_Doc_Outbound_Log docoutBoundLogRecord)
{
final List<AttachmentEntry> attachmentEntries = retrieveAllAttachments(docoutBoundLogRecord);
return attachmentEntries
.stream()
.anyMatch(this::isStorable);
}
private List<AttachmentEntry> retrieveAllAttachments(@NonNull final I_C_Doc_Outbound_Log docoutBoundLogRecord)
{
final AttachmentEntryQuery query = AttachmentEntryQuery
.builder()
.referencedRecord(docoutBoundLogRecord)
.build();
return attachmentEntryService.getByQuery(query);
}
private boolean isStorable(@NonNull final AttachmentEntry attachmentEntry)
{
return storeAttachmentService.isAttachmentStorable(attachmentEntry);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.document.archive\de.metas.document.archive.base\src\main\java\de\metas\document\archive\storage\attachments\process\C_Doc_Outbound_Log_StoreAttachments.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
PatientHospital patientHospital = (PatientHospital) o;
return Objects.equals(this.hospitalId, patientHospital.hospitalId) &&
Objects.equals(this.dischargeDate, patientHospital.dischargeDate);
}
@Override
public int hashCode() {
return Objects.hash(hospitalId, dischargeDate);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class PatientHospital {\n");
sb.append(" hospitalId: ").append(toIndentedString(hospitalId)).append("\n");
sb.append(" dischargeDate: ").append(toIndentedString(dischargeDate)).append("\n");
sb.append("}");
|
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\alberta\alberta-patient-api\src\main\java\io\swagger\client\model\PatientHospital.java
| 2
|
请完成以下Java代码
|
public static Optional<IProductPriceAware> ofModel(final Object model)
{
if (model == null)
{
return Optional.empty();
}
if (model instanceof IProductPriceAware)
{
final IProductPriceAware productPriceAware = (IProductPriceAware)model;
return Optional.of(productPriceAware);
}
// If model does not have product price column we consider that it's not product price aware
if (!InterfaceWrapperHelper.hasModelColumnName(model, COLUMNNAME_M_ProductPrice_ID))
{
return Optional.empty();
}
final Integer productPriceId = InterfaceWrapperHelper.getValueOrNull(model, COLUMNNAME_M_ProductPrice_ID);
final boolean productPriceIdSet = productPriceId != null && productPriceId > 0;
final boolean isExplicitProductPrice;
if (InterfaceWrapperHelper.hasModelColumnName(model, COLUMNNAME_IsExplicitProductPriceAttribute))
{
final Object isExplicitObj = InterfaceWrapperHelper.getValueOrNull(model, COLUMNNAME_IsExplicitProductPriceAttribute);
isExplicitProductPrice = DisplayType.toBooleanNonNull(isExplicitObj, false);
}
else
{
// In case the "IsExplicit" column is missing,
// we are considering it as Explicit if the actual M_ProductPrice_ID is set.
isExplicitProductPrice = productPriceIdSet;
}
final IProductPriceAware productPriceAware = new ProductPriceAware(
|
isExplicitProductPrice,
productPriceIdSet ? productPriceId : -1);
return Optional.of(productPriceAware);
}
private final boolean isExplicitProductPrice;
private final int productPriceId;
private ProductPriceAware(final boolean isExplicitProductPrice, final int productPriceId)
{
this.isExplicitProductPrice = isExplicitProductPrice;
this.productPriceId = productPriceId;
}
@Override
public String toString()
{
return MoreObjects.toStringHelper(this)
.add("productPriceId", productPriceId)
.add("isExplicit", isExplicitProductPrice)
.toString();
}
@Override
public boolean isExplicitProductPriceAttribute()
{
return isExplicitProductPrice;
}
@Override
public int getM_ProductPrice_ID()
{
return productPriceId;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\pricing\attributebased\ProductPriceAware.java
| 1
|
请完成以下Java代码
|
public I_C_UOM getUOM() {return qtyToPick.getUOM();}
public boolean isNothingPicked() {return pickFroms.isNothingPicked();}
public Quantity getQtyPicked()
{
return pickFroms.getQtyPicked().orElseGet(qtyToPick::toZero);
}
public Quantity getQtyRejected()
{
return pickFroms.getQtyRejected().orElseGet(qtyToPick::toZero);
}
public PickingJobStep reduceWithPickedEvent(
@NonNull PickingJobStepPickFromKey key,
@NonNull PickingJobStepPickedTo pickedTo)
{
return withChangedPickFroms(pickFroms -> pickFroms.reduceWithPickedEvent(key, pickedTo));
}
public PickingJobStep reduceWithUnpickEvent(
@NonNull PickingJobStepPickFromKey key,
@NonNull PickingJobStepUnpickInfo unpicked)
{
return withChangedPickFroms(pickFroms -> pickFroms.reduceWithUnpickEvent(key, unpicked));
}
private PickingJobStep withChangedPickFroms(@NonNull final UnaryOperator<PickingJobStepPickFromMap> mapper)
{
final PickingJobStepPickFromMap newPickFroms = mapper.apply(this.pickFroms);
return !Objects.equals(this.pickFroms, newPickFroms)
|
? toBuilder().pickFroms(newPickFroms).build()
: this;
}
public ImmutableSet<PickingJobStepPickFromKey> getPickFromKeys()
{
return pickFroms.getKeys();
}
public PickingJobStepPickFrom getPickFrom(@NonNull final PickingJobStepPickFromKey key)
{
return pickFroms.getPickFrom(key);
}
public PickingJobStepPickFrom getPickFromByHUQRCode(@NonNull final HUQRCode qrCode)
{
return pickFroms.getPickFromByHUQRCode(qrCode);
}
@NonNull
public List<HuId> getPickedHUIds()
{
return pickFroms.getPickedHUIds();
}
@NonNull
public Optional<PickingJobStepPickedToHU> getLastPickedHU()
{
return pickFroms.getLastPickedHU();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\picking\job\model\PickingJobStep.java
| 1
|
请完成以下Java代码
|
public Object getValue(@NonNull final String keyColumnName)
{
return values.get(keyColumnName);
}
public Optional<Integer> getValueAsInteger(@NonNull final String keyColumnName)
{
return Optional.ofNullable(NumberUtils.asIntegerOrNull(getValue(keyColumnName)));
}
public <T extends RepoIdAware> Optional<T> getValueAsId(@NonNull final String keyColumnName, @NonNull final Class<T> type)
{
return getValueAsInteger(keyColumnName).map(repoId -> RepoIdAwares.ofRepoIdOrNull(repoId, type));
}
/**
* @return all values (including nulls) in the same order as the key column names are
*/
public ArrayList<Object> getSqlValuesList()
{
final ArrayList<Object> allValuesIncludingNulls = new ArrayList<>(keyColumnNames.size());
for (final String keyColumnName : keyColumnNames)
{
final Object value = getValue(keyColumnName);
allValuesIncludingNulls.add(value);
}
return allValuesIncludingNulls;
}
public void forEach(@NonNull final BiConsumer<String, Object> keyAndValueConsumer)
{
for (final String keyColumnName : keyColumnNames)
{
final Object value = getValue(keyColumnName);
keyAndValueConsumer.accept(keyColumnName, value);
}
}
public SqlAndParams getSqlValuesCommaSeparated()
{
final SqlAndParams.Builder sqlBuilder = SqlAndParams.builder();
for (final String keyColumnName : keyColumnNames)
{
final Object value = getValue(keyColumnName);
if (!sqlBuilder.isEmpty())
{
sqlBuilder.append(", ");
}
sqlBuilder.append("?", value);
|
}
return sqlBuilder.build();
}
public String getSqlWhereClauseById(@NonNull final String tableAlias)
{
final StringBuilder sql = new StringBuilder();
for (final String keyFieldName : keyColumnNames)
{
final Object idPart = getValue(keyFieldName);
if (sql.length() > 0)
{
sql.append(" AND ");
}
sql.append(tableAlias).append(".").append(keyFieldName);
if (!JSONNullValue.isNull(idPart))
{
sql.append("=").append(DB.TO_SQL(idPart));
}
else
{
sql.append(" IS NULL");
}
}
return sql.toString();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\model\sql\SqlComposedKey.java
| 1
|
请完成以下Java代码
|
public int getC_OrderLine_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_OrderLine_ID);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public de.metas.esb.edi.model.I_EDI_Desadv getEDI_Desadv() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_EDI_Desadv_ID, de.metas.esb.edi.model.I_EDI_Desadv.class);
}
@Override
public void setEDI_Desadv(de.metas.esb.edi.model.I_EDI_Desadv EDI_Desadv)
{
set_ValueFromPO(COLUMNNAME_EDI_Desadv_ID, de.metas.esb.edi.model.I_EDI_Desadv.class, EDI_Desadv);
}
/** Set DESADV.
@param EDI_Desadv_ID DESADV */
@Override
public void setEDI_Desadv_ID (int EDI_Desadv_ID)
{
if (EDI_Desadv_ID < 1)
|
set_ValueNoCheck (COLUMNNAME_EDI_Desadv_ID, null);
else
set_ValueNoCheck (COLUMNNAME_EDI_Desadv_ID, Integer.valueOf(EDI_Desadv_ID));
}
/** Get DESADV.
@return DESADV */
@Override
public int getEDI_Desadv_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_EDI_Desadv_ID);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.edi\src\main\java-gen\de\metas\esb\edi\model\X_EDI_Desadv_NullDelivery_C_OrderLine_v.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Boolean getExcludeTaskVariables() {
return excludeTaskVariables;
}
public void setExcludeTaskVariables(Boolean excludeTaskVariables) {
this.excludeTaskVariables = excludeTaskVariables;
}
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public String getPlanItemInstanceId() {
return planItemInstanceId;
}
public void setPlanItemInstanceId(String planItemInstanceId) {
this.planItemInstanceId = planItemInstanceId;
}
public String getCaseInstanceId() {
return caseInstanceId;
}
public void setCaseInstanceId(String caseInstanceId) {
this.caseInstanceId = caseInstanceId;
}
public String getVariableName() {
return variableName;
}
public void setVariableName(String variableName) {
this.variableName = variableName;
}
public String getVariableNameLike() {
return variableNameLike;
}
|
public void setVariableNameLike(String variableNameLike) {
this.variableNameLike = variableNameLike;
}
@JsonTypeInfo(use = Id.CLASS, defaultImpl = QueryVariable.class)
public List<QueryVariable> getVariables() {
return variables;
}
public void setVariables(List<QueryVariable> variables) {
this.variables = variables;
}
public void setExcludeLocalVariables(Boolean excludeLocalVariables) {
this.excludeLocalVariables = excludeLocalVariables;
}
public Boolean getExcludeLocalVariables() {
return excludeLocalVariables;
}
}
|
repos\flowable-engine-main\modules\flowable-cmmn-rest\src\main\java\org\flowable\cmmn\rest\service\api\history\variable\HistoricVariableInstanceQueryRequest.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public BigDecimal getTaxAmount() {
return taxAmount;
}
/**
* Sets the value of the taxAmount property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setTaxAmount(BigDecimal value) {
this.taxAmount = value;
}
/**
* The overall amount for this line item (net value).
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getLineItemAmount() {
return lineItemAmount;
}
/**
* Sets the value of the lineItemAmount property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setLineItemAmount(BigDecimal value) {
this.lineItemAmount = value;
}
/**
|
* Gets the value of the listLineItemExtension property.
*
* @return
* possible object is
* {@link ListLineItemExtensionType }
*
*/
public ListLineItemExtensionType getListLineItemExtension() {
return listLineItemExtension;
}
/**
* Sets the value of the listLineItemExtension property.
*
* @param value
* allowed object is
* {@link ListLineItemExtensionType }
*
*/
public void setListLineItemExtension(ListLineItemExtensionType value) {
this.listLineItemExtension = value;
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\documents\ListLineItemType.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
private void configure() {
Collection<SecurityConfigurer<O, B>> configurers = getConfigurers();
for (SecurityConfigurer<O, B> configurer : configurers) {
configurer.configure((B) this);
}
}
private Collection<SecurityConfigurer<O, B>> getConfigurers() {
List<SecurityConfigurer<O, B>> result = new ArrayList<>();
for (List<SecurityConfigurer<O, B>> configs : this.configurers.values()) {
result.addAll(configs);
}
return result;
}
/**
* Determines if the object is unbuilt.
* @return true, if unbuilt else false
*/
private boolean isUnbuilt() {
synchronized (this.configurers) {
return this.buildState == BuildState.UNBUILT;
}
}
/**
* The build state for the application
*
* @author Rob Winch
* @since 3.2
*/
private enum BuildState {
/**
* This is the state before the {@link Builder#build()} is invoked
*/
UNBUILT(0),
/**
* The state from when {@link Builder#build()} is first invoked until all the
* {@link SecurityConfigurer#init(SecurityBuilder)} methods have been invoked.
*/
INITIALIZING(1),
/**
* The state from after all {@link SecurityConfigurer#init(SecurityBuilder)} have
* been invoked until after all the
* {@link SecurityConfigurer#configure(SecurityBuilder)} methods have been
* invoked.
*/
CONFIGURING(2),
/**
* From the point after all the
|
* {@link SecurityConfigurer#configure(SecurityBuilder)} have completed to just
* after {@link AbstractConfiguredSecurityBuilder#performBuild()}.
*/
BUILDING(3),
/**
* After the object has been completely built.
*/
BUILT(4);
private final int order;
BuildState(int order) {
this.order = order;
}
public boolean isInitializing() {
return INITIALIZING.order == this.order;
}
/**
* Determines if the state is CONFIGURING or later
* @return
*/
public boolean isConfigured() {
return this.order >= CONFIGURING.order;
}
}
}
|
repos\spring-security-main\config\src\main\java\org\springframework\security\config\annotation\AbstractConfiguredSecurityBuilder.java
| 2
|
请完成以下Java代码
|
public String getExternalSystemValue()
{
return get_ValueAsString(COLUMNNAME_ExternalSystemValue);
}
@Override
public void setPharmacy_PriceList_ID (final int Pharmacy_PriceList_ID)
{
if (Pharmacy_PriceList_ID < 1)
set_Value (COLUMNNAME_Pharmacy_PriceList_ID, null);
else
set_Value (COLUMNNAME_Pharmacy_PriceList_ID, Pharmacy_PriceList_ID);
}
@Override
public int getPharmacy_PriceList_ID()
|
{
return get_ValueAsInt(COLUMNNAME_Pharmacy_PriceList_ID);
}
@Override
public void setTenant (final String Tenant)
{
set_Value (COLUMNNAME_Tenant, Tenant);
}
@Override
public String getTenant()
{
return get_ValueAsString(COLUMNNAME_Tenant);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.externalsystem\src\main\java-gen\de\metas\externalsystem\model\X_ExternalSystem_Config_Alberta.java
| 1
|
请完成以下Java代码
|
public void setAuthorizationSuccessHandler(ReactiveOAuth2AuthorizationSuccessHandler authorizationSuccessHandler) {
Assert.notNull(authorizationSuccessHandler, "authorizationSuccessHandler cannot be null");
this.authorizationSuccessHandler = authorizationSuccessHandler;
}
/**
* Sets the handler that handles authorization failures.
*
* <p>
* A {@link RemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler} is used
* by default.
* </p>
* @param authorizationFailureHandler the handler that handles authorization failures.
* @since 5.3
* @see RemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler
*/
public void setAuthorizationFailureHandler(ReactiveOAuth2AuthorizationFailureHandler authorizationFailureHandler) {
Assert.notNull(authorizationFailureHandler, "authorizationFailureHandler cannot be null");
this.authorizationFailureHandler = authorizationFailureHandler;
}
|
/**
* The default implementation of the {@link #setContextAttributesMapper(Function)
* contextAttributesMapper}.
*/
public static class DefaultContextAttributesMapper
implements Function<OAuth2AuthorizeRequest, Mono<Map<String, Object>>> {
private final AuthorizedClientServiceOAuth2AuthorizedClientManager.DefaultContextAttributesMapper mapper = new AuthorizedClientServiceOAuth2AuthorizedClientManager.DefaultContextAttributesMapper();
@Override
public Mono<Map<String, Object>> apply(OAuth2AuthorizeRequest authorizeRequest) {
return Mono.fromCallable(() -> this.mapper.apply(authorizeRequest));
}
}
}
|
repos\spring-security-main\oauth2\oauth2-client\src\main\java\org\springframework\security\oauth2\client\AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager.java
| 1
|
请完成以下Java代码
|
public void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException {
onEmptyElement();
super.writeEmptyElement(prefix, localName, namespaceURI);
}
public void writeEmptyElement(String localName) throws XMLStreamException {
onEmptyElement();
super.writeEmptyElement(localName);
}
public void writeEndElement() throws XMLStreamException {
onEndElement();
super.writeEndElement();
}
|
public void writeCharacters(String text) throws XMLStreamException {
state = SEEN_DATA;
super.writeCharacters(text);
}
public void writeCharacters(char[] text, int start, int len) throws XMLStreamException {
state = SEEN_DATA;
super.writeCharacters(text, start, len);
}
public void writeCData(String data) throws XMLStreamException {
state = SEEN_DATA;
super.writeCData(data);
}
}
|
repos\Activiti-develop\activiti-core\activiti-bpmn-converter\src\main\java\org\activiti\bpmn\converter\IndentingXMLStreamWriter.java
| 1
|
请完成以下Java代码
|
public static ExchangeBuilder fanoutExchange(String name) {
return new ExchangeBuilder(name, ExchangeTypes.FANOUT);
}
/**
* Return a {@link HeadersExchange} builder.
* @param name the name.
* @return the builder.
*/
public static ExchangeBuilder headersExchange(String name) {
return new ExchangeBuilder(name, ExchangeTypes.HEADERS);
}
/**
* Return an {@code x-consistent-hash} exchange builder.
* @param name the name.
* @return the builder.
* @since 3.2
*/
public static ConsistentHashExchangeBuilder consistentHashExchange(String name) {
return new ConsistentHashExchangeBuilder(name);
}
/**
* An {@link ExchangeBuilder} extension for the {@link ConsistentHashExchange}.
*
* @since 3.2
*/
public static final class ConsistentHashExchangeBuilder extends BaseExchangeBuilder<ConsistentHashExchangeBuilder> {
/**
* Construct an instance of the builder for {@link ConsistentHashExchange}.
*
* @param name the exchange name
* @see ExchangeTypes
*/
public ConsistentHashExchangeBuilder(String name) {
super(name, ExchangeTypes.CONSISTENT_HASH);
}
|
public ConsistentHashExchangeBuilder hashHeader(String headerName) {
withArgument("hash-header", headerName);
return this;
}
public ConsistentHashExchangeBuilder hashProperty(String propertyName) {
withArgument("hash-property", propertyName);
return this;
}
@Override
@SuppressWarnings("unchecked")
public ConsistentHashExchange build() {
return configureExchange(
new ConsistentHashExchange(this.name, this.durable, this.autoDelete, getArguments()));
}
}
}
|
repos\spring-amqp-main\spring-amqp\src\main\java\org\springframework\amqp\core\ExchangeBuilder.java
| 1
|
请完成以下Java代码
|
private Object convertJsonValue(JsonValue jsonValue) {
switch (jsonValue.getValueType()) {
case STRING:
return ((JsonString) jsonValue).getString();
case NUMBER:
JsonNumber num = (JsonNumber) jsonValue;
return num.isIntegral() ? num.longValue() : num.doubleValue();
case TRUE:
return true;
case FALSE:
return false;
case NULL:
return null;
case ARRAY:
return convertJsonArray(( jakarta.json.JsonArray) jsonValue);
|
case OBJECT:
return convertJsonToMap((JsonObject) jsonValue);
default:
return jsonValue.toString();
}
}
private List<Object> convertJsonArray( jakarta.json.JsonArray jsonArray) {
List<Object> list = new ArrayList<>();
for (JsonValue value : jsonArray) {
list.add(convertJsonValue(value));
}
return list;
}
}
|
repos\tutorials-master\json-modules\json-3\src\main\java\com\baeldung\jsondeserialization\JsonDeserializerService.java
| 1
|
请完成以下Java代码
|
public boolean isWithoutTenantId() {
return withoutTenantId;
}
public boolean isIncludeTaskLocalVariables() {
return includeTaskLocalVariables;
}
public boolean isIncludeProcessVariables() {
return includeProcessVariables;
}
public boolean isInOrStatement() {
return inOrStatement;
}
public boolean isFinished() {
return finished;
}
public boolean isUnfinished() {
return unfinished;
}
public String getTaskName() {
return taskName;
}
public String getTaskNameLike() {
return taskNameLike;
}
public List<String> getTaskNameList() {
return taskNameList;
}
public List<String> getTaskNameListIgnoreCase() {
return taskNameListIgnoreCase;
}
public String getTaskDescription() {
return taskDescription;
}
public String getTaskDescriptionLike() {
return taskDescriptionLike;
}
public String getTaskDeleteReason() {
return taskDeleteReason;
}
public String getTaskDeleteReasonLike() {
return taskDeleteReasonLike;
}
public List<String> getTaskAssigneeIds() {
return taskAssigneeIds;
}
public String getTaskAssignee() {
return taskAssignee;
}
public String getTaskAssigneeLike() {
return taskAssigneeLike;
}
public String getTaskId() {
return taskId;
}
public String getTaskDefinitionKey() {
return taskDefinitionKey;
}
public String getTaskOwnerLike() {
return taskOwnerLike;
}
public String getTaskOwner() {
return taskOwner;
}
public String getTaskParentTaskId() {
return taskParentTaskId;
}
public Date getCreationDate() {
return creationDate;
}
public String getCandidateUser() {
return candidateUser;
}
|
public String getCandidateGroup() {
return candidateGroup;
}
public String getInvolvedUser() {
return involvedUser;
}
public List<String> getInvolvedGroups() {
return involvedGroups;
}
public String getProcessDefinitionKeyLikeIgnoreCase() {
return processDefinitionKeyLikeIgnoreCase;
}
public String getProcessInstanceBusinessKeyLikeIgnoreCase() {
return processInstanceBusinessKeyLikeIgnoreCase;
}
public String getTaskNameLikeIgnoreCase() {
return taskNameLikeIgnoreCase;
}
public String getTaskDescriptionLikeIgnoreCase() {
return taskDescriptionLikeIgnoreCase;
}
public String getTaskOwnerLikeIgnoreCase() {
return taskOwnerLikeIgnoreCase;
}
public String getTaskAssigneeLikeIgnoreCase() {
return taskAssigneeLikeIgnoreCase;
}
public String getLocale() {
return locale;
}
public List<HistoricTaskInstanceQueryImpl> getOrQueryObjects() {
return orQueryObjects;
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\HistoricTaskInstanceQueryImpl.java
| 1
|
请完成以下Java代码
|
public final class ServerOneTimeTokenAuthenticationConverter implements ServerAuthenticationConverter {
private static final String TOKEN = "token";
@Override
public Mono<Authentication> convert(ServerWebExchange exchange) {
Assert.notNull(exchange, "exchange cannot be null");
if (isFormEncodedRequest(exchange.getRequest())) {
return exchange.getFormData()
.map((data) -> OneTimeTokenAuthenticationToken.unauthenticated(data.getFirst(TOKEN)));
}
String token = resolveTokenFromRequest(exchange.getRequest());
if (!StringUtils.hasText(token)) {
return Mono.empty();
}
return Mono.just(OneTimeTokenAuthenticationToken.unauthenticated(token));
}
|
private @Nullable String resolveTokenFromRequest(ServerHttpRequest request) {
List<String> parameterTokens = request.getQueryParams().get(TOKEN);
if (CollectionUtils.isEmpty(parameterTokens)) {
return null;
}
if (parameterTokens.size() == 1) {
return parameterTokens.get(0);
}
return null;
}
private boolean isFormEncodedRequest(ServerHttpRequest request) {
return HttpMethod.POST.equals(request.getMethod()) && MediaType.APPLICATION_FORM_URLENCODED_VALUE
.equals(request.getHeaders().getFirst(HttpHeaders.CONTENT_TYPE));
}
}
|
repos\spring-security-main\web\src\main\java\org\springframework\security\web\server\authentication\ott\ServerOneTimeTokenAuthenticationConverter.java
| 1
|
请完成以下Java代码
|
public void setWarehouse_temperature (final @Nullable java.lang.String Warehouse_temperature)
{
set_Value (COLUMNNAME_Warehouse_temperature, Warehouse_temperature);
}
@Override
public java.lang.String getWarehouse_temperature()
{
return get_ValueAsString(COLUMNNAME_Warehouse_temperature);
}
@Override
public void setWeight (final @Nullable BigDecimal Weight)
{
set_Value (COLUMNNAME_Weight, Weight);
}
@Override
public BigDecimal getWeight()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Weight);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setWeight_UOM_ID (final int Weight_UOM_ID)
{
if (Weight_UOM_ID < 1)
set_Value (COLUMNNAME_Weight_UOM_ID, null);
else
set_Value (COLUMNNAME_Weight_UOM_ID, Weight_UOM_ID);
}
|
@Override
public int getWeight_UOM_ID()
{
return get_ValueAsInt(COLUMNNAME_Weight_UOM_ID);
}
@Override
public void setWidthInCm (final int WidthInCm)
{
set_Value (COLUMNNAME_WidthInCm, WidthInCm);
}
@Override
public int getWidthInCm()
{
return get_ValueAsInt(COLUMNNAME_WidthInCm);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_Product.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void configure(StateMachineStateConfigurer<String, String> states) throws Exception {
states
.withStates()
.initial("SI")
.end("SF")
.states(new HashSet<>(Arrays.asList("S1", "S2")))
.stateEntry("S3", entryAction())
.stateExit("S3", exitAction())
.state("S4", executeAction(), errorAction())
.state("S5", executeAction(), errorAction());
}
@Override
public void configure(StateMachineTransitionConfigurer<String, String> transitions) throws Exception {
transitions
.withExternal()
.source("SI")
.target("S1")
.event("E1")
.action(initAction())
.and()
.withExternal()
.source("S1")
.target("S2")
.event("E2")
.and()
.withExternal()
.source("SI")
.target("S3")
.event("E3")
.and()
.withExternal()
.source("S3")
.target("S4")
.event("E4")
.and()
.withExternal()
.source("S4")
.target("S5")
.event("E5")
.and()
.withExternal()
.source("S5")
.target("SF")
.event("end")
.guard(simpleGuard());
}
@Bean
public Guard<String, String> simpleGuard() {
return ctx -> {
int approvalCount = (int) ctx
.getExtendedState()
.getVariables()
.getOrDefault("approvalCount", 0);
return approvalCount > 0;
};
}
@Bean
public Action<String, String> entryAction() {
return ctx -> LOGGER.info("Entry " + ctx
.getTarget()
.getId());
}
@Bean
public Action<String, String> doAction() {
return ctx -> LOGGER.info("Do " + ctx
.getTarget()
.getId());
}
@Bean
public Action<String, String> executeAction() {
return ctx -> {
LOGGER.info("Execute " + ctx
.getTarget()
|
.getId());
int approvals = (int) ctx
.getExtendedState()
.getVariables()
.getOrDefault("approvalCount", 0);
approvals++;
ctx
.getExtendedState()
.getVariables()
.put("approvalCount", approvals);
};
}
@Bean
public Action<String, String> exitAction() {
return ctx -> LOGGER.info("Exit " + ctx
.getSource()
.getId() + " -> " + ctx
.getTarget()
.getId());
}
@Bean
public Action<String, String> errorAction() {
return ctx -> LOGGER.info("Error " + ctx
.getSource()
.getId() + ctx.getException());
}
@Bean
public Action<String, String> initAction() {
return ctx -> LOGGER.info(ctx
.getTarget()
.getId());
}
}
|
repos\tutorials-master\spring-state-machine\src\main\java\com\baeldung\spring\statemachine\config\SimpleStateMachineConfiguration.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
String decode() {
if (this.requireBase64) {
BASE_64_CHECKER.checkAcceptable(this.encoded);
}
byte[] bytes = Saml2Utils.samlDecode(this.encoded);
return (this.inflate) ? Saml2Utils.samlInflate(bytes) : new String(bytes, StandardCharsets.UTF_8);
}
static class Base64Checker {
private static final int[] values = genValueMapping();
Base64Checker() {
}
private static int[] genValueMapping() {
byte[] alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
.getBytes(StandardCharsets.ISO_8859_1);
int[] values = new int[256];
Arrays.fill(values, -1);
for (int i = 0; i < alphabet.length; i++) {
values[alphabet[i] & 0xff] = i;
}
return values;
}
boolean isAcceptable(String s) {
int goodChars = 0;
int lastGoodCharVal = -1;
// count number of characters from Base64 alphabet
for (int i = 0; i < s.length(); i++) {
|
int val = values[0xff & s.charAt(i)];
if (val != -1) {
lastGoodCharVal = val;
goodChars++;
}
}
// in cases of an incomplete final chunk, ensure the unused bits are zero
switch (goodChars % 4) {
case 0:
return true;
case 2:
return (lastGoodCharVal & 0b1111) == 0;
case 3:
return (lastGoodCharVal & 0b11) == 0;
default:
return false;
}
}
void checkAcceptable(String ins) {
if (!isAcceptable(ins)) {
throw new IllegalArgumentException("Failed to decode SAMLResponse");
}
}
}
}
}
|
repos\spring-security-main\saml2\saml2-service-provider\src\main\java\org\springframework\security\saml2\internal\Saml2Utils.java
| 2
|
请完成以下Java代码
|
public void start() {
this.running = true;
}
@Override
public void stop() {
throw new UnsupportedOperationException("Stop must not be invoked directly");
}
@Override
public void stop(Runnable callback) {
this.running = false;
this.webServer.shutDownGracefully((result) -> callback.run());
}
@Override
|
public boolean isRunning() {
return this.running;
}
@Override
public int getPhase() {
return WebServerApplicationContext.GRACEFUL_SHUTDOWN_PHASE;
}
@Override
public boolean isPauseable() {
return false;
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-web-server\src\main\java\org\springframework\boot\web\server\context\WebServerGracefulShutdownLifecycle.java
| 1
|
请完成以下Java代码
|
public String getDeploymentMode() {
return deploymentMode;
}
public void setDeploymentMode(String deploymentMode) {
this.deploymentMode = deploymentMode;
}
public boolean isSerializePOJOsInVariablesToJson() {
return serializePOJOsInVariablesToJson;
}
public void setSerializePOJOsInVariablesToJson(boolean serializePOJOsInVariablesToJson) {
this.serializePOJOsInVariablesToJson = serializePOJOsInVariablesToJson;
}
public String getJavaClassFieldForJackson() {
return javaClassFieldForJackson;
}
public void setJavaClassFieldForJackson(String javaClassFieldForJackson) {
this.javaClassFieldForJackson = javaClassFieldForJackson;
}
public Integer getProcessDefinitionCacheLimit() {
return processDefinitionCacheLimit;
}
public void setProcessDefinitionCacheLimit(Integer processDefinitionCacheLimit) {
|
this.processDefinitionCacheLimit = processDefinitionCacheLimit;
}
public String getProcessDefinitionCacheName() {
return processDefinitionCacheName;
}
public void setProcessDefinitionCacheName(String processDefinitionCacheName) {
this.processDefinitionCacheName = processDefinitionCacheName;
}
public void setDisableExistingStartEventSubscriptions(boolean disableExistingStartEventSubscriptions) {
this.disableExistingStartEventSubscriptions = disableExistingStartEventSubscriptions;
}
public boolean shouldDisableExistingStartEventSubscriptions() {
return disableExistingStartEventSubscriptions;
}
}
|
repos\Activiti-develop\activiti-core\activiti-spring-boot-starter\src\main\java\org\activiti\spring\boot\ActivitiProperties.java
| 1
|
请完成以下Java代码
|
public boolean registerDunningDocLineSourceListener(final DunningDocLineSourceEvent eventName, final IDunningDocLineSourceListener listener)
{
Check.assumeNotNull(eventName, "eventName not null");
Check.assumeNotNull(listener, "listener not null");
List<IDunningDocLineSourceListener> eventListeners = dunningDocLineSourceListeners.get(eventName);
if (eventListeners == null)
{
eventListeners = new ArrayList<IDunningDocLineSourceListener>();
dunningDocLineSourceListeners.put(eventName, eventListeners);
}
if (eventListeners.contains(listener))
{
return false;
}
eventListeners.add(listener);
return true;
}
@Override
public void fireDunningDocLineSourceEvent(final DunningDocLineSourceEvent eventName, final I_C_DunningDoc_Line_Source source)
{
Check.assumeNotNull(eventName, "eventName not null");
|
Check.assumeNotNull(source, "source not null");
synchronized (dunningDocLineSourceListeners)
{
final List<IDunningDocLineSourceListener> listeners = dunningDocLineSourceListeners.get(eventName);
if (listeners == null)
{
return;
}
for (final IDunningDocLineSourceListener listener : listeners)
{
listener.onEvent(eventName, source);
}
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.dunning\src\main\java\de\metas\dunning\api\impl\DunningEventDispatcher.java
| 1
|
请完成以下Java代码
|
public void addedObserveRelation(ObserveRelation relation) {
Request request = relation.getExchange().getRequest();
String token = getTokenFromRequest(request);
clients.registerObserveRelation(token, relation);
log.trace("Added Observe relation for token: {}", token);
}
@Override
public void removedObserveRelation(ObserveRelation relation) {
Request request = relation.getExchange().getRequest();
String token = getTokenFromRequest(request);
clients.deregisterObserveRelation(token);
log.trace("Relation removed for token: {}", token);
}
}
private TbCoapDtlsSessionInfo getCoapDtlsSessionInfo(EndpointContext endpointContext) {
InetSocketAddress peerAddress = endpointContext.getPeerAddress();
String certPemStr = getCertPem(endpointContext);
TbCoapDtlsSessionKey tbCoapDtlsSessionKey = StringUtils.isNotBlank(certPemStr) ? new TbCoapDtlsSessionKey(peerAddress, certPemStr) : null;
TbCoapDtlsSessionInfo tbCoapDtlsSessionInfo;
if (tbCoapDtlsSessionKey != null) {
tbCoapDtlsSessionInfo = dtlsSessionsMap
.computeIfPresent(tbCoapDtlsSessionKey, (dtlsSessionIdStr, dtlsSessionInfo) -> {
dtlsSessionInfo.setLastActivityTime(System.currentTimeMillis());
return dtlsSessionInfo;
});
} else {
tbCoapDtlsSessionInfo = null;
}
|
return tbCoapDtlsSessionInfo;
}
private String getCertPem(EndpointContext endpointContext) {
try {
X509CertPath certPath = (X509CertPath) endpointContext.getPeerIdentity();
X509Certificate x509Certificate = (X509Certificate) certPath.getPath().getCertificates().get(0);
return Base64.getEncoder().encodeToString(x509Certificate.getEncoded());
} catch (Exception e) {
log.error("Failed to get cert PEM: [{}]", endpointContext.getPeerAddress(), e);
return null;
}
}
}
|
repos\thingsboard-master\common\transport\coap\src\main\java\org\thingsboard\server\transport\coap\CoapTransportResource.java
| 1
|
请完成以下Java代码
|
public BigDecimal getQty()
{
Quantity qtyDelivered = orderBOMBL.getQuantities(ppOrderBOMLine)
.getQtyIssuedOrReceivedActual();
if (isCoOrByProduct)
{
qtyDelivered = qtyDelivered.negate();
}
return qtyDelivered.toBigDecimal();
}
@Override
public final I_C_UOM getC_UOM()
{
return orderBOMBL.getBOMLineUOM(ppOrderBOMLine);
}
@Override
public ProductionMaterialType getType()
{
return type;
}
@Override
public void setQM_QtyDeliveredPercOfRaw(final BigDecimal qtyDeliveredPercOfRaw)
{
ppOrderBOMLine.setQM_QtyDeliveredPercOfRaw(qtyDeliveredPercOfRaw);
}
@Override
public BigDecimal getQM_QtyDeliveredPercOfRaw()
{
return ppOrderBOMLine.getQM_QtyDeliveredPercOfRaw();
}
@Override
public void setQM_QtyDeliveredAvg(final BigDecimal qtyDeliveredAvg)
{
ppOrderBOMLine.setQM_QtyDeliveredAvg(qtyDeliveredAvg);
}
@Override
public BigDecimal getQM_QtyDeliveredAvg()
{
return ppOrderBOMLine.getQM_QtyDeliveredAvg();
|
}
@Override
public Object getModel()
{
return ppOrderBOMLine;
}
@Override
public String getVariantGroup()
{
return ppOrderBOMLine.getVariantGroup();
}
@Override
public BOMComponentType getComponentType()
{
return BOMComponentType.ofCode(ppOrderBOMLine.getComponentType());
}
@Override
public IHandlingUnitsInfo getHandlingUnitsInfo()
{
if (!_handlingUnitsInfoLoaded)
{
_handlingUnitsInfo = handlingUnitsInfoFactory.createFromModel(ppOrderBOMLine);
_handlingUnitsInfoLoaded = true;
}
return _handlingUnitsInfo;
}
@Override
public I_M_Product getMainComponentProduct()
{
return mainComponentProduct;
}
@Override
public String toString()
{
return ObjectUtils.toString(this);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.materialtracking\src\main\java\de\metas\materialtracking\qualityBasedInvoicing\impl\PPOrderBOMLineProductionMaterial.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class QMAnalysisReportDocumentHandler implements DocumentHandler
{
private final IMaterialTrackingAttributeBL materialTrackingAttributeBL = Services.get(IMaterialTrackingAttributeBL.class);
private final IMaterialTrackingDAO materialTrackingDAO = Services.get(IMaterialTrackingDAO.class);
@Override
public String getSummary(@NonNull final DocumentTableFields docFields)
{
return extractQMAnalysisReport(docFields).getDocumentNo();
}
@Override
public String getDocumentInfo(@NonNull final DocumentTableFields docFields)
{
return getSummary(docFields);
}
@Override
public int getDoc_User_ID(@NonNull final DocumentTableFields docFields)
{
return extractQMAnalysisReport(docFields).getCreatedBy();
}
@Override
public LocalDate getDocumentDate(@NonNull final DocumentTableFields docFields)
{
return TimeUtil.asLocalDate(extractQMAnalysisReport(docFields).getDateDoc());
}
/**
* Sets the <code>Processed</code> flag of the given <code>dunningDoc</code> lines.
* <p>
* Assumes that the given doc is not yet processed.
*/
@Override
public String completeIt(@NonNull final DocumentTableFields docFields)
{
final I_QM_Analysis_Report analysisReport = extractQMAnalysisReport(docFields);
analysisReport.setDocAction(IDocument.ACTION_ReActivate);
if (analysisReport.isProcessed())
{
throw new AdempiereException("@Processed@=@Y@");
}
final AttributeSetInstanceId asiId = AttributeSetInstanceId.ofRepoIdOrNone(analysisReport.getM_AttributeSetInstance_ID());
final I_M_Material_Tracking materialTracking = materialTrackingAttributeBL.getMaterialTrackingOrNull(asiId);
if (materialTracking != null)
{
|
final I_M_Material_Tracking_Ref ref = materialTrackingDAO.createMaterialTrackingRefNoSave(materialTracking, analysisReport);
InterfaceWrapperHelper.save(ref);
}
analysisReport.setProcessed(true);
return IDocument.STATUS_Completed;
}
@Override
public void voidIt(final DocumentTableFields docFields)
{
final I_QM_Analysis_Report analysisReport = extractQMAnalysisReport(docFields);
analysisReport.setProcessed(true);
analysisReport.setDocAction(IDocument.ACTION_None);
}
@Override
public void reactivateIt(@NonNull final DocumentTableFields docFields)
{
final I_QM_Analysis_Report analysisReport = extractQMAnalysisReport(docFields);
analysisReport.setProcessed(false);
analysisReport.setDocAction(IDocument.ACTION_Complete);
}
private static I_QM_Analysis_Report extractQMAnalysisReport(@NonNull final DocumentTableFields docFields)
{
return InterfaceWrapperHelper.create(docFields, I_QM_Analysis_Report.class);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.qualitymgmt\src\main\java\de\metas\qualitymgmt\analysis\QMAnalysisReportDocumentHandler.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
private Map<String, Object> createDefaultProperties(ConfigurableEnvironment environment) {
Map<String, Object> defaultProperties = new HashMap<>();
setDubboApplicationNameProperty(environment, defaultProperties);
setDubboConfigMultipleProperty(defaultProperties);
setDubboApplicationQosEnableProperty(defaultProperties);
setAllowBeanDefinitionOverriding(defaultProperties);
return defaultProperties;
}
private void setDubboApplicationNameProperty(Environment environment, Map<String, Object> defaultProperties) {
String springApplicationName = environment.getProperty(SPRING_APPLICATION_NAME_PROPERTY);
if (StringUtils.hasLength(springApplicationName)
&& !environment.containsProperty(DUBBO_APPLICATION_NAME_PROPERTY)) {
defaultProperties.put(DUBBO_APPLICATION_NAME_PROPERTY, springApplicationName);
}
}
private void setDubboConfigMultipleProperty(Map<String, Object> defaultProperties) {
defaultProperties.put(DUBBO_CONFIG_MULTIPLE_PROPERTY, Boolean.TRUE.toString());
}
private void setDubboApplicationQosEnableProperty(Map<String, Object> defaultProperties) {
defaultProperties.put(DUBBO_APPLICATION_QOS_ENABLE_PROPERTY, Boolean.FALSE.toString());
}
/**
* Set {@link #ALLOW_BEAN_DEFINITION_OVERRIDING_PROPERTY "spring.main.allow-bean-definition-overriding"} to be
* <code>true</code> as default.
*
* @param defaultProperties the default {@link Properties properties}
* @see #ALLOW_BEAN_DEFINITION_OVERRIDING_PROPERTY
* @since 2.7.1
*/
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
|
请完成以下Java代码
|
public Set<DDOrderLineId> getDDOrderLineIds()
{
return list.stream().map(DDOrderCandidateAlloc::getDdOrderLineId).collect(ImmutableSet.toImmutableSet());
}
@Override
@NonNull
public Iterator<DDOrderCandidateAlloc> iterator()
{
return list.iterator();
}
public Map<DDOrderCandidateId, DDOrderCandidateAllocList> groupByCandidateId()
{
if (list.isEmpty())
{
return ImmutableMap.of();
}
return list.stream().collect(Collectors.groupingBy(DDOrderCandidateAlloc::getDdOrderCandidateId, collect()));
}
public Optional<Quantity> getQtySum()
|
{
return list.stream()
.map(DDOrderCandidateAlloc::getQty)
.reduce(Quantity::add);
}
public Set<Integer> getIds()
{
if (list.isEmpty())
{
return ImmutableSet.of();
}
return list.stream()
.map(DDOrderCandidateAlloc::getId)
.filter(id -> id > 0)
.collect(ImmutableSet.toImmutableSet());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\de\metas\distribution\ddordercandidate\DDOrderCandidateAllocList.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private <T> T getPickingJobOption(
@Nullable final BPartnerId customerId,
@NonNull final PickingJobOptionsCollection pickingJobOptionsCollection,
@NonNull final Function<PickingJobOptions, T> extractOption,
@NonNull final T defaultValue)
{
if (customerId != null)
{
final PickingJobOptions pickingJobOptions = customerConfigs.getPickingJobOptionsId(customerId)
.map(pickingJobOptionsCollection::getById)
.orElse(null);
if (pickingJobOptions != null)
{
final T option = extractOption.apply(pickingJobOptions);
if (option != null)
{
return option;
}
}
}
final T option = extractOption.apply(defaultPickingJobOptions);
if (option != null)
{
return option;
|
}
return defaultValue;
}
@NonNull
public ImmutableSet<BPartnerId> getPickOnlyCustomerIds()
{
if (isAllowPickingAnyCustomer)
{
return ImmutableSet.of();
}
return customerConfigs.getCustomerIds();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\picking\config\mobileui\MobileUIPickingUserProfile.java
| 2
|
请完成以下Java代码
|
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
if(userId != null && authorizationType == AUTH_TYPE_GLOBAL && !ANY.equals(userId)) {
throw LOG.illegalValueForUserIdException(userId, ANY);
}
this.userId = userId;
}
public int getResourceType() {
return resourceType;
}
public void setResourceType(int type) {
this.resourceType = type;
}
public Integer getResource() {
return resourceType;
}
public void setResource(Resource resource) {
this.resourceType = resource.resourceType();
}
public String getResourceId() {
return resourceId;
}
public void setResourceId(String resourceId) {
this.resourceId = resourceId;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public int getRevision() {
return revision;
}
public void setRevision(int revision) {
this.revision = revision;
}
public void setPermissions(int permissions) {
this.permissions = permissions;
}
public int getPermissions() {
return permissions;
}
public Set<Permission> getCachedPermissions() {
return cachedPermissions;
}
public int getRevisionNext() {
return revision + 1;
}
|
public Object getPersistentState() {
HashMap<String, Object> state = new HashMap<String, Object>();
state.put("userId", userId);
state.put("groupId", groupId);
state.put("resourceType", resourceType);
state.put("resourceId", resourceId);
state.put("permissions", permissions);
state.put("removalTime", removalTime);
state.put("rootProcessInstanceId", rootProcessInstanceId);
return state;
}
@Override
public Date getRemovalTime() {
return removalTime;
}
public void setRemovalTime(Date removalTime) {
this.removalTime = removalTime;
}
@Override
public String getRootProcessInstanceId() {
return rootProcessInstanceId;
}
public void setRootProcessInstanceId(String rootProcessInstanceId) {
this.rootProcessInstanceId = rootProcessInstanceId;
}
@Override
public Set<String> getReferencedEntityIds() {
Set<String> referencedEntityIds = new HashSet<String>();
return referencedEntityIds;
}
@Override
public Map<String, Class> getReferencedEntitiesIdAndClass() {
Map<String, Class> referenceIdAndClass = new HashMap<String, Class>();
return referenceIdAndClass;
}
@Override
public String toString() {
return this.getClass().getSimpleName()
+ "[id=" + id
+ ", revision=" + revision
+ ", authorizationType=" + authorizationType
+ ", permissions=" + permissions
+ ", userId=" + userId
+ ", groupId=" + groupId
+ ", resourceType=" + resourceType
+ ", resourceId=" + resourceId
+ "]";
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\AuthorizationEntity.java
| 1
|
请完成以下Java代码
|
public I_C_ILCandHandler retrieveForClassOneOnly(final Properties ctx,
@NonNull final Class<? extends IInvoiceCandidateHandler> handlerClass)
{
final List<I_C_ILCandHandler> result = retrieveForClass(ctx, handlerClass);
//
// Retain only active handlers
for (final Iterator<I_C_ILCandHandler> it = result.iterator(); it.hasNext();)
{
final I_C_ILCandHandler handlerDef = it.next();
if (!handlerDef.isActive())
{
it.remove();
}
}
if (result.isEmpty())
{
throw new AdempiereException("@NotFound@ @C_ILCandHandler@ (@Classname@:" + handlerClass + ")");
}
else if (result.size() != 1)
{
throw new AdempiereException("@QueryMoreThanOneRecordsFound@ @C_ILCandHandler@ (@Classname@:" + handlerClass + "): " + result);
}
return result.get(0);
}
@Override
public List<I_C_ILCandHandler> retrieveForClass(
final Properties ctx,
@NonNull final Class<? extends IInvoiceCandidateHandler> clazz)
{
final String classname = clazz.getName();
|
final List<I_C_ILCandHandler> result = new ArrayList<>();
for (final I_C_ILCandHandler handlerDef : retrieveAll(ctx))
{
if (classname.equals(handlerDef.getClassname()))
{
result.add(handlerDef);
}
}
return result;
}
@Override
public I_C_ILCandHandler retrieveFor(final I_C_Invoice_Candidate ic)
{
final Properties ctx = InterfaceWrapperHelper.getCtx(ic);
for (final I_C_ILCandHandler handlerDef : retrieveAll(ctx))
{
if (ic.getC_ILCandHandler_ID() == handlerDef.getC_ILCandHandler_ID())
{
return handlerDef;
}
}
throw new AdempiereException("Missing C_ILCandHandler return for C_ILCandHandler_ID=" + ic.getC_ILCandHandler_ID());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\invoicecandidate\api\impl\InvoiceCandidateHandlerDAO.java
| 1
|
请完成以下Java代码
|
public LocalDate getDocumentDate(Properties ctx, int adTableID, int recordId)
{
final Object model = POJOLookupMap.get().lookup(adTableID, recordId);
return getDocumentDate(model);
}
@Override
protected IDocument getLegacyDocumentOrNull(
Object documentObj,
boolean throwEx)
{
final Object documentObjToUse;
final POJOWrapper wrapper;
if (documentObj instanceof ITableRecordReference)
{
final Object referencedModel = ((ITableRecordReference)documentObj).getModel(Object.class);
documentObjToUse = referencedModel;
wrapper = POJOWrapper.getWrapper(referencedModel);
}
else
{
wrapper = POJOWrapper.getWrapper(documentObj);
documentObjToUse = documentObj;
}
|
final Class<?> interfaceClass = wrapper.getInterfaceClass();
if (hasMethod(interfaceClass, String.class, "getDocStatus")
&& hasMethod(interfaceClass, String.class, "getDocAction")
// allow for now to consider documents also the ones that don't have DocumentNo; see <code>I_C_Flatrate_Term</code>
// && hasMethod(interfaceClass, String.class, "getDocumentNo")
)
{
final IDocument pojoWrapper = POJOWrapper.create(documentObjToUse, IDocument.class);
return pojoWrapper;
}
if (throwEx)
{
throw new AdempiereException("Cannot extract " + IDocument.class + " from " + documentObj);
}
return null;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\document\engine\impl\PlainDocumentBL.java
| 1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.