instruction string | input string | output string | source_file string | priority int64 |
|---|---|---|---|---|
请完成以下Java代码 | public final class ContractPricingUtil
{
private ContractPricingUtil()
{
}
/**
* Helper method to get the {@link I_C_Flatrate_Conditions} instance out of a referenced object, if there is any.
*
* @param referencedObject
* @return
*/
public static I_C_Flatrate_Conditions getC_Flatrate_Conditions(final Object referencedObject)
{
if (referencedObject == null)
{
return null;
}
if (referencedObject instanceof IFlatrateConditionsAware) | {
return ((IFlatrateConditionsAware)(referencedObject)).getC_Flatrate_Conditions();
}
try
{
final IFlatrateConditionsAware flatrateConditionsProvider = InterfaceWrapperHelper.create(referencedObject, IFlatrateConditionsAware.class);
return flatrateConditionsProvider.getC_Flatrate_Conditions();
}
catch (AdempiereException e)
{
return null;
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\pricing\ContractPricingUtil.java | 1 |
请完成以下Java代码 | public class ActiveJDBCApp
{
public static void main( String[] args )
{
try(final DB open = Base.open()) {
ActiveJDBCApp app = new ActiveJDBCApp();
app.create();
app.update();
app.delete();
app.deleteCascade();
} catch (Exception e) {
e.printStackTrace();
} finally {
Base.close();
}
}
protected void create() {
Employee employee = new Employee("Hugo","C","M","BN");
employee.saveIt();
employee.add(new Role("Java Developer","BN"));
LazyList<Model> all = Employee.findAll();
System.out.println(all.size());
}
protected void update() {
Employee employee = Employee.findFirst("first_name = ?","Hugo");
employee.set("last_namea","Choi").saveIt();
employee = Employee.findFirst("last_name = ?","Choi");
System.out.println(employee.getString("first_name") + " " + employee.getString("last_name"));
}
protected void delete() {
Employee employee = Employee.findFirst("first_name = ?","Hugo");
employee.delete(); | employee = Employee.findFirst("last_name = ?","Choi");
if(null == employee){
System.out.println("No such Employee found!");
}
}
protected void deleteCascade() {
create();
Employee employee = Employee.findFirst("first_name = ?","Hugo");
employee.deleteCascade();
employee = Employee.findFirst("last_name = ?","C");
if(null == employee){
System.out.println("No such Employee found!");
}
}
} | repos\tutorials-master\persistence-modules\activejdbc\src\main\java\com\baeldung\ActiveJDBCApp.java | 1 |
请完成以下Java代码 | protected LinksHandler getLinksHandler() {
return new WebMvcLinksHandler();
}
/**
* Handler for root endpoint providing links.
*/
class WebMvcLinksHandler implements LinksHandler {
@Override
@ResponseBody
@Reflective
public Map<String, Map<String, Link>> links(HttpServletRequest request, HttpServletResponse response) {
Map<String, Link> links = WebMvcEndpointHandlerMapping.this.linksResolver
.resolveLinks(request.getRequestURL().toString());
return OperationResponseBody.of(Collections.singletonMap("_links", links));
}
@Override
public String toString() {
return "Actuator root web endpoint";
} | }
static class WebMvcEndpointHandlerMappingRuntimeHints implements RuntimeHintsRegistrar {
private final ReflectiveRuntimeHintsRegistrar reflectiveRegistrar = new ReflectiveRuntimeHintsRegistrar();
private final BindingReflectionHintsRegistrar bindingRegistrar = new BindingReflectionHintsRegistrar();
@Override
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
this.reflectiveRegistrar.registerRuntimeHints(hints, WebMvcLinksHandler.class);
this.bindingRegistrar.registerReflectionHints(hints.reflection(), Link.class);
}
}
} | repos\spring-boot-4.0.1\module\spring-boot-webmvc\src\main\java\org\springframework\boot\webmvc\actuate\endpoint\web\WebMvcEndpointHandlerMapping.java | 1 |
请完成以下Java代码 | public class InOutLineHUPackingAware implements IHUPackingAware
{
private final I_M_InOutLine inoutLine;
private final PlainHUPackingAware values = new PlainHUPackingAware();
public InOutLineHUPackingAware(@NonNull final I_M_InOutLine inoutLine)
{
this.inoutLine = inoutLine;
}
@Override
public int getM_Product_ID()
{
return inoutLine.getM_Product_ID();
}
@Override
public void setM_Product_ID(final int productId)
{
inoutLine.setM_Product_ID(productId);
}
@Override
public void setQty(final BigDecimal qty)
{
inoutLine.setQtyEntered(qty);
final ProductId productId = ProductId.ofRepoIdOrNull(getM_Product_ID());
final I_C_UOM uom = Services.get(IUOMDAO.class).getById(getC_UOM_ID());
final BigDecimal movementQty = Services.get(IUOMConversionBL.class).convertToProductUOM(productId, uom, qty);
inoutLine.setMovementQty(movementQty);
}
@Override
public BigDecimal getQty()
{
return inoutLine.getQtyEntered();
}
@Override
public int getM_HU_PI_Item_Product_ID()
{
final IHUInOutBL huInOutBL = Services.get(IHUInOutBL.class);
final org.compiere.model.I_M_InOut inOut = inoutLine.getM_InOut();
// Applied only to customer return inout lines.
final boolean isCustomerReturnInOutLine = huInOutBL.isCustomerReturn(inOut);
if (inoutLine.isManualPackingMaterial() || isCustomerReturnInOutLine)
{
return inoutLine.getM_HU_PI_Item_Product_ID();
}
final I_C_OrderLine orderline = InterfaceWrapperHelper.create(inoutLine.getC_OrderLine(), I_C_OrderLine.class);
return orderline == null ? -1 : orderline.getM_HU_PI_Item_Product_ID();
}
@Override
public void setM_HU_PI_Item_Product_ID(final int huPiItemProductId)
{
values.setM_HU_PI_Item_Product_ID(huPiItemProductId);
}
@Override
public int getM_AttributeSetInstance_ID()
{
return inoutLine.getM_AttributeSetInstance_ID();
}
@Override | public void setM_AttributeSetInstance_ID(final int M_AttributeSetInstance_ID)
{
inoutLine.setM_AttributeSetInstance_ID(M_AttributeSetInstance_ID);
}
@Override
public int getC_UOM_ID()
{
return inoutLine.getC_UOM_ID();
}
@Override
public void setC_UOM_ID(final int uomId)
{
// we assume inoutLine's UOM is correct
if (uomId > 0)
{
inoutLine.setC_UOM_ID(uomId);
}
}
@Override
public BigDecimal getQtyTU()
{
return inoutLine.getQtyEnteredTU();
}
@Override
public void setQtyTU(final BigDecimal qtyPacks)
{
inoutLine.setQtyEnteredTU(qtyPacks);
}
@Override
public int getC_BPartner_ID()
{
return values.getC_BPartner_ID();
}
@Override
public void setC_BPartner_ID(final int partnerId)
{
values.setC_BPartner_ID(partnerId);
}
@Override
public boolean isInDispute()
{
return inoutLine.isInDispute();
}
@Override
public void setInDispute(final boolean inDispute)
{
inoutLine.setIsInDispute(inDispute);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\adempiere\gui\search\impl\InOutLineHUPackingAware.java | 1 |
请在Spring Boot框架中完成以下Java代码 | private void sessionClearAnalysisError(IWebSession webSession) {
webSession.removeAttribute("analysisError");
}
private void sessionSetAnalysisError(NameRequest nameRequest, IWebSession webSession) {
webSession.setAttributeValue("analysisError", nameRequest);
}
private void clearAnalysis(IWebSession webSession) {
webSession.removeAttribute("lastAnalysis");
}
private void sessionRegisterAnalysis(NameAnalysisEntity analysis, IWebSession webSession) {
webSession.setAttributeValue("lastAnalysis", analysis);
}
private void sessionRegisterRequest(NameRequest nameRequest, IWebSession webSession) {
webSession.setAttributeValue("lastRequest", nameRequest);
SessionNameRequest sessionNameRequest = sessionNameRequestFactory.getInstance(nameRequest);
List<SessionNameRequest> requests = getRequestsFromSession(webSession); | requests.add(0, sessionNameRequest);
}
private List<SessionNameRequest> getRequestsFromSession(IWebSession session) {
Object requests = session.getAttributeValue("requests");
if (requests == null || !(requests instanceof List)) {
List<SessionNameRequest> sessionNameRequests = new ArrayList<>();
session.setAttributeValue("requests", sessionNameRequests);
requests = sessionNameRequests;
}
return (List<SessionNameRequest>) requests;
}
private IWebSession getIWebSession(HttpServletRequest request, HttpServletResponse response) {
IServletWebExchange exchange = webApp.buildExchange(request, response);
return exchange == null ? null : exchange.getSession();
}
} | repos\tutorials-master\spring-web-modules\spring-thymeleaf-attributes\accessing-session-attributes\src\main\java\com\baeldung\accesing_session_attributes\web\controllers\NameAnalysisController.java | 2 |
请完成以下Java代码 | public @Nullable String getPath() {
return this.path;
}
public void setPath(@Nullable String path) {
this.path = path;
}
public @Nullable Boolean getHttpOnly() {
return this.httpOnly;
}
public void setHttpOnly(@Nullable Boolean httpOnly) {
this.httpOnly = httpOnly;
}
public @Nullable Boolean getSecure() {
return this.secure;
}
public void setSecure(@Nullable Boolean secure) {
this.secure = secure;
}
public @Nullable Duration getMaxAge() {
return this.maxAge;
}
public void setMaxAge(@Nullable Duration maxAge) {
this.maxAge = maxAge;
}
public @Nullable SameSite getSameSite() {
return this.sameSite;
}
public void setSameSite(@Nullable SameSite sameSite) {
this.sameSite = sameSite;
}
public @Nullable Boolean getPartitioned() {
return this.partitioned;
}
public void setPartitioned(@Nullable Boolean partitioned) {
this.partitioned = partitioned;
}
/**
* SameSite values. | */
public enum SameSite {
/**
* SameSite attribute will be omitted when creating the cookie.
*/
OMITTED(null),
/**
* SameSite attribute will be set to None. Cookies are sent in both first-party
* and cross-origin requests.
*/
NONE("None"),
/**
* SameSite attribute will be set to Lax. Cookies are sent in a first-party
* context, also when following a link to the origin site.
*/
LAX("Lax"),
/**
* SameSite attribute will be set to Strict. Cookies are only sent in a
* first-party context (i.e. not when following a link to the origin site).
*/
STRICT("Strict");
private @Nullable final String attributeValue;
SameSite(@Nullable String attributeValue) {
this.attributeValue = attributeValue;
}
public @Nullable String attributeValue() {
return this.attributeValue;
}
}
} | repos\spring-boot-4.0.1\module\spring-boot-web-server\src\main\java\org\springframework\boot\web\server\Cookie.java | 1 |
请完成以下Java代码 | public void addErrorPages(ErrorPage... errorPages) {
Assert.notNull(errorPages, "'errorPages' must not be null");
this.errorPages.addAll(Arrays.asList(errorPages));
}
public @Nullable Ssl getSsl() {
return this.ssl;
}
@Override
public void setSsl(@Nullable Ssl ssl) {
this.ssl = ssl;
}
/**
* Return the configured {@link SslBundles}.
* @return the {@link SslBundles} or {@code null}
* @since 3.2.0
*/
public @Nullable SslBundles getSslBundles() {
return this.sslBundles;
}
@Override
public void setSslBundles(@Nullable SslBundles sslBundles) {
this.sslBundles = sslBundles;
}
public @Nullable Http2 getHttp2() {
return this.http2;
}
@Override
public void setHttp2(@Nullable Http2 http2) {
this.http2 = http2;
}
public @Nullable Compression getCompression() {
return this.compression;
}
@Override
public void setCompression(@Nullable Compression compression) {
this.compression = compression;
}
public @Nullable String getServerHeader() {
return this.serverHeader;
}
@Override
public void setServerHeader(@Nullable String serverHeader) {
this.serverHeader = serverHeader;
}
@Override
public void setShutdown(Shutdown shutdown) {
this.shutdown = shutdown;
}
/** | * Returns the shutdown configuration that will be applied to the server.
* @return the shutdown configuration
* @since 2.3.0
*/
public Shutdown getShutdown() {
return this.shutdown;
}
/**
* Return the {@link SslBundle} that should be used with this server.
* @return the SSL bundle
*/
protected final SslBundle getSslBundle() {
return WebServerSslBundle.get(this.ssl, this.sslBundles);
}
protected final Map<String, SslBundle> getServerNameSslBundles() {
Assert.state(this.ssl != null, "'ssl' must not be null");
return this.ssl.getServerNameBundles()
.stream()
.collect(Collectors.toMap(ServerNameSslBundle::serverName, (serverNameSslBundle) -> {
Assert.state(this.sslBundles != null, "'sslBundles' must not be null");
return this.sslBundles.getBundle(serverNameSslBundle.bundle());
}));
}
/**
* Return the absolute temp dir for given web server.
* @param prefix server name
* @return the temp dir for given server.
*/
protected final File createTempDir(String prefix) {
try {
File tempDir = Files.createTempDirectory(prefix + "." + getPort() + ".").toFile();
tempDir.deleteOnExit();
return tempDir;
}
catch (IOException ex) {
throw new WebServerException(
"Unable to create tempDir. java.io.tmpdir is set to " + System.getProperty("java.io.tmpdir"), ex);
}
}
} | repos\spring-boot-4.0.1\module\spring-boot-web-server\src\main\java\org\springframework\boot\web\server\AbstractConfigurableWebServerFactory.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class PackageableQuery
{
public static final PackageableQuery ALL = PackageableQuery.builder().build();
@Nullable ProductId productId;
@NonNull @Singular ImmutableSet<BPartnerId> customerIds;
@NonNull @Singular ImmutableSet<BPartnerLocationId> handoverLocationIds;
@Nullable BPartnerLocationId deliveryBPLocationId;
@Nullable WarehouseTypeId warehouseTypeId;
@Nullable WarehouseId warehouseId;
@NonNull @Singular ImmutableSet<LocalDate> deliveryDays;
@Nullable LocalDate preparationDate;
@Nullable ZonedDateTime maximumFixedPreparationDate;
@Nullable ZonedDateTime maximumFixedPromisedDate;
@Nullable ShipperId shipperId;
/**
* retrieve only those packageables which are created from sales order/lines
*/
boolean onlyFromSalesOrder;
@Nullable OrderId salesOrderId;
@Nullable DocumentNoFilter salesOrderDocumentNo;
/**
* Consider records which were locked via M_ShipmentSchedule_Lock table.
*/
@Nullable UserId lockedBy;
/**
* Considers records which were not locked via M_ShipmentSchedule_Lock table. Applies when {@link #lockedBy} is set.
*/ | @Builder.Default boolean includeNotLocked = true;
/**
* Excludes records which were locked via T_Lock table.
*/
@Builder.Default boolean excludeLockedForProcessing = false; // false by default to be backward-compatibile
@Nullable Set<ShipmentScheduleId> onlyShipmentScheduleIds;
@Nullable Set<ShipmentScheduleId> excludeShipmentScheduleIds;
@Builder.Default
@NonNull ImmutableSet<OrderBy> orderBys = ImmutableSet.of(OrderBy.ProductName, OrderBy.PriorityRule, OrderBy.DateOrdered);
@Nullable ResolvedScannedProductCodes scannedProductCodes;
public enum OrderBy
{
ProductName,
PriorityRule,
DateOrdered,
PreparationDate,
SalesOrderId,
DeliveryBPLocationId,
WarehouseTypeId,
SetupPlaceNo_Descending,
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\picking\api\PackageableQuery.java | 2 |
请完成以下Java代码 | public Long getLongValue() {
return longValue;
}
public void setLongValue(Long longValue) {
this.longValue = longValue;
}
public Double getDoubleValue() {
return doubleValue;
}
public void setDoubleValue(Double doubleValue) {
this.doubleValue = doubleValue;
}
public byte[] getByteArrayValue() {
return null;
} | public void setByteArrayValue(byte[] bytes) {
}
public String getType() {
return type;
}
public boolean getFindNulledEmptyStrings() {
return findNulledEmptyStrings;
}
public void setFindNulledEmptyStrings(boolean findNulledEmptyStrings) {
this.findNulledEmptyStrings = findNulledEmptyStrings;
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\SingleQueryVariableValueCondition.java | 1 |
请完成以下Java代码 | public Object getParameterDefaultValue(@NonNull final IProcessDefaultParameter parameter)
{
if (getProcessInfo().getRecord_ID() <= 0)
{
return IProcessDefaultParametersProvider.DEFAULT_VALUE_NOTAVAILABLE;
}
final I_C_InvoiceSchedule invoiceScheduleRecord = getProcessInfo().getRecord(I_C_InvoiceSchedule.class);
if (I_C_InvoiceSchedule.COLUMNNAME_Name.equals(parameter.getColumnName()))
{
return invoiceScheduleRecord.getName();
}
else if (I_C_InvoiceSchedule.COLUMNNAME_InvoiceDistance.equals(parameter.getColumnName()))
{
return invoiceScheduleRecord.getInvoiceDistance();
}
else if (I_C_InvoiceSchedule.COLUMNNAME_InvoiceFrequency.equals(parameter.getColumnName()))
{
return invoiceScheduleRecord.getInvoiceFrequency();
}
else if (I_C_InvoiceSchedule.COLUMNNAME_InvoiceDay.equals(parameter.getColumnName()))
{
return invoiceScheduleRecord.getInvoiceDay();
}
else if (I_C_InvoiceSchedule.COLUMNNAME_InvoiceWeekDay.equals(parameter.getColumnName()))
{
return invoiceScheduleRecord.getInvoiceWeekDay();
}
else if (I_C_InvoiceSchedule.COLUMNNAME_IsAmount.equals(parameter.getColumnName()))
{
return invoiceScheduleRecord.isAmount();
}
else if (I_C_InvoiceSchedule.COLUMNNAME_Amt.equals(parameter.getColumnName())) | {
return invoiceScheduleRecord.getAmt();
}
return IProcessDefaultParametersProvider.DEFAULT_VALUE_NOTAVAILABLE;
}
/**
* Needed because otherwise we need a cache-reset in case a new record was added.
*/
@Override
protected final void postProcess(final boolean success)
{
if (success && isNewRecord)
{
getView().invalidateAll();
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\invoice\process\C_InvoiceSchedule_CreateOrUpdate.java | 1 |
请完成以下Java代码 | public int getRepoId()
{
return repoId;
}
public boolean isNone()
{
return repoId == NONE.repoId;
}
/**
* @return true if this is about a "real" greater-than-zero {@code M_AttributeSetInstance_ID}.
*/
public boolean isRegular()
{
return repoId > NONE.repoId;
}
public static boolean isRegular(@Nullable final AttributeSetInstanceId asiId)
{
return asiId != null && asiId.isRegular();
}
@Nullable
public AttributeSetInstanceId asRegularOrNull() {return isRegular() ? this : null;}
/**
* Note that currently, according to this method, "NONE" ist not equal to an emptpy ASI | */
public static boolean equals(@Nullable final AttributeSetInstanceId id1, @Nullable final AttributeSetInstanceId id2)
{
return Objects.equals(id1, id2);
}
@SuppressWarnings("unused")
public void assertRegular()
{
if (!isRegular())
{
throw new AdempiereException("Expected regular ASI but got " + this);
}
}
@Contract("!null -> !null")
public AttributeSetInstanceId orElseIfNone(final AttributeSetInstanceId other) {return isNone() ? other : this;}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\mm\attributes\AttributeSetInstanceId.java | 1 |
请完成以下Java代码 | public class Details {
private String name;
private String login;
public Details() {
}
public Details(String name, String login) {
this.name = name;
this.login = login;
}
public String getName() { | return name;
}
public void setName(String name) {
this.name = name;
}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
} | repos\tutorials-master\spring-boot-modules\spring-boot-client\src\main\java\com\baeldung\boot\client\Details.java | 1 |
请完成以下Java代码 | private static final class ConcurrentCache<K, V> {
private final int size;
private final Map<K, V> eden;
private final Map<K, V> longterm;
ConcurrentCache(int size) {
this.size = size;
this.eden = new ConcurrentHashMap<>(size);
this.longterm = new WeakHashMap<>(size);
}
public V get(K key) {
V value = this.eden.get(key);
if (value == null) {
synchronized (longterm) {
value = this.longterm.get(key);
}
if (value != null) {
this.eden.put(key, value);
}
} | return value;
}
public void put(K key, V value) {
if (this.eden.size() >= this.size) {
synchronized (longterm) {
this.longterm.putAll(this.eden);
}
this.eden.clear();
}
this.eden.put(key, value);
}
}
} | repos\flowable-engine-main\modules\flowable-engine-common\src\main\java\org\flowable\common\engine\impl\javax\el\BeanELResolver.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public void addToPickingSlotQueue(@NonNull final PickingSlotId pickingSlotId, @NonNull final Set<HuId> huIds)
{
pickingSlotService.addToPickingSlotQueue(pickingSlotId, huIds);
}
public PickingSlotSuggestions getPickingSlotsSuggestions(@NonNull final Set<DocumentLocation> deliveryLocations)
{
if (deliveryLocations.isEmpty())
{
return PickingSlotSuggestions.EMPTY;
}
final ImmutableMap<BPartnerLocationId, DocumentLocation> deliveryLocationsById = Maps.uniqueIndex(deliveryLocations, DocumentLocation::getBpartnerLocationId);
final List<I_M_PickingSlot> pickingSlots = pickingSlotService.list(PickingSlotQuery.builder().assignedToBPartnerLocationIds(deliveryLocationsById.keySet()).build());
if (pickingSlots.isEmpty())
{
return PickingSlotSuggestions.EMPTY;
}
final PickingSlotQueuesSummary queues = pickingSlotService.getNotEmptyQueuesSummary(PickingSlotQueueQuery.onlyPickingSlotIds(extractPickingSlotIds(pickingSlots)));
return pickingSlots.stream()
.map(pickingSlotIdAndCaption -> toPickingSlotSuggestion(pickingSlotIdAndCaption, deliveryLocationsById, queues))
.collect(PickingSlotSuggestions.collect());
}
private static PickingSlotSuggestion toPickingSlotSuggestion( | @NonNull final I_M_PickingSlot pickingSlot,
@NonNull final ImmutableMap<BPartnerLocationId, DocumentLocation> deliveryLocationsById,
@NonNull final PickingSlotQueuesSummary queues)
{
final PickingSlotIdAndCaption pickingSlotIdAndCaption = toPickingSlotIdAndCaption(pickingSlot);
final BPartnerLocationId deliveryLocationId = BPartnerLocationId.ofRepoIdOrNull(pickingSlot.getC_BPartner_ID(), pickingSlot.getC_BPartner_Location_ID());
final DocumentLocation deliveryLocation = deliveryLocationsById.get(deliveryLocationId);
return PickingSlotSuggestion.builder()
.pickingSlotIdAndCaption(pickingSlotIdAndCaption)
.deliveryLocation(deliveryLocation)
.countHUs(queues.getCountHUs(pickingSlotIdAndCaption.getPickingSlotId()).orElse(0))
.build();
}
private static ImmutableSet<PickingSlotId> extractPickingSlotIds(final List<I_M_PickingSlot> pickingSlots)
{
return pickingSlots.stream()
.map(pickingSlot -> PickingSlotId.ofRepoId(pickingSlot.getM_PickingSlot_ID()))
.collect(ImmutableSet.toImmutableSet());
}
private static PickingSlotIdAndCaption toPickingSlotIdAndCaption(@NonNull final I_M_PickingSlot record)
{
return PickingSlotIdAndCaption.of(PickingSlotId.ofRepoId(record.getM_PickingSlot_ID()), record.getPickingSlot());
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\picking\job\service\PickingJobSlotService.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public class ApplicationSecurityConfig extends WebSecurityConfigurerAdapter {
//
private final PasswordEncoder passwordEncoder;
@Autowired
public ApplicationSecurityConfig(PasswordEncoder passwordEncoder) {
this.passwordEncoder = passwordEncoder;
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.csrf().disable()
.authorizeRequests()
.antMatchers("/", "index", "/css/*", "/js/*").permitAll()
.anyRequest()
.authenticated()
.and()
.httpBasic();
}
@Override
@Bean | protected UserDetailsService userDetailsService() {
// Permission User(s)
UserDetails urunovUser =
User
.builder()
.username("urunov")
.password(passwordEncoder.encode("urunov1987"))
.authorities("STUDENT")
.build();
return new InMemoryUserDetailsManager( // manage user(s)
urunovUser
);
}
} | repos\SpringBoot-Projects-FullStack-master\Advanced-SpringSecure\spring-login-password\src\main\java\uz\bepro\springloginpassword\security\ApplicationSecurityConfig.java | 2 |
请完成以下Java代码 | public void setC_Currency_ID (int C_Currency_ID)
{
throw new IllegalArgumentException ("C_Currency_ID is virtual column"); }
/** Get Währung.
@return Die Währung für diesen Eintrag
*/
@Override
public int getC_Currency_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Currency_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Datum von.
@param DateFrom
Startdatum eines Abschnittes
*/
@Override
public void setDateFrom (java.sql.Timestamp DateFrom)
{
set_Value (COLUMNNAME_DateFrom, DateFrom);
}
/** Get Datum von.
@return Startdatum eines Abschnittes
*/
@Override
public java.sql.Timestamp getDateFrom ()
{
return (java.sql.Timestamp)get_Value(COLUMNNAME_DateFrom); | }
/** Set Freigegeben.
@param Processed
Checkbox sagt aus, ob der Beleg verarbeitet wurde.
*/
@Override
public void setProcessed (boolean Processed)
{
set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed));
}
/** Get Freigegeben.
@return Checkbox sagt aus, ob der Beleg verarbeitet wurde.
*/
@Override
public boolean isProcessed ()
{
Object oo = get_Value(COLUMNNAME_Processed);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_BPartner_CreditLimit.java | 1 |
请完成以下Java代码 | public String toString()
{
final StringBuilder sb = new StringBuilder("State{");
sb.append("depth=").append(depth);
sb.append(", ID=").append(index);
sb.append(", emits=").append(emits);
sb.append(", success=").append(success.keySet());
sb.append(", failureID=").append(failure == null ? "-1" : failure.index);
sb.append(", failure=").append(failure);
sb.append('}');
return sb.toString();
}
/**
* 获取goto表
* @return
*/ | public Map<Character, State> getSuccess()
{
return success;
}
public int getIndex()
{
return index;
}
public void setIndex(int index)
{
this.index = index;
}
} | repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\collection\AhoCorasick\State.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class JeecgNacosApplication {
/** 是否单机模式启动 */
private static String standalone = "true";
/** 是否开启鉴权 */
private static String enabled = "false";
public static void main(String[] args) {
System.setProperty("nacos.standalone", standalone);
System.setProperty("nacos.core.auth.enabled", enabled);
// //一旦Nacos初始化,用户名nacos将不能被修改,但你可以通过控制台或API来修改密码 https://nacos.io/en/blog/faq/nacos-user-question-history8420
// System.setProperty("nacos.core.auth.default.username", "nacos");
// System.setProperty("nacos.core.auth.default.password", "nacos");
System.setProperty("server.tomcat.basedir","logs");
//自定义启动端口号 | System.setProperty("server.port","8848");
SpringApplication.run(JeecgNacosApplication.class, args);
}
/**
* 默认跳转首页
*
* @param model
* @return
*/
@GetMapping("/")
public String index(Model model, HttpServletResponse response) {
// 视图重定向 - 跳转
return "/nacos";
}
} | repos\JeecgBoot-main\jeecg-boot\jeecg-server-cloud\jeecg-cloud-nacos\src\main\java\com\alibaba\nacos\JeecgNacosApplication.java | 2 |
请完成以下Java代码 | public String getUsername() {
return username;
}
public UserDO setUsername(String username) {
this.username = username;
return this;
}
public String getPassword() {
return password;
}
public UserDO setPassword(String password) {
this.password = password;
return this;
}
public Date getCreateTime() {
return createTime;
} | public UserDO setCreateTime(Date createTime) {
this.createTime = createTime;
return this;
}
public Integer getDeleted() {
return deleted;
}
public UserDO setDeleted(Integer deleted) {
this.deleted = deleted;
return this;
}
} | repos\SpringBoot-Labs-master\lab-12-mybatis\lab-12-mybatis-plus\src\main\java\cn\iocoder\springboot\lab12\mybatis\dataobject\UserDO.java | 1 |
请完成以下Java代码 | public Long getProductId() {
return productId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
public BigDecimal getFlashPromotionPrice() {
return flashPromotionPrice;
}
public void setFlashPromotionPrice(BigDecimal flashPromotionPrice) {
this.flashPromotionPrice = flashPromotionPrice;
}
public Integer getFlashPromotionCount() {
return flashPromotionCount;
}
public void setFlashPromotionCount(Integer flashPromotionCount) {
this.flashPromotionCount = flashPromotionCount;
}
public Integer getFlashPromotionLimit() {
return flashPromotionLimit;
}
public void setFlashPromotionLimit(Integer flashPromotionLimit) {
this.flashPromotionLimit = flashPromotionLimit;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
} | @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", flashPromotionId=").append(flashPromotionId);
sb.append(", flashPromotionSessionId=").append(flashPromotionSessionId);
sb.append(", productId=").append(productId);
sb.append(", flashPromotionPrice=").append(flashPromotionPrice);
sb.append(", flashPromotionCount=").append(flashPromotionCount);
sb.append(", flashPromotionLimit=").append(flashPromotionLimit);
sb.append(", sort=").append(sort);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
} | repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\SmsFlashPromotionProductRelation.java | 1 |
请完成以下Java代码 | public boolean lUpdateIndex(String key, long index, Object value) {
try {
redisTemplate.opsForList().set(key, index, value);
return true;
} catch (Exception e) {
log.error(e.getMessage(), e);
return false;
}
}
/**
* 移除N个值为value
*
* @param key 键
* @param count 移除多少个
* @param value 值
* @return 移除的个数
*/
public long lRemove(String key, long count, Object value) {
try {
return redisTemplate.opsForList().remove(key, count, value);
} catch (Exception e) {
log.error(e.getMessage(), e);
return 0;
}
}
/**
* @param prefix 前缀
* @param ids id
*/
public void delByKeys(String prefix, Set<Long> ids) {
Set<Object> keys = new HashSet<>();
for (Long id : ids) {
keys.addAll(redisTemplate.keys(new StringBuffer(prefix).append(id).toString()));
}
long count = redisTemplate.delete(keys); | }
// ============================incr=============================
/**
* 递增
* @param key
* @return
*/
public Long increment(String key) {
return redisTemplate.opsForValue().increment(key);
}
/**
* 递减
* @param key
* @return
*/
public Long decrement(String key) {
return redisTemplate.opsForValue().decrement(key);
}
} | repos\eladmin-master\eladmin-common\src\main\java\me\zhengjie\utils\RedisUtils.java | 1 |
请完成以下Java代码 | public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getState() {
return this.state;
} | public void setState(String state) {
this.state = state;
}
public String getCountry() {
return this.country;
}
public void setCountry(String country) {
this.country = country;
}
@Override
public String toString() {
return getId() + "," + getName() + "," + getState() + "," + getCountry();
}
} | repos\pagehelper-spring-boot-master\pagehelper-spring-boot-samples\pagehelper-spring-boot-sample-xml\src\main\java\tk\mybatis\pagehelper\domain\City.java | 1 |
请完成以下Java代码 | public void setName(String name) {
this.name = name;
}
public String getExtension() {
return extension;
}
public void setExtension(String extension) {
this.extension = extension;
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public byte[] getContent() { | return content;
}
public void setContent(byte[] content) {
this.content = content;
}
public String getFileInfo() {
return "Generic File Impl";
}
public Object read() {
return content;
}
} | repos\tutorials-master\core-java-modules\core-java-lang-oop-inheritance-2\src\main\java\com\baeldung\polymorphism\GenericFile.java | 1 |
请完成以下Java代码 | /* package */class HUItemProductStorage implements IProductStorage
{
private final IHUItemStorage itemStorage;
private final ProductId productId;
private final I_C_UOM uom;
private final ZonedDateTime date;
public HUItemProductStorage(
@NonNull final IHUItemStorage itemStorage,
@NonNull final ProductId productId,
@NonNull final I_C_UOM uom,
@NonNull final ZonedDateTime date)
{
this.itemStorage = itemStorage;
this.productId = productId;
this.uom = uom;
this.date = date;
}
@Override
public String toString()
{
return getClass().getSimpleName() + "["
+ "\nProduct: " + productId
+ "\nQty: " + getQty()
+ "\nCapacity: " + getTotalCapacity()
+ "\nItem storage: " + itemStorage
+ "]";
}
public Capacity getTotalCapacity()
{
return itemStorage.getCapacity(productId, uom, date);
}
@Override
public ProductId getProductId()
{
return productId;
}
@Override
public I_C_UOM getC_UOM()
{
return uom;
}
@Override
public BigDecimal getQtyFree()
{
final Capacity capacityAvailable = itemStorage.getAvailableCapacity(getProductId(), getC_UOM(), date);
if (capacityAvailable.isInfiniteCapacity())
{
return Quantity.QTY_INFINITE;
}
return capacityAvailable.toBigDecimal();
}
@Override
public Quantity getQty()
{
return itemStorage.getQuantity(getProductId(), getC_UOM());
}
@Override
public final Quantity getQty(final I_C_UOM uom) | {
final ProductId productId = getProductId();
final Quantity qty = getQty();
final IUOMConversionBL uomConversionBL = Services.get(IUOMConversionBL.class);
final UOMConversionContext conversionCtx= UOMConversionContext.of(productId);
return uomConversionBL.convertQuantityTo(qty, conversionCtx, uom);
}
@Override
public BigDecimal getQtyCapacity()
{
final Capacity capacityTotal = getTotalCapacity();
return capacityTotal.toBigDecimal();
}
@Override
public IAllocationRequest addQty(final IAllocationRequest request)
{
return itemStorage.requestQtyToAllocate(request);
}
@Override
public IAllocationRequest removeQty(final IAllocationRequest request)
{
return itemStorage.requestQtyToDeallocate(request);
}
@Override
public void markStaled()
{
// nothing, so far, itemStorage is always database coupled, no in memory values
}
@Override
public boolean isEmpty()
{
return itemStorage.isEmpty(getProductId());
}
@Override
public boolean isAllowNegativeStorage()
{
return itemStorage.isAllowNegativeStorage();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\storage\impl\HUItemProductStorage.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class EmployeeJDBCRepository {
@Autowired
JdbcTemplate jdbcTemplate;
class EmployeeRowMapper implements RowMapper < Employee > {
@Override
public Employee mapRow(ResultSet rs, int rowNum) throws SQLException {
Employee employee = new Employee();
employee.setId(rs.getLong("id"));
employee.setFirstName(rs.getString("first_name"));
employee.setLastName(rs.getString("last_name"));
employee.setEmailId(rs.getString("email_address"));
return employee;
}
}
public List < Employee > findAll() {
return jdbcTemplate.query("select * from employees", new EmployeeRowMapper());
}
public Optional < Employee > findById(long id) {
return Optional.of(jdbcTemplate.queryForObject("select * from employees where id=?", new Object[] {
id
},
new BeanPropertyRowMapper < Employee > (Employee.class)));
} | public int deleteById(long id) {
return jdbcTemplate.update("delete from employees where id=?", new Object[] {
id
});
}
public int insert(Employee employee) {
return jdbcTemplate.update("insert into employees (id, first_name, last_name, email_address) " + "values(?, ?, ?, ?)",
new Object[] {
employee.getId(), employee.getFirstName(), employee.getLastName(), employee.getEmailId()
});
}
public int update(Employee employee) {
return jdbcTemplate.update("update employees " + " set first_name = ?, last_name = ?, email_address = ? " + " where id = ?",
new Object[] {
employee.getFirstName(), employee.getLastName(), employee.getEmailId(), employee.getId()
});
}
} | repos\Spring-Boot-Advanced-Projects-main\springboot2-jdbc-crud-mysql-example\src\main\java\net\alanbinu\springboot2\jdbc\repository\EmployeeJDBCRepository.java | 2 |
请完成以下Java代码 | private Predicate<String> isNameMatch(@Nullable String name) {
return (name != null) ? ((requested) -> requested.equals(name)) : matchAll();
}
private Predicate<String> matchAll() {
return (name) -> true;
}
/**
* Description of the caches.
*/
public static final class CachesDescriptor implements OperationResponseBody {
private final Map<String, CacheManagerDescriptor> cacheManagers;
public CachesDescriptor(Map<String, CacheManagerDescriptor> cacheManagers) {
this.cacheManagers = cacheManagers;
}
public Map<String, CacheManagerDescriptor> getCacheManagers() {
return this.cacheManagers;
}
}
/**
* Description of a {@link CacheManager}.
*/
public static final class CacheManagerDescriptor {
private final Map<String, CacheDescriptor> caches;
public CacheManagerDescriptor(Map<String, CacheDescriptor> caches) {
this.caches = caches;
}
public Map<String, CacheDescriptor> getCaches() {
return this.caches;
}
}
/**
* Description of a {@link Cache}.
*/
public static class CacheDescriptor implements OperationResponseBody {
private final String target;
public CacheDescriptor(String target) {
this.target = target;
}
/**
* Return the fully qualified name of the native cache.
* @return the fully qualified name of the native cache
*/ | public String getTarget() {
return this.target;
}
}
/**
* Description of a {@link Cache} entry.
*/
public static final class CacheEntryDescriptor extends CacheDescriptor {
private final String name;
private final String cacheManager;
public CacheEntryDescriptor(Cache cache, String cacheManager) {
super(cache.getNativeCache().getClass().getName());
this.name = cache.getName();
this.cacheManager = cacheManager;
}
public String getName() {
return this.name;
}
public String getCacheManager() {
return this.cacheManager;
}
}
} | repos\spring-boot-4.0.1\module\spring-boot-cache\src\main\java\org\springframework\boot\cache\actuate\endpoint\CachesEndpoint.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public void setStoreAddressCode(String storeAddressCode) {
this.storeAddressCode = storeAddressCode;
}
public String getStoreStreet() {
return storeStreet;
}
public void setStoreStreet(String storeStreet) {
this.storeStreet = storeStreet;
}
public String getStoreEntrancePic() {
return storeEntrancePic;
}
public void setStoreEntrancePic(String storeEntrancePic) {
this.storeEntrancePic = storeEntrancePic;
}
public String getIndoorPic() {
return indoorPic;
}
public void setIndoorPic(String indoorPic) {
this.indoorPic = indoorPic;
}
public String getMerchantShortname() {
return merchantShortname;
}
public void setMerchantShortname(String merchantShortname) {
this.merchantShortname = merchantShortname;
}
public String getServicePhone() {
return servicePhone;
}
public void setServicePhone(String servicePhone) {
this.servicePhone = servicePhone;
}
public String getProductDesc() {
return productDesc;
}
public void setProductDesc(String productDesc) {
this.productDesc = productDesc;
}
public String getRate() {
return rate;
}
public void setRate(String rate) {
this.rate = rate; | }
public String getContactPhone() {
return contactPhone;
}
public void setContactPhone(String contactPhone) {
this.contactPhone = contactPhone;
}
@Override
public String toString() {
return "RpMicroSubmitRecord{" +
"businessCode='" + businessCode + '\'' +
", subMchId='" + subMchId + '\'' +
", idCardCopy='" + idCardCopy + '\'' +
", idCardNational='" + idCardNational + '\'' +
", idCardName='" + idCardName + '\'' +
", idCardNumber='" + idCardNumber + '\'' +
", idCardValidTime='" + idCardValidTime + '\'' +
", accountBank='" + accountBank + '\'' +
", bankAddressCode='" + bankAddressCode + '\'' +
", accountNumber='" + accountNumber + '\'' +
", storeName='" + storeName + '\'' +
", storeAddressCode='" + storeAddressCode + '\'' +
", storeStreet='" + storeStreet + '\'' +
", storeEntrancePic='" + storeEntrancePic + '\'' +
", indoorPic='" + indoorPic + '\'' +
", merchantShortname='" + merchantShortname + '\'' +
", servicePhone='" + servicePhone + '\'' +
", productDesc='" + productDesc + '\'' +
", rate='" + rate + '\'' +
", contactPhone='" + contactPhone + '\'' +
", idCardValidTimeBegin='" + idCardValidTimeBegin + '\'' +
", idCardValidTimeEnd='" + idCardValidTimeEnd + '\'' +
'}';
}
} | repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\trade\entity\RpMicroSubmitRecord.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public class ConsumerSessionAwareMessageListener implements MessageListener {
private static final Log log = LogFactory.getLog(ConsumerSessionAwareMessageListener.class);
@Autowired
private NotifyQueue notifyQueue;
@Autowired
private RpNotifyService rpNotifyService;
@Autowired
private NotifyPersist notifyPersist;
@Override
public void onMessage(Message message) {
try {
ActiveMQTextMessage msg = (ActiveMQTextMessage) message;
final String ms = msg.getText();
log.info("== receive message:" + ms);
JSON json = (JSON) JSONObject.parse(ms);
RpNotifyRecord notifyRecord = JSONObject.toJavaObject(json, RpNotifyRecord.class);
if (notifyRecord == null) {
return;
}
// log.info("notifyParam:" + notifyParam);
notifyRecord.setStatus(NotifyStatusEnum.CREATED.name());
notifyRecord.setCreateTime(new Date());
notifyRecord.setLastNotifyTime(new Date());
if (!StringUtil.isEmpty(notifyRecord.getId())) {
RpNotifyRecord notifyRecordById = rpNotifyService.getNotifyRecordById(notifyRecord.getId()); | if (notifyRecordById != null) {
return;
}
}
while (rpNotifyService == null) {
Thread.currentThread().sleep(1000); // 主动休眠,防止类Spring 未加载完成,监听服务就开启监听出现空指针异常
}
try {
// 将获取到的通知先保存到数据库中
notifyPersist.saveNotifyRecord(notifyRecord);
notifyRecord = rpNotifyService.getNotifyByMerchantNoAndMerchantOrderNoAndNotifyType(notifyRecord.getMerchantNo(), notifyRecord.getMerchantOrderNo(), notifyRecord.getNotifyType());
// 添加到通知队列
notifyQueue.addElementToList(notifyRecord);
} catch (BizException e) {
log.error("BizException :", e);
} catch (Exception e) {
log.error(e);
}
} catch (Exception e) {
e.printStackTrace();
log.error(e);
}
}
} | repos\roncoo-pay-master\roncoo-pay-app-notify\src\main\java\com\roncoo\pay\app\notify\message\ConsumerSessionAwareMessageListener.java | 2 |
请在Spring Boot框架中完成以下Java代码 | private static class CampaignPricePage
{
public static CampaignPricePage of(final List<CampaignPrice> prices)
{
if (prices.isEmpty())
{
return EMPTY;
}
else
{
return new CampaignPricePage(prices);
}
}
private static final CampaignPricePage EMPTY = new CampaignPricePage();
private final ImmutableListMultimap<BPartnerId, CampaignPrice> bpartnerPrices;
private final ImmutableListMultimap<BPGroupId, CampaignPrice> bpGroupPrices;
private final ImmutableListMultimap<PricingSystemId, CampaignPrice> pricingSystemPrices;
private CampaignPricePage(final List<CampaignPrice> prices)
{
bpartnerPrices = prices.stream()
.filter(price -> price.getBpartnerId() != null)
.sorted(Comparator.comparing(CampaignPrice::getValidFrom))
.collect(GuavaCollectors.toImmutableListMultimap(CampaignPrice::getBpartnerId));
bpGroupPrices = prices.stream()
.filter(price -> price.getBpGroupId() != null)
.sorted(Comparator.comparing(CampaignPrice::getValidFrom))
.collect(GuavaCollectors.toImmutableListMultimap(CampaignPrice::getBpGroupId));
pricingSystemPrices = prices.stream()
.filter(price -> price.getPricingSystemId() != null)
.sorted(Comparator.comparing(CampaignPrice::getValidFrom))
.collect(GuavaCollectors.toImmutableListMultimap(CampaignPrice::getPricingSystemId));
} | private CampaignPricePage()
{
bpartnerPrices = ImmutableListMultimap.of();
bpGroupPrices = ImmutableListMultimap.of();
pricingSystemPrices = ImmutableListMultimap.of();
}
public Optional<CampaignPrice> findPrice(@NonNull final CampaignPriceQuery query)
{
Optional<CampaignPrice> result = findPrice(bpartnerPrices.get(query.getBpartnerId()), query);
if (result.isPresent())
{
return result;
}
result = findPrice(bpGroupPrices.get(query.getBpGroupId()), query);
if (result.isPresent()) {
return result;
}
return findPrice(pricingSystemPrices.get(query.getPricingSystemId()), query);
}
private static Optional<CampaignPrice> findPrice(@NonNull final Collection<CampaignPrice> prices, @NonNull final CampaignPriceQuery query)
{
return prices.stream()
.filter(query::isMatching)
.findFirst();
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\pricing\rules\campaign_price\CampaignPriceRepository.java | 2 |
请完成以下Java代码 | protected void prepare()
{
final ProcessInfoParameter[] para = getParametersAsArray();
for (int i = 0; i < para.length; i++)
{
final String name = para[i].getParameterName();
if (para[i].getParameter() == null)
{
;
}
else if (name.equals("C_BPartner_ID"))
{
p_C_BPartner_ID = BPartnerId.ofRepoId(para[i].getParameterAsInt());
}
else
{
log.error("Unknown Parameter: {}", name);
}
}
} // prepare
@Override
protected String doIt()
{
if (p_C_BPartner_ID != null) | {
throw new FillMandatoryException("C_BPartner_ID");
}
final I_C_BPartner bp = bpartnersRepo.getByIdInTrx(p_C_BPartner_ID);
//
if (bp.getAD_OrgBP_ID() <= 0)
{
throw new IllegalArgumentException("Business Partner not linked to an Organization");
}
bp.setAD_OrgBP_ID(-1);
bpartnersRepo.save(bp);
return MSG_OK;
} // doIt
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\process\BPartnerOrgUnLink.java | 1 |
请完成以下Java代码 | public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((age == null) ? 0 : age.hashCode());
result = prime * result + ((countries == null) ? 0 : countries.hashCode());
result = prime * result + ((gender == null) ? 0 : gender.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
NameAnalysisEntity other = (NameAnalysisEntity) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (age == null) {
if (other.age != null) | return false;
} else if (!age.equals(other.age))
return false;
if (countries == null) {
if (other.countries != null)
return false;
} else if (!countries.equals(other.countries))
return false;
if (gender == null) {
if (other.gender != null)
return false;
} else if (!gender.equals(other.gender))
return false;
return true;
}
@Override
public String toString() {
return "NameAnalysisEntity [name=" + name + ", age=" + age + ", countries=" + countries + ", gender=" + gender + "]";
}
} | repos\tutorials-master\spring-web-modules\spring-thymeleaf-attributes\accessing-session-attributes\src\main\java\com\baeldung\accesing_session_attributes\business\entities\NameAnalysisEntity.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class PmsRoleServiceImpl implements PmsRoleService {
@Autowired
private PmsRoleDao pmsRoleDao;
/**
* 创建pmsOperator
*/
public void saveData(PmsRole pmsRole) {
pmsRoleDao.insert(pmsRole);
}
/**
* 修改pmsOperator
*/
public void updateData(PmsRole pmsRole) {
pmsRoleDao.update(pmsRole);
}
/**
* 根据id获取数据pmsOperator
*
* @param id
* @return
*/
public PmsRole getDataById(Long id) {
return pmsRoleDao.getById(id);
}
/**
* 分页查询pmsOperator
*
* @param pageParam
* @param ActivityVo
* PmsOperator
* @return
*/
public PageBean listPage(PageParam pageParam, PmsRole pmsRole) {
Map<String, Object> paramMap = new HashMap<String, Object>(); // 业务条件查询参数
paramMap.put("roleName", pmsRole.getRoleName()); // 角色名称(模糊查询)
return pmsRoleDao.listPage(pageParam, paramMap);
}
/**
* 获取所有角色列表,以供添加操作员时选择.
*
* @return roleList .
*/
public List<PmsRole> listAllRole() {
return pmsRoleDao.listAll(); | }
/**
* 判断此权限是否关联有角色
*
* @param permissionId
* @return
*/
public List<PmsRole> listByPermissionId(Long permissionId) {
return pmsRoleDao.listByPermissionId(permissionId);
}
/**
* 根据角色名或者角色编号查询角色
*
* @param roleName
* @param roleCode
* @return
*/
public PmsRole getByRoleNameOrRoleCode(String roleName, String roleCode) {
return pmsRoleDao.getByRoleNameOrRoleCode(roleName, roleCode);
}
/**
* 删除
*
* @param roleId
*/
public void delete(Long roleId) {
pmsRoleDao.delete(roleId);
}
} | repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\permission\service\impl\PmsRoleServiceImpl.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public String getCacheKey(Long id) {
return String.valueOf(id);
}
@CacheResult(cacheKeyMethod = "getCacheKey")
@HystrixCommand(fallbackMethod = "getUserDefault", commandKey = "getUserById", groupKey = "userGroup",
threadPoolKey = "getUserThread")
public User getUser(Long id) {
log.info("获取用户信息");
return restTemplate.getForObject("http://Server-Provider/user/{id}", User.class, id);
}
@HystrixCommand(fallbackMethod = "getUserDefault2")
public User getUserDefault(Long id) {
String a = null;
// 测试服务降级
a.toString();
User user = new User();
user.setId(-1L);
user.setUsername("defaultUser");
user.setPassword("123456");
return user;
}
public User getUserDefault2(Long id, Throwable e) {
System.out.println(e.getMessage());
User user = new User();
user.setId(-2L);
user.setUsername("defaultUser2");
user.setPassword("123456"); | return user;
}
public List<User> getUsers() {
return this.restTemplate.getForObject("http://Server-Provider/user", List.class);
}
public String addUser() {
User user = new User(1L, "mrbird", "123456");
HttpStatus status = this.restTemplate.postForEntity("http://Server-Provider/user", user, null).getStatusCode();
if (status.is2xxSuccessful()) {
return "新增用户成功";
} else {
return "新增用户失败";
}
}
@CacheRemove(commandKey = "getUserById")
@HystrixCommand
public void updateUser(@CacheKey("id") User user) {
this.restTemplate.put("http://Server-Provider/user", user);
}
public void deleteUser(@PathVariable Long id) {
this.restTemplate.delete("http://Server-Provider/user/{1}", id);
}
} | repos\SpringAll-master\30.Spring-Cloud-Hystrix-Circuit-Breaker\Ribbon-Consumer\src\main\java\com\example\demo\Service\UserService.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public BrandEntity getBrandEntity() {
return brandEntity;
}
public void setBrandEntity(BrandEntity brandEntity) {
this.brandEntity = brandEntity;
}
public ProdStateEnum getProdStateEnum() {
return prodStateEnum;
}
public void setProdStateEnum(ProdStateEnum prodStateEnum) {
this.prodStateEnum = prodStateEnum;
}
public List<ProdImageEntity> getProdImageEntityList() {
return prodImageEntityList;
}
public void setProdImageEntityList(List<ProdImageEntity> prodImageEntityList) {
this.prodImageEntityList = prodImageEntityList;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public UserEntity getCompanyEntity() {
return companyEntity;
}
public void setCompanyEntity(UserEntity companyEntity) {
this.companyEntity = companyEntity; | }
public int getSales() {
return sales;
}
public void setSales(int sales) {
this.sales = sales;
}
@Override
public String toString() {
return "ProductEntity{" +
"id='" + id + '\'' +
", prodName='" + prodName + '\'' +
", marketPrice='" + marketPrice + '\'' +
", shopPrice='" + shopPrice + '\'' +
", stock=" + stock +
", sales=" + sales +
", weight='" + weight + '\'' +
", topCateEntity=" + topCateEntity +
", subCategEntity=" + subCategEntity +
", brandEntity=" + brandEntity +
", prodStateEnum=" + prodStateEnum +
", prodImageEntityList=" + prodImageEntityList +
", content='" + content + '\'' +
", companyEntity=" + companyEntity +
'}';
}
} | repos\SpringBoot-Dubbo-Docker-Jenkins-master\Gaoxi-Common-Service-Facade\src\main\java\com\gaoxi\entity\product\ProductEntity.java | 2 |
请完成以下Java代码 | public String resolveStringValue(String value) {
return value;
}
});
this.registry = registry;
this.proxyTargetClass = proxyTargetClass;
this.scope = scope;
this.scoped = scoped;
}
@Override
protected Object resolveValue(Object value) {
BeanDefinition definition = null;
String beanName = null;
if (value instanceof BeanDefinition) {
definition = (BeanDefinition) value;
beanName = BeanDefinitionReaderUtils.generateBeanName(definition, registry);
} else if (value instanceof BeanDefinitionHolder) {
BeanDefinitionHolder holder = (BeanDefinitionHolder) value; | definition = holder.getBeanDefinition();
beanName = holder.getBeanName();
}
if (definition != null) {
boolean nestedScoped = scope.equals(definition.getScope());
boolean scopeChangeRequiresProxy = !scoped && nestedScoped;
if (scopeChangeRequiresProxy) {
// Exit here so that nested inner bean definitions are not
// analysed
return createScopedProxy(beanName, definition, registry, proxyTargetClass);
}
}
// Nested inner bean definitions are recursively analysed here
value = super.resolveValue(value);
return value;
}
} | repos\camunda-bpm-platform-master\engine-spring\core\src\main\java\org\camunda\bpm\engine\spring\components\aop\util\Scopifier.java | 1 |
请完成以下Java代码 | public java.sql.Timestamp getMovementDate ()
{
return (java.sql.Timestamp)get_Value(COLUMNNAME_MovementDate);
}
/** Set Ausgelagerte Menge.
@param QtyIssued Ausgelagerte Menge */
@Override
public void setQtyIssued (java.math.BigDecimal QtyIssued)
{
set_Value (COLUMNNAME_QtyIssued, QtyIssued);
}
/** Get Ausgelagerte Menge.
@return Ausgelagerte Menge */
@Override
public java.math.BigDecimal getQtyIssued ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyIssued);
if (bd == null)
return BigDecimal.ZERO;
return bd;
}
/** Set Empfangene Menge.
@param QtyReceived Empfangene Menge */
@Override
public void setQtyReceived (java.math.BigDecimal QtyReceived)
{
throw new IllegalArgumentException ("QtyReceived is virtual column"); }
/** Get Empfangene Menge.
@return Empfangene Menge */
@Override
public java.math.BigDecimal getQtyReceived ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyReceived);
if (bd == null)
return BigDecimal.ZERO;
return bd;
}
/** Set Datensatz-ID.
@param Record_ID | Direct internal record ID
*/
@Override
public void setRecord_ID (int Record_ID)
{
if (Record_ID < 0)
set_Value (COLUMNNAME_Record_ID, null);
else
set_Value (COLUMNNAME_Record_ID, Integer.valueOf(Record_ID));
}
/** Get Datensatz-ID.
@return Direct internal record ID
*/
@Override
public int getRecord_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Record_ID);
if (ii == null)
return 0;
return ii.intValue();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.materialtracking\src\main\java-gen\de\metas\materialtracking\model\X_M_Material_Tracking_Ref.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class JsonPrintHULabelResponse
{
List<JsonPrintDataItem> printData;
//
//
//
@Value
@Builder
public static class JsonPrintDataItem
{
@NonNull String printerName;
@NonNull String printerURI;
@NonNull String filename;
@Nullable String dataBase64Encoded; | public static List<JsonPrintDataItem> of(final FrontendPrinterData data)
{
return data.getItems().stream()
.map(JsonPrintDataItem::of)
.collect(ImmutableList.toImmutableList());
}
public static JsonPrintDataItem of(final FrontendPrinterDataItem item)
{
return builder()
.printerName(item.getPrinterName())
.printerURI(item.getPrinterURI().toString())
.filename(item.getFilename())
.dataBase64Encoded(item.getDataBase64Encoded())
.build();
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.mobileui\src\main\java\de\metas\handlingunits\rest_api\JsonPrintHULabelResponse.java | 2 |
请完成以下Java代码 | public class C_Order_CreateCompensationGroup extends OrderCompensationGroupProcess
{
@Param(parameterName = I_M_Product.COLUMNNAME_M_Product_ID, mandatory = true)
private int compensationProductId;
@Param(parameterName = I_M_Product_Category.COLUMNNAME_M_Product_Category_ID)
private I_M_Product_Category productCategory;
@Param(parameterName = "Name")
private String groupName;
@Override
public ProcessPreconditionsResolution checkPreconditionsApplicable(final @NonNull IProcessPreconditionsContext context)
{
return acceptIfEligibleOrder(context)
.and(() -> acceptIfOrderLinesNotInGroup(context));
}
@Override
protected String doIt()
{
groupsRepo.prepareNewGroup()
.groupTemplate(createNewGroupTemplate())
.createGroup(getSelectedOrderLineIds());
return MSG_OK;
}
private GroupTemplate createNewGroupTemplate()
{
String groupNameEffective = this.groupName;
if (Check.isEmpty(groupNameEffective, true) && productCategory != null)
{ | groupNameEffective = productCategory.getName();
}
if (Check.isEmpty(groupNameEffective, true))
{
throw new FillMandatoryException("Name");
}
return GroupTemplate.builder()
.name(groupNameEffective)
.productCategoryId(productCategory != null ? ProductCategoryId.ofRepoId(productCategory.getM_Product_Category_ID()) : null)
.compensationLine(GroupTemplateCompensationLine.ofProductId(ProductId.ofRepoId(compensationProductId)))
.regularLinesToAdd(ImmutableList.of())
.build();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\order\process\C_Order_CreateCompensationGroup.java | 1 |
请完成以下Java代码 | static String exists (int AD_Table_ID, int Record_ID, String trxName)
{
// Table Loop only
for (int i = 0; i < s_restrictNames.length; i++)
{
// SELECT COUNT(*) FROM table WHERE AD_Table_ID=#1 AND Record_ID=#2
final StringBuilder sql = new StringBuilder("SELECT COUNT(*) FROM ")
.append(s_restrictNames[i])
.append(" WHERE AD_Table_ID=? AND Record_ID=?");
final int no = DB.getSQLValue(trxName, sql.toString(), AD_Table_ID, Record_ID);
if (no > 0)
{
return s_restrictNames[i];
}
}
return null;
} // exists
/**
* Validate all tables for AD_Table/Record_ID relationships
*/
static void validate ()
{
String sql = "SELECT AD_Table_ID, TableName FROM AD_Table WHERE IsView='N' ORDER BY TableName";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement (sql, null);
rs = pstmt.executeQuery ();
while (rs.next ())
{
validate (rs.getInt(1), rs.getString(2));
}
}
catch (Exception e)
{
log.error(sql, e);
}
finally {
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
} // validate
/** | * Validate all tables for AD_Table/Record_ID relationships
* @param AD_Table_ID table
*/
static void validate (int AD_Table_ID)
{
MTable table = new MTable(Env.getCtx(), AD_Table_ID, null);
if (table.isView())
{
log.warn("Ignored - View " + table.getTableName());
}
else
{
validate (table.getAD_Table_ID(), table.getTableName());
}
} // validate
/**
* Validate Table for Table/Record
* @param AD_Table_ID table
* @param TableName Name
*/
static private void validate (int AD_Table_ID, String TableName)
{
for (int i = 0; i < s_cascades.length; i++)
{
final StringBuilder sql = new StringBuilder("DELETE FROM ")
.append(s_cascadeNames[i])
.append(" WHERE AD_Table_ID=").append(AD_Table_ID)
.append(" AND Record_ID NOT IN (SELECT ")
.append(TableName).append("_ID FROM ").append(TableName).append(")");
int no = DB.executeUpdateAndSaveErrorOnFail(sql.toString(), null);
if (no > 0)
{
log.info(s_cascadeNames[i] + " (" + AD_Table_ID + "/" + TableName
+ ") Invalid #" + no);
}
}
} // validate
} // PO_Record | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\PO_Record.java | 1 |
请在Spring Boot框架中完成以下Java代码 | class CustomerConfig {
@Bean
PlatformTransactionManager customerTransactionManager() {
return new JpaTransactionManager(customerEntityManagerFactory().getObject());
}
@Bean
LocalContainerEntityManagerFactoryBean customerEntityManagerFactory() {
var jpaVendorAdapter = new HibernateJpaVendorAdapter();
jpaVendorAdapter.setGenerateDdl(true);
var factoryBean = new LocalContainerEntityManagerFactoryBean(); | factoryBean.setDataSource(customerDataSource());
factoryBean.setJpaVendorAdapter(jpaVendorAdapter);
factoryBean.setPackagesToScan(CustomerConfig.class.getPackage().getName());
return factoryBean;
}
@Bean
DataSource customerDataSource() {
return new EmbeddedDatabaseBuilder().//
setType(EmbeddedDatabaseType.HSQL).//
setName("customers").//
build();
}
} | repos\spring-data-examples-main\jpa\multiple-datasources\src\main\java\example\springdata\jpa\multipleds\customer\CustomerConfig.java | 2 |
请完成以下Java代码 | public class MicrometerConsumerListener<K, V> extends KafkaMetricsSupport<Consumer<K, V>>
implements ConsumerFactory.Listener<K, V> {
/**
* Construct an instance with the provided registry.
* @param meterRegistry the registry.
*/
public MicrometerConsumerListener(MeterRegistry meterRegistry) {
this(meterRegistry, Collections.emptyList());
}
/**
* Construct an instance with the provided registry and task scheduler.
* @param meterRegistry the registry.
* @param taskScheduler the task scheduler.
* @since 3.3
*/
public MicrometerConsumerListener(MeterRegistry meterRegistry, TaskScheduler taskScheduler) {
this(meterRegistry, Collections.emptyList(), taskScheduler);
}
/**
* Construct an instance with the provided registry and tags.
* @param meterRegistry the registry.
* @param tags the tags.
*/
public MicrometerConsumerListener(MeterRegistry meterRegistry, List<Tag> tags) {
super(meterRegistry, tags); | }
/**
* Construct an instance with the provided registry, tags and task scheduler.
* @param meterRegistry the registry.
* @param tags the tags.
* @param taskScheduler the task scheduler.
* @since 3.3
*/
public MicrometerConsumerListener(MeterRegistry meterRegistry, List<Tag> tags, TaskScheduler taskScheduler) {
super(meterRegistry, tags, taskScheduler);
}
@Override
public synchronized void consumerAdded(String id, Consumer<K, V> consumer) {
bindClient(id, consumer);
}
@Override
public synchronized void consumerRemoved(@Nullable String id, Consumer<K, V> consumer) {
unbindClient(id, consumer);
}
} | repos\spring-kafka-main\spring-kafka\src\main\java\org\springframework\kafka\core\MicrometerConsumerListener.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getOrderIp() {
return orderIp;
}
public void setOrderIp(String orderIp) {
this.orderIp = orderIp;
}
public String getField1() {
return field1;
}
public void setField1(String field1) {
this.field1 = field1;
}
public String getField2() {
return field2;
}
public void setField2(String field2) {
this.field2 = field2;
}
public String getField3() {
return field3; | }
public void setField3(String field3) {
this.field3 = field3;
}
public String getField4() {
return field4;
}
public void setField4(String field4) {
this.field4 = field4;
}
public String getField5() {
return field5;
}
public void setField5(String field5) {
this.field5 = field5;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
} | repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\trade\vo\F2FPayResultVo.java | 2 |
请完成以下Java代码 | public int getM_Product_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Preis.
@param Price
Price
*/
@Override
public void setPrice (java.math.BigDecimal Price)
{
set_ValueNoCheck (COLUMNNAME_Price, Price);
}
/** Get Preis.
@return Price
*/
@Override
public java.math.BigDecimal getPrice ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Price);
if (bd == null)
return BigDecimal.ZERO;
return bd;
}
/** Set Menge.
@param Qty
Quantity
*/
@Override
public void setQty (java.math.BigDecimal Qty)
{
set_ValueNoCheck (COLUMNNAME_Qty, Qty);
}
/** Get Menge.
@return Quantity
*/
@Override
public java.math.BigDecimal getQty ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Qty);
if (bd == null)
return BigDecimal.ZERO;
return bd;
}
/** Set Quantity Price.
@param QtyPrice Quantity Price */
@Override
public void setQtyPrice (java.math.BigDecimal QtyPrice)
{ | set_ValueNoCheck (COLUMNNAME_QtyPrice, QtyPrice);
}
/** Get Quantity Price.
@return Quantity Price */
@Override
public java.math.BigDecimal getQtyPrice ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyPrice);
if (bd == null)
return BigDecimal.ZERO;
return bd;
}
/** Set Quantity Ranking.
@param QtyRanking Quantity Ranking */
@Override
public void setQtyRanking (int QtyRanking)
{
set_ValueNoCheck (COLUMNNAME_QtyRanking, Integer.valueOf(QtyRanking));
}
/** Get Quantity Ranking.
@return Quantity Ranking */
@Override
public int getQtyRanking ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_QtyRanking);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Ranking.
@param Ranking
Relative Rank Number
*/
@Override
public void setRanking (int Ranking)
{
set_ValueNoCheck (COLUMNNAME_Ranking, Integer.valueOf(Ranking));
}
/** Get Ranking.
@return Relative Rank Number
*/
@Override
public int getRanking ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Ranking);
if (ii == null)
return 0;
return ii.intValue();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.rfq\src\main\java-gen\de\metas\rfq\model\X_RV_C_RfQResponse.java | 1 |
请完成以下Java代码 | public final class AuthenticationMethod implements Serializable {
private static final long serialVersionUID = 620L;
public static final AuthenticationMethod HEADER = new AuthenticationMethod("header");
public static final AuthenticationMethod FORM = new AuthenticationMethod("form");
public static final AuthenticationMethod QUERY = new AuthenticationMethod("query");
private final String value;
/**
* Constructs an {@code AuthenticationMethod} using the provided value.
* @param value the value of the authentication method type
*/
public AuthenticationMethod(String value) {
Assert.hasText(value, "value cannot be empty");
this.value = value;
}
/**
* Returns the value of the authentication method type.
* @return the value of the authentication method type
*/
public String getValue() {
return this.value;
}
@Override | public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || this.getClass() != obj.getClass()) {
return false;
}
AuthenticationMethod that = (AuthenticationMethod) obj;
return this.getValue().equals(that.getValue());
}
@Override
public int hashCode() {
return this.getValue().hashCode();
}
} | repos\spring-security-main\oauth2\oauth2-core\src\main\java\org\springframework\security\oauth2\core\AuthenticationMethod.java | 1 |
请完成以下Java代码 | private @NonNull Set<PurchaseCandidateId> getPurchaseCandidateIds(final @NonNull SupplyRequiredDecreasedEvent event)
{
final Candidate demandCandidate = candidateRepositoryRetrieval.retrieveById(CandidateId.ofRepoId(event.getSupplyRequiredDescriptor().getDemandCandidateId()));
return candidateRepositoryWriteService.getSupplyCandidatesForDemand(demandCandidate, CandidateBusinessCase.PURCHASE)
.stream()
.map(PurchaseCandidateAdvisedEventCreator::getPurchaseCandidateRepoIdOrNull)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
}
@Nullable
private static PurchaseCandidateId getPurchaseCandidateRepoIdOrNull(final Candidate candidate)
{
final PurchaseDetail purchaseDetail = PurchaseDetail.castOrNull(candidate.getBusinessCaseDetail());
if (purchaseDetail == null)
{
return null;
}
return PurchaseCandidateId.ofRepoIdOrNull(purchaseDetail.getPurchaseCandidateRepoId());
}
private Quantity doDecreaseQty(final PurchaseCandidate candidate, final Quantity remainingQtyToDistribute)
{
if (isCandidateEligibleForBeingDecreased(candidate)) | {
final Quantity qtyToPurchase = candidate.getQtyToPurchase();
final Quantity qtyToDecrease = remainingQtyToDistribute.min(qtyToPurchase);
candidate.setQtyToPurchase(qtyToPurchase.subtract(qtyToDecrease));
purchaseCandidateRepository.save(candidate);
return remainingQtyToDistribute.subtract(qtyToDecrease);
}
return remainingQtyToDistribute;
}
private static boolean isCandidateEligibleForBeingDecreased(final PurchaseCandidate candidate)
{
return !candidate.isProcessed()
&& candidate.getQtyToPurchase().signum() > 0;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.purchasecandidate.base\src\main\java\de\metas\purchasecandidate\material\event\PurchaseCandidateAdvisedEventCreator.java | 1 |
请完成以下Java代码 | public String viewStartPage(Model model){
model.addAttribute("ipAddress", inspectLocalHost());
return "hero/hero.search.html";
}
@GetMapping("/hero/list")
public String viewHeros(@RequestParam(value="search", required = false)String search, Model model) {
model.addAttribute("heros", collectHeros(search));
model.addAttribute("ipAddress", inspectLocalHost());
return "hero/hero.list.html";
}
private Collection<Hero> collectHeros(String search) {
if(StringUtils.isBlank(search) || StringUtils.isEmpty(search)) {
return heroRepository.allHeros();
} else {
searchCounter.increment();
return heroRepository.findHerosBySearchCriteria(search);
}
}
@GetMapping("/hero/new")
public String newHero(Model model){
addCounter.increment(); | model.addAttribute("newHero", new NewHeroModel());
return "hero/hero.new.html";
}
@PostMapping("/hero/new")
public String addNewHero(@ModelAttribute("newHero") NewHeroModel newHeroModel) {
heroRepository.addHero(newHeroModel.getHero());
return "redirect:/hero/list";
}
private String inspectLocalHost() {
try {
return Inet4Address.getLocalHost().getHostAddress();
} catch (UnknownHostException e) {
throw new RuntimeException(e);
}
}
} | repos\spring-boot-demo-master (1)\src\main\java\com\github\sparsick\springbootexample\hero\universum\HeroController.java | 1 |
请在Spring Boot框架中完成以下Java代码 | QueueChannel multipleofThreeChannel() {
return new QueueChannel();
}
@Bean
QueueChannel remainderIsOneChannel() {
return new QueueChannel();
}
@Bean
QueueChannel remainderIsTwoChannel() {
return new QueueChannel();
}
boolean isMultipleOfThree(Integer number) {
return number % 3 == 0;
}
boolean isRemainderOne(Integer number) {
return number % 3 == 1;
} | boolean isRemainderTwo(Integer number) {
return number % 3 == 2;
}
@Bean
public IntegrationFlow classify() {
return flow -> flow.split()
.routeToRecipients(route -> route
.recipientFlow(subflow -> subflow
.<Integer> filter(this::isMultipleOfThree)
.channel("multipleofThreeChannel"))
.<Integer> recipient("remainderIsOneChannel",this::isRemainderOne)
.<Integer> recipient("remainderIsTwoChannel",this::isRemainderTwo));
}
} | repos\tutorials-master\spring-integration\src\main\java\com\baeldung\subflows\routetorecipients\RouteToRecipientsExample.java | 2 |
请完成以下Java代码 | public void setIsReadOnly (boolean IsReadOnly)
{
set_Value (COLUMNNAME_IsReadOnly, Boolean.valueOf(IsReadOnly));
}
/** Get Read Only.
@return Field is read only
*/
public boolean isReadOnly ()
{
Object oo = get_Value(COLUMNNAME_IsReadOnly);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set User updateable.
@param IsUserUpdateable
The field can be updated by the user
*/
public void setIsUserUpdateable (boolean IsUserUpdateable)
{
set_Value (COLUMNNAME_IsUserUpdateable, Boolean.valueOf(IsUserUpdateable));
}
/** Get User updateable.
@return The field can be updated by the user
*/
public boolean isUserUpdateable ()
{
Object oo = get_Value(COLUMNNAME_IsUserUpdateable);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
} | /** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_UserDef_Win.java | 1 |
请完成以下Java代码 | public void addWeightedAverage(
@NonNull final CostAmount amt,
@NonNull final Quantity qty,
@NonNull final QuantityUOMConverter uomConverter)
{
assertCostCurrency(amt);
final CostAmount currentAmt = costPrice.getOwnCostPrice().multiply(currentQty);
final CostAmount newAmt = currentAmt.add(amt);
final Quantity qtyConv = uomConverter.convertQuantityTo(qty, costSegment.getProductId(), uomId);
final Quantity newQty = currentQty.add(qtyConv);
if (newQty.signum() != 0)
{
final CostAmount ownCostPrice = newAmt.divide(newQty, getPrecision());
this.costPrice = costPrice.withOwnCostPrice(ownCostPrice);
}
currentQty = newQty;
addCumulatedAmtAndQty(amt, qtyConv);
}
private void addCumulatedAmtAndQty(
@NonNull final CostAmount amt,
@NonNull final Quantity qty)
{
assertCostUOM(qty);
addCumulatedAmt(amt);
cumulatedQty = cumulatedQty.add(qty);
}
public void addCumulatedAmt(@NonNull final CostAmount amt)
{
assertCostCurrency(amt);
cumulatedAmt = cumulatedAmt.add(amt);
}
public void addToCurrentQtyAndCumulate(
@NonNull final Quantity qtyToAdd,
@NonNull final CostAmount amt,
@NonNull final QuantityUOMConverter uomConverter) | {
final Quantity qtyToAddConv = uomConverter.convertQuantityTo(qtyToAdd, costSegment.getProductId(), uomId);
addToCurrentQtyAndCumulate(qtyToAddConv, amt);
}
public void addToCurrentQtyAndCumulate(
@NonNull final Quantity qtyToAdd,
@NonNull final CostAmount amt)
{
currentQty = currentQty.add(qtyToAdd).toZeroIfNegative();
addCumulatedAmtAndQty(amt, qtyToAdd);
}
public void addToCurrentQtyAndCumulate(@NonNull final CostAmountAndQty amtAndQty)
{
addToCurrentQtyAndCumulate(amtAndQty.getQty(), amtAndQty.getAmt());
}
public void setCostPrice(@NonNull final CostPrice costPrice)
{
this.costPrice = costPrice;
}
public void setOwnCostPrice(@NonNull final CostAmount ownCostPrice)
{
setCostPrice(getCostPrice().withOwnCostPrice(ownCostPrice));
}
public void clearOwnCostPrice()
{
setCostPrice(getCostPrice().withZeroOwnCostPrice());
}
public void addToOwnCostPrice(@NonNull final CostAmount ownCostPriceToAdd)
{
setCostPrice(getCostPrice().addToOwnCostPrice(ownCostPriceToAdd));
}
public void clearComponentsCostPrice()
{
setCostPrice(getCostPrice().withZeroComponentsCostPrice());
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\costing\CurrentCost.java | 1 |
请完成以下Java代码 | protected void handleBPMNModelConstraints(BpmnModel bpmnModel, List<ValidationError> errors) {
if (
bpmnModel.getTargetNamespace() != null &&
bpmnModel.getTargetNamespace().length() > Constraints.BPMN_MODEL_TARGET_NAMESPACE_MAX_LENGTH
) {
Map<String, String> params = new HashMap<>();
params.put("maxLength", String.valueOf(Constraints.BPMN_MODEL_TARGET_NAMESPACE_MAX_LENGTH));
addError(errors, Problems.BPMN_MODEL_TARGET_NAMESPACE_TOO_LONG, params);
}
}
/**
* Returns 'true' if at least one process definition in the {@link BpmnModel} is executable.
*/
protected boolean validateAtLeastOneExecutable(BpmnModel bpmnModel, List<ValidationError> errors) {
int nrOfExecutableDefinitions = 0;
for (Process process : bpmnModel.getProcesses()) {
if (process.isExecutable()) {
nrOfExecutableDefinitions++;
}
}
if (nrOfExecutableDefinitions == 0) {
addError(errors, Problems.ALL_PROCESS_DEFINITIONS_NOT_EXECUTABLE);
}
return nrOfExecutableDefinitions > 0;
} | protected List<Process> getProcessesWithSameId(final List<Process> processes) {
List<Process> filteredProcesses = processes
.stream()
.filter(process -> process.getName() != null)
.collect(Collectors.toList());
return getDuplicatesMap(filteredProcesses)
.values()
.stream()
.filter(duplicates -> duplicates.size() > 1)
.flatMap(Collection::stream)
.collect(Collectors.toList());
}
private static Map<String, List<Process>> getDuplicatesMap(List<Process> processes) {
return processes.stream().collect(Collectors.groupingBy(Process::getId));
}
} | repos\Activiti-develop\activiti-core\activiti-process-validation\src\main\java\org\activiti\validation\validator\impl\BpmnModelValidator.java | 1 |
请完成以下Java代码 | public void setRetryTopicSuffix(String retryTopicSuffix) {
this.retryTopicSuffix = retryTopicSuffix;
}
public String getFixedDelayTopicStrategy() {
return fixedDelayTopicStrategy;
}
public void setFixedDelayTopicStrategy(String fixedDelayTopicStrategy) {
this.fixedDelayTopicStrategy = fixedDelayTopicStrategy;
}
public String getTopicSuffixingStrategy() {
return topicSuffixingStrategy;
}
public void setTopicSuffixingStrategy(String topicSuffixingStrategy) {
this.topicSuffixingStrategy = topicSuffixingStrategy;
}
public NonBlockingRetryBackOff getNonBlockingBackOff() {
return nonBlockingBackOff;
}
public void setNonBlockingBackOff(NonBlockingRetryBackOff nonBlockingBackOff) {
this.nonBlockingBackOff = nonBlockingBackOff;
}
public String getAutoCreateTopics() {
return autoCreateTopics;
}
public void setAutoCreateTopics(String autoCreateTopics) {
this.autoCreateTopics = autoCreateTopics;
}
public String getNumPartitions() {
return numPartitions;
}
public void setNumPartitions(String numPartitions) {
this.numPartitions = numPartitions;
}
public String getReplicationFactor() {
return replicationFactor;
}
public void setReplicationFactor(String replicationFactor) {
this.replicationFactor = replicationFactor;
}
}
public static class NonBlockingRetryBackOff {
protected String delay;
protected String maxDelay;
protected String multiplier;
protected String random;
public String getDelay() {
return delay;
}
public void setDelay(String delay) {
this.delay = delay;
}
public String getMaxDelay() {
return maxDelay;
} | public void setMaxDelay(String maxDelay) {
this.maxDelay = maxDelay;
}
public String getMultiplier() {
return multiplier;
}
public void setMultiplier(String multiplier) {
this.multiplier = multiplier;
}
public String getRandom() {
return random;
}
public void setRandom(String random) {
this.random = random;
}
}
public static class TopicPartition {
protected String topic;
protected Collection<String> partitions;
public String getTopic() {
return topic;
}
public void setTopic(String topic) {
this.topic = topic;
}
public Collection<String> getPartitions() {
return partitions;
}
public void setPartitions(Collection<String> partitions) {
this.partitions = partitions;
}
}
} | repos\flowable-engine-main\modules\flowable-event-registry-model\src\main\java\org\flowable\eventregistry\model\KafkaInboundChannelModel.java | 1 |
请完成以下Java代码 | public Timestamp getDateOfProduction(final I_PP_Order ppOrder)
{
final Timestamp dateOfProduction;
if (ppOrder.getDateDelivered() != null)
{
dateOfProduction = ppOrder.getDateDelivered();
}
else
{
dateOfProduction = ppOrder.getDateFinishSchedule();
}
Check.assumeNotNull(dateOfProduction, "dateOfProduction not null for PP_Order {}", ppOrder);
return dateOfProduction;
}
@Override
public List<I_M_InOutLine> retrieveIssuedInOutLines(final I_PP_Order ppOrder)
{
// services
final IPPOrderMInOutLineRetrievalService ppOrderMInOutLineRetrievalService = Services.get(IPPOrderMInOutLineRetrievalService.class);
final IPPCostCollectorBL ppCostCollectorBL = Services.get(IPPCostCollectorBL.class);
final IPPCostCollectorDAO ppCostCollectorDAO = Services.get(IPPCostCollectorDAO.class);
final List<I_M_InOutLine> allIssuedInOutLines = new ArrayList<>(); | final PPOrderId ppOrderId = PPOrderId.ofRepoId(ppOrder.getPP_Order_ID());
for (final I_PP_Cost_Collector cc : ppCostCollectorDAO.getByOrderId(ppOrderId))
{
if (!ppCostCollectorBL.isAnyComponentIssueOrCoProduct(cc))
{
continue;
}
final List<I_M_InOutLine> issuedInOutLinesForCC = ppOrderMInOutLineRetrievalService.provideIssuedInOutLines(cc);
allIssuedInOutLines.addAll(issuedInOutLinesForCC);
}
return allIssuedInOutLines;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.materialtracking\src\main\java\de\metas\materialtracking\impl\MaterialTrackingPPOrderBL.java | 1 |
请完成以下Java代码 | public String generateSecureRandomPassword() {
Stream<Character> pwdStream = Stream.concat(getRandomNumbers(2), Stream.concat(getRandomSpecialChars(2), Stream.concat(getRandomAlphabets(2, true), getRandomAlphabets(4, false))));
List<Character> charList = pwdStream.collect(Collectors.toList());
Collections.shuffle(charList);
String password = charList.stream()
.collect(StringBuilder::new, StringBuilder::append, StringBuilder::append)
.toString();
return password;
}
public String generateRandomSpecialCharacters(int length) {
RandomStringGenerator pwdGenerator = new RandomStringGenerator.Builder().withinRange(33, 45)
.build();
return pwdGenerator.generate(length);
}
public String generateRandomNumbers(int length) {
RandomStringGenerator pwdGenerator = new RandomStringGenerator.Builder().withinRange(48, 57)
.build();
return pwdGenerator.generate(length);
}
public String generateRandomCharacters(int length) {
RandomStringGenerator pwdGenerator = new RandomStringGenerator.Builder().withinRange(48, 57)
.build();
return pwdGenerator.generate(length);
}
public String generateRandomAlphabet(int length, boolean lowerCase) {
int low;
int hi;
if (lowerCase) {
low = 97;
hi = 122;
} else {
low = 65;
hi = 90;
}
RandomStringGenerator pwdGenerator = new RandomStringGenerator.Builder().withinRange(low, hi)
.build();
return pwdGenerator.generate(length);
} | public Stream<Character> getRandomAlphabets(int count, boolean upperCase) {
IntStream characters = null;
if (upperCase) {
characters = random.ints(count, 65, 90);
} else {
characters = random.ints(count, 97, 122);
}
return characters.mapToObj(data -> (char) data);
}
public Stream<Character> getRandomNumbers(int count) {
IntStream numbers = random.ints(count, 48, 57);
return numbers.mapToObj(data -> (char) data);
}
public Stream<Character> getRandomSpecialChars(int count) {
IntStream specialChars = random.ints(count, 33, 45);
return specialChars.mapToObj(data -> (char) data);
}
} | repos\tutorials-master\core-java-modules\core-java-string-apis\src\main\java\com\baeldung\password\RandomPasswordGenerator.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class UserServiceImpl implements UserService {
private static final Logger LOGGER = LoggerFactory.getLogger(UserServiceImpl.class);
@Autowired
UserRepository userRepository;
@Override
public List<User> findAll() {
return userRepository.findAll();
}
@Override
public User insertByUser(User user) {
LOGGER.info("新增用户:" + user.toString());
return userRepository.save(user);
}
@Override
public User update(User user) {
LOGGER.info("更新用户:" + user.toString());
return userRepository.save(user);
} | @Override
public User delete(Long id) {
User user = userRepository.findById(id).get();
userRepository.delete(user);
LOGGER.info("删除用户:" + user.toString());
return user;
}
@Override
public User findById(Long id) {
LOGGER.info("获取用户 ID :" + id);
return userRepository.findById(id).get();
}
} | repos\springboot-learning-example-master\chapter-4-spring-boot-validating-form-input\src\main\java\spring\boot\core\service\impl\UserServiceImpl.java | 2 |
请完成以下Java代码 | public boolean isEnabled() {
return caseActivityInstanceState == ENABLED.getStateCode();
}
public boolean isDisabled() {
return caseActivityInstanceState == DISABLED.getStateCode();
}
public boolean isActive() {
return caseActivityInstanceState == ACTIVE.getStateCode();
}
public boolean isSuspended() {
return caseActivityInstanceState == SUSPENDED.getStateCode();
}
public boolean isCompleted() {
return caseActivityInstanceState == COMPLETED.getStateCode();
}
public boolean isTerminated() {
return caseActivityInstanceState == TERMINATED.getStateCode();
}
public String toString() { | return this.getClass().getSimpleName()
+ "[caseActivityId=" + caseActivityId
+ ", caseActivityName=" + caseActivityName
+ ", caseActivityInstanceId=" + id
+ ", caseActivityInstanceState=" + caseActivityInstanceState
+ ", parentCaseActivityInstanceId=" + parentCaseActivityInstanceId
+ ", taskId=" + taskId
+ ", calledProcessInstanceId=" + calledProcessInstanceId
+ ", calledCaseInstanceId=" + calledCaseInstanceId
+ ", durationInMillis=" + durationInMillis
+ ", createTime=" + startTime
+ ", endTime=" + endTime
+ ", eventType=" + eventType
+ ", caseExecutionId=" + caseExecutionId
+ ", caseDefinitionId=" + caseDefinitionId
+ ", caseInstanceId=" + caseInstanceId
+ ", tenantId=" + tenantId
+ "]";
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\history\event\HistoricCaseActivityInstanceEventEntity.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public void setHPAYT1(HPAYT1 value) {
this.hpayt1 = value;
}
/**
* Gets the value of the htrsd1 property.
*
* @return
* possible object is
* {@link HTRSD1 }
*
*/
public HTRSD1 getHTRSD1() {
return htrsd1;
}
/**
* Sets the value of the htrsd1 property.
*
* @param value
* allowed object is
* {@link HTRSD1 }
*
*/
public void setHTRSD1(HTRSD1 value) {
this.htrsd1 = value;
}
/**
* Gets the value of the htrsc1 property.
*
* @return
* possible object is
* {@link HTRSC1 }
*
*/
public HTRSC1 getHTRSC1() {
return htrsc1;
}
/**
* Sets the value of the htrsc1 property.
*
* @param value
* allowed object is
* {@link HTRSC1 }
*
*/
public void setHTRSC1(HTRSC1 value) {
this.htrsc1 = value; | }
/**
* Gets the value of the detail property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the detail property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getDETAIL().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link DETAILXbest }
*
*
*/
public List<DETAILXbest> getDETAIL() {
if (detail == null) {
detail = new ArrayList<DETAILXbest>();
}
return this.detail;
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_stepcom_orders\de\metas\edi\esb\jaxb\stepcom\orders\HEADERXbest.java | 2 |
请完成以下Java代码 | public static Registration.Builder copyOf(Registration registration) {
return registration.toBuilder();
}
/**
* Determines the service url. It might be overriden by metadata entries to override
* the service url.
* @param serviceUrl original serviceUrl
* @param metadata metadata information of registered instance
* @return the actual service url
*/
@Nullable
private String getServiceUrl(@Nullable String serviceUrl, Map<String, String> metadata) {
if (serviceUrl == null) {
return null;
}
String url = metadata.getOrDefault("service-url", serviceUrl);
try {
URI baseUri = new URI(url);
return baseUri.toString();
}
catch (URISyntaxException ex) {
log.warn("Invalid service url: " + serviceUrl, ex);
}
return serviceUrl;
}
public Map<String, String> getMetadata() {
return Collections.unmodifiableMap(this.metadata);
} | /**
* Checks the syntax of the given URL.
* @param url the URL.
* @return true, if valid.
*/
private boolean checkUrl(String url) {
try {
URI uri = new URI(url);
return uri.isAbsolute();
}
catch (URISyntaxException ex) {
return false;
}
}
public static class Builder {
// Will be generated by lombok
}
} | repos\spring-boot-admin-master\spring-boot-admin-server\src\main\java\de\codecentric\boot\admin\server\domain\values\Registration.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class SalesOrderLineRepository
{
private final OrderLineRepository orderLineRepository;
public SalesOrderLineRepository(@NonNull final OrderLineRepository orderLineRepository)
{
this.orderLineRepository = orderLineRepository;
}
public SalesOrderLine getById(@NonNull final OrderLineId orderLineId)
{
final I_C_OrderLine orderLineRecord = load(orderLineId.getRepoId(), I_C_OrderLine.class);
return ofRecord(orderLineRecord);
}
public List<SalesOrderLine> getByIds(@NonNull final Collection<OrderLineId> orderLineIds)
{
if (orderLineIds.isEmpty())
{
return ImmutableList.of();
}
final Set<Integer> ids = orderLineIds.stream().map(OrderLineId::getRepoId).collect(ImmutableSet.toImmutableSet());
return loadByIds(ids, I_C_OrderLine.class)
.stream()
.map(this::ofRecord)
.collect(ImmutableList.toImmutableList());
} | public SalesOrderLine ofRecord(@NonNull final I_C_OrderLine salesOrderLineRecord)
{
final OrderLine orderLine = orderLineRepository.ofRecord(salesOrderLineRecord);
final ZonedDateTime preparationDate = TimeUtil.asZonedDateTime(salesOrderLineRecord.getC_Order().getPreparationDate());
final SalesOrder salesOrder = new SalesOrder(preparationDate);
final Quantity deliveredQty = Quantity.of(
salesOrderLineRecord.getQtyDelivered(),
orderLine.getOrderedQty().getUOM());
return SalesOrderLine.builder()
.orderLine(orderLine)
.order(salesOrder)
.deliveredQty(deliveredQty)
.build();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.purchasecandidate.base\src\main\java\de\metas\purchasecandidate\SalesOrderLineRepository.java | 2 |
请完成以下Java代码 | public V[] getValueArray(V[] a)
{
return valueArray;
}
/**
* 前缀查询
* @param key
* @param offset
* @param maxResults
* @return
*/
public ArrayList<Pair<String, V>> commonPrefixSearch(String key, int offset, int maxResults)
{
byte[] keyBytes = key.getBytes(utf8);
List<Pair<Integer, Integer>> pairList = commonPrefixSearch(keyBytes, offset, maxResults);
ArrayList<Pair<String, V>> resultList = new ArrayList<Pair<String, V>>(pairList.size());
for (Pair<Integer, Integer> pair : pairList)
{
resultList.add(new Pair<String, V>(new String(keyBytes, 0, pair.first), valueArray[pair.second]));
}
return resultList;
}
public ArrayList<Pair<String, V>> commonPrefixSearch(String key)
{
return commonPrefixSearch(key, 0, Integer.MAX_VALUE);
}
@Override
public V put(String key, V value)
{
throw new UnsupportedOperationException("双数组不支持增量式插入");
}
@Override
public V remove(Object key)
{
throw new UnsupportedOperationException("双数组不支持删除");
}
@Override
public void putAll(Map<? extends String, ? extends V> m)
{ | throw new UnsupportedOperationException("双数组不支持增量式插入");
}
@Override
public void clear()
{
throw new UnsupportedOperationException("双数组不支持");
}
@Override
public Set<String> keySet()
{
throw new UnsupportedOperationException("双数组不支持");
}
@Override
public Collection<V> values()
{
return Arrays.asList(valueArray);
}
@Override
public Set<Entry<String, V>> entrySet()
{
throw new UnsupportedOperationException("双数组不支持");
}
} | repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\collection\dartsclone\DartMap.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public String getEBPPConsolidatorsBillerID() {
return ebppConsolidatorsBillerID;
}
/**
* Sets the value of the ebppConsolidatorsBillerID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEBPPConsolidatorsBillerID(String value) {
this.ebppConsolidatorsBillerID = value;
}
/**
* The ID of the supplier issued by the customer.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSupplierIDissuedByCustomer() {
return supplierIDissuedByCustomer;
}
/**
* Sets the value of the supplierIDissuedByCustomer property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSupplierIDissuedByCustomer(String value) {
this.supplierIDissuedByCustomer = value;
}
/**
* Gets the value of the supplierExtension property.
*
* @return
* possible object is | * {@link SupplierExtensionType }
*
*/
public SupplierExtensionType getSupplierExtension() {
return supplierExtension;
}
/**
* Sets the value of the supplierExtension property.
*
* @param value
* allowed object is
* {@link SupplierExtensionType }
*
*/
public void setSupplierExtension(SupplierExtensionType value) {
this.supplierExtension = value;
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\documents\SupplierType.java | 2 |
请完成以下Java代码 | public class FrontControllerServlet extends HttpServlet {
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
Bookshelf bookshelf = new BookshelfImpl();
bookshelf.init();
getServletContext().setAttribute("bookshelf", bookshelf);
}
@Override
protected void doGet(
HttpServletRequest request,
HttpServletResponse response
) throws ServletException, IOException {
doCommand(request, response);
}
@Override
protected void doPost(
HttpServletRequest request,
HttpServletResponse response
) throws ServletException, IOException {
doCommand(request, response);
}
private void doCommand(
HttpServletRequest request,
HttpServletResponse response
) throws ServletException, IOException {
FrontCommand command = getCommand(request); | command.init(request, response);
command.process();
}
private FrontCommand getCommand(HttpServletRequest request) {
try {
Class type = Class.forName(
String.format(
"com.baeldung.patterns.intercepting.filter.commands.%sCommand",
request.getParameter("command")
)
);
return (FrontCommand) type
.asSubclass(FrontCommand.class)
.newInstance();
} catch (Exception e) {
return new UnknownCommand();
}
}
} | repos\tutorials-master\patterns-modules\intercepting-filter\src\main\java\com\baeldung\patterns\intercepting\filter\FrontControllerServlet.java | 1 |
请完成以下Java代码 | public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getRootProcessInstanceId() {
return rootProcessInstanceId;
} | public void setRootProcessInstanceId(String rootProcessInstanceId) {
this.rootProcessInstanceId = rootProcessInstanceId;
}
public void delete() {
byteArrayField.deleteByteArrayValue();
Context
.getCommandContext()
.getDbEntityManager()
.delete(this);
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\history\event\HistoricDecisionInputInstanceEntity.java | 1 |
请完成以下Java代码 | public ShipmentScheduleReferencedLine createFor(@NonNull final I_M_ShipmentSchedule shipmentSchedule)
{
final String tableName = Services.get(IADTableDAO.class).retrieveTableName(shipmentSchedule.getAD_Table_ID());
final ShipmentScheduleReferencedLineProvider provider = getProviderForTableNameOrNull(tableName);
if (provider == null)
{
throw new UnsupportedShipmentScheduleTableId(shipmentSchedule, tableName);
}
return provider.provideFor(shipmentSchedule);
}
@VisibleForTesting
ShipmentScheduleReferencedLineProvider getProviderForTableNameOrNull(@NonNull final String tableName)
{
return providers.get(tableName);
}
/** | * See {@link ShipmentScheduleReferencedLineFactory#createFor(I_M_ShipmentSchedule)}.
*
* @author metas-dev <dev@metasfresh.com>
*
*/
public static final class UnsupportedShipmentScheduleTableId extends AdempiereException
{
private static final long serialVersionUID = 3430768273480532505L;
public UnsupportedShipmentScheduleTableId(final I_M_ShipmentSchedule shipmentSchedule, final String tableName)
{
super("Missing ShipmentScheduleOrderDocProvider for tableName='" + tableName + "'; AD_Table_ID=" + shipmentSchedule.getAD_Table_ID() + "; M_ShipmentSchedule=" + shipmentSchedule.toString());
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\inoutcandidate\spi\ShipmentScheduleReferencedLineFactory.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public Date getCreateTime() {
return createTime;
}
@Override
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public String getLockOwner() {
return lockOwner;
}
@Override
public void setLockOwner(String claimedBy) {
this.lockOwner = claimedBy;
}
@Override
public Date getLockExpirationTime() {
return lockExpirationTime;
}
@Override
public void setLockExpirationTime(Date claimedUntil) {
this.lockExpirationTime = claimedUntil;
}
@Override
public String getScopeType() {
return scopeType;
}
@Override
public void setScopeType(String scopeType) {
this.scopeType = scopeType;
}
protected String getJobByteArrayRefAsString(ByteArrayRef jobByteArrayRef) {
if (jobByteArrayRef == null) {
return null;
}
return jobByteArrayRef.asString(getEngineType());
}
protected String getEngineType() {
if (StringUtils.isNotEmpty(scopeType)) {
return scopeType; | } else {
return ScopeTypes.BPMN;
}
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("HistoryJobEntity[").append("id=").append(id)
.append(", jobHandlerType=").append(jobHandlerType);
if (scopeType != null) {
sb.append(", scopeType=").append(scopeType);
}
if (StringUtils.isNotEmpty(tenantId)) {
sb.append(", tenantId=").append(tenantId);
}
sb.append("]");
return sb.toString();
}
} | repos\flowable-engine-main\modules\flowable-job-service\src\main\java\org\flowable\job\service\impl\persistence\entity\HistoryJobEntityImpl.java | 2 |
请完成以下Java代码 | public void updateRenderedAddressAndCapturedLocation(final IDocumentHandOverLocationAdapter locationAdapter)
{
toPlainDocumentLocation(locationAdapter)
.map(this::withUpdatedLocationId)
.map(this::computeRenderedAddress)
.ifPresent(locationAdapter::setRenderedAddressAndCapturedLocation);
}
@Override
public void updateRenderedAddress(final IDocumentHandOverLocationAdapter locationAdapter)
{
toPlainDocumentLocation(locationAdapter)
.map(this::computeRenderedAddress)
.ifPresent(locationAdapter::setRenderedAddress);
}
@Override
public Set<DocumentLocation> getDocumentLocations(@NonNull final Set<BPartnerLocationId> bpartnerLocationIds)
{
if (bpartnerLocationIds.isEmpty())
{
return ImmutableSet.of();
} | return bpartnerLocationIds
.stream()
.map(this::getDocumentLocation)
.collect(ImmutableSet.toImmutableSet());
}
@Override
public DocumentLocation getDocumentLocation(@NonNull final BPartnerLocationId bpartnerLocationId)
{
DocumentLocation documentLocation = DocumentLocation.ofBPartnerLocationId(bpartnerLocationId);
final RenderedAddressAndCapturedLocation renderedAddress = computeRenderedAddress(documentLocation);
return documentLocation.withRenderedAddress(renderedAddress);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\document\location\impl\DocumentLocationBL.java | 1 |
请完成以下Java代码 | public void setDefaultAsyncJobAcquireWaitTimeInMillis(int waitTimeInMillis) {
for (AsyncExecutor asyncExecutor : tenantExecutors.values()) {
asyncExecutor.setDefaultAsyncJobAcquireWaitTimeInMillis(waitTimeInMillis);
}
}
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 |
请完成以下Java代码 | public String getRestTypeName() {
return "localDateTime";
}
@Override
public Class<?> getVariableType() {
return LocalDateTime.class;
}
@Override
public Object getVariableValue(EngineRestVariable result) {
if (result.getValue() != null) {
if (!(result.getValue() instanceof String)) {
throw new FlowableIllegalArgumentException("Converter can only convert string to localDateTime");
}
try {
return LocalDateTime.parse((String) result.getValue());
} catch (DateTimeParseException e) {
throw new FlowableIllegalArgumentException("The given variable value is not a localDateTime: '" + result.getValue() + "'", e); | }
}
return null;
}
@Override
public void convertVariableValue(Object variableValue, EngineRestVariable result) {
if (variableValue != null) {
if (!(variableValue instanceof LocalDateTime)) {
throw new FlowableIllegalArgumentException("Converter can only convert localDateTime");
}
result.setValue(variableValue.toString());
} else {
result.setValue(null);
}
}
} | repos\flowable-engine-main\modules\flowable-common-rest\src\main\java\org\flowable\common\rest\variable\LocalDateTimeRestVariableConverter.java | 1 |
请完成以下Java代码 | public void setId(final PPOrderRoutingActivityId id)
{
if (this.id == null)
{
this.id = id;
}
else
{
Check.assumeEquals(this.id, id);
}
}
public void changeStatusTo(@NonNull final PPOrderRoutingActivityStatus newStatus)
{
final PPOrderRoutingActivityStatus currentStatus = getStatus();
if (currentStatus.equals(newStatus))
{
return;
}
currentStatus.assertCanChangeTo(newStatus);
this.status = newStatus;
}
void reportProgress(final PPOrderActivityProcessReport report)
{
changeStatusTo(PPOrderRoutingActivityStatus.IN_PROGRESS);
if (getDateStart() == null)
{
setDateStart(report.getFinishDate().minus(report.getDuration()));
}
if (getDateFinish() == null || getDateFinish().isBefore(report.getFinishDate()))
{
setDateFinish(report.getFinishDate());
}
if (report.getQtyProcessed() != null)
{
setQtyDelivered(getQtyDelivered().add(report.getQtyProcessed()));
}
if (report.getQtyScrapped() != null)
{
setQtyScrapped(getQtyScrapped().add(report.getQtyScrapped()));
}
if (report.getQtyRejected() != null)
{
setQtyRejected(getQtyRejected().add(report.getQtyRejected()));
}
setDurationReal(getDurationReal().plus(report.getDuration()));
setSetupTimeReal(getSetupTimeReal().plus(report.getSetupTime()));
}
void closeIt()
{
if (getStatus() == PPOrderRoutingActivityStatus.CLOSED)
{
logger.warn("Activity already closed - {}", this);
return;
}
else if (getStatus() == PPOrderRoutingActivityStatus.IN_PROGRESS)
{
completeIt();
}
changeStatusTo(PPOrderRoutingActivityStatus.CLOSED);
if (getDateFinish() != null)
{
setDateFinish(SystemTime.asInstant());
}
if (!Objects.equals(getDurationRequired(), getDurationReal()))
{
// addDescription(Services.get(IMsgBL.class).parseTranslation(getCtx(), "@closed@ ( @Duration@ :" + getDurationRequiered() + ") ( @QtyRequiered@ :" + getQtyRequiered() + ")"));
setDurationRequired(getDurationReal());
setQtyRequired(getQtyDelivered());
}
}
void uncloseIt() | {
if (getStatus() != PPOrderRoutingActivityStatus.CLOSED)
{
logger.warn("Only Closed activities can be unclosed - {}", this);
return;
}
changeStatusTo(PPOrderRoutingActivityStatus.IN_PROGRESS);
}
void voidIt()
{
if (getStatus() == PPOrderRoutingActivityStatus.VOIDED)
{
logger.warn("Activity already voided - {}", this);
return;
}
changeStatusTo(PPOrderRoutingActivityStatus.VOIDED);
setQtyRequired(getQtyRequired().toZero());
setSetupTimeRequired(Duration.ZERO);
setDurationRequired(Duration.ZERO);
}
public void completeIt()
{
changeStatusTo(PPOrderRoutingActivityStatus.COMPLETED);
if (getDateFinish() == null)
{
setDateFinish(SystemTime.asInstant());
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\org\eevolution\api\PPOrderRoutingActivity.java | 1 |
请完成以下Java代码 | public <T> IQueryFilter<T> getQueryFilter(@NonNull final Class<T> recordClass)
{
final String tableName = InterfaceWrapperHelper.getTableName(recordClass);
final SqlViewRowsWhereClause sqlWhereClause = view.getSqlWhereClause(getSelectedRowIds(), SqlOptions.usingTableName(tableName));
return sqlWhereClause.toQueryFilter();
}
private static final class SelectedModelsList
{
private static SelectedModelsList of(final List<?> models, final Class<?> modelClass)
{
if (models == null || models.isEmpty())
{
return EMPTY;
}
return new SelectedModelsList(models, modelClass);
}
private static final SelectedModelsList EMPTY = new SelectedModelsList();
private final ImmutableList<?> models;
private final Class<?> modelClass;
/**
* empty constructor
*/
private SelectedModelsList()
{
models = ImmutableList.of();
modelClass = null;
}
private SelectedModelsList(final List<?> models, final Class<?> modelClass)
{
super();
this.models = ImmutableList.copyOf(models); | this.modelClass = modelClass;
}
@Override
public String toString()
{
return MoreObjects.toStringHelper(this)
.omitNullValues()
.add("modelClass", modelClass)
.add("models", models)
.toString();
}
public <T> List<T> getModels(final Class<T> modelClass)
{
// If loaded models list is empty, we can return an empty list directly
if (models.isEmpty())
{
return ImmutableList.of();
}
// If loaded models have the same model class as the requested one
// we can simple cast & return them
if (Objects.equals(modelClass, this.modelClass))
{
@SuppressWarnings("unchecked") final List<T> modelsCasted = (List<T>)models;
return modelsCasted;
}
// If not the same class, we have to wrap them fist.
else
{
return InterfaceWrapperHelper.wrapToImmutableList(models, modelClass);
}
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\process\ViewAsPreconditionsContext.java | 1 |
请完成以下Java代码 | public List<String> queryUserIdsByDeptPostIds(List<String> deptPostIds) {
return List.of();
}
@Override
public List<String> queryUserAccountsByDeptIds(List<String> deptIds) {
return null;
}
@Override
public List<String> queryUserIdsByRoleds(List<String> roleCodes) {
return null;
}
@Override
public List<String> queryUsernameByIds(List<String> userIds) {
return List.of();
}
@Override
public List<String> queryUsernameByDepartPositIds(List<String> positionIds) {
return null;
}
@Override
public List<String> queryUserIdsByPositionIds(List<String> positionIds) {
return null;
}
@Override
public List<String> getUserAccountsByDepCode(String orgCode) {
return null;
}
@Override
public boolean dictTableWhiteListCheckBySql(String selectSql) {
return false;
}
@Override
public boolean dictTableWhiteListCheckByDict(String tableOrDictCode, String... fields) {
return false;
}
@Override
public void announcementAutoRelease(String dataId, String currentUserName) {
}
@Override
public SysDepartModel queryCompByOrgCode(String orgCode) {
return null; | }
@Override
public SysDepartModel queryCompByOrgCodeAndLevel(String orgCode, Integer level) {
return null;
}
@Override
public Object runAiragFlow(AiragFlowDTO airagFlowDTO) {
return null;
}
@Override
public void uniPushMsgToUser(PushMessageDTO pushMessageDTO) {
}
@Override
public String getDepartPathNameByOrgCode(String orgCode, String depId) {
return "";
}
@Override
public List<String> queryUserIdsByCascadeDeptIds(List<String> deptIds) {
return null;
}
} | repos\JeecgBoot-main\jeecg-boot\jeecg-module-system\jeecg-system-api\jeecg-system-cloud-api\src\main\java\org\jeecg\common\system\api\fallback\SysBaseAPIFallback.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public static List<String> unZipFiles(String zipPath, String descDir) throws IOException {
return unZipFiles(new File(zipPath), descDir);
}
/**
* 解压文件到指定目录
*
* @param zipFile
* @param descDir
* @author isea533
*/
@SuppressWarnings("rawtypes")
public static List<String> unZipFiles(File zipFile, String descDir) throws IOException {
List<String> result = new ArrayList<String>();
File pathFile = new File(descDir);
if (!pathFile.exists()) {
pathFile.mkdirs();
}
Charset charset = Charset.forName("GBK");
ZipFile zip = new ZipFile(zipFile, charset);
for (Enumeration entries = zip.entries(); entries.hasMoreElements();) {
ZipEntry entry = (ZipEntry) entries.nextElement();
String zipEntryName = entry.getName();
InputStream in = zip.getInputStream(entry);
String outPath = (descDir + zipEntryName).replaceAll("\\*", "/");
;
// 判断路径是否存在,不存在则创建文件路径
File file = new File(outPath.substring(0, outPath.lastIndexOf('/')));
if (!file.exists()) {
file.mkdirs();
}
// 判断文件全路径是否为文件夹,如果是上面已经上传,不需要解压
if (new File(outPath).isDirectory()) {
continue;
}
// 输出文件路径信息
result.add(outPath);
OutputStream out = new FileOutputStream(outPath);
byte[] buf1 = new byte[1024];
int len;
while ((len = in.read(buf1)) > 0) {
out.write(buf1, 0, len);
}
in.close();
out.close();
}
return result;
}
/**
* 解析csv文件 到一个list中 每个单元个为一个String类型记录,每一行为一个list。 再将所有的行放到一个总list中
*
* @param file
* 要解析的cvs文件
* @param charsetName
* 指定的字符编号
* @return
* @throws IOException
*/
public static List<List<String>> readCSVFile(String file, String charsetName) throws IOException {
if (file == null || !file.contains(".csv")) {
return null;
}
InputStreamReader fr = new InputStreamReader(new FileInputStream(file), charsetName); | BufferedReader br = new BufferedReader(fr);
String rec = null;// 一行
String str;// 一个单元格
List<List<String>> listFile = new ArrayList<List<String>>();
try {
// 读取一行
while ((rec = br.readLine()) != null) {
Pattern pCells = Pattern.compile("(\"[^\"]*(\"{2})*[^\"]*\")*[^,]*,");
Matcher mCells = pCells.matcher(rec);
List<String> cells = new ArrayList<String>();// 每行记录一个list
// 读取每个单元格
while (mCells.find()) {
str = mCells.group();
str = str.replaceAll("(?sm)\"?([^\"]*(\"{2})*[^\"]*)\"?.*,", "$1");
str = str.replaceAll("(?sm)(\"(\"))", "$2");
cells.add(str);
}
listFile.add(cells);
}
} catch (Exception e) {
LOG.error("异常", e);
} finally {
if (fr != null) {
fr.close();
}
if (br != null) {
br.close();
}
}
return listFile;
}
} | repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\reconciliation\utils\FileUtils.java | 2 |
请完成以下Java代码 | public static void validate(final Properties ctx)
{
try
{
checkSequences(ctx);
}
catch (final Exception e)
{
s_log.error("validate", e);
}
} // validate
/**
* Check/Initialize DocumentNo/Value Sequences for all Clients
*
* @param ctx context
* @param sp server process or null
*/
private static void checkClientSequences(final Properties ctx)
{ | final IClientDAO clientDAO = Services.get(IClientDAO.class);
final String trxName = null;
// Sequence for DocumentNo/Value
for (final I_AD_Client client : clientDAO.retrieveAllClients(ctx))
{
if (!client.isActive())
{
continue;
}
MSequence.checkClientSequences(ctx, client.getAD_Client_ID(), trxName);
}
} // checkClientSequences
} // SequenceCheck | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\process\SequenceCheck.java | 1 |
请完成以下Java代码 | public String getWebParam6 ()
{
return (String)get_Value(COLUMNNAME_WebParam6);
}
/** Set Web Store EMail.
@param WStoreEMail
EMail address used as the sender (From)
*/
public void setWStoreEMail (String WStoreEMail)
{
set_Value (COLUMNNAME_WStoreEMail, WStoreEMail);
}
/** Get Web Store EMail.
@return EMail address used as the sender (From)
*/
public String getWStoreEMail ()
{
return (String)get_Value(COLUMNNAME_WStoreEMail);
}
/** Set Web Store.
@param W_Store_ID
A Web Store of the Client
*/
public void setW_Store_ID (int W_Store_ID)
{
if (W_Store_ID < 1)
set_ValueNoCheck (COLUMNNAME_W_Store_ID, null);
else
set_ValueNoCheck (COLUMNNAME_W_Store_ID, Integer.valueOf(W_Store_ID));
}
/** Get Web Store.
@return A Web Store of the Client
*/
public int getW_Store_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_W_Store_ID);
if (ii == null) | return 0;
return ii.intValue();
}
/** Set WebStore User.
@param WStoreUser
User ID of the Web Store EMail address
*/
public void setWStoreUser (String WStoreUser)
{
set_Value (COLUMNNAME_WStoreUser, WStoreUser);
}
/** Get WebStore User.
@return User ID of the Web Store EMail address
*/
public String getWStoreUser ()
{
return (String)get_Value(COLUMNNAME_WStoreUser);
}
/** Set WebStore Password.
@param WStoreUserPW
Password of the Web Store EMail address
*/
public void setWStoreUserPW (String WStoreUserPW)
{
set_Value (COLUMNNAME_WStoreUserPW, WStoreUserPW);
}
/** Get WebStore Password.
@return Password of the Web Store EMail address
*/
public String getWStoreUserPW ()
{
return (String)get_Value(COLUMNNAME_WStoreUserPW);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_W_Store.java | 1 |
请完成以下Java代码 | protected void writeAdditionalAttributes(BaseElement element, BpmnModel model, XMLStreamWriter xtw) throws Exception {
StartEvent startEvent = (StartEvent) element;
writeQualifiedAttribute(ATTRIBUTE_EVENT_START_INITIATOR, startEvent.getInitiator(), xtw);
writeQualifiedAttribute(ATTRIBUTE_FORM_FORMKEY, startEvent.getFormKey(), xtw);
writeQualifiedAttribute(ATTRIBUTE_FORM_FIELD_VALIDATION, startEvent.getValidateFormFields(), xtw);
if (!startEvent.isSameDeployment()) {
// default value is true
writeQualifiedAttribute(ATTRIBUTE_SAME_DEPLOYMENT, "false", xtw);
}
if ((startEvent.getEventDefinitions() != null && startEvent.getEventDefinitions().size() > 0) ||
(startEvent.getExtensionElements() != null && startEvent.getExtensionElements().containsKey(ELEMENT_EVENT_TYPE))) {
writeDefaultAttribute(ATTRIBUTE_EVENT_START_INTERRUPTING, String.valueOf(startEvent.isInterrupting()), xtw);
}
} | @Override
protected boolean writeExtensionChildElements(BaseElement element, boolean didWriteExtensionStartElement, XMLStreamWriter xtw) throws Exception {
StartEvent startEvent = (StartEvent) element;
didWriteExtensionStartElement = BpmnXMLUtil.writeIOParameters(ELEMENT_IN_PARAMETERS, startEvent.getInParameters(), didWriteExtensionStartElement, xtw);
didWriteExtensionStartElement = writeVariableListenerDefinition(startEvent, didWriteExtensionStartElement, xtw);
didWriteExtensionStartElement = writeFormProperties(startEvent, didWriteExtensionStartElement, xtw);
return didWriteExtensionStartElement;
}
@Override
protected void writeAdditionalChildElements(BaseElement element, BpmnModel model, XMLStreamWriter xtw) throws Exception {
StartEvent startEvent = (StartEvent) element;
writeEventDefinitions(startEvent, startEvent.getEventDefinitions(), model, xtw);
}
} | repos\flowable-engine-main\modules\flowable-bpmn-converter\src\main\java\org\flowable\bpmn\converter\StartEventXMLConverter.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class HUTraceEventQuery
{
public enum RecursionMode
{
BACKWARD, FORWARD, BOTH, NONE
}
@NonNull
@Default
RecursionMode recursionMode = RecursionMode.NONE;
public enum EventTimeOperator
{
/**
* only expects {@link #eventTime} to be set.
*/
EQUAL,
/**
* Expects both {@link #eventTime} and {@link #eventTimeTo} to be set.
*/
BETWEEN
}
@Default
EventTimeOperator eventTimeOperator = EventTimeOperator.EQUAL;
Instant eventTime;
Instant eventTimeTo;
@NonNull
@Default
OptionalInt huTraceEventId = OptionalInt.empty();
OrgId orgId;
@NonNull
@Singular
ImmutableSet<HUTraceType> types;
@NonNull
@Singular | ImmutableSet<HuId> vhuIds;
ProductId productId;
@Nullable Quantity qty;
String vhuStatus;
@Singular
@NonNull
ImmutableSet<HuId> topLevelHuIds;
HuId vhuSourceId;
int inOutId;
ShipmentScheduleId shipmentScheduleId;
int movementId;
@Nullable InventoryId inventoryId;
int ppCostCollectorId;
int ppOrderId;
String docStatus;
@NonNull
@Default
Optional<DocTypeId> docTypeId = Optional.empty();
int huTrxLineId;
@Nullable String lotNumber;
/**
* In case it is not specified, only the active records are considered when querying for other criteria
*/
@Nullable
Boolean isActive;
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\trace\HUTraceEventQuery.java | 2 |
请完成以下Java代码 | public DeploymentOperationBuilder addStep(DeploymentOperationStep step) {
steps.add(step);
return this;
}
public DeploymentOperationBuilder addSteps(Collection<DeploymentOperationStep> steps) {
for (DeploymentOperationStep step: steps) {
addStep(step);
}
return this;
}
public DeploymentOperationBuilder addAttachment(String name, Object value) {
initialAttachments.put(name, value);
return this;
}
public DeploymentOperationBuilder setUndeploymentOperation() { | isUndeploymentOperation = true;
return this;
}
public void execute() {
DeploymentOperation operation = new DeploymentOperation(name, container, steps);
operation.isRollbackOnFailure = !isUndeploymentOperation;
operation.attachments.putAll(initialAttachments);
container.executeDeploymentOperation(operation);
}
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\container\impl\spi\DeploymentOperation.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class SysClientDetailsServiceImpl implements SysClientDetailsService {
private final SysClientDetailsRepository sysClientDetailsRepository;
private final PasswordEncoder passwordEncoder;
@Override
public ClientDetails loadClientByClientId(String id) throws ClientRegistrationException {
return sysClientDetailsRepository.findFirstByClientId(id).orElseThrow(() -> new ClientRegistrationException("Loading client exception."));
}
@Override
public SysClientDetails findByClientId(String clientId) {
return sysClientDetailsRepository.findFirstByClientId(clientId).orElseThrow(() -> new ClientRegistrationException("Loading client exception."));
}
@Override
public void addClientDetails(SysClientDetails clientDetails) throws ClientAlreadyExistsException {
clientDetails.setId(null);
if (sysClientDetailsRepository.findFirstByClientId(clientDetails.getClientId()).isPresent()) {
throw new ClientAlreadyExistsException(String.format("Client id %s already exist.", clientDetails.getClientId()));
}
sysClientDetailsRepository.save(clientDetails);
}
@Override
public void updateClientDetails(SysClientDetails clientDetails) throws NoSuchClientException {
SysClientDetails exist = sysClientDetailsRepository.findFirstByClientId(clientDetails.getClientId()).orElseThrow(() -> new NoSuchClientException("No such client!"));
clientDetails.setClientSecret(exist.getClientSecret());
sysClientDetailsRepository.save(clientDetails);
} | @Override
public void updateClientSecret(String clientId, String clientSecret) throws NoSuchClientException {
SysClientDetails exist = sysClientDetailsRepository.findFirstByClientId(clientId).orElseThrow(() -> new NoSuchClientException("No such client!"));
exist.setClientSecret(passwordEncoder.encode(clientSecret));
sysClientDetailsRepository.save(exist);
}
@Override
public void removeClientDetails(String clientId) throws NoSuchClientException {
sysClientDetailsRepository.deleteByClientId(clientId);
}
@Override
public List<SysClientDetails> findAll() {
return sysClientDetailsRepository.findAll();
}
} | repos\spring-boot-demo-master\demo-oauth\oauth-authorization-server\src\main\java\com\xkcoding\oauth\service\impl\SysClientDetailsServiceImpl.java | 2 |
请完成以下Java代码 | public void setCharset(@Nullable String charset) {
this.charset = charset;
}
@Override
public boolean checkResource(Locale locale) throws Exception {
Resource resource = getResource();
return resource != null;
}
@Override
protected void renderMergedTemplateModel(Map<String, Object> model, HttpServletRequest request,
HttpServletResponse response) throws Exception {
Resource resource = getResource();
Assert.state(resource != null, "'resource' must not be null");
Template template = createTemplate(resource);
if (template != null) {
template.execute(model, response.getWriter());
}
}
private @Nullable Resource getResource() {
ApplicationContext applicationContext = getApplicationContext();
String url = getUrl();
if (applicationContext == null || url == null) {
return null;
}
Resource resource = applicationContext.getResource(url);
return (resource.exists()) ? resource : null;
} | private Template createTemplate(Resource resource) throws IOException {
try (Reader reader = getReader(resource)) {
Assert.state(this.compiler != null, "'compiler' must not be null");
return this.compiler.compile(reader);
}
}
private Reader getReader(Resource resource) throws IOException {
if (this.charset != null) {
return new InputStreamReader(resource.getInputStream(), this.charset);
}
return new InputStreamReader(resource.getInputStream());
}
} | repos\spring-boot-4.0.1\module\spring-boot-mustache\src\main\java\org\springframework\boot\mustache\servlet\view\MustacheView.java | 1 |
请完成以下Java代码 | public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getMemberId() {
return memberId;
}
public void setMemberId(Long memberId) {
this.memberId = memberId;
}
public Long getTagId() {
return tagId;
}
public void setTagId(Long tagId) {
this.tagId = tagId; | }
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", memberId=").append(memberId);
sb.append(", tagId=").append(tagId);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
} | repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\UmsMemberMemberTagRelation.java | 1 |
请完成以下Java代码 | public class X_C_BPartner_QuickInput_RelatedRecord1 extends org.compiere.model.PO implements I_C_BPartner_QuickInput_RelatedRecord1, org.compiere.model.I_Persistent
{
private static final long serialVersionUID = 1616554338L;
/** Standard Constructor */
public X_C_BPartner_QuickInput_RelatedRecord1 (final Properties ctx, final int C_BPartner_QuickInput_RelatedRecord1_ID, @Nullable final String trxName)
{
super (ctx, C_BPartner_QuickInput_RelatedRecord1_ID, trxName);
}
/** Load Constructor */
public X_C_BPartner_QuickInput_RelatedRecord1 (final Properties ctx, final ResultSet rs, @Nullable final String trxName)
{
super (ctx, rs, trxName);
}
/** Load Meta Data */
@Override
protected org.compiere.model.POInfo initPO(final Properties ctx)
{
return org.compiere.model.POInfo.getPOInfo(Table_Name);
}
@Override
public org.compiere.model.I_C_BPartner_QuickInput getC_BPartner_QuickInput()
{
return get_ValueAsPO(COLUMNNAME_C_BPartner_QuickInput_ID, org.compiere.model.I_C_BPartner_QuickInput.class);
}
@Override
public void setC_BPartner_QuickInput(final org.compiere.model.I_C_BPartner_QuickInput C_BPartner_QuickInput)
{
set_ValueFromPO(COLUMNNAME_C_BPartner_QuickInput_ID, org.compiere.model.I_C_BPartner_QuickInput.class, C_BPartner_QuickInput);
}
@Override
public void setC_BPartner_QuickInput_ID (final int C_BPartner_QuickInput_ID)
{
if (C_BPartner_QuickInput_ID < 1)
set_Value (COLUMNNAME_C_BPartner_QuickInput_ID, null);
else
set_Value (COLUMNNAME_C_BPartner_QuickInput_ID, C_BPartner_QuickInput_ID);
}
@Override
public int getC_BPartner_QuickInput_ID()
{
return get_ValueAsInt(COLUMNNAME_C_BPartner_QuickInput_ID);
}
@Override
public void setC_BPartner_QuickInput_RelatedRecord1_ID (final int C_BPartner_QuickInput_RelatedRecord1_ID)
{ | if (C_BPartner_QuickInput_RelatedRecord1_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_BPartner_QuickInput_RelatedRecord1_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_BPartner_QuickInput_RelatedRecord1_ID, C_BPartner_QuickInput_RelatedRecord1_ID);
}
@Override
public int getC_BPartner_QuickInput_RelatedRecord1_ID()
{
return get_ValueAsInt(COLUMNNAME_C_BPartner_QuickInput_RelatedRecord1_ID);
}
@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);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_BPartner_QuickInput_RelatedRecord1.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class IssueLabelRepository
{
private final IQueryBL queryBL;
public IssueLabelRepository(final IQueryBL queryBL)
{
this.queryBL = queryBL;
}
public void persistLabels(@NonNull final IssueId issueId,
@NonNull final ImmutableList<IssueLabel> issueLabels)
{
final ImmutableList<I_S_IssueLabel> newLabels =
issueLabels
.stream()
.map(label -> of(issueId, label))
.collect(ImmutableList.toImmutableList());
final ImmutableList<I_S_IssueLabel> existingLabels = getRecordsByIssueId(issueId);
persistLabels(newLabels, existingLabels);
}
@VisibleForTesting
@NonNull
ImmutableList<I_S_IssueLabel> getRecordsByIssueId(@NonNull final IssueId issueId)
{
return queryBL.createQueryBuilder(I_S_IssueLabel.class)
.addOnlyActiveRecordsFilter()
.addEqualsFilter(I_S_IssueLabel.COLUMNNAME_S_Issue_ID, issueId.getRepoId())
.create()
.list()
.stream()
.collect(ImmutableList.toImmutableList());
}
@NonNull
private I_S_IssueLabel of(@NonNull final IssueId issueId, @NonNull final IssueLabel issueLabel)
{
final I_S_IssueLabel record = InterfaceWrapperHelper.newInstance(I_S_IssueLabel.class);
record.setS_Issue_ID(issueId.getRepoId());
record.setAD_Org_ID(issueLabel.getOrgId().getRepoId());
record.setLabel(issueLabel.getValue());
return record;
}
private void persistLabels(@NonNull final List<I_S_IssueLabel> newLabels,
@NonNull final List<I_S_IssueLabel> existingLabels)
{
if (Check.isEmpty(newLabels))
{
InterfaceWrapperHelper.deleteAll(existingLabels);
return;
}
final List<I_S_IssueLabel> recordsToInsert = | newLabels
.stream()
.filter(label -> existingLabels
.stream()
.noneMatch(record -> areEqual(record, label))
)
.collect(Collectors.toList());
final List<I_S_IssueLabel> recordsToDelete = existingLabels
.stream()
.filter(record -> newLabels
.stream()
.noneMatch(label -> areEqual(record, label))
)
.collect(Collectors.toList());
InterfaceWrapperHelper.deleteAll(recordsToDelete);
InterfaceWrapperHelper.saveAll(recordsToInsert);
}
private boolean areEqual(@NonNull final I_S_IssueLabel record1,
@NonNull final I_S_IssueLabel record2)
{
return record1.getLabel().equalsIgnoreCase(record2.getLabel());
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.serviceprovider\src\main\java\de\metas\serviceprovider\external\label\IssueLabelRepository.java | 2 |
请完成以下Java代码 | final class ASIDocumentValuesSupplier implements DocumentValuesSupplier
{
private static final String VERSION = "0";
private final Supplier<DocumentId> documentIdSupplier;
private final Map<String, Object> values;
@Builder
private ASIDocumentValuesSupplier(
@NonNull final Supplier<DocumentId> documentIdSupplier,
@Nullable final Map<String, Object> values)
{
this.documentIdSupplier = documentIdSupplier;
this.values = values != null ? values : ImmutableMap.of();
}
@Override
public DocumentId getDocumentId()
{
return documentIdSupplier.get();
}
@Override
public String getVersion()
{
return VERSION;
} | @Override
public Object getValue(final DocumentFieldDescriptor fieldDescriptor)
{
final String fieldName = fieldDescriptor.getFieldName();
if (values.containsKey(fieldName))
{
return values.get(fieldName);
}
else
{
return NO_VALUE;
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\pattribute\ASIDocumentValuesSupplier.java | 1 |
请完成以下Java代码 | public MeterProvider<Counter> getAttemptCounter() {
return this.attemptCounter;
}
public MeterProvider<DistributionSummary> getSentMessageSizeDistribution() {
return this.sentMessageSizeDistribution;
}
public MeterProvider<DistributionSummary> getReceivedMessageSizeDistribution() {
return this.receivedMessageSizeDistribution;
}
public MeterProvider<Timer> getClientAttemptDuration() {
return this.clientAttemptDuration;
}
public MeterProvider<Timer> getClientCallDuration() {
return this.clientCallDuration;
}
public static Builder newBuilder() {
return new Builder();
}
static class Builder {
private MeterProvider<Counter> attemptCounter;
private MeterProvider<DistributionSummary> sentMessageSizeDistribution;
private MeterProvider<DistributionSummary> receivedMessageSizeDistribution;
private MeterProvider<Timer> clientAttemptDuration;
private MeterProvider<Timer> clientCallDuration;
private Builder() {}
public Builder setAttemptCounter(MeterProvider<Counter> counter) {
this.attemptCounter = counter;
return this;
}
public Builder setSentMessageSizeDistribution(MeterProvider<DistributionSummary> distribution) {
this.sentMessageSizeDistribution = distribution;
return this;
} | public Builder setReceivedMessageSizeDistribution(MeterProvider<DistributionSummary> distribution) {
this.receivedMessageSizeDistribution = distribution;
return this;
}
public Builder setClientAttemptDuration(MeterProvider<Timer> timer) {
this.clientAttemptDuration = timer;
return this;
}
public Builder setClientCallDuration(MeterProvider<Timer> timer) {
this.clientCallDuration = timer;
return this;
}
public MetricsClientMeters build() {
return new MetricsClientMeters(this);
}
}
} | repos\grpc-spring-master\grpc-client-spring-boot-starter\src\main\java\net\devh\boot\grpc\client\metrics\MetricsClientMeters.java | 1 |
请完成以下Java代码 | protected void save(List<EdgeEventEntity> entities) {
transactionTemplate.execute(new TransactionCallbackWithoutResult() {
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) {
jdbcTemplate.batchUpdate(INSERT, new BatchPreparedStatementSetter() {
@Override
public void setValues(PreparedStatement ps, int i) throws SQLException {
EdgeEventEntity edgeEvent = entities.get(i);
ps.setObject(1, edgeEvent.getId());
ps.setLong(2, edgeEvent.getCreatedTime());
ps.setObject(3, edgeEvent.getEdgeId());
ps.setString(4, edgeEvent.getEdgeEventType().name());
ps.setString(5, edgeEvent.getEdgeEventUid());
ps.setObject(6, edgeEvent.getEntityId());
ps.setString(7, edgeEvent.getEdgeEventAction().name());
ps.setString(8, edgeEvent.getEntityBody() != null | ? edgeEvent.getEntityBody().toString()
: null);
ps.setObject(9, edgeEvent.getTenantId());
ps.setLong(10, edgeEvent.getTs());
}
@Override
public int getBatchSize() {
return entities.size();
}
});
}
});
}
} | repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\sql\edge\EdgeEventInsertRepository.java | 1 |
请完成以下Java代码 | public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Date getCompleteTime() {
return completeTime;
}
public void setCompleteTime(Date completeTime) {
this.completeTime = completeTime;
}
public String getSourceProcessDefinitionId() {
return sourceProcessDefinitionId;
}
public void setSourceProcessDefinitionId(String sourceProcessDefinitionId) {
this.sourceProcessDefinitionId = sourceProcessDefinitionId;
}
public String getTargetProcessDefinitionId() {
return targetProcessDefinitionId;
}
public void setTargetProcessDefinitionId(String targetProcessDefinitionId) {
this.targetProcessDefinitionId = targetProcessDefinitionId;
}
public List<ProcessInstanceBatchMigrationPartResult> getAllMigrationParts() {
return allMigrationParts;
}
public void addMigrationPart(ProcessInstanceBatchMigrationPartResult migrationPart) {
if (allMigrationParts == null) {
allMigrationParts = new ArrayList<>();
}
allMigrationParts.add(migrationPart);
if (!STATUS_COMPLETED.equals(migrationPart.getStatus())) { | if (waitingMigrationParts == null) {
waitingMigrationParts = new ArrayList<>();
}
waitingMigrationParts.add(migrationPart);
} else {
if (RESULT_SUCCESS.equals(migrationPart.getResult())) {
if (succesfulMigrationParts == null) {
succesfulMigrationParts = new ArrayList<>();
}
succesfulMigrationParts.add(migrationPart);
} else {
if (failedMigrationParts == null) {
failedMigrationParts = new ArrayList<>();
}
failedMigrationParts.add(migrationPart);
}
}
}
public List<ProcessInstanceBatchMigrationPartResult> getSuccessfulMigrationParts() {
return succesfulMigrationParts;
}
public List<ProcessInstanceBatchMigrationPartResult> getFailedMigrationParts() {
return failedMigrationParts;
}
public List<ProcessInstanceBatchMigrationPartResult> getWaitingMigrationParts() {
return waitingMigrationParts;
}
} | repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\migration\ProcessInstanceBatchMigrationResult.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public AppDeploymentQueryImpl deploymentTenantId(String tenantId) {
if (tenantId == null) {
throw new FlowableIllegalArgumentException("deploymentTenantId is null");
}
this.tenantId = tenantId;
return this;
}
@Override
public AppDeploymentQueryImpl deploymentTenantIdLike(String tenantIdLike) {
if (tenantIdLike == null) {
throw new FlowableIllegalArgumentException("deploymentTenantIdLike is null");
}
this.tenantIdLike = tenantIdLike;
return this;
}
@Override
public AppDeploymentQueryImpl deploymentWithoutTenantId() {
this.withoutTenantId = true;
return this;
}
@Override
public AppDeploymentQueryImpl latest() {
if (key == null) {
throw new FlowableIllegalArgumentException("latest can only be used together with a deployment key");
}
this.latest = true;
return this;
}
// sorting ////////////////////////////////////////////////////////
@Override
public AppDeploymentQuery orderByDeploymentId() {
return orderBy(AppDeploymentQueryProperty.DEPLOYMENT_ID);
}
@Override
public AppDeploymentQuery orderByDeploymentTime() {
return orderBy(AppDeploymentQueryProperty.DEPLOY_TIME);
}
@Override
public AppDeploymentQuery orderByDeploymentName() {
return orderBy(AppDeploymentQueryProperty.DEPLOYMENT_NAME);
}
@Override
public AppDeploymentQuery orderByTenantId() {
return orderBy(AppDeploymentQueryProperty.DEPLOYMENT_TENANT_ID);
}
// results ////////////////////////////////////////////////////////
@Override
public long executeCount(CommandContext commandContext) {
return CommandContextUtil.getAppDeploymentEntityManager(commandContext).findDeploymentCountByQueryCriteria(this);
}
@Override
public List<AppDeployment> executeList(CommandContext commandContext) { | return CommandContextUtil.getAppDeploymentEntityManager(commandContext).findDeploymentsByQueryCriteria(this);
}
// getters ////////////////////////////////////////////////////////
public String getDeploymentId() {
return deploymentId;
}
public List<String> getDeploymentIds() {
return deploymentIds;
}
public String getName() {
return name;
}
public String getNameLike() {
return nameLike;
}
public String getCategory() {
return category;
}
public String getCategoryNotEquals() {
return categoryNotEquals;
}
public String getKey() {
return key;
}
public boolean isLatest() {
return latest;
}
public String getTenantId() {
return tenantId;
}
public String getTenantIdLike() {
return tenantIdLike;
}
public boolean isWithoutTenantId() {
return withoutTenantId;
}
} | repos\flowable-engine-main\modules\flowable-app-engine\src\main\java\org\flowable\app\engine\impl\repository\AppDeploymentQueryImpl.java | 2 |
请完成以下Java代码 | public void setM_FreightCost_NormalVAT_Product_ID (final int M_FreightCost_NormalVAT_Product_ID)
{
if (M_FreightCost_NormalVAT_Product_ID < 1)
set_Value (COLUMNNAME_M_FreightCost_NormalVAT_Product_ID, null);
else
set_Value (COLUMNNAME_M_FreightCost_NormalVAT_Product_ID, M_FreightCost_NormalVAT_Product_ID);
}
@Override
public int getM_FreightCost_NormalVAT_Product_ID()
{
return get_ValueAsInt(COLUMNNAME_M_FreightCost_NormalVAT_Product_ID);
}
@Override
public void setM_FreightCost_ReducedVAT_Product_ID (final int M_FreightCost_ReducedVAT_Product_ID)
{
if (M_FreightCost_ReducedVAT_Product_ID < 1)
set_Value (COLUMNNAME_M_FreightCost_ReducedVAT_Product_ID, null);
else
set_Value (COLUMNNAME_M_FreightCost_ReducedVAT_Product_ID, M_FreightCost_ReducedVAT_Product_ID);
}
@Override
public int getM_FreightCost_ReducedVAT_Product_ID()
{
return get_ValueAsInt(COLUMNNAME_M_FreightCost_ReducedVAT_Product_ID);
}
@Override
public void setM_PriceList_ID (final int M_PriceList_ID)
{
if (M_PriceList_ID < 1)
set_Value (COLUMNNAME_M_PriceList_ID, null);
else
set_Value (COLUMNNAME_M_PriceList_ID, M_PriceList_ID);
}
@Override
public int getM_PriceList_ID()
{
return get_ValueAsInt(COLUMNNAME_M_PriceList_ID); | }
/**
* ProductLookup AD_Reference_ID=541499
* Reference name: _ProductLookup
*/
public static final int PRODUCTLOOKUP_AD_Reference_ID=541499;
/** Product Id = ProductId */
public static final String PRODUCTLOOKUP_ProductId = "ProductId";
/** Product Number = ProductNumber */
public static final String PRODUCTLOOKUP_ProductNumber = "ProductNumber";
@Override
public void setProductLookup (final java.lang.String ProductLookup)
{
set_Value (COLUMNNAME_ProductLookup, ProductLookup);
}
@Override
public java.lang.String getProductLookup()
{
return get_ValueAsString(COLUMNNAME_ProductLookup);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.externalsystem\src\main\java-gen\de\metas\externalsystem\model\X_ExternalSystem_Config_Shopware6.java | 1 |
请完成以下Java代码 | public void remove() {
throw new UnsupportedOperationException("InfoProperties are immutable.");
}
}
/**
* Property entry.
*/
public static final class Entry {
private final String key;
private final String value; | private Entry(String key, String value) {
this.key = key;
this.value = value;
}
public String getKey() {
return this.key;
}
public String getValue() {
return this.value;
}
}
} | repos\spring-boot-4.0.1\core\spring-boot\src\main\java\org\springframework\boot\info\InfoProperties.java | 1 |
请完成以下Java代码 | public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Repository other = (Repository) obj;
if (this.name == null) {
if (other.name != null) {
return false;
}
}
else if (!this.name.equals(other.name)) {
return false;
}
if (this.releasesEnabled != other.releasesEnabled) {
return false;
}
if (this.snapshotsEnabled != other.snapshotsEnabled) {
return false;
}
if (this.url == null) {
if (other.url != null) {
return false;
}
}
else if (!this.url.equals(other.url)) {
return false; | }
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((this.name == null) ? 0 : this.name.hashCode());
result = prime * result + (this.releasesEnabled ? 1231 : 1237);
result = prime * result + (this.snapshotsEnabled ? 1231 : 1237);
result = prime * result + ((this.url == null) ? 0 : this.url.hashCode());
return result;
}
@Override
public String toString() {
return new StringJoiner(", ", Repository.class.getSimpleName() + "[", "]").add("name='" + this.name + "'")
.add("url=" + this.url)
.add("releasesEnabled=" + this.releasesEnabled)
.add("snapshotsEnabled=" + this.snapshotsEnabled)
.toString();
}
} | repos\initializr-main\initializr-metadata\src\main\java\io\spring\initializr\metadata\Repository.java | 1 |
请完成以下Java代码 | public void setSupervisor_ID (int Supervisor_ID)
{
if (Supervisor_ID < 1)
set_Value (COLUMNNAME_Supervisor_ID, null);
else
set_Value (COLUMNNAME_Supervisor_ID, Integer.valueOf(Supervisor_ID));
}
/** Get Vorgesetzter.
@return Supervisor for this user/organization - used for escalation and approval
*/
@Override
public int getSupervisor_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Supervisor_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/**
* WeekDay AD_Reference_ID=167
* Reference name: Weekdays
*/
public static final int WEEKDAY_AD_Reference_ID=167;
/** Sonntag = 7 */
public static final String WEEKDAY_Sonntag = "7";
/** Montag = 1 */
public static final String WEEKDAY_Montag = "1";
/** Dienstag = 2 */
public static final String WEEKDAY_Dienstag = "2";
/** Mittwoch = 3 */
public static final String WEEKDAY_Mittwoch = "3";
/** Donnerstag = 4 */ | public static final String WEEKDAY_Donnerstag = "4";
/** Freitag = 5 */
public static final String WEEKDAY_Freitag = "5";
/** Samstag = 6 */
public static final String WEEKDAY_Samstag = "6";
/** Set Day of the Week.
@param WeekDay
Day of the Week
*/
@Override
public void setWeekDay (java.lang.String WeekDay)
{
set_Value (COLUMNNAME_WeekDay, WeekDay);
}
/** Get Day of the Week.
@return Day of the Week
*/
@Override
public java.lang.String getWeekDay ()
{
return (java.lang.String)get_Value(COLUMNNAME_WeekDay);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Scheduler.java | 1 |
请完成以下Java代码 | public void setOrderByClause (java.lang.String OrderByClause)
{
set_Value (COLUMNNAME_OrderByClause, OrderByClause);
}
/** Get Sql ORDER BY.
@return Fully qualified ORDER BY clause
*/
@Override
public java.lang.String getOrderByClause ()
{
return (java.lang.String)get_Value(COLUMNNAME_OrderByClause);
}
/** Set Other SQL Clause.
@param OtherClause
Other SQL Clause
*/
@Override
public void setOtherClause (java.lang.String OtherClause)
{
set_Value (COLUMNNAME_OtherClause, OtherClause);
}
/** Get Other SQL Clause.
@return Other SQL Clause
*/
@Override
public java.lang.String getOtherClause ()
{
return (java.lang.String)get_Value(COLUMNNAME_OtherClause);
}
/** Set Verarbeiten.
@param Processing Verarbeiten */
@Override
public void setProcessing (boolean Processing)
{
set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing));
}
/** Get Verarbeiten. | @return Verarbeiten */
@Override
public boolean isProcessing ()
{
Object oo = get_Value(COLUMNNAME_Processing);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set ShowInMenu.
@param ShowInMenu ShowInMenu */
@Override
public void setShowInMenu (boolean ShowInMenu)
{
set_Value (COLUMNNAME_ShowInMenu, Boolean.valueOf(ShowInMenu));
}
/** Get ShowInMenu.
@return ShowInMenu */
@Override
public boolean isShowInMenu ()
{
Object oo = get_Value(COLUMNNAME_ShowInMenu);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_InfoWindow.java | 1 |
请完成以下Java代码 | public String getPassword() {
return password;
}
public void setPassword(String password) {
this.newPassword = password;
}
public String getSalt() {
return this.salt;
}
public void setSalt(String salt) {
this.salt = salt;
}
/**
* Special setter for MyBatis.
*/
public void setDbPassword(String password) {
this.password = password;
}
public int getRevision() {
return revision;
}
public void setRevision(int revision) {
this.revision = revision;
}
public Date getLockExpirationTime() {
return lockExpirationTime;
}
public void setLockExpirationTime(Date lockExpirationTime) {
this.lockExpirationTime = lockExpirationTime;
}
public int getAttempts() {
return attempts;
}
public void setAttempts(int attempts) {
this.attempts = attempts;
}
public void encryptPassword() {
if (newPassword != null) {
salt = generateSalt();
setDbPassword(encryptPassword(newPassword, salt));
}
}
protected String encryptPassword(String password, String salt) {
if (password == null) {
return null;
} else { | String saltedPassword = saltPassword(password, salt);
return Context.getProcessEngineConfiguration()
.getPasswordManager()
.encrypt(saltedPassword);
}
}
protected String generateSalt() {
return Context.getProcessEngineConfiguration()
.getSaltGenerator()
.generateSalt();
}
public boolean checkPasswordAgainstPolicy() {
PasswordPolicyResult result = Context.getProcessEngineConfiguration()
.getIdentityService()
.checkPasswordAgainstPolicy(newPassword, this);
return result.isValid();
}
public boolean hasNewPassword() {
return newPassword != null;
}
public String toString() {
return this.getClass().getSimpleName()
+ "[id=" + id
+ ", revision=" + revision
+ ", firstName=" + firstName
+ ", lastName=" + lastName
+ ", email=" + email
+ ", password=******" // sensitive for logging
+ ", salt=******" // sensitive for logging
+ ", lockExpirationTime=" + lockExpirationTime
+ ", attempts=" + attempts
+ "]";
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\UserEntity.java | 1 |
请完成以下Java代码 | public int getC_Async_Batch_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Async_Batch_ID);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public de.metas.async.model.I_C_Queue_WorkPackage getC_Queue_WorkPackage()
{
return get_ValueAsPO(COLUMNNAME_C_Queue_WorkPackage_ID, de.metas.async.model.I_C_Queue_WorkPackage.class);
}
@Override
public void setC_Queue_WorkPackage(de.metas.async.model.I_C_Queue_WorkPackage C_Queue_WorkPackage)
{
set_ValueFromPO(COLUMNNAME_C_Queue_WorkPackage_ID, de.metas.async.model.I_C_Queue_WorkPackage.class, C_Queue_WorkPackage);
}
/** Set WorkPackage Queue.
@param C_Queue_WorkPackage_ID WorkPackage Queue */
@Override
public void setC_Queue_WorkPackage_ID (int C_Queue_WorkPackage_ID)
{
if (C_Queue_WorkPackage_ID < 1)
set_Value (COLUMNNAME_C_Queue_WorkPackage_ID, null);
else
set_Value (COLUMNNAME_C_Queue_WorkPackage_ID, Integer.valueOf(C_Queue_WorkPackage_ID));
}
/** Get WorkPackage Queue.
@return WorkPackage Queue */
@Override
public int getC_Queue_WorkPackage_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Queue_WorkPackage_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set WorkPackage Notified.
@param C_Queue_WorkPackage_Notified_ID WorkPackage Notified */
@Override
public void setC_Queue_WorkPackage_Notified_ID (int C_Queue_WorkPackage_Notified_ID)
{
if (C_Queue_WorkPackage_Notified_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_Queue_WorkPackage_Notified_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_Queue_WorkPackage_Notified_ID, Integer.valueOf(C_Queue_WorkPackage_Notified_ID));
}
/** Get WorkPackage Notified.
@return WorkPackage Notified */ | @Override
public int getC_Queue_WorkPackage_Notified_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Queue_WorkPackage_Notified_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Notified.
@param IsNotified Notified */
@Override
public void setIsNotified (boolean IsNotified)
{
set_Value (COLUMNNAME_IsNotified, Boolean.valueOf(IsNotified));
}
/** Get Notified.
@return Notified */
@Override
public boolean isNotified ()
{
Object oo = get_Value(COLUMNNAME_IsNotified);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.async\src\main\java-gen\de\metas\async\model\X_C_Queue_WorkPackage_Notified.java | 1 |
请完成以下Java代码 | protected int get_AccessLevel()
{
return accessLevel.intValue();
}
/** Load Meta Data */
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_R_CategoryUpdates[")
.append(get_ID()).append("]");
return sb.toString();
}
public I_AD_User getAD_User() throws RuntimeException
{
return (I_AD_User)MTable.get(getCtx(), I_AD_User.Table_Name)
.getPO(getAD_User_ID(), get_TrxName()); }
/** Set User/Contact.
@param AD_User_ID
User within the system - Internal or Business Partner Contact
*/
public void setAD_User_ID (int AD_User_ID)
{
if (AD_User_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_User_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_User_ID, Integer.valueOf(AD_User_ID));
}
/** Get User/Contact.
@return User within the system - Internal or Business Partner Contact
*/
public int getAD_User_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Self-Service.
@param IsSelfService
This is a Self-Service entry or this entry can be changed via Self-Service
*/
public void setIsSelfService (boolean IsSelfService)
{
set_Value (COLUMNNAME_IsSelfService, Boolean.valueOf(IsSelfService));
} | /** Get Self-Service.
@return This is a Self-Service entry or this entry can be changed via Self-Service
*/
public boolean isSelfService ()
{
Object oo = get_Value(COLUMNNAME_IsSelfService);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
public I_R_Category getR_Category() throws RuntimeException
{
return (I_R_Category)MTable.get(getCtx(), I_R_Category.Table_Name)
.getPO(getR_Category_ID(), get_TrxName()); }
/** Set Category.
@param R_Category_ID
Request Category
*/
public void setR_Category_ID (int R_Category_ID)
{
if (R_Category_ID < 1)
set_ValueNoCheck (COLUMNNAME_R_Category_ID, null);
else
set_ValueNoCheck (COLUMNNAME_R_Category_ID, Integer.valueOf(R_Category_ID));
}
/** Get Category.
@return Request Category
*/
public int getR_Category_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_R_Category_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_R_CategoryUpdates.java | 1 |
请完成以下Java代码 | public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getMemberId() {
return memberId;
}
public void setMemberId(Long memberId) {
this.memberId = memberId;
}
public Long getProductCategoryId() {
return productCategoryId;
} | public void setProductCategoryId(Long productCategoryId) {
this.productCategoryId = productCategoryId;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", memberId=").append(memberId);
sb.append(", productCategoryId=").append(productCategoryId);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
} | repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\UmsMemberProductCategoryRelation.java | 1 |
请完成以下Java代码 | public ServerResponse.BodyBuilder location(URI location) {
this.headers.setLocation(location);
return this;
}
@Override
public ServerResponse.BodyBuilder cacheControl(CacheControl cacheControl) {
this.headers.setCacheControl(cacheControl);
return this;
}
@Override
public ServerResponse.BodyBuilder varyBy(String... requestHeaders) {
this.headers.setVary(Arrays.asList(requestHeaders));
return this;
}
@Override
public ServerResponse build() {
return build((request, response) -> null);
}
@Override
public ServerResponse build(WriteFunction writeFunction) {
return new WriteFunctionResponse(this.statusCode, this.headers, this.cookies, writeFunction);
}
@Override
public ServerResponse body(Object body) {
return GatewayEntityResponseBuilder.fromObject(body)
.status(this.statusCode)
.headers(headers -> headers.putAll(this.headers))
.cookies(cookies -> cookies.addAll(this.cookies))
.build();
}
@Override
public <T> ServerResponse body(T body, ParameterizedTypeReference<T> bodyType) {
return GatewayEntityResponseBuilder.fromObject(body, bodyType)
.status(this.statusCode)
.headers(headers -> headers.putAll(this.headers))
.cookies(cookies -> cookies.addAll(this.cookies))
.build();
}
@Override
public ServerResponse render(String name, Object... modelAttributes) {
return new GatewayRenderingResponseBuilder(name).status(this.statusCode)
.headers(headers -> headers.putAll(this.headers))
.cookies(cookies -> cookies.addAll(this.cookies))
.modelAttributes(modelAttributes)
.build();
}
@Override
public ServerResponse render(String name, Map<String, ?> model) {
return new GatewayRenderingResponseBuilder(name).status(this.statusCode)
.headers(headers -> headers.putAll(this.headers)) | .cookies(cookies -> cookies.addAll(this.cookies))
.modelAttributes(model)
.build();
}
@Override
public ServerResponse stream(Consumer<ServerResponse.StreamBuilder> streamConsumer) {
return GatewayStreamingServerResponse.create(this.statusCode, this.headers, this.cookies, streamConsumer, null);
}
private static class WriteFunctionResponse extends AbstractGatewayServerResponse {
private final WriteFunction writeFunction;
WriteFunctionResponse(HttpStatusCode statusCode, HttpHeaders headers, MultiValueMap<String, Cookie> cookies,
WriteFunction writeFunction) {
super(statusCode, headers, cookies);
Objects.requireNonNull(writeFunction, "WriteFunction must not be null");
this.writeFunction = writeFunction;
}
@Override
protected @Nullable ModelAndView writeToInternal(HttpServletRequest request, HttpServletResponse response,
Context context) throws Exception {
return this.writeFunction.write(request, response);
}
}
} | repos\spring-cloud-gateway-main\spring-cloud-gateway-server-webmvc\src\main\java\org\springframework\cloud\gateway\server\mvc\handler\GatewayServerResponseBuilder.java | 1 |
请完成以下Java代码 | public String getSingleTableName()
{
final ImmutableSet<String> tableNames = recordRefs.stream()
.map(TableRecordReference::getTableName)
.collect(ImmutableSet.toImmutableSet());
if (tableNames.isEmpty())
{
throw new AdempiereException("No tablename");
}
else if (tableNames.size() == 1)
{
return tableNames.iterator().next();
}
else
{
throw new AdempiereException("More than one tablename found: " + tableNames);
}
}
public Set<TableRecordReference> toSet() {return recordRefs;}
public Set<Integer> toIntSet()
{
// just to make sure that our records are from a single table
getSingleTableName();
return recordRefs.stream()
.map(TableRecordReference::getRecord_ID)
.collect(ImmutableSet.toImmutableSet());
}
public int size()
{
return recordRefs.size();
}
@NonNull
public AdTableId getSingleTableId()
{
final ImmutableSet<AdTableId> tableIds = getTableIds();
if (tableIds.isEmpty())
{
throw new AdempiereException("No AD_Table_ID");
}
else if (tableIds.size() == 1)
{
return tableIds.iterator().next();
}
else
{
throw new AdempiereException("More than one AD_Table_ID found: " + tableIds);
}
}
public void assertSingleTableName()
{ | final ImmutableSet<AdTableId> tableIds = getTableIds();
if (tableIds.isEmpty())
{
throw new AdempiereException("No AD_Table_ID");
}
else if (tableIds.size() != 1)
{
throw new AdempiereException("More than one AD_Table_ID found: " + tableIds);
}
}
public Stream<TableRecordReference> streamReferences()
{
return recordRefs.stream();
}
@NonNull
private ImmutableSet<AdTableId> getTableIds()
{
return recordRefs.stream()
.map(TableRecordReference::getAD_Table_ID)
.map(AdTableId::ofRepoId)
.collect(ImmutableSet.toImmutableSet());
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\util\lang\impl\TableRecordReferenceSet.java | 1 |
请完成以下Java代码 | private static final class AttachmentEntryItem
{
public static AttachmentEntryItem of(final AttachmentEntry entry)
{
return new AttachmentEntryItem(entry.getId(), entry.getName(), entry.getFilename());
}
private final AttachmentEntryId attachmentEntryId;
private final String displayName;
private final String filename;
@Override
public String toString()
{
return displayName;
}
@Override
public int hashCode()
{
return attachmentEntryId.hashCode();
}
@Override
public boolean equals(final Object obj)
{
if (this == obj)
{
return true;
}
if (obj instanceof AttachmentEntryItem)
{
final AttachmentEntryItem other = (AttachmentEntryItem)obj;
return attachmentEntryId == other.attachmentEntryId;
}
else
{
return false;
}
}
}
/**************************************************************************
* Graphic Image Panel
*/
class GImage extends JPanel
{
/**
*
*/
private static final long serialVersionUID = 4991225210651641722L;
/**
* Graphic Image
*/
public GImage()
{
super();
} // GImage
/** The Image */
private Image m_image = null;
/**
* Set Image
*
* @param image image
*/
public void setImage(final Image image)
{
m_image = image;
if (m_image == null)
{
return;
}
MediaTracker mt = new MediaTracker(this);
mt.addImage(m_image, 0);
try
{ | mt.waitForID(0);
}
catch (Exception e)
{
}
Dimension dim = new Dimension(m_image.getWidth(this), m_image.getHeight(this));
this.setPreferredSize(dim);
} // setImage
/**
* Paint
*
* @param g graphics
*/
@Override
public void paint(final Graphics g)
{
Insets in = getInsets();
if (m_image != null)
{
g.drawImage(m_image, in.left, in.top, this);
}
} // paint
/**
* Update
*
* @param g graphics
*/
@Override
public void update(final Graphics g)
{
paint(g);
} // update
} // GImage
} // Attachment | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\apps\Attachment.java | 1 |
请完成以下Java代码 | public class DelegateExpressionTransactionDependentExecutionListener implements TransactionDependentExecutionListener {
protected Expression expression;
public DelegateExpressionTransactionDependentExecutionListener(Expression expression) {
this.expression = expression;
}
@Override
public void notify(
String processInstanceId,
String executionId,
FlowElement flowElement,
Map<String, Object> executionVariables,
Map<String, Object> customPropertiesMap
) {
NoExecutionVariableScope scope = new NoExecutionVariableScope();
Object delegate = expression.getValue(scope);
if (delegate instanceof TransactionDependentExecutionListener) {
((TransactionDependentExecutionListener) delegate).notify(
processInstanceId,
executionId,
flowElement,
executionVariables,
customPropertiesMap
);
} else {
throw new ActivitiIllegalArgumentException( | "Delegate expression " +
expression +
" did not resolve to an implementation of " +
TransactionDependentExecutionListener.class
);
}
}
/**
* returns the expression text for this execution listener. Comes in handy if you want to check which listeners you already have.
*/
public String getExpressionText() {
return expression.getExpressionText();
}
} | repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\bpmn\listener\DelegateExpressionTransactionDependentExecutionListener.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class TodoJpaResource {
private TodoService todoService;
private TodoRepository todoRepository;
public TodoJpaResource(TodoService todoService, TodoRepository todoRepository) {
this.todoService = todoService;
this.todoRepository = todoRepository;
}
@GetMapping("/users/{username}/todos")
public List<Todo> retrieveTodos(@PathVariable String username) {
//return todoService.findByUsername(username);
return todoRepository.findByUsername(username);
}
@GetMapping("/users/{username}/todos/{id}")
public Todo retrieveTodo(@PathVariable String username,
@PathVariable int id) {
//return todoService.findById(id);
return todoRepository.findById(id).get();
}
@DeleteMapping("/users/{username}/todos/{id}")
public ResponseEntity<Void> deleteTodo(@PathVariable String username,
@PathVariable int id) {
//todoService.deleteById(id);
todoRepository.deleteById(id);
return ResponseEntity.noContent().build();
}
@PutMapping("/users/{username}/todos/{id}")
public Todo updateTodo(@PathVariable String username,
@PathVariable int id, @RequestBody Todo todo) { | //todoService.updateTodo(todo);
todoRepository.save(todo);
return todo;
}
@PostMapping("/users/{username}/todos")
public Todo createTodo(@PathVariable String username,
@RequestBody Todo todo) {
todo.setUsername(username);
todo.setId(null);
return todoRepository.save(todo);
// Todo createdTodo = todoService.addTodo(username, todo.getDescription(),
// todo.getTargetDate(),todo.isDone() );
// return createdTodo;
}
} | repos\master-spring-and-spring-boot-main\13-full-stack\02-rest-api\src\main\java\com\in28minutes\rest\webservices\restfulwebservices\todo\TodoJpaResource.java | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.