instruction
string | input
string | output
string | source_file
string | priority
int64 |
|---|---|---|---|---|
请完成以下Java代码
|
public synchronized ApplicationServerImpl getApplicationServer() {
if (applicationServer == null) {
applicationServer = PlatformDiagnosticsRegistry.getApplicationServer();
}
return applicationServer;
}
public synchronized void setApplicationServer(String applicationServerVersion) {
this.applicationServer = new ApplicationServerImpl(applicationServerVersion);
}
public Map<String, CommandCounter> getCommands() {
return commands;
}
public String getCamundaIntegration() {
return camundaIntegration;
}
public void setCamundaIntegration(String camundaIntegration) {
this.camundaIntegration = camundaIntegration;
}
public LicenseKeyDataImpl getLicenseKey() {
return licenseKey;
}
public void setLicenseKey(LicenseKeyDataImpl licenseKey) {
this.licenseKey = licenseKey;
}
public synchronized Set<String> getWebapps() {
return webapps;
}
public synchronized void setWebapps(Set<String> webapps) {
this.webapps = webapps;
}
public void markOccurrence(String name) {
markOccurrence(name, 1);
}
|
public void markOccurrence(String name, long times) {
CommandCounter counter = commands.get(name);
if (counter == null) {
synchronized (commands) {
if (counter == null) {
counter = new CommandCounter(name);
commands.put(name, counter);
}
}
}
counter.mark(times);
}
public synchronized void addWebapp(String webapp) {
if (!webapps.contains(webapp)) {
webapps.add(webapp);
}
}
public void clearCommandCounts() {
commands.clear();
}
public void clear() {
commands.clear();
licenseKey = null;
applicationServer = null;
webapps.clear();
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\diagnostics\DiagnosticsRegistry.java
| 1
|
请完成以下Java代码
|
protected void invalidateDeviceProfileCache(DeviceId deviceId, String deviceJson) {
DeviceState deviceState = deviceStates.get(deviceId);
if (deviceState != null) {
DeviceProfileId currentProfileId = deviceState.getProfileId();
try {
Device device = JacksonUtil.fromString(deviceJson, Device.class);
if (!currentProfileId.equals(device.getDeviceProfileId())) {
removeDeviceState(deviceId);
}
} catch (IllegalArgumentException e) {
log.debug("[{}] Received device update notification with non-device msg body: [{}]", ctx.getSelfId(), deviceId, e);
}
}
}
protected void invalidateDeviceProfileCache(DeviceId deviceId, DeviceProfileId deviceProfileId) {
DeviceState deviceState = deviceStates.get(deviceId);
if (deviceState != null) {
if (!deviceState.getProfileId().equals(deviceProfileId)) {
removeDeviceState(deviceId);
}
}
}
private void removeDeviceState(DeviceId deviceId) {
DeviceState state = deviceStates.remove(deviceId);
if (config.isPersistAlarmRulesState() && (state != null || !config.isFetchAlarmRulesStateOnStart())) {
ctx.removeRuleNodeStateForEntity(deviceId);
}
|
}
@Override
public TbPair<Boolean, JsonNode> upgrade(int fromVersion, JsonNode oldConfiguration) throws TbNodeException {
boolean hasChanges = false;
switch (fromVersion) {
case 0:
String persistAlarmRulesState = "persistAlarmRulesState";
String fetchAlarmRulesStateOnStart = "fetchAlarmRulesStateOnStart";
if (oldConfiguration.has(persistAlarmRulesState)) {
if (!oldConfiguration.get(persistAlarmRulesState).asBoolean()) {
hasChanges = true;
((ObjectNode) oldConfiguration).put(fetchAlarmRulesStateOnStart, false);
}
}
break;
default:
break;
}
return new TbPair<>(hasChanges, oldConfiguration);
}
}
|
repos\thingsboard-master\rule-engine\rule-engine-components\src\main\java\org\thingsboard\rule\engine\profile\TbDeviceProfileNode.java
| 1
|
请完成以下Java代码
|
public java.lang.String getPostal()
{
return get_ValueAsString(COLUMNNAME_Postal);
}
/**
* TerminationReason AD_Reference_ID=540761
* Reference name: Contracts_TerminationaReason
*/
public static final int TERMINATIONREASON_AD_Reference_ID=540761;
/** HighAge = Hi */
public static final String TERMINATIONREASON_HighAge = "Hi";
/** DidNotOrder = Dno */
public static final String TERMINATIONREASON_DidNotOrder = "Dno";
/** General = Ge */
public static final String TERMINATIONREASON_General = "Ge";
/** Religion = Rel */
public static final String TERMINATIONREASON_Religion = "Rel";
/** NoTime = Nt */
public static final String TERMINATIONREASON_NoTime = "Nt";
/** TooMuchPapers = Tmp */
public static final String TERMINATIONREASON_TooMuchPapers = "Tmp";
/** FinancialReasons = Fr */
public static final String TERMINATIONREASON_FinancialReasons = "Fr";
/** TooModern = Tm */
public static final String TERMINATIONREASON_TooModern = "Tm";
/** NoInterest = Ni */
public static final String TERMINATIONREASON_NoInterest = "Ni";
/** NewSubscriptionType = Nst */
public static final String TERMINATIONREASON_NewSubscriptionType = "Nst";
/** GiftNotRenewed = Gnr */
public static final String TERMINATIONREASON_GiftNotRenewed = "Gnr";
/** StayingForeign = Sf */
public static final String TERMINATIONREASON_StayingForeign = "Sf";
/** Died = Di */
public static final String TERMINATIONREASON_Died = "Di";
/** Sick = Si */
public static final String TERMINATIONREASON_Sick = "Si";
/** DoubleReader = Dr */
public static final String TERMINATIONREASON_DoubleReader = "Dr";
/** SubscriptionSwitch = Ss */
public static final String TERMINATIONREASON_SubscriptionSwitch = "Ss";
|
/** LimitedDelivery = Ld */
public static final String TERMINATIONREASON_LimitedDelivery = "Ld";
/** PrivateReasons = Pr */
public static final String TERMINATIONREASON_PrivateReasons = "Pr";
/** CanNotRead = Cnr */
public static final String TERMINATIONREASON_CanNotRead = "Cnr";
/** NotReachable = Nr */
public static final String TERMINATIONREASON_NotReachable = "Nr";
/** IncorrectlyRecorded = Err */
public static final String TERMINATIONREASON_IncorrectlyRecorded = "Err";
/** OrgChange = Os */
public static final String TERMINATIONREASON_OrgChange = "Os";
@Override
public void setTerminationReason (final @Nullable java.lang.String TerminationReason)
{
set_ValueNoCheck (COLUMNNAME_TerminationReason, TerminationReason);
}
@Override
public java.lang.String getTerminationReason()
{
return get_ValueAsString(COLUMNNAME_TerminationReason);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_BPartner_Export.java
| 1
|
请完成以下Java代码
|
public void showError(final String title, final Throwable ex)
{
final String message = buildErrorMessage(ex);
JOptionPane.showMessageDialog(parent, message, title, JOptionPane.ERROR_MESSAGE);
if (log.isLoggable(Level.FINE))
{
log.log(Level.FINE, title + " - " + message, ex);
}
}
private String buildErrorMessage(final Throwable ex)
{
final StringBuilder msg = new StringBuilder();
if (ex.getLocalizedMessage() != null)
{
msg.append(ex.getLocalizedMessage());
}
|
final Throwable cause = ex.getCause();
if (cause != null)
{
if (msg.length() > 0)
{
msg.append(": ");
}
msg.append(cause.toString());
}
return msg.toString();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.printing.client\src\main\java\de\metas\printing\client\ui\SwingUserInterface.java
| 1
|
请完成以下Java代码
|
public StatsTimer createStatsTimer(String type, String name, String... tags) {
return new StatsTimer(name, Timer.builder(type)
.tags(getTags(name, tags))
.register(meterRegistry));
}
private static String[] getTags(String statsName, String[] otherTags) {
String[] tags = new String[]{STATS_NAME_TAG, statsName};
if (otherTags.length > 0) {
if (otherTags.length % 2 != 0) {
throw new IllegalArgumentException("Invalid tags array size");
}
tags = ArrayUtils.addAll(tags, otherTags);
}
return tags;
}
private static class StubCounter implements Counter {
|
@Override
public void increment(double amount) {
}
@Override
public double count() {
return 0;
}
@Override
public Id getId() {
return null;
}
}
}
|
repos\thingsboard-master\common\stats\src\main\java\org\thingsboard\server\common\stats\DefaultStatsFactory.java
| 1
|
请完成以下Java代码
|
public Boolean getWithoutTenantId() {
return withoutTenantId;
}
@CamundaQueryParam(value = "withoutTenantId", converter = BooleanConverter.class)
public void setWithoutTenantId(Boolean withoutTenantId) {
this.withoutTenantId = withoutTenantId;
}
public Boolean getIncludeEventSubscriptionsWithoutTenantId() {
return includeEventSubscriptionsWithoutTenantId;
}
@CamundaQueryParam(value = "includeEventSubscriptionsWithoutTenantId", converter = BooleanConverter.class)
public void setIncludeEventSubscriptionsWithoutTenantId(Boolean includeEventSubscriptionsWithoutTenantId) {
this.includeEventSubscriptionsWithoutTenantId = includeEventSubscriptionsWithoutTenantId;
}
@Override
protected boolean isValidSortByValue(String value) {
return VALID_SORT_BY_VALUES.contains(value);
}
@Override
protected EventSubscriptionQuery createNewQuery(ProcessEngine engine) {
return engine.getRuntimeService().createEventSubscriptionQuery();
}
@Override
protected void applyFilters(EventSubscriptionQuery query) {
if (eventSubscriptionId != null) {
query.eventSubscriptionId(eventSubscriptionId);
}
if (eventName != null) {
query.eventName(eventName);
}
if (eventType != null) {
query.eventType(eventType);
|
}
if (executionId != null) {
query.executionId(executionId);
}
if (processInstanceId != null) {
query.processInstanceId(processInstanceId);
}
if (activityId != null) {
query.activityId(activityId);
}
if (tenantIdIn != null && !tenantIdIn.isEmpty()) {
query.tenantIdIn(tenantIdIn.toArray(new String[tenantIdIn.size()]));
}
if (TRUE.equals(withoutTenantId)) {
query.withoutTenantId();
}
if (TRUE.equals(includeEventSubscriptionsWithoutTenantId)) {
query.includeEventSubscriptionsWithoutTenantId();
}
}
@Override
protected void applySortBy(EventSubscriptionQuery query, String sortBy, Map<String, Object> parameters, ProcessEngine engine) {
if (sortBy.equals(SORT_BY_CREATED)) {
query.orderByCreated();
} else if (sortBy.equals(SORT_BY_TENANT_ID)) {
query.orderByTenantId();
}
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\runtime\EventSubscriptionQueryDto.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public EngineRestVariable createRestVariable(String name, Object value, boolean includeBinaryValue) {
return createRestVariable(name, value, includeBinaryValue, createUrlBuilder());
}
public EngineRestVariable createRestVariable(String name, Object value, boolean includeBinaryValue, DmnRestUrlBuilder urlBuilder) {
RestVariableConverter converter = null;
EngineRestVariable restVar = new EngineRestVariable();
restVar.setName(name);
if (value != null) {
// Try converting the value
for (RestVariableConverter c : variableConverters) {
if (c.getVariableType().isAssignableFrom(value.getClass())) {
converter = c;
break;
}
}
if (converter != null) {
converter.convertVariableValue(value, restVar);
restVar.setType(converter.getRestTypeName());
} else {
// Revert to default conversion, which is the
// serializable/byte-array form
if (value instanceof Byte[] || value instanceof byte[]) {
restVar.setType(BYTE_ARRAY_VARIABLE_TYPE);
} else {
restVar.setType(SERIALIZABLE_VARIABLE_TYPE);
}
if (includeBinaryValue) {
restVar.setValue(value);
}
}
// TODO: set url
}
return restVar;
}
/**
* Called once when the converters need to be initialized. Override of custom conversion needs to be done between Java and REST.
*/
|
protected void initializeVariableConverters() {
variableConverters.add(new StringRestVariableConverter());
variableConverters.add(new IntegerRestVariableConverter());
variableConverters.add(new LongRestVariableConverter());
variableConverters.add(new ShortRestVariableConverter());
variableConverters.add(new DoubleRestVariableConverter());
variableConverters.add(new BigDecimalRestVariableConverter());
variableConverters.add(new BigIntegerRestVariableConverter());
variableConverters.add(new BooleanRestVariableConverter());
variableConverters.add(new DateRestVariableConverter());
variableConverters.add(new InstantRestVariableConverter());
variableConverters.add(new LocalDateRestVariableConverter());
variableConverters.add(new LocalDateTimeRestVariableConverter());
variableConverters.add(new UUIDRestVariableConverter());
}
protected DmnRestUrlBuilder createUrlBuilder() {
return DmnRestUrlBuilder.fromCurrentRequest();
}
}
|
repos\flowable-engine-main\modules\flowable-dmn-rest\src\main\java\org\flowable\dmn\rest\service\api\DmnRestResponseFactory.java
| 2
|
请完成以下Java代码
|
private static void addToken(final String newToken, final StringBuilder sb)
{
if (!Check.isEmpty(newToken))
{
final String s = sb.toString();
if (!s.endsWith("\n") && !s.endsWith(" ") && !s.isEmpty())
{
sb.append(" ");
}
sb.append(newToken);
}
}
private static final Pattern PATTERN_BRACKETS = Pattern.compile("\\\\?(\\()(.+?)(\\))");
private static List<String> extractBracketsString(final AddressDisplaySequence displaySequence)
{
final Matcher m = PATTERN_BRACKETS.matcher(displaySequence.getPattern());
final List<String> bracketsTxt = new ArrayList<>();
while (m.find())
{
bracketsTxt.add(m.group());
}
|
return bracketsTxt;
}
private AddressDisplaySequence getDisplaySequence(@NonNull final I_C_Country country, final boolean isLocalAddress)
{
final CountryId countryId = CountryId.ofRepoId(country.getC_Country_ID());
final CountrySequences countrySequence = countriesRepo
.getCountrySequences(countryId, getOrgId(), getAD_Language())
.orElse(null);
if (countrySequence == null)
{
return AddressDisplaySequence.ofNullable(isLocalAddress ? country.getDisplaySequenceLocal() : country.getDisplaySequence());
}
else
{
return isLocalAddress ? countrySequence.getLocalAddressDisplaySequence() : countrySequence.getAddressDisplaySequence();
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\location\impl\AddressBuilder.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public User signUp(UserSignUpRequest request) {
final var encodedPassword = Password.of(request.getRawPassword(), passwordEncoder);
return userRepository.save(User.of(request.getEmail(),
request.getUserName(),
encodedPassword));
}
@Transactional(readOnly = true)
public Optional<User> login(Email email, String rawPassword) {
return userRepository.findFirstByEmail(email)
.filter(user -> user.matchesPassword(rawPassword, passwordEncoder));
}
@Override
@Transactional(readOnly = true)
public Optional<User> findById(long id) {
return userRepository.findById(id);
}
@Override
public Optional<User> findByUsername(UserName userName) {
return userRepository.findFirstByProfileUserName(userName);
}
|
@Transactional
public User updateUser(long id, UserUpdateRequest request) {
final var user = userRepository.findById(id).orElseThrow(NoSuchElementException::new);
request.getEmailToUpdate()
.ifPresent(user::changeEmail);
request.getUserNameToUpdate()
.ifPresent(user::changeName);
request.getPasswordToUpdate()
.map(rawPassword -> Password.of(rawPassword, passwordEncoder))
.ifPresent(user::changePassword);
request.getImageToUpdate()
.ifPresent(user::changeImage);
request.getBioToUpdate()
.ifPresent(user::changeBio);
return userRepository.save(user);
}
}
|
repos\realworld-springboot-java-master\src\main\java\io\github\raeperd\realworld\domain\user\UserService.java
| 2
|
请完成以下Java代码
|
public java.lang.String getSuchname ()
{
return (java.lang.String)get_Value(COLUMNNAME_Suchname);
}
/** Set Titel.
@param Title
Bezeichnung für diesen Eintrag
*/
@Override
public void setTitle (final java.lang.String Title)
{
set_ValueNoCheck (COLUMNNAME_Title, Title);
}
/** Get Titel.
@return Bezeichnung für diesen Eintrag
*/
@Override
public java.lang.String getTitle ()
{
return (java.lang.String)get_Value(COLUMNNAME_Title);
}
/** Set Offener Saldo.
@param TotalOpenBalance
Gesamt der offenen Beträge in primärer Buchführungswährung
*/
@Override
public void setTotalOpenBalance (final BigDecimal TotalOpenBalance)
{
set_Value (COLUMNNAME_TotalOpenBalance, TotalOpenBalance);
}
/** Get Offener Saldo.
@return Gesamt der offenen Beträge in primärer Buchführungswährung
*/
@Override
public BigDecimal getTotalOpenBalance ()
{
final BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_TotalOpenBalance);
if (bd == null)
{
return BigDecimal.ZERO;
}
return bd;
}
/** Set V_BPartnerCockpit_ID.
@param V_BPartnerCockpit_ID V_BPartnerCockpit_ID */
@Override
public void setV_BPartnerCockpit_ID (final int V_BPartnerCockpit_ID)
{
if (V_BPartnerCockpit_ID < 1)
{
set_ValueNoCheck (COLUMNNAME_V_BPartnerCockpit_ID, null);
}
else
{
set_ValueNoCheck (COLUMNNAME_V_BPartnerCockpit_ID, Integer.valueOf(V_BPartnerCockpit_ID));
}
}
|
/** Get V_BPartnerCockpit_ID.
@return V_BPartnerCockpit_ID */
@Override
public int getV_BPartnerCockpit_ID ()
{
final Integer ii = (Integer)get_Value(COLUMNNAME_V_BPartnerCockpit_ID);
if (ii == null)
{
return 0;
}
return ii.intValue();
}
/** Set Suchschlüssel.
@param value
Suchschlüssel für den Eintrag im erforderlichen Format - muss eindeutig sein
*/
@Override
public void setvalue (final java.lang.String value)
{
set_Value (COLUMNNAME_value, value);
}
/** Get Suchschlüssel.
@return Suchschlüssel für den Eintrag im erforderlichen Format - muss eindeutig sein
*/
@Override
public java.lang.String getvalue ()
{
return (java.lang.String)get_Value(COLUMNNAME_value);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java-gen\de\metas\adempiere\model\X_V_BPartnerCockpit.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public abstract class SslBundleProperties {
/**
* Key details for the bundle.
*/
private final Key key = new Key();
/**
* Options for the SSL connection.
*/
private final Options options = new Options();
/**
* SSL Protocol to use.
*/
private String protocol = SslBundle.DEFAULT_PROTOCOL;
/**
* Whether to reload the SSL bundle.
*/
private boolean reloadOnUpdate;
public Key getKey() {
return this.key;
}
public Options getOptions() {
return this.options;
}
public String getProtocol() {
return this.protocol;
}
public void setProtocol(String protocol) {
this.protocol = protocol;
}
public boolean isReloadOnUpdate() {
return this.reloadOnUpdate;
}
public void setReloadOnUpdate(boolean reloadOnUpdate) {
this.reloadOnUpdate = reloadOnUpdate;
}
public static class Options {
/**
* Supported SSL ciphers.
*/
private @Nullable Set<String> ciphers;
/**
* Enabled SSL protocols.
*/
private @Nullable Set<String> enabledProtocols;
public @Nullable Set<String> getCiphers() {
|
return this.ciphers;
}
public void setCiphers(@Nullable Set<String> ciphers) {
this.ciphers = ciphers;
}
public @Nullable Set<String> getEnabledProtocols() {
return this.enabledProtocols;
}
public void setEnabledProtocols(@Nullable Set<String> enabledProtocols) {
this.enabledProtocols = enabledProtocols;
}
}
public static class Key {
/**
* The password used to access the key in the key store.
*/
private @Nullable String password;
/**
* The alias that identifies the key in the key store.
*/
private @Nullable String alias;
public @Nullable String getPassword() {
return this.password;
}
public void setPassword(@Nullable String password) {
this.password = password;
}
public @Nullable String getAlias() {
return this.alias;
}
public void setAlias(@Nullable String alias) {
this.alias = alias;
}
}
}
|
repos\spring-boot-4.0.1\core\spring-boot-autoconfigure\src\main\java\org\springframework\boot\autoconfigure\ssl\SslBundleProperties.java
| 2
|
请完成以下Java代码
|
public class ResolveIncidentCmd implements Command<Void> {
protected String incidentId;
public ResolveIncidentCmd(String incidentId) {
EnsureUtil.ensureNotNull(BadUserRequestException.class, "", "incidentId", incidentId);
this.incidentId = incidentId;
}
@Override
public Void execute(CommandContext commandContext) {
final Incident incident = commandContext.getIncidentManager().findIncidentById(incidentId);
EnsureUtil.ensureNotNull(NotFoundException.class, "Cannot find an incident with id '" + incidentId + "'",
"incident", incident);
if (incident.getIncidentType().equals("failedJob") || incident.getIncidentType().equals("failedExternalTask")) {
throw new BadUserRequestException("Cannot resolve an incident of type " + incident.getIncidentType());
|
}
EnsureUtil.ensureNotNull(BadUserRequestException.class, "", "executionId", incident.getExecutionId());
ExecutionEntity execution = commandContext.getExecutionManager().findExecutionById(incident.getExecutionId());
EnsureUtil.ensureNotNull(BadUserRequestException.class,
"Cannot find an execution for an incident with id '" + incidentId + "'", "execution", execution);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkUpdateProcessInstance(execution);
}
commandContext.getOperationLogManager().logProcessInstanceOperation(UserOperationLogEntry.OPERATION_TYPE_RESOLVE, execution.getProcessInstanceId(),
execution.getProcessDefinitionId(), null, Collections.singletonList(new PropertyChange("incidentId", null, incidentId)));
execution.resolveIncident(incidentId);
return null;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmd\ResolveIncidentCmd.java
| 1
|
请完成以下Java代码
|
public boolean isValueChanged(final Object model, final String columnName)
{
return POJOWrapper.isValueChanged(model, columnName);
}
@Override
public boolean isValueChanged(final Object model, final Set<String> columnNames)
{
return POJOWrapper.isValueChanged(model, columnNames);
}
@Override
public boolean isNull(final Object model, final String columnName)
{
return POJOWrapper.isNull(model, columnName);
}
@Override
public <T> T getDynAttribute(final Object model, final String attributeName)
{
final T value = POJOWrapper.getDynAttribute(model, attributeName);
return value;
|
}
@Override
public Object setDynAttribute(final Object model, final String attributeName, final Object value)
{
return POJOWrapper.setDynAttribute(model, attributeName, value);
}
@Override
public <T extends PO> T getPO(final Object model, final boolean strict)
{
throw new UnsupportedOperationException("Getting PO from '" + model + "' is not supported in JUnit testing mode");
}
@Override
public Evaluatee getEvaluatee(final Object model)
{
return POJOWrapper.getWrapper(model).asEvaluatee();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\wrapper\POJOInterfaceWrapperHelper.java
| 1
|
请完成以下Java代码
|
public void setUrl(String url) {
this.url = url;
}
public String getFileType() {
return fileType;
}
public void setFileType(String fileType) {
this.fileType = fileType;
}
public String getStoreType() {
return storeType;
}
public void setStoreType(String storeType) {
this.storeType = storeType;
}
|
public Double getFileSize() {
return fileSize;
}
public void setFileSize(Double fileSize) {
this.fileSize = fileSize;
}
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
}
|
repos\JeecgBoot-main\jeecg-boot\jeecg-boot-base-core\src\main\java\org\jeecg\common\system\vo\SysFilesModel.java
| 1
|
请完成以下Java代码
|
protected AttributeSetInstanceId getM_AttributeSetInstance(final I_C_AllocationLine documentLine)
{
// shall not be called because we implement "getMaterialTrackingFromDocumentLineASI"
throw new IllegalStateException("shall not be called");
}
/**
* Loads and returns the material tracking of the invoice referenced by the given {@code documentLine}, if there is any. If there is none, it returns {@code null}.
* Analog to {@link C_Invoice#isEligibleForMaterialTracking(I_C_Invoice)}, if the invoice is a sales invoice or if it is reversed, then we don't bother trying to get its material tracking and directly return {@code null}.
*/
@Override
protected I_M_Material_Tracking getMaterialTrackingFromDocumentLineASI(final I_C_AllocationLine documentLine)
{
if (documentLine.getC_Invoice_ID() <= 0)
{
return null;
}
|
final IMaterialTrackingDAO materialTrackingDAO = Services.get(IMaterialTrackingDAO.class);
final I_C_Invoice invoice = documentLine.getC_Invoice();
// please keep in sync with the isEligible method mentioned in the javadoc.
if (Services.get(IInvoiceBL.class).isReversal(invoice))
{
return null;
}
if (invoice.isSOTrx())
{
return null;
}
final I_M_Material_Tracking materialTracking = materialTrackingDAO.retrieveSingleMaterialTrackingForModel(invoice);
return materialTracking;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.materialtracking\src\main\java\de\metas\materialtracking\model\validator\C_AllocationHdr.java
| 1
|
请完成以下Java代码
|
private static Predicate<List<String>> containsAudience() {
return (audienceClaim) -> {
if (CollectionUtils.isEmpty(audienceClaim)) {
return false;
}
List<String> audienceList = getAudience();
for (String audience : audienceClaim) {
if (audienceList.contains(audience)) {
return true;
}
}
return false;
};
}
private static List<String> getAudience() {
AuthorizationServerContext authorizationServerContext = AuthorizationServerContextHolder.getContext();
if (!StringUtils.hasText(authorizationServerContext.getIssuer())) {
return Collections.emptyList();
}
|
AuthorizationServerSettings authorizationServerSettings = authorizationServerContext
.getAuthorizationServerSettings();
List<String> audience = new ArrayList<>();
audience.add(authorizationServerContext.getIssuer());
audience.add(asUrl(authorizationServerContext.getIssuer(), authorizationServerSettings.getTokenEndpoint()));
audience.add(asUrl(authorizationServerContext.getIssuer(),
authorizationServerSettings.getTokenIntrospectionEndpoint()));
audience.add(asUrl(authorizationServerContext.getIssuer(),
authorizationServerSettings.getTokenRevocationEndpoint()));
audience.add(asUrl(authorizationServerContext.getIssuer(),
authorizationServerSettings.getPushedAuthorizationRequestEndpoint()));
return audience;
}
private static String asUrl(String issuer, String endpoint) {
return UriComponentsBuilder.fromUriString(issuer).path(endpoint).build().toUriString();
}
}
|
repos\spring-security-main\oauth2\oauth2-authorization-server\src\main\java\org\springframework\security\oauth2\server\authorization\authentication\JwtClientAssertionDecoderFactory.java
| 1
|
请完成以下Java代码
|
public void setWEBUI_KPI_Field_ID (final int WEBUI_KPI_Field_ID)
{
if (WEBUI_KPI_Field_ID < 1)
set_ValueNoCheck (COLUMNNAME_WEBUI_KPI_Field_ID, null);
else
set_ValueNoCheck (COLUMNNAME_WEBUI_KPI_Field_ID, WEBUI_KPI_Field_ID);
}
@Override
public int getWEBUI_KPI_Field_ID()
{
return get_ValueAsInt(COLUMNNAME_WEBUI_KPI_Field_ID);
}
@Override
public de.metas.ui.web.base.model.I_WEBUI_KPI getWEBUI_KPI()
{
return get_ValueAsPO(COLUMNNAME_WEBUI_KPI_ID, de.metas.ui.web.base.model.I_WEBUI_KPI.class);
}
@Override
public void setWEBUI_KPI(final de.metas.ui.web.base.model.I_WEBUI_KPI WEBUI_KPI)
|
{
set_ValueFromPO(COLUMNNAME_WEBUI_KPI_ID, de.metas.ui.web.base.model.I_WEBUI_KPI.class, WEBUI_KPI);
}
@Override
public void setWEBUI_KPI_ID (final int WEBUI_KPI_ID)
{
if (WEBUI_KPI_ID < 1)
set_ValueNoCheck (COLUMNNAME_WEBUI_KPI_ID, null);
else
set_ValueNoCheck (COLUMNNAME_WEBUI_KPI_ID, WEBUI_KPI_ID);
}
@Override
public int getWEBUI_KPI_ID()
{
return get_ValueAsInt(COLUMNNAME_WEBUI_KPI_ID);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java-gen\de\metas\ui\web\base\model\X_WEBUI_KPI_Field.java
| 1
|
请完成以下Java代码
|
public void setElapsedTimeMS (final BigDecimal ElapsedTimeMS)
{
set_Value (COLUMNNAME_ElapsedTimeMS, ElapsedTimeMS);
}
@Override
public BigDecimal getElapsedTimeMS()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_ElapsedTimeMS);
return bd != null ? bd : BigDecimal.ZERO;
}
/**
* EventType AD_Reference_ID=306
* Reference name: WF_EventType
*/
public static final int EVENTTYPE_AD_Reference_ID=306;
/** Process Created = PC */
public static final String EVENTTYPE_ProcessCreated = "PC";
/** State Changed = SC */
public static final String EVENTTYPE_StateChanged = "SC";
/** Process Completed = PX */
public static final String EVENTTYPE_ProcessCompleted = "PX";
/** Trace = TR */
public static final String EVENTTYPE_Trace = "TR";
@Override
public void setEventType (final java.lang.String EventType)
{
set_Value (COLUMNNAME_EventType, EventType);
}
@Override
public java.lang.String getEventType()
{
return get_ValueAsString(COLUMNNAME_EventType);
}
@Override
public void setNewValue (final java.lang.String NewValue)
{
set_Value (COLUMNNAME_NewValue, NewValue);
}
@Override
public java.lang.String getNewValue()
{
return get_ValueAsString(COLUMNNAME_NewValue);
}
@Override
public void setOldValue (final java.lang.String OldValue)
{
set_Value (COLUMNNAME_OldValue, OldValue);
}
@Override
public java.lang.String getOldValue()
{
return get_ValueAsString(COLUMNNAME_OldValue);
}
@Override
public void setRecord_ID (final int Record_ID)
{
if (Record_ID < 0)
set_Value (COLUMNNAME_Record_ID, null);
else
set_Value (COLUMNNAME_Record_ID, Record_ID);
}
@Override
public int getRecord_ID()
{
return get_ValueAsInt(COLUMNNAME_Record_ID);
}
|
@Override
public void setTextMsg (final java.lang.String TextMsg)
{
set_Value (COLUMNNAME_TextMsg, TextMsg);
}
@Override
public java.lang.String getTextMsg()
{
return get_ValueAsString(COLUMNNAME_TextMsg);
}
/**
* WFState AD_Reference_ID=305
* Reference name: WF_Instance State
*/
public static final int WFSTATE_AD_Reference_ID=305;
/** NotStarted = ON */
public static final String WFSTATE_NotStarted = "ON";
/** Running = OR */
public static final String WFSTATE_Running = "OR";
/** Suspended = OS */
public static final String WFSTATE_Suspended = "OS";
/** Completed = CC */
public static final String WFSTATE_Completed = "CC";
/** Aborted = CA */
public static final String WFSTATE_Aborted = "CA";
/** Terminated = CT */
public static final String WFSTATE_Terminated = "CT";
@Override
public void setWFState (final java.lang.String WFState)
{
set_Value (COLUMNNAME_WFState, WFState);
}
@Override
public java.lang.String getWFState()
{
return get_ValueAsString(COLUMNNAME_WFState);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_WF_EventAudit.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public I_AD_InfoColumn retrieveTreeInfoColumn(final I_AD_InfoWindow infoWindow)
{
for (final I_AD_InfoColumn infoColumn : retrieveInfoColumns(infoWindow))
{
if (!infoColumn.isActive())
{
continue;
}
if (infoColumn.isTree())
{
return infoColumn;
}
}
return null;
}
@Override
public List<I_AD_InfoColumn> retrieveQueryColumns(final I_AD_InfoWindow infoWindow)
{
final List<I_AD_InfoColumn> list = new ArrayList<I_AD_InfoColumn>();
for (final I_AD_InfoColumn infoColumn : retrieveInfoColumns(infoWindow))
{
if (!infoColumn.isActive())
{
continue;
}
if (!infoColumn.isQueryCriteria())
{
continue;
}
list.add(infoColumn);
}
Collections.sort(list, new Comparator<I_AD_InfoColumn>()
{
@Override
public int compare(final I_AD_InfoColumn o1, final I_AD_InfoColumn o2)
{
return o1.getParameterSeqNo() - o2.getParameterSeqNo();
}
});
return list;
}
@Override
public List<I_AD_InfoColumn> retrieveDisplayedColumns(final I_AD_InfoWindow infoWindow)
{
final List<I_AD_InfoColumn> list = new ArrayList<I_AD_InfoColumn>();
for (final I_AD_InfoColumn infoColumn : retrieveInfoColumns(infoWindow))
{
if (!infoColumn.isActive())
{
continue;
}
if (!infoColumn.isDisplayed())
{
continue;
}
list.add(infoColumn);
}
|
Collections.sort(list, new Comparator<I_AD_InfoColumn>()
{
@Override
public int compare(final I_AD_InfoColumn o1, final I_AD_InfoColumn o2)
{
return o1.getSeqNo() - o2.getSeqNo();
}
});
return list;
}
@Override
@Cached(cacheName = I_AD_InfoWindow.Table_Name + "#by#" + I_AD_InfoWindow.COLUMNNAME_ShowInMenu)
public List<I_AD_InfoWindow> retrieveInfoWindowsInMenu(@CacheCtx final Properties ctx)
{
return Services.get(IQueryBL.class)
.createQueryBuilder(I_AD_InfoWindow.class, ctx, ITrx.TRXNAME_None)
.addCompareFilter(I_AD_InfoWindow.COLUMNNAME_AD_InfoWindow_ID, CompareQueryFilter.Operator.NOT_EQUAL, 540008) // FIXME: hardcoded "Info Partner"
.addCompareFilter(I_AD_InfoWindow.COLUMNNAME_AD_InfoWindow_ID, CompareQueryFilter.Operator.NOT_EQUAL, 540009) // FIXME: hardcoded "Info Product"
.addEqualsFilter(I_AD_InfoWindow.COLUMNNAME_IsActive, true)
.addEqualsFilter(I_AD_InfoWindow.COLUMNNAME_ShowInMenu, true)
.addOnlyContextClientOrSystem()
//
.orderBy()
.addColumn(I_AD_InfoWindow.COLUMNNAME_AD_InfoWindow_ID)
.endOrderBy()
//
.create()
.list(I_AD_InfoWindow.class);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\service\impl\ADInfoWindowDAO.java
| 2
|
请完成以下Java代码
|
public org.compiere.model.I_M_Warehouse_PickingGroup getM_Warehouse_PickingGroup() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_M_Warehouse_PickingGroup_ID, org.compiere.model.I_M_Warehouse_PickingGroup.class);
}
@Override
public void setM_Warehouse_PickingGroup(org.compiere.model.I_M_Warehouse_PickingGroup M_Warehouse_PickingGroup)
{
set_ValueFromPO(COLUMNNAME_M_Warehouse_PickingGroup_ID, org.compiere.model.I_M_Warehouse_PickingGroup.class, M_Warehouse_PickingGroup);
}
/** Set Kommissionier-Lagergruppe .
@param M_Warehouse_PickingGroup_ID Kommissionier-Lagergruppe */
@Override
public void setM_Warehouse_PickingGroup_ID (int M_Warehouse_PickingGroup_ID)
{
if (M_Warehouse_PickingGroup_ID < 1)
|
set_Value (COLUMNNAME_M_Warehouse_PickingGroup_ID, null);
else
set_Value (COLUMNNAME_M_Warehouse_PickingGroup_ID, Integer.valueOf(M_Warehouse_PickingGroup_ID));
}
/** Get Kommissionier-Lagergruppe .
@return Kommissionier-Lagergruppe */
@Override
public int getM_Warehouse_PickingGroup_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Warehouse_PickingGroup_ID);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.msv3.server-peer-metasfresh\src\main\java-gen\de\metas\vertical\pharma\msv3\server\model\X_MSV3_Server.java
| 1
|
请完成以下Java代码
|
public void delete(String groupId) {
GroupEntity group = dataManager.findById(groupId);
if (group != null) {
getMembershipEntityManager().deleteMembershipByGroupId(groupId);
if (getEventDispatcher() != null && getEventDispatcher().isEnabled()) {
getEventDispatcher().dispatchEvent(FlowableIdmEventBuilder.createMembershipEvent(FlowableIdmEventType.MEMBERSHIPS_DELETED, groupId, null),
engineConfiguration.getEngineCfgKey());
}
delete(group);
}
}
@Override
public GroupQuery createNewGroupQuery() {
return new GroupQueryImpl(getCommandExecutor());
}
@Override
public List<Group> findGroupByQueryCriteria(GroupQueryImpl query) {
return dataManager.findGroupByQueryCriteria(query);
}
@Override
public long findGroupCountByQueryCriteria(GroupQueryImpl query) {
return dataManager.findGroupCountByQueryCriteria(query);
}
@Override
public List<Group> findGroupsByUser(String userId) {
return dataManager.findGroupsByUser(userId);
}
@Override
public List<Group> findGroupsByNativeQuery(Map<String, Object> parameterMap) {
return dataManager.findGroupsByNativeQuery(parameterMap);
}
@Override
public long findGroupCountByNativeQuery(Map<String, Object> parameterMap) {
|
return dataManager.findGroupCountByNativeQuery(parameterMap);
}
@Override
public boolean isNewGroup(Group group) {
return ((GroupEntity) group).getRevision() == 0;
}
@Override
public List<Group> findGroupsByPrivilegeId(String privilegeId) {
return dataManager.findGroupsByPrivilegeId(privilegeId);
}
protected MembershipEntityManager getMembershipEntityManager() {
return engineConfiguration.getMembershipEntityManager();
}
}
|
repos\flowable-engine-main\modules\flowable-idm-engine\src\main\java\org\flowable\idm\engine\impl\persistence\entity\GroupEntityManagerImpl.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Servlet getServlet() {
return this.servlet;
}
public static class Servlet {
/**
* Servlet init parameters to pass to Spring Web Services.
*/
private Map<String, String> init = new HashMap<>();
/**
* Load on startup priority of the Spring Web Services servlet.
*/
private int loadOnStartup = -1;
public Map<String, String> getInit() {
return this.init;
}
|
public void setInit(Map<String, String> init) {
this.init = init;
}
public int getLoadOnStartup() {
return this.loadOnStartup;
}
public void setLoadOnStartup(int loadOnStartup) {
this.loadOnStartup = loadOnStartup;
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-webservices\src\main\java\org\springframework\boot\webservices\autoconfigure\WebServicesProperties.java
| 2
|
请完成以下Java代码
|
public Object apply(TypeConverter converter, Object o1, Object o2) {
return NumberOperations.sub(converter, o1, o2);
}
@Override
public String toString() {
return "-";
}
};
private final Operator operator;
private final AstNode left, right;
public AstBinary(AstNode left, AstNode right, Operator operator) {
this.left = left;
this.right = right;
this.operator = operator;
}
public Operator getOperator() {
return operator;
}
@Override
public Object eval(Bindings bindings, ELContext context) {
return operator.eval(bindings, context, left, right);
}
@Override
public String toString() {
|
return "'" + operator.toString() + "'";
}
@Override
public void appendStructure(StringBuilder b, Bindings bindings) {
left.appendStructure(b, bindings);
b.append(' ');
b.append(operator);
b.append(' ');
right.appendStructure(b, bindings);
}
public int getCardinality() {
return 2;
}
public AstNode getChild(int i) {
return i == 0 ? left : i == 1 ? right : null;
}
}
|
repos\Activiti-develop\activiti-core-common\activiti-juel-jakarta\src\main\java\org\activiti\core\el\juel\tree\impl\ast\AstBinary.java
| 1
|
请完成以下Java代码
|
public class Message {
private Long id;
private String text;
private String summary;
private Calendar created = Calendar.getInstance();
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public Calendar getCreated() {
return this.created;
}
public void setCreated(Calendar created) {
this.created = created;
}
|
public String getText() {
return this.text;
}
public void setText(String text) {
this.text = text;
}
public String getSummary() {
return this.summary;
}
public void setSummary(String summary) {
this.summary = summary;
}
}
|
repos\spring-boot-leaning-master\2.x_42_courses\第 2-8 课: Spring Boot 构建一个 RESTful Web 服务\spring-boot-web-restful\src\main\java\com\neo\model\Message.java
| 1
|
请完成以下Java代码
|
public void addDataSource(Object key, DataSource dataSource) {
dataSources.put(key, dataSource);
}
public void removeDataSource(Object key) {
dataSources.remove(key);
}
@Override
public Connection getConnection() throws SQLException {
return getCurrentDataSource().getConnection();
}
@Override
public Connection getConnection(String username, String password) throws SQLException {
return getCurrentDataSource().getConnection(username, password);
}
protected DataSource getCurrentDataSource() {
String tenantId = tenantInfoHolder.getCurrentTenantId();
DataSource dataSource = dataSources.get(tenantId);
if (dataSource == null) {
throw new FlowableException("Could not find a dataSource for tenant " + tenantId);
}
return dataSource;
}
@Override
public int getLoginTimeout() throws SQLException {
return 0; // Default
}
@Override
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
return Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
}
@SuppressWarnings("unchecked")
@Override
public <T> T unwrap(Class<T> iface) throws SQLException {
if (iface.isInstance(this)) {
|
return (T) this;
}
throw new SQLException("Cannot unwrap " + getClass().getName() + " as an instance of " + iface.getName());
}
@Override
public boolean isWrapperFor(Class<?> iface) throws SQLException {
return iface.isInstance(this);
}
public Map<Object, DataSource> getDataSources() {
return dataSources;
}
public void setDataSources(Map<Object, DataSource> dataSources) {
this.dataSources = dataSources;
}
// Unsupported //////////////////////////////////////////////////////////
@Override
public PrintWriter getLogWriter() throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public void setLogWriter(PrintWriter out) throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public void setLoginTimeout(int seconds) throws SQLException {
throw new UnsupportedOperationException();
}
}
|
repos\flowable-engine-main\modules\flowable-engine-common\src\main\java\org\flowable\common\engine\impl\cfg\multitenant\TenantAwareDataSource.java
| 1
|
请完成以下Java代码
|
public Class<?> getType(ELContext context, Object base, Object property) {
Objects.requireNonNull(context);
if (base instanceof ResourceBundle) {
context.setPropertyResolved(base, property);
/*
* ResourceBundles are always read-only so fall-through to return null
*/
}
return null;
}
@Override
public void setValue(ELContext context, Object base, Object property, Object value) {
Objects.requireNonNull(context);
if (base instanceof ResourceBundle) {
context.setPropertyResolved(base, property);
throw new PropertyNotWritableException("ELResolver not writable for type '" + base.getClass().getName() + "'");
}
}
@Override
public boolean isReadOnly(ELContext context, Object base, Object property) {
Objects.requireNonNull(context);
|
if (base instanceof ResourceBundle) {
context.setPropertyResolved(base, property);
return true;
}
return false;
}
@Override
public Class<?> getCommonPropertyType(ELContext context, Object base) {
if (base instanceof ResourceBundle) {
return String.class;
}
return null;
}
}
|
repos\flowable-engine-main\modules\flowable-engine-common\src\main\java\org\flowable\common\engine\impl\javax\el\ResourceBundleELResolver.java
| 1
|
请完成以下Java代码
|
private DDOrderLoader newLoader()
{
return DDOrderLoader.builder()
.productPlanningDAO(productPlanningDAO)
.distributionNetworkRepository(distributionNetworkRepository)
.ddOrderLowLevelService(ddOrderLowLevelService)
.replenishInfoRepository(replenishInfoRepository)
.build();
}
@ModelChange(
timings = { ModelValidator.TYPE_AFTER_CHANGE, ModelValidator.TYPE_AFTER_DELETE},
ifColumnsChanged = {
I_DD_OrderLine.COLUMNNAME_M_Product_ID,
I_DD_OrderLine.COLUMNNAME_M_AttributeSetInstance_ID,
|
I_DD_OrderLine.COLUMNNAME_M_Locator_ID,
I_DD_OrderLine.COLUMNNAME_M_LocatorTo_ID })
public void fireDeleteDDOrderEvents(final I_DD_OrderLine ddOrderLineRecord)
{
if (InterfaceWrapperHelper.isNew(ddOrderLineRecord))
{
return;
}
final DDOrder ddOrder = newLoader().loadWithSingleLine(ddOrderLineRecord);
final UserId userId = UserId.ofRepoId(ddOrderLineRecord.getUpdatedBy());
materialEventService.enqueueEventAfterNextCommit(DDOrderDeletedEvent.of(ddOrder, userId));
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\de\metas\distribution\ddorder\lowlevel\interceptor\DD_OrderLine_PostMaterialEvent.java
| 1
|
请完成以下Java代码
|
private Map<String, IDocActionItem> getDocActionItemsIndexedByValue()
{
if (docActionItemsByValue == null)
{
docActionItemsByValue = Services.get(IDocumentBL.class).retrieveDocActionItemsIndexedByValue();
}
return docActionItemsByValue;
}
/**
* ActionListener
*
* @param e event
*/
@Override
public void actionPerformed(final ActionEvent e)
{
if (e.getActionCommand().equals(ConfirmPanel.A_OK))
{
if (save())
{
dispose();
m_OKpressed = true;
}
}
else if (e.getActionCommand().equals(ConfirmPanel.A_CANCEL))
{
dispose();
}
//
// ActionCombo: display the description for the selection
else if (e.getSource() == actionCombo)
{
final IDocActionItem selectedDocAction = actionCombo.getSelectedItem();
// Display description
if (selectedDocAction != null)
{
message.setText(selectedDocAction.getDescription());
}
}
} // actionPerformed
|
/**
* Save to Database
*
* @return true if saved to Tab
*/
private boolean save()
{
final IDocActionItem selectedDocAction = actionCombo.getSelectedItem();
if (selectedDocAction == null)
{
return false;
}
// Save Selection
log.info("DocAction={}", selectedDocAction);
m_mTab.setValue("DocAction", selectedDocAction.getValue());
return true;
} // save
} // VDocAction
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\grid\ed\VDocAction.java
| 1
|
请完成以下Java代码
|
private JarFile createJarFileForStream(URL url, Version version, Consumer<JarFile> closeAction) throws IOException {
try (InputStream in = url.openStream()) {
return createJarFileForStream(in, version, closeAction);
}
}
private JarFile createJarFileForStream(InputStream in, Version version, Consumer<JarFile> closeAction)
throws IOException {
Path local = Files.createTempFile("jar_cache", null);
try {
Files.copy(in, local, StandardCopyOption.REPLACE_EXISTING);
JarFile jarFile = new UrlJarFile(local.toFile(), version, closeAction);
local.toFile().deleteOnExit();
return jarFile;
}
catch (Throwable ex) {
deleteIfPossible(local, ex);
throw ex;
}
}
|
private void deleteIfPossible(Path local, Throwable cause) {
try {
Files.delete(local);
}
catch (IOException ex) {
cause.addSuppressed(ex);
}
}
static boolean isNestedUrl(URL url) {
return url.getProtocol().equalsIgnoreCase("nested");
}
}
|
repos\spring-boot-4.0.1\loader\spring-boot-loader\src\main\java\org\springframework\boot\loader\net\protocol\jar\UrlJarFileFactory.java
| 1
|
请完成以下Java代码
|
public @Nullable String getSessionId() {
return this.sessionId;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
WebAuthenticationDetails that = (WebAuthenticationDetails) o;
return Objects.equals(this.remoteAddress, that.remoteAddress) && Objects.equals(this.sessionId, that.sessionId);
}
|
@Override
public int hashCode() {
return Objects.hash(this.remoteAddress, this.sessionId);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName()).append(" [");
sb.append("RemoteIpAddress=").append(this.getRemoteAddress()).append(", ");
sb.append("SessionId=").append(this.getSessionId()).append("]");
return sb.toString();
}
}
|
repos\spring-security-main\web\src\main\java\org\springframework\security\web\authentication\WebAuthenticationDetails.java
| 1
|
请完成以下Java代码
|
public List<String> getFailures() {
return failures;
}
public void setFailures(List<String> failures) {
this.failures = failures;
}
public String getSourceScopeId() {
return sourceScopeId;
}
public void setSourceScopeId(String sourceScopeId) {
this.sourceScopeId = sourceScopeId;
}
public static List<MigratingTransitionInstanceValidationReportDto> from(List<MigratingTransitionInstanceValidationReport> reports) {
|
ArrayList<MigratingTransitionInstanceValidationReportDto> dtos = new ArrayList<MigratingTransitionInstanceValidationReportDto>();
for (MigratingTransitionInstanceValidationReport report : reports) {
dtos.add(MigratingTransitionInstanceValidationReportDto.from(report));
}
return dtos;
}
public static MigratingTransitionInstanceValidationReportDto from(MigratingTransitionInstanceValidationReport report) {
MigratingTransitionInstanceValidationReportDto dto = new MigratingTransitionInstanceValidationReportDto();
dto.setMigrationInstruction(MigrationInstructionDto.from(report.getMigrationInstruction()));
dto.setTransitionInstanceId(report.getTransitionInstanceId());
dto.setFailures(report.getFailures());
dto.setSourceScopeId(report.getSourceScopeId());
return dto;
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\migration\MigratingTransitionInstanceValidationReportDto.java
| 1
|
请完成以下Java代码
|
public void updateQtyTU(final I_C_OrderLine orderLine, final ICalloutField field)
{
final IHUPackingAware packingAware = new OrderLineHUPackingAware(orderLine);
packingAwareBL.setQtyTU(packingAware);
packingAwareBL.setQtyLUFromQtyTU(packingAware);
packingAware.setQty(packingAware.getQty());
}
/**
* Task 06915: If QtyEnteredTU or M_HU_PI_Item_Product_ID change, then update QtyEntered (i.e. the CU qty).
*
*/
@CalloutMethod(columnNames = { I_C_OrderLine.COLUMNNAME_QtyEnteredTU, I_C_OrderLine.COLUMNNAME_M_HU_PI_Item_Product_ID })
public void updateQtyCU(final I_C_OrderLine orderLine, final ICalloutField field)
{
final IHUPackingAware packingAware = new OrderLineHUPackingAware(orderLine);
setQtuCUFromQtyTU(packingAware);
packingAwareBL.setQtyLUFromQtyTU(packingAware);
// Update lineNetAmt, because QtyEnteredCU changed : see task 06727
Services.get(IOrderLineBL.class).updateLineNetAmtFromQtyEntered(orderLine);
}
private void setQtuCUFromQtyTU(final IHUPackingAware packingAware)
{
final int qtyPacks = packingAware.getQtyTU().intValue();
packingAwareBL.setQtyCUFromQtyTU(packingAware, qtyPacks);
}
@CalloutMethod(columnNames = { I_C_OrderLine.COLUMNNAME_QtyLU, I_C_OrderLine.COLUMNNAME_M_LU_HU_PI_ID })
public void updateQtyTUCU(final I_C_OrderLine orderLine, final ICalloutField field)
|
{
packingAwareBL.validateLUQty(orderLine.getQtyLU());
final IHUPackingAware packingAware = new OrderLineHUPackingAware(orderLine);
packingAwareBL.setQtyTUFromQtyLU(packingAware);
updateQtyCU(orderLine, field);
}
@CalloutMethod(columnNames = { I_C_OrderLine.COLUMNNAME_C_BPartner_ID
, I_C_OrderLine.COLUMNNAME_QtyEntered
, I_C_OrderLine.COLUMNNAME_M_HU_PI_Item_Product_ID
, I_C_OrderLine.COLUMNNAME_M_Product_ID })
public void onHURelevantChange(final I_C_OrderLine orderLine, final ICalloutField field)
{
final I_C_OrderLine ol = InterfaceWrapperHelper.create(orderLine, I_C_OrderLine.class);
Services.get(IHUOrderBL.class).updateOrderLine(ol, field.getColumnName());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\callout\C_OrderLine.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class KafkaCountingMessagesComponent {
@Value(value = "${spring.kafka.bootstrap-servers}")
private String bootstrapAddress;
public static Map<String, Object> props = new HashMap<>();
@PostConstruct
public void init(){
System.out.println(getTotalNumberOfMessagesInATopic("baeldung"));
}
public Long getTotalNumberOfMessagesInATopic(String topic){
org.apache.kafka.clients.consumer.KafkaConsumer<String, String> consumer = new org.apache.kafka.clients.consumer.KafkaConsumer<>(getProps());
List<TopicPartition> partitions = consumer.partitionsFor(topic).stream()
.map(p -> new TopicPartition(topic, p.partition()))
.collect(Collectors.toList());
consumer.assign(partitions);
consumer.seekToEnd(Collections.emptySet());
Map<TopicPartition, Long> endPartitions = partitions.stream()
|
.collect(Collectors.toMap(Function.identity(), consumer::position));
return partitions.stream().mapToLong(p -> endPartitions.get(p)).sum();
}
public Map<String, Object> getProps() {
if (props.isEmpty()) {
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapAddress);
props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
props.put(ConsumerConfig.MAX_PARTITION_FETCH_BYTES_CONFIG, "20971520");
props.put(ConsumerConfig.FETCH_MAX_BYTES_CONFIG, "20971520");
}
return props;
}
}
|
repos\tutorials-master\spring-kafka-4\src\main\java\com\baeldung\countingmessages\KafkaCountingMessagesComponent.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public DataSource dataSource() {
return new EmbeddedDatabaseBuilder()
.setType(EmbeddedDatabaseType.H2)
.addScript(JdbcDaoImpl.DEFAULT_USER_SCHEMA_DDL_LOCATION)
.build();
}
@Bean
public UserDetailsService userDetailService(DataSource dataSource) {
var user = User.withUsername("in28minutes")
//.password("{noop}dummy")
.password("dummy")
.passwordEncoder(str -> passwordEncoder().encode(str))
.roles("USER")
.build();
var admin = User.withUsername("admin")
//.password("{noop}dummy")
.password("dummy")
.passwordEncoder(str -> passwordEncoder().encode(str))
|
.roles("ADMIN", "USER")
.build();
var jdbcUserDetailsManager = new JdbcUserDetailsManager(dataSource);
jdbcUserDetailsManager.createUser(user);
jdbcUserDetailsManager.createUser(admin);
return jdbcUserDetailsManager;
}
@Bean
public BCryptPasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
}
|
repos\master-spring-and-spring-boot-main\71-spring-security\src\main\java\com\in28minutes\learnspringsecurity\basic\BasicAuthSecurityConfiguration.java
| 2
|
请完成以下Java代码
|
public class Item extends SimpleItem
{
/**
* 该条目的索引,比如“啊”
*/
public String key;
public Item(String key, String label)
{
this(key);
labelMap.put(label, 1);
}
public Item(String key)
{
super();
this.key = key;
}
@Override
public String toString()
{
final StringBuilder sb = new StringBuilder(key);
ArrayList<Map.Entry<String, Integer>> entries = new ArrayList<Map.Entry<String, Integer>>(labelMap.entrySet());
Collections.sort(entries, new Comparator<Map.Entry<String, Integer>>()
{
@Override
public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2)
{
return -o1.getValue().compareTo(o2.getValue());
}
});
for (Map.Entry<String, Integer> entry : entries)
{
sb.append(' '); // 现阶段词典分隔符统一使用空格
sb.append(entry.getKey());
sb.append(' ');
sb.append(entry.getValue());
}
return sb.toString();
}
|
/**
* 获取首个label
* @return
*/
public String firstLabel()
{
return labelMap.keySet().iterator().next();
}
/**
*
* @param param 类似 “希望 v 7685 vn 616” 的字串
* @return
*/
public static Item create(String param)
{
if (param == null) return null;
String mark = "\\s"; // 分隔符,历史格式用空格,但是现在觉得用制表符比较好
if (param.indexOf('\t') > 0) mark = "\t";
String[] array = param.split(mark);
return create(array);
}
public static Item create(String param[])
{
if (param.length % 2 == 0) return null;
Item item = new Item(param[0]);
int natureCount = (param.length - 1) / 2;
for (int i = 0; i < natureCount; ++i)
{
item.labelMap.put(param[1 + 2 * i], Integer.parseInt(param[2 + 2 * i]));
}
return item;
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\corpus\dictionary\item\Item.java
| 1
|
请完成以下Java代码
|
public String getGroupId() {
return this.groupId;
}
/**
* Sets the group id.
* @param groupId the group id
*/
public void setGroupId(String groupId) {
this.groupId = groupId;
}
@Override
public String getArtifactId() {
return this.artifactId;
}
/**
* Sets the artifact id.
* @param artifactId the artifact id
*/
public void setArtifactId(String artifactId) {
this.artifactId = artifactId;
}
@Override
public String getVersion() {
return this.version;
}
/**
* Sets the version.
* @param version the version
*/
public void setVersion(String version) {
this.version = version;
}
@Override
public String getName() {
return this.name;
}
/**
* Sets the name.
* @param name the name
*/
public void setName(String name) {
this.name = name;
}
@Override
public String getDescription() {
return this.description;
}
/**
* Sets the description.
* @param description the description
*/
public void setDescription(String description) {
this.description = description;
}
@Override
public String getApplicationName() {
return this.applicationName;
}
/**
* Sets the application name.
* @param applicationName the application name
*/
public void setApplicationName(String applicationName) {
this.applicationName = applicationName;
}
|
@Override
public String getPackageName() {
if (StringUtils.hasText(this.packageName)) {
return this.packageName;
}
if (StringUtils.hasText(this.groupId) && StringUtils.hasText(this.artifactId)) {
return this.groupId + "." + this.artifactId;
}
return null;
}
/**
* Sets the package name.
* @param packageName the package name
*/
public void setPackageName(String packageName) {
this.packageName = packageName;
}
@Override
public String getBaseDirectory() {
return this.baseDirectory;
}
/**
* Sets the base directory.
* @param baseDirectory the base directory
*/
public void setBaseDirectory(String baseDirectory) {
this.baseDirectory = baseDirectory;
}
}
|
repos\initializr-main\initializr-generator\src\main\java\io\spring\initializr\generator\project\MutableProjectDescription.java
| 1
|
请完成以下Java代码
|
public void setReversalLine_ID (int ReversalLine_ID)
{
if (ReversalLine_ID < 1)
set_Value (COLUMNNAME_ReversalLine_ID, null);
else
set_Value (COLUMNNAME_ReversalLine_ID, Integer.valueOf(ReversalLine_ID));
}
/** Get Reversal Line.
@return Use to keep the reversal line ID for reversing costing purpose
*/
@Override
public int getReversalLine_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_ReversalLine_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Verworfene Menge.
@param ScrappedQty
The Quantity scrapped due to QA issues
*/
@Override
public void setScrappedQty (java.math.BigDecimal ScrappedQty)
{
set_Value (COLUMNNAME_ScrappedQty, ScrappedQty);
}
/** Get Verworfene Menge.
@return The Quantity scrapped due to QA issues
*/
@Override
public java.math.BigDecimal getScrappedQty ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_ScrappedQty);
if (bd == null)
return Env.ZERO;
return bd;
}
|
/** Set Zielmenge.
@param TargetQty
Target Movement Quantity
*/
@Override
public void setTargetQty (java.math.BigDecimal TargetQty)
{
set_Value (COLUMNNAME_TargetQty, TargetQty);
}
/** Get Zielmenge.
@return Target Movement Quantity
*/
@Override
public java.math.BigDecimal getTargetQty ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_TargetQty);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Suchschlüssel.
@param Value
Search key for the record in the format required - must be unique
*/
@Override
public void setValue (java.lang.String Value)
{
throw new IllegalArgumentException ("Value is virtual column"); }
/** Get Suchschlüssel.
@return Search key for the record in the format required - must be unique
*/
@Override
public java.lang.String getValue ()
{
return (java.lang.String)get_Value(COLUMNNAME_Value);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_MovementLine.java
| 1
|
请完成以下Java代码
|
public void setDIM_Dimension_Spec_Attribute_ID (int DIM_Dimension_Spec_Attribute_ID)
{
if (DIM_Dimension_Spec_Attribute_ID < 1)
set_ValueNoCheck (COLUMNNAME_DIM_Dimension_Spec_Attribute_ID, null);
else
set_ValueNoCheck (COLUMNNAME_DIM_Dimension_Spec_Attribute_ID, Integer.valueOf(DIM_Dimension_Spec_Attribute_ID));
}
/** Get Dimensionsspezifikation (Merkmal).
@return Dimensionsspezifikation (Merkmal) */
@Override
public int getDIM_Dimension_Spec_Attribute_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_DIM_Dimension_Spec_Attribute_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Dimensionsattributwert.
@param DIM_Dimension_Spec_AttributeValue_ID Dimensionsattributwert */
@Override
public void setDIM_Dimension_Spec_AttributeValue_ID (int DIM_Dimension_Spec_AttributeValue_ID)
{
if (DIM_Dimension_Spec_AttributeValue_ID < 1)
set_ValueNoCheck (COLUMNNAME_DIM_Dimension_Spec_AttributeValue_ID, null);
else
set_ValueNoCheck (COLUMNNAME_DIM_Dimension_Spec_AttributeValue_ID, Integer.valueOf(DIM_Dimension_Spec_AttributeValue_ID));
}
/** Get Dimensionsattributwert.
@return Dimensionsattributwert */
@Override
public int getDIM_Dimension_Spec_AttributeValue_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_DIM_Dimension_Spec_AttributeValue_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Merkmals-Wert.
@param M_AttributeValue_ID
|
Product Attribute Value
*/
@Override
public void setM_AttributeValue_ID (int M_AttributeValue_ID)
{
if (M_AttributeValue_ID < 1)
set_Value (COLUMNNAME_M_AttributeValue_ID, null);
else
set_Value (COLUMNNAME_M_AttributeValue_ID, Integer.valueOf(M_AttributeValue_ID));
}
/** Get Merkmals-Wert.
@return Product Attribute Value
*/
@Override
public int getM_AttributeValue_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_AttributeValue_ID);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.dimension\src\main\java-gen\de\metas\dimension\model\X_DIM_Dimension_Spec_AttributeValue.java
| 1
|
请完成以下Java代码
|
public int getPA_Measure_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_PA_Measure_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_PA_Ratio getPA_Ratio() throws RuntimeException
{
return (I_PA_Ratio)MTable.get(getCtx(), I_PA_Ratio.Table_Name)
.getPO(getPA_Ratio_ID(), get_TrxName()); }
/** Set Ratio.
@param PA_Ratio_ID
Performace Ratio
*/
public void setPA_Ratio_ID (int PA_Ratio_ID)
{
if (PA_Ratio_ID < 1)
set_Value (COLUMNNAME_PA_Ratio_ID, null);
else
set_Value (COLUMNNAME_PA_Ratio_ID, Integer.valueOf(PA_Ratio_ID));
}
/** Get Ratio.
@return Performace Ratio
*/
public int getPA_Ratio_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_PA_Ratio_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_R_RequestType getR_RequestType() throws RuntimeException
{
return (I_R_RequestType)MTable.get(getCtx(), I_R_RequestType.Table_Name)
|
.getPO(getR_RequestType_ID(), get_TrxName()); }
/** Set Request Type.
@param R_RequestType_ID
Type of request (e.g. Inquiry, Complaint, ..)
*/
public void setR_RequestType_ID (int R_RequestType_ID)
{
if (R_RequestType_ID < 1)
set_Value (COLUMNNAME_R_RequestType_ID, null);
else
set_Value (COLUMNNAME_R_RequestType_ID, Integer.valueOf(R_RequestType_ID));
}
/** Get Request Type.
@return Type of request (e.g. Inquiry, Complaint, ..)
*/
public int getR_RequestType_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_R_RequestType_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_PA_Measure.java
| 1
|
请完成以下Java代码
|
private PInstanceId getPinstanceId()
{
return pinstanceId;
}
public ESRImportEnqueuer fromDataSource(final ESRImportEnqueuerDataSource fromDataSource)
{
this.fromDataSource = fromDataSource;
return this;
}
@NonNull
private ESRImportEnqueuerDataSource getFromDataSource()
{
return fromDataSource;
}
public ESRImportEnqueuer loggable(@NonNull final ILoggable loggable)
{
this.loggable = loggable;
return this;
}
private void addLog(final String msg, final Object... msgParameters)
{
loggable.addLog(msg, msgParameters);
}
private static class ZipFileResource extends AbstractResource
{
private final byte[] data;
private final String filename;
@Builder
private ZipFileResource(
@NonNull final byte[] data,
@NonNull final String filename)
|
{
this.data = data;
this.filename = filename;
}
@Override
public String getFilename()
{
return filename;
}
@Override
public String getDescription()
{
return null;
}
@Override
public InputStream getInputStream()
{
return new ByteArrayInputStream(data);
}
public byte[] getData()
{
return data;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.esr\src\main\java\de\metas\payment\esr\dataimporter\ESRImportEnqueuer.java
| 1
|
请完成以下Java代码
|
private String getQtysDisplayName()
{
if (_qtyTUPlanned == null && _qtyTUMoved == null)
{
return null;
}
final StringBuilder sb = new StringBuilder();
//
// Qty Moved
if (_qtyTUMoved != null)
{
sb.append(toQtyTUString(_qtyTUMoved));
}
//
// Qty Planned
{
if (sb.length() > 0)
{
sb.append(" / ");
}
sb.append(toQtyTUString(_qtyTUPlanned));
}
return sb.toString();
}
private final String toQtyTUString(final BigDecimal qtyTU)
{
if (qtyTU == null)
{
return "?";
}
return qtyTU
.setScale(0, RoundingMode.UP) // it's general integer, just making sure we don't end up with 3.0000000
.toString();
}
@Override
public IHUPIItemProductDisplayNameBuilder setM_HU_PI_Item_Product(final I_M_HU_PI_Item_Product huPIItemProduct)
{
_huPIItemProduct = huPIItemProduct;
return this;
}
@Override
public IHUPIItemProductDisplayNameBuilder setM_HU_PI_Item_Product(@NonNull final HUPIItemProductId id)
{
final I_M_HU_PI_Item_Product huPIItemProduct = Services.get(IHUPIItemProductDAO.class).getRecordById(id);
return setM_HU_PI_Item_Product(huPIItemProduct);
}
private I_M_HU_PI_Item_Product getM_HU_PI_Item_Product()
{
Check.assumeNotNull(_huPIItemProduct, "_huPIItemProduct not null");
|
return _huPIItemProduct;
}
@Override
public IHUPIItemProductDisplayNameBuilder setQtyTUPlanned(final BigDecimal qtyTUPlanned)
{
_qtyTUPlanned = qtyTUPlanned;
return this;
}
@Override
public IHUPIItemProductDisplayNameBuilder setQtyTUPlanned(final int qtyTUPlanned)
{
setQtyTUPlanned(BigDecimal.valueOf(qtyTUPlanned));
return this;
}
@Override
public IHUPIItemProductDisplayNameBuilder setQtyTUMoved(final BigDecimal qtyTUMoved)
{
_qtyTUMoved = qtyTUMoved;
return this;
}
@Override
public IHUPIItemProductDisplayNameBuilder setQtyTUMoved(final int qtyTUMoved)
{
setQtyTUMoved(BigDecimal.valueOf(qtyTUMoved));
return this;
}
@Override
public HUPIItemProductDisplayNameBuilder setQtyCapacity(final BigDecimal qtyCapacity)
{
_qtyCapacity = qtyCapacity;
return this;
}
@Override
public IHUPIItemProductDisplayNameBuilder setShowAnyProductIndicator(boolean showAnyProductIndicator)
{
this._showAnyProductIndicator = showAnyProductIndicator;
return this;
}
private boolean isShowAnyProductIndicator()
{
return _showAnyProductIndicator;
}
private boolean isAnyProductAllowed()
{
return getM_HU_PI_Item_Product().isAllowAnyProduct();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\impl\HUPIItemProductDisplayNameBuilder.java
| 1
|
请完成以下Java代码
|
public UUID getId() {
return id;
}
public void setId(final UUID id) {
this.id = id;
}
public Integer getVersion() {
return version;
}
public void setVersion(final Integer version) {
this.version = version;
}
public String getPassword() {
return password;
}
@Override
public String getUsername() {
return username;
}
public void setUsername(final String username) {
this.username = username;
}
public Boolean getActive() {
return active;
}
public void setActive(final Boolean active) {
this.active = active;
}
public void setPassword(final String password) {
this.password = password;
}
public String getEmail() {
return email;
}
public void setEmail(final String email) {
this.email = email;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(final String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(final String lastName) {
this.lastName = lastName;
|
}
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
return authorities != null ? authorities : Collections.emptyList();
}
@Override
public void setAuthorities(final Collection<? extends GrantedAuthority> authorities) {
this.authorities = authorities;
}
@Override
public boolean isAccountNonExpired() {
return true;
}
@Override
public boolean isAccountNonLocked() {
return true;
}
@Override
public boolean isCredentialsNonExpired() {
return true;
}
@Override
public boolean isEnabled() {
return Boolean.TRUE.equals(active);
}
@InstanceName
@DependsOnProperties({"firstName", "lastName", "username"})
public String getDisplayName() {
return String.format("%s %s [%s]", (firstName != null ? firstName : ""),
(lastName != null ? lastName : ""), username).trim();
}
@Override
public String getTimeZoneId() {
return timeZoneId;
}
public void setTimeZoneId(final String timeZoneId) {
this.timeZoneId = timeZoneId;
}
}
|
repos\tutorials-master\spring-boot-modules\jmix\src\main\java\com\baeldung\jmix\expensetracker\entity\User.java
| 1
|
请完成以下Java代码
|
public OrderFactory warehouseId(@Nullable final WarehouseId warehouseId)
{
assertNotBuilt();
order.setM_Warehouse_ID(WarehouseId.toRepoId(warehouseId));
return this;
}
public OrderFactory orgId(@NonNull final OrgId orgId)
{
assertNotBuilt();
order.setAD_Org_ID(orgId.getRepoId());
return this;
}
public OrgId getOrgId()
{
return OrgId.ofRepoId(order.getAD_Org_ID());
}
public OrderFactory dateOrdered(final LocalDate dateOrdered)
{
assertNotBuilt();
order.setDateOrdered(TimeUtil.asTimestamp(dateOrdered));
return this;
}
public OrderFactory datePromised(final ZonedDateTime datePromised)
{
assertNotBuilt();
order.setDatePromised(TimeUtil.asTimestamp(datePromised));
return this;
}
public ZonedDateTime getDatePromised()
{
final ZoneId timeZone = orgDAO.getTimeZone(OrgId.ofRepoId(order.getAD_Org_ID()));
return TimeUtil.asZonedDateTime(order.getDatePromised(), timeZone);
}
public OrderFactory shipBPartner(
@NonNull final BPartnerId bpartnerId,
@Nullable final BPartnerLocationId bpartnerLocationId,
@Nullable final BPartnerContactId contactId)
{
assertNotBuilt();
OrderDocumentLocationAdapterFactory
.locationAdapter(order)
.setFrom(DocumentLocation.builder()
.bpartnerId(bpartnerId)
.bpartnerLocationId(bpartnerLocationId)
.contactId(contactId)
.build());
return this;
}
public OrderFactory shipBPartner(final BPartnerId bpartnerId)
{
shipBPartner(bpartnerId, null, null);
return this;
|
}
public BPartnerId getShipBPartnerId()
{
return BPartnerId.ofRepoId(order.getC_BPartner_ID());
}
public OrderFactory pricingSystemId(@NonNull final PricingSystemId pricingSystemId)
{
assertNotBuilt();
order.setM_PricingSystem_ID(pricingSystemId.getRepoId());
return this;
}
public OrderFactory poReference(@Nullable final String poReference)
{
assertNotBuilt();
order.setPOReference(poReference);
return this;
}
public OrderFactory salesRepId(@Nullable final UserId salesRepId)
{
assertNotBuilt();
order.setSalesRep_ID(UserId.toRepoId(salesRepId));
return this;
}
public OrderFactory projectId(@Nullable final ProjectId projectId)
{
assertNotBuilt();
order.setC_Project_ID(ProjectId.toRepoId(projectId));
return this;
}
public OrderFactory campaignId(final int campaignId)
{
assertNotBuilt();
order.setC_Campaign_ID(campaignId);
return this;
}
public DocTypeId getDocTypeTargetId()
{
return docTypeTargetId;
}
public void setDocTypeTargetId(final DocTypeId docTypeTargetId)
{
this.docTypeTargetId = docTypeTargetId;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\order\OrderFactory.java
| 1
|
请完成以下Java代码
|
public class X_M_Source_HU extends org.compiere.model.PO implements I_M_Source_HU, org.compiere.model.I_Persistent
{
private static final long serialVersionUID = 1877649145L;
/** Standard Constructor */
public X_M_Source_HU (final Properties ctx, final int M_Source_HU_ID, @Nullable final String trxName)
{
super (ctx, M_Source_HU_ID, trxName);
}
/** Load Constructor */
public X_M_Source_HU (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 de.metas.handlingunits.model.I_M_HU getM_HU()
{
return get_ValueAsPO(COLUMNNAME_M_HU_ID, de.metas.handlingunits.model.I_M_HU.class);
}
@Override
public void setM_HU(final de.metas.handlingunits.model.I_M_HU M_HU)
{
set_ValueFromPO(COLUMNNAME_M_HU_ID, de.metas.handlingunits.model.I_M_HU.class, M_HU);
}
@Override
public void setM_HU_ID (final int M_HU_ID)
{
if (M_HU_ID < 1)
set_Value (COLUMNNAME_M_HU_ID, null);
|
else
set_Value (COLUMNNAME_M_HU_ID, M_HU_ID);
}
@Override
public int getM_HU_ID()
{
return get_ValueAsInt(COLUMNNAME_M_HU_ID);
}
@Override
public void setM_Source_HU_ID (final int M_Source_HU_ID)
{
if (M_Source_HU_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Source_HU_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Source_HU_ID, M_Source_HU_ID);
}
@Override
public int getM_Source_HU_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Source_HU_ID);
}
@Override
public void setPreDestroy_Snapshot_UUID (final @Nullable java.lang.String PreDestroy_Snapshot_UUID)
{
set_Value (COLUMNNAME_PreDestroy_Snapshot_UUID, PreDestroy_Snapshot_UUID);
}
@Override
public java.lang.String getPreDestroy_Snapshot_UUID()
{
return get_ValueAsString(COLUMNNAME_PreDestroy_Snapshot_UUID);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java-gen\de\metas\handlingunits\model\X_M_Source_HU.java
| 1
|
请完成以下Java代码
|
public class Emit extends Interval implements Intervalable
{
/**
* 匹配到的模式串
*/
private final String keyword;
/**
* 构造一个模式串匹配结果
* @param start 起点
* @param end 重点
* @param keyword 模式串
*/
public Emit(final int start, final int end, final String keyword)
{
super(start, end);
this.keyword = keyword;
|
}
/**
* 获取对应的模式串
* @return 模式串
*/
public String getKeyword()
{
return this.keyword;
}
@Override
public String toString()
{
return super.toString() + "=" + this.keyword;
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\algorithm\ahocorasick\trie\Emit.java
| 1
|
请完成以下Java代码
|
public String getBIC() {
return bic;
}
/**
* Sets the value of the bic property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBIC(String value) {
this.bic = value;
}
/**
* Gets the value of the othr property.
*
* @return
* possible object is
* {@link OthrIdentification }
*
*/
|
public OthrIdentification getOthr() {
return othr;
}
/**
* Sets the value of the othr property.
*
* @param value
* allowed object is
* {@link OthrIdentification }
*
*/
public void setOthr(OthrIdentification value) {
this.othr = value;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.sepa\schema-pain_008_003_02\src\main\java-xjc\de\metas\payment\sepa\jaxb\sct\pain_008_003_02\FinancialInstitutionIdentificationSEPA3.java
| 1
|
请完成以下Java代码
|
public class SqlSelectDisplayValue
{
@Nullable private final String joinOnTableNameOrAlias;
@NonNull private final String joinOnColumnName;
@Nullable private final SqlForFetchingLookupById sqlExpression;
@Getter
@NonNull private final String columnNameAlias;
@Builder(toBuilder = true)
private SqlSelectDisplayValue(
@Nullable final String joinOnTableNameOrAlias,
@NonNull final String joinOnColumnName,
@Nullable final SqlForFetchingLookupById sqlExpression,
@NonNull final String columnNameAlias)
{
this.joinOnTableNameOrAlias = StringUtils.trimBlankToNull(joinOnTableNameOrAlias);
this.joinOnColumnName = joinOnColumnName;
this.sqlExpression = sqlExpression;
this.columnNameAlias = columnNameAlias;
}
/**
* @return (sql expression) AS columnNameAlias
*/
public String toSqlStringWithColumnNameAlias(@NonNull final Evaluatee ctx)
{
return toStringExpressionWithColumnNameAlias().evaluate(ctx, OnVariableNotFound.Fail);
}
/**
* @return (sql expression) AS columnNameAlias
*/
public IStringExpression toStringExpressionWithColumnNameAlias()
{
return IStringExpression.composer()
.append("(").append(toStringExpression()).append(") AS ").append(columnNameAlias)
.build();
}
public IStringExpression toStringExpression()
{
final String joinOnColumnNameFQ = !Check.isEmpty(joinOnTableNameOrAlias)
? joinOnTableNameOrAlias + "." + joinOnColumnName
: joinOnColumnName;
if (sqlExpression == null)
{
return ConstantStringExpression.of(joinOnColumnNameFQ);
}
else
{
return sqlExpression.toStringExpression(joinOnColumnNameFQ);
}
}
|
public IStringExpression toOrderByStringExpression()
{
final String joinOnColumnNameFQ = !Check.isEmpty(joinOnTableNameOrAlias)
? joinOnTableNameOrAlias + "." + joinOnColumnName
: joinOnColumnName;
if (sqlExpression == null)
{
return ConstantStringExpression.of(joinOnColumnNameFQ);
}
else
{
return sqlExpression.toOrderByStringExpression(joinOnColumnNameFQ);
}
}
public SqlSelectDisplayValue withJoinOnTableNameOrAlias(@Nullable final String joinOnTableNameOrAlias)
{
return !Objects.equals(this.joinOnTableNameOrAlias, joinOnTableNameOrAlias)
? toBuilder().joinOnTableNameOrAlias(joinOnTableNameOrAlias).build()
: this;
}
public String toSqlOrderByUsingColumnNameAlias()
{
final String columnNameAliasFQ = joinOnTableNameOrAlias != null ? joinOnTableNameOrAlias + "." + columnNameAlias : columnNameAlias;
if (sqlExpression != null)
{
return columnNameAliasFQ + "[" + sqlExpression.getNameSqlArrayIndex() + "]";
}
else
{
return columnNameAliasFQ;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\descriptor\sql\SqlSelectDisplayValue.java
| 1
|
请完成以下Java代码
|
public String getIncidentMessage() {
return incidentMessage;
}
public String getTenantId() {
return tenantId;
}
public String getJobDefinitionId() {
return jobDefinitionId;
}
public String getAnnotation() {
return annotation;
}
public static IncidentDto fromIncident(Incident incident) {
IncidentDto dto = new IncidentDto();
dto.id = incident.getId();
dto.processDefinitionId = incident.getProcessDefinitionId();
|
dto.processInstanceId = incident.getProcessInstanceId();
dto.executionId = incident.getExecutionId();
dto.incidentTimestamp = incident.getIncidentTimestamp();
dto.incidentType = incident.getIncidentType();
dto.activityId = incident.getActivityId();
dto.failedActivityId = incident.getFailedActivityId();
dto.causeIncidentId = incident.getCauseIncidentId();
dto.rootCauseIncidentId = incident.getRootCauseIncidentId();
dto.configuration = incident.getConfiguration();
dto.incidentMessage = incident.getIncidentMessage();
dto.tenantId = incident.getTenantId();
dto.jobDefinitionId = incident.getJobDefinitionId();
dto.annotation = incident.getAnnotation();
return dto;
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\runtime\IncidentDto.java
| 1
|
请完成以下Java代码
|
public String getPgNb() {
return pgNb;
}
/**
* Sets the value of the pgNb property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPgNb(String value) {
this.pgNb = value;
}
/**
* Gets the value of the lastPgInd property.
|
*
*/
public boolean isLastPgInd() {
return lastPgInd;
}
/**
* Sets the value of the lastPgInd property.
*
*/
public void setLastPgInd(boolean value) {
this.lastPgInd = value;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.camt53\src\main\java-xjc\de\metas\banking\camt53\jaxb\camt053_001_02\Pagination.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
static AutoConfigurationMetadata loadMetadata(Properties properties) {
return new PropertiesAutoConfigurationMetadata(properties);
}
/**
* {@link AutoConfigurationMetadata} implementation backed by a properties file.
*/
private static class PropertiesAutoConfigurationMetadata implements AutoConfigurationMetadata {
private final Properties properties;
PropertiesAutoConfigurationMetadata(Properties properties) {
this.properties = properties;
}
@Override
public boolean wasProcessed(String className) {
return this.properties.containsKey(className);
}
@Override
public @Nullable Integer getInteger(String className, String key) {
return getInteger(className, key, null);
}
@Override
public @Nullable Integer getInteger(String className, String key, @Nullable Integer defaultValue) {
String value = get(className, key);
return (value != null) ? Integer.valueOf(value) : defaultValue;
}
@Override
public @Nullable Set<String> getSet(String className, String key) {
|
return getSet(className, key, null);
}
@Override
public @Nullable Set<String> getSet(String className, String key, @Nullable Set<String> defaultValue) {
String value = get(className, key);
return (value != null) ? StringUtils.commaDelimitedListToSet(value) : defaultValue;
}
@Override
public @Nullable String get(String className, String key) {
return get(className, key, null);
}
@Override
public @Nullable String get(String className, String key, @Nullable String defaultValue) {
String value = this.properties.getProperty(className + "." + key);
return (value != null) ? value : defaultValue;
}
}
}
|
repos\spring-boot-4.0.1\core\spring-boot-autoconfigure\src\main\java\org\springframework\boot\autoconfigure\AutoConfigurationMetadataLoader.java
| 2
|
请完成以下Java代码
|
private Optional<PaymentProcessor> getPaymentProcessorIfExists(final PaymentRule paymentRule)
{
return paymentProcessors.getByPaymentRule(paymentRule);
}
public void captureAmount(@NonNull final PaymentReservationCaptureRequest request)
{
final PaymentReservation reservation = getBySalesOrderIdNotVoided(request.getSalesOrderId())
.orElse(null);
if (reservation == null)
{
return;
}
// eagerly fetching the processor to fail fast
final PaymentProcessor paymentProcessor = getPaymentProcessor(reservation.getPaymentRule());
final PaymentId paymentId = createPayment(request);
final PaymentReservationCapture capture = PaymentReservationCapture.builder()
.reservationId(reservation.getId())
.status(PaymentReservationCaptureStatus.NEW)
//
.orgId(reservation.getOrgId())
.salesOrderId(reservation.getSalesOrderId())
.salesInvoiceId(request.getSalesInvoiceId())
.paymentId(paymentId)
//
.amount(request.getAmount())
//
.build();
|
capturesRepo.save(capture);
paymentProcessor.processCapture(reservation, capture);
reservationsRepo.save(reservation);
capture.setStatusAsCompleted();
capturesRepo.save(capture);
}
private PaymentId createPayment(@NonNull final PaymentReservationCaptureRequest request)
{
final I_C_Payment payment = Services.get(IPaymentBL.class).newInboundReceiptBuilder()
.invoiceId(request.getSalesInvoiceId())
.bpartnerId(request.getCustomerId())
.payAmt(request.getAmount().toBigDecimal())
.currencyId(request.getAmount().getCurrencyId())
.tenderType(TenderType.DirectDeposit)
.dateTrx(request.getDateTrx())
.createAndProcess();
return PaymentId.ofRepoId(payment.getC_Payment_ID());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\payment\reservation\PaymentReservationService.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
static WsdlDefinitionBeanFactoryPostProcessor wsdlDefinitionBeanFactoryPostProcessor() {
return new WsdlDefinitionBeanFactoryPostProcessor();
}
@Configuration(proxyBeanMethods = false)
@EnableWs
protected static class WsConfiguration {
}
static class WsdlDefinitionBeanFactoryPostProcessor
implements BeanDefinitionRegistryPostProcessor, ApplicationContextAware {
@SuppressWarnings("NullAway.Init")
private ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) {
this.applicationContext = applicationContext;
}
@Override
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
Binder binder = Binder.get(this.applicationContext.getEnvironment());
List<String> wsdlLocations = binder.bind("spring.webservices.wsdl-locations", Bindable.listOf(String.class))
.orElse(Collections.emptyList());
for (String wsdlLocation : wsdlLocations) {
registerBeans(wsdlLocation, "*.wsdl", SimpleWsdl11Definition.class, SimpleWsdl11Definition::new,
registry);
registerBeans(wsdlLocation, "*.xsd", SimpleXsdSchema.class, SimpleXsdSchema::new, registry);
}
}
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
}
private <T> void registerBeans(String location, String pattern, Class<T> type,
Function<Resource, T> beanSupplier, BeanDefinitionRegistry registry) {
for (Resource resource : getResources(location, pattern)) {
BeanDefinition beanDefinition = BeanDefinitionBuilder
|
.rootBeanDefinition(type, () -> beanSupplier.apply(resource))
.getBeanDefinition();
String filename = resource.getFilename();
Assert.state(filename != null, "'filename' must not be null");
registry.registerBeanDefinition(StringUtils.stripFilenameExtension(filename), beanDefinition);
}
}
private Resource[] getResources(String location, String pattern) {
try {
return this.applicationContext.getResources(ensureTrailingSlash(location) + pattern);
}
catch (IOException ex) {
return new Resource[0];
}
}
private String ensureTrailingSlash(String path) {
return path.endsWith("/") ? path : path + "/";
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-webservices\src\main\java\org\springframework\boot\webservices\autoconfigure\WebServicesAutoConfiguration.java
| 2
|
请完成以下Java代码
|
public void setProcessed (boolean Processed)
{
set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed));
}
/** Get Verarbeitet.
@return Checkbox sagt aus, ob der Beleg verarbeitet wurde.
*/
@Override
public boolean isProcessed ()
{
Object oo = get_Value(COLUMNNAME_Processed);
if (oo != null)
{
if (oo instanceof Boolean)
{
return ((Boolean)oo).booleanValue();
}
return "Y".equals(oo);
}
return false;
}
/** Set Produkt UUID.
@param Product_UUID Produkt UUID */
@Override
public void setProduct_UUID (java.lang.String Product_UUID)
{
set_Value (COLUMNNAME_Product_UUID, Product_UUID);
}
/** Get Produkt UUID.
@return Produkt UUID */
@Override
public java.lang.String getProduct_UUID ()
{
return (java.lang.String)get_Value(COLUMNNAME_Product_UUID);
}
/** Set Menge.
@param Qty
Menge
*/
@Override
public void setQty (java.math.BigDecimal Qty)
{
set_Value (COLUMNNAME_Qty, Qty);
}
/** Get Menge.
@return Menge
*/
@Override
public java.math.BigDecimal getQty ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Qty);
|
if (bd == null)
{
return Env.ZERO;
}
return bd;
}
/** Set Menge (old).
@param Qty_Old Menge (old) */
@Override
public void setQty_Old (java.math.BigDecimal Qty_Old)
{
set_Value (COLUMNNAME_Qty_Old, Qty_Old);
}
/** Get Menge (old).
@return Menge (old) */
@Override
public java.math.BigDecimal getQty_Old ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Qty_Old);
if (bd == null)
{
return Env.ZERO;
}
return bd;
}
/**
* Type AD_Reference_ID=540660
* Reference name: PMM_RfQResponse_ChangeEvent_Type
*/
public static final int TYPE_AD_Reference_ID=540660;
/** Price = P */
public static final String TYPE_Price = "P";
/** Quantity = Q */
public static final String TYPE_Quantity = "Q";
/** Set Art.
@param Type
Type of Validation (SQL, Java Script, Java Language)
*/
@Override
public void setType (java.lang.String Type)
{
set_Value (COLUMNNAME_Type, Type);
}
/** Get Art.
@return Type of Validation (SQL, Java Script, Java Language)
*/
@Override
public java.lang.String getType ()
{
return (java.lang.String)get_Value(COLUMNNAME_Type);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.procurement.base\src\main\java-gen\de\metas\procurement\base\model\X_PMM_RfQResponse_ChangeEvent.java
| 1
|
请完成以下Java代码
|
public void setSize(int newSize)
{
keys.setSize(newSize);
elements.setSize(newSize);
}
public void setGrow(int growBy)
{
keys.setGrow(growBy);
elements.setGrow(growBy);
}
public synchronized void put(String key,Object element)
{
try
{
if( containsKey(key) )
{
elements.add(keys.location(key),element);
}
else
{
keys.add( key );
elements.add(element);
}
}
catch(org.apache.ecs.storage.NoSuchObjectException nsoe)
{
}
}
public synchronized void remove(String key)
{
try
{
if(containsKey(key))
{
elements.remove(keys.location(key));
elements.remove(elements.location(key));
}
}
catch(org.apache.ecs.storage.NoSuchObjectException nsoe)
{
}
}
public int size()
{
return keys.getCurrentSize();
}
public boolean contains(Object element)
{
try
{
elements.location(element);
return(true);
}
catch(org.apache.ecs.storage.NoSuchObjectException noSuchObject)
{
return false;
}
}
|
public Enumeration keys()
{
return keys;
}
public boolean containsKey(String key)
{
try
{
keys.location(key);
}
catch(org.apache.ecs.storage.NoSuchObjectException noSuchObject)
{
return false;
}
return(true);
}
public Enumeration elements()
{
return elements;
}
public Object get(String key)
{
try
{
if( containsKey(key) )
return(elements.get(keys.location(key)));
}
catch(org.apache.ecs.storage.NoSuchObjectException nsoe)
{
}
return null;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\tools\src\main\java-legacy\org\apache\ecs\storage\Hash.java
| 1
|
请完成以下Java代码
|
public InOutCostsViewData getData(
@NonNull final SOTrx soTrx,
@NonNull final InvoiceAndLineId invoiceAndLineId,
@Nullable final DocumentFilter filter)
{
return InOutCostsViewData.builder()
.viewDataService(this)
.soTrx(soTrx)
.invoiceAndLineId(invoiceAndLineId)
.filter(filter)
.build();
}
ImmutableList<InOutCostRow> retrieveRows(
@NonNull final SOTrx soTrx,
@Nullable final DocumentFilter filter)
{
final ImmutableList<InOutCost> inoutCosts = orderCostService
.stream(InOutCostsViewFilterHelper.toInOutCostQuery(soTrx, filter))
.collect(ImmutableList.toImmutableList());
|
return newLoader().loadRows(inoutCosts);
}
private InOutCostRowsLoader newLoader()
{
return InOutCostRowsLoader.builder()
.moneyService(moneyService)
.bpartnerLookup(bpartnerLookup)
.orderLookup(orderLookup)
.inoutLookup(inoutLookup)
.costTypeLookup(costTypeLookup)
.build();
}
public Amount getInvoiceLineOpenAmount(final InvoiceAndLineId invoiceAndLineId)
{
final Money invoiceLineOpenAmt = orderCostService.getInvoiceLineOpenAmt(invoiceAndLineId);
return moneyService.toAmount(invoiceLineOpenAmt);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\invoice\match_inout_costs\InOutCostsViewDataService.java
| 1
|
请完成以下Java代码
|
protected Iterator<IDunnableDoc> createRawSourceIterator(final IDunningContext context)
{
final Iterator<I_C_Dunning_Candidate_Invoice_v1> it = Services.get(IInvoiceSourceDAO.class).retrieveDunningCandidateInvoices(context);
return IteratorUtils.map(it, candidate -> createDunnableDoc(context, candidate));
}
private IDunnableDoc createDunnableDoc(
@NonNull final IDunningContext context,
@NonNull final I_C_Dunning_Candidate_Invoice_v1 candidate)
{
final int invoiceId = candidate.getC_Invoice_ID();
final int invoicePayScheduleId = candidate.getC_InvoicePaySchedule_ID();
final int adClientId = candidate.getAD_Client_ID();
final int adOrgId = candidate.getAD_Org_ID();
final int bpartnerId = candidate.getC_BPartner_ID();
final int bpartnerLocationId = candidate.getC_BPartner_Location_ID();
final int contactId = candidate.getAD_User_ID();
final int currencyId = candidate.getC_Currency_ID();
final BigDecimal grandTotal = candidate.getGrandTotal();
final BigDecimal openAmt = candidate.getOpenAmt();
final Date dateInvoiced = candidate.getDateInvoiced();
final Date dueDate = candidate.getDueDate();
final Date dunningGrace = candidate.getDunningGrace();
final int paymentTermId = candidate.getC_PaymentTerm_ID();
final boolean isInDispute = candidate.isInDispute();
final String documentNo; // FRESH-504
final String tableName;
final int recordId;
if (invoicePayScheduleId > 0)
{
tableName = I_C_InvoicePaySchedule.Table_Name;
recordId = invoicePayScheduleId;
// The table C_InvoicePaySchedule does not have the column DocumentNo. In this case, the documentNo is null
documentNo = null;
}
else
// if (C_Invoice_ID > 0)
{
tableName = I_C_Invoice.Table_Name;
recordId = invoiceId;
final I_C_Invoice invoice = InterfaceWrapperHelper.create(
context.getCtx(),
invoiceId,
I_C_Invoice.class,
ITrx.TRXNAME_ThreadInherited);
if (invoice == null)
{
// shall not happen
// in case of no referenced record the documentNo is null.
documentNo = null;
}
else
{
|
documentNo = invoice.getDocumentNo();
}
}
final int daysDue;
if (invoicePayScheduleId > 0)
{
daysDue = TimeUtil.getDaysBetween(dueDate, context.getDunningDate());
}
else
{
final IInvoiceSourceDAO invoiceSourceDAO = Services.get(IInvoiceSourceDAO.class);
daysDue = invoiceSourceDAO.retrieveDueDays(
PaymentTermId.ofRepoId(paymentTermId),
dateInvoiced,
context.getDunningDate());
}
final IDunnableDoc dunnableDoc = new DunnableDoc(tableName,
recordId,
documentNo, // FRESH-504 DocumentNo is also needed
adClientId,
adOrgId,
bpartnerId,
bpartnerLocationId,
contactId,
currencyId,
grandTotal,
openAmt,
dueDate,
dunningGrace,
daysDue,
isInDispute);
return dunnableDoc;
}
@Override
public String getSourceTableName()
{
return I_C_Invoice.Table_Name;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.dunning\src\main\java\de\metas\dunning\invoice\spi\impl\InvoiceSource.java
| 1
|
请完成以下Java代码
|
public static Json succ() {
return new Json();
}
public static Json succ(String operate) {
return new Json(operate, true, DEFAULT_SUCC_CODE, DEFAULT_SUCC_MSG, null);
}
public static Json succ(String operate, String message) {
return new Json(operate, true, DEFAULT_SUCC_CODE, message, null);
}
public static Json succ(String operate, Object data) {
return new Json(operate, true, DEFAULT_SUCC_CODE, DEFAULT_SUCC_MSG, data);
}
public static Json succ(String operate, String dataKey, Object dataVal) {
return new Json(operate, true, DEFAULT_SUCC_CODE, DEFAULT_SUCC_MSG, null).data(dataKey, dataVal);
}
////// 操作失败的:
public static Json fail() {
return new Json(DEFAULT_OPER_VAL, false, DEFAULT_FAIL_CODE, DEFAULT_FAIL_MSG, null);
}
public static Json fail(String operate) {
return new Json(operate, false, DEFAULT_FAIL_CODE, DEFAULT_FAIL_MSG, null);
}
public static Json fail(String operate, String message) {
return new Json(operate, false, DEFAULT_FAIL_CODE, message, null);
}
public static Json fail(String operate, Object data) {
return new Json(operate, false, DEFAULT_FAIL_CODE, DEFAULT_FAIL_MSG, data);
}
public static Json fail(String operate, String dataKey, Object dataVal) {
return new Json(operate, false, DEFAULT_FAIL_CODE, DEFAULT_FAIL_MSG, null).data(dataKey, dataVal);
}
////// 操作动态判定成功或失败的:
public static Json result(String operate, boolean success) {
return new Json(operate, success, (success ? DEFAULT_SUCC_CODE : DEFAULT_FAIL_CODE),
(success ? DEFAULT_SUCC_MSG : DEFAULT_FAIL_MSG), null);
}
public static Json result(String operate, boolean success, Object data) {
return new Json(operate, success, (success ? DEFAULT_SUCC_CODE : DEFAULT_FAIL_CODE),
(success ? DEFAULT_SUCC_MSG : DEFAULT_FAIL_MSG), data);
}
public static Json result(String operate, boolean success, String dataKey, Object dataVal) {
return new Json(operate, success, (success ? DEFAULT_SUCC_CODE : DEFAULT_FAIL_CODE),
(success ? DEFAULT_SUCC_MSG : DEFAULT_FAIL_MSG), null).data(dataKey, dataVal);
}
/////////////////////// 各种链式调用方法 ///////////////////////
|
/** 设置操作名称 */
public Json oper(String operate) {
this.put(KEY_OPER, operate);
return this;
}
/** 设置操作结果是否成功的标记 */
public Json succ(boolean success) {
this.put(KEY_SUCC, success);
return this;
}
/** 设置操作结果的代码 */
public Json code(int code) {
this.put(KEY_CODE, code);
return this;
}
/** 设置操作结果的信息 */
public Json msg(String message) {
this.put(KEY_MSG, message);
return this;
}
/** 设置操作返回的数据 */
public Json data(Object dataVal) {
this.put(KEY_DATA, dataVal);
return this;
}
/** 设置操作返回的数据,数据使用自定义的key存储 */
public Json data(String dataKey, Object dataVal) {
this.put(dataKey, dataVal);
return this;
}
}
|
repos\spring-boot-quick-master\quick-spring-shiro\src\main\java\com\shiro\vo\Json.java
| 1
|
请完成以下Java代码
|
protected org.compiere.model.POInfo initPO(final Properties ctx)
{
return org.compiere.model.POInfo.getPOInfo(Table_Name);
}
@Override
public void setClassname (final java.lang.String Classname)
{
set_Value (COLUMNNAME_Classname, Classname);
}
@Override
public java.lang.String getClassname()
{
return get_ValueAsString(COLUMNNAME_Classname);
}
@Override
public void setM_IolCandHandler_ID (final int M_IolCandHandler_ID)
{
if (M_IolCandHandler_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_IolCandHandler_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_IolCandHandler_ID, M_IolCandHandler_ID);
}
@Override
|
public int getM_IolCandHandler_ID()
{
return get_ValueAsInt(COLUMNNAME_M_IolCandHandler_ID);
}
@Override
public void setTableName (final java.lang.String TableName)
{
set_Value (COLUMNNAME_TableName, TableName);
}
@Override
public java.lang.String getTableName()
{
return get_ValueAsString(COLUMNNAME_TableName);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java-gen\de\metas\inoutcandidate\model\X_M_IolCandHandler.java
| 1
|
请完成以下Java代码
|
public int getPP_OrderLine_Candidate_ID()
{
return get_ValueAsInt(COLUMNNAME_PP_OrderLine_Candidate_ID);
}
@Override
public org.eevolution.model.I_PP_Product_BOMLine getPP_Product_BOMLine()
{
return get_ValueAsPO(COLUMNNAME_PP_Product_BOMLine_ID, org.eevolution.model.I_PP_Product_BOMLine.class);
}
@Override
public void setPP_Product_BOMLine(final org.eevolution.model.I_PP_Product_BOMLine PP_Product_BOMLine)
{
set_ValueFromPO(COLUMNNAME_PP_Product_BOMLine_ID, org.eevolution.model.I_PP_Product_BOMLine.class, PP_Product_BOMLine);
}
@Override
public void setPP_Product_BOMLine_ID (final int PP_Product_BOMLine_ID)
{
if (PP_Product_BOMLine_ID < 1)
set_ValueNoCheck (COLUMNNAME_PP_Product_BOMLine_ID, null);
|
else
set_ValueNoCheck (COLUMNNAME_PP_Product_BOMLine_ID, PP_Product_BOMLine_ID);
}
@Override
public int getPP_Product_BOMLine_ID()
{
return get_ValueAsInt(COLUMNNAME_PP_Product_BOMLine_ID);
}
@Override
public void setQtyEntered (final @Nullable BigDecimal QtyEntered)
{
set_Value (COLUMNNAME_QtyEntered, QtyEntered);
}
@Override
public BigDecimal getQtyEntered()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyEntered);
return bd != null ? bd : BigDecimal.ZERO;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_PP_OrderLine_Candidate.java
| 1
|
请完成以下Java代码
|
public int size()
{
return size;
}
/**
* @return <code>true</code> if the "goal" record was found, or if there aren't forther records in the queue to check.
*/
@Override
public boolean isQueueEmpty()
{
if (foundGoal)
{
return true;
}
return queueItemsToProcess.isEmpty();
}
@Override
public ITableRecordReference nextFromQueue()
{
return queueItemsToProcess.removeFirst();
}
@Override
public void registerHandler(IIterateResultHandler handler)
{
handlerSupport.registerListener(handler);
}
@Override
public List<IIterateResultHandler> getRegisteredHandlers()
{
return handlerSupport.getRegisteredHandlers();
}
@Override
public boolean isHandlerSignaledToStop()
{
return handlerSupport.isHandlerSignaledToStop();
}
public boolean isFoundGoalRecord()
{
return foundGoal;
}
@Override
public boolean contains(final ITableRecordReference forwardReference)
{
return g.containsVertex(forwardReference);
}
public List<ITableRecordReference> getPath()
{
final List<ITableRecordReference> result = new ArrayList<>();
final AsUndirectedGraph<ITableRecordReference, DefaultEdge> undirectedGraph = new AsUndirectedGraph<>(g);
final List<DefaultEdge> path = DijkstraShortestPath.<ITableRecordReference, DefaultEdge> findPathBetween(
undirectedGraph, start, goal);
if (path == null || path.isEmpty())
{
return ImmutableList.of();
|
}
result.add(start);
for (final DefaultEdge e : path)
{
final ITableRecordReference edgeSource = undirectedGraph.getEdgeSource(e);
if (!result.contains(edgeSource))
{
result.add(edgeSource);
}
else
{
result.add(undirectedGraph.getEdgeTarget(e));
}
}
return ImmutableList.copyOf(result);
}
/* package */ Graph<ITableRecordReference, DefaultEdge> getGraph()
{
return g;
}
@Override
public String toString()
{
return "FindPathIterateResult [start=" + start + ", goal=" + goal + ", size=" + size + ", foundGoal=" + foundGoal + ", queueItemsToProcess.size()=" + queueItemsToProcess.size() + "]";
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.dlm\base\src\main\java\de\metas\dlm\partitioner\graph\FindPathIterateResult.java
| 1
|
请完成以下Java代码
|
public List<ITableRecordReference> getRecordsFlat()
{
return records.values().stream().flatMap(v -> v.stream()).collect(Collectors.toList());
}
/**
* Gets the records that were added via {@link #withRecords(Map)}.
* <p>
* <b>IMPORTANT:</b> please see the note at {@link #getRecordsFlat()}.
*
* @return the records of this partition.
*/
public Map<String, Collection<ITableRecordReference>> getRecords()
{
return records;
}
public Collection<ITableRecordReference> getRecordsWithTable(final String referencedTableName)
{
return records.getOrDefault(referencedTableName, Collections.emptyList());
}
public boolean isRecordsChanged()
{
return recordsChanged;
}
public boolean isComplete()
{
return complete;
}
public PartitionConfig getConfig()
{
return config;
}
public boolean isConfigChanged()
{
return configChanged;
}
public int getTargetDLMLevel()
{
return targetDLMLevel;
}
public int getCurrentDLMLevel()
{
return currentDLMLevel;
}
public Timestamp getNextInspectionDate()
{
return nextInspectionDate;
}
public int getDLM_Partition_ID()
{
return DLM_Partition_ID;
}
public boolean isAborted()
{
return aborted;
}
@Override
public String toString()
{
return "Partition [DLM_Partition_ID=" + DLM_Partition_ID + ", records.size()=" + records.size() + ", recordsChanged=" + recordsChanged + ", configChanged=" + configChanged + ", targetDLMLevel=" + targetDLMLevel + ", currentDLMLevel=" + currentDLMLevel + ", nextInspectionDate=" + nextInspectionDate + "]";
}
public static class WorkQueue
{
public static WorkQueue of(final I_DLM_Partition_Workqueue workqueueDB)
{
final ITableRecordReference tableRecordRef = TableRecordReference.ofReferencedOrNull(workqueueDB);
final WorkQueue result = new WorkQueue(tableRecordRef);
result.setDLM_Partition_Workqueue_ID(workqueueDB.getDLM_Partition_Workqueue_ID());
|
return result;
}
public static WorkQueue of(final ITableRecordReference tableRecordRef)
{
return new WorkQueue(tableRecordRef);
}
private final ITableRecordReference tableRecordReference;
private int dlmPartitionWorkqueueId;
private WorkQueue(final ITableRecordReference tableRecordReference)
{
this.tableRecordReference = tableRecordReference;
}
public ITableRecordReference getTableRecordReference()
{
return tableRecordReference;
}
public int getDLM_Partition_Workqueue_ID()
{
return dlmPartitionWorkqueueId;
}
public void setDLM_Partition_Workqueue_ID(final int dlm_Partition_Workqueue_ID)
{
dlmPartitionWorkqueueId = dlm_Partition_Workqueue_ID;
}
@Override
public String toString()
{
return "Partition.WorkQueue [DLM_Partition_Workqueue_ID=" + dlmPartitionWorkqueueId + ", tableRecordReference=" + tableRecordReference + "]";
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.dlm\base\src\main\java\de\metas\dlm\Partition.java
| 1
|
请完成以下Java代码
|
public class SimpleGrantedAuthoritiesResolver implements GrantedAuthoritiesResolver {
@Override
public Collection<? extends GrantedAuthority> getAuthorities(@NonNull Principal principal) {
return Optional.of(principal)
.filter(this::isSupportedPrincipal)
.map(this.getPrincipalClass()::cast)
.map(this::getAuthorities)
.orElseThrow(this::securityException);
}
protected SecurityException securityException() {
return new SecurityException("Invalid principal authorities");
}
protected <T> Collection<? extends GrantedAuthority> getAuthorities(Authentication authentication) {
|
return Optional.ofNullable(authentication.getAuthorities()).orElseGet(this::emptyAuthorities);
}
protected <T> Collection<T> emptyAuthorities() {
return emptyList();
}
protected Boolean isSupportedPrincipal(Principal principal) {
return getPrincipalClass().isInstance(principal);
}
protected <T> Class<? extends Authentication> getPrincipalClass() {
return Authentication.class;
}
}
|
repos\Activiti-develop\activiti-core-common\activiti-spring-security\src\main\java\org\activiti\core\common\spring\security\SimpleGrantedAuthoritiesResolver.java
| 1
|
请完成以下Java代码
|
public boolean isDefault ()
{
Object oo = get_Value(COLUMNNAME_IsDefault);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
|
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Set Search Key.
@param Value
Search key for the record in the format required - must be unique
*/
public void setValue (String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
/** Get Search Key.
@return Search key for the record in the format required - must be unique
*/
public String getValue ()
{
return (String)get_Value(COLUMNNAME_Value);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_HR_Concept_Category.java
| 1
|
请完成以下Java代码
|
public PageResult<String> findKeysForPage(String patternKey, int currentPage, int pageSize) {
ScanOptions options = ScanOptions.scanOptions().match(patternKey).build();
RedisConnectionFactory factory = stringRedisTemplate.getConnectionFactory();
RedisConnection rc = factory.getConnection();
Cursor<byte[]> cursor = rc.scan(options);
List<String> result = Lists.newArrayList();
long tmpIndex = 0;
int startIndex = (currentPage - 1) * pageSize;
int end = currentPage * pageSize;
while (cursor.hasNext()) {
String key = new String(cursor.next());
if (tmpIndex >= startIndex && tmpIndex < end) {
result.add(key);
}
tmpIndex++;
}
try {
cursor.close();
RedisConnectionUtils.releaseConnection(rc, factory);
} catch (Exception e) {
log.warn("Redis连接关闭异常,", e);
}
return new PageResult<>(result, tmpIndex);
}
|
/**
* 删除 Redis 中的某个key
*
* @param key 键
*/
public void delete(String key) {
stringRedisTemplate.delete(key);
}
/**
* 批量删除 Redis 中的某些key
*
* @param keys 键列表
*/
public void delete(Collection<String> keys) {
stringRedisTemplate.delete(keys);
}
}
|
repos\spring-boot-demo-master\demo-rbac-security\src\main\java\com\xkcoding\rbac\security\util\RedisUtil.java
| 1
|
请完成以下Java代码
|
public java.sql.Timestamp getValidFrom ()
{
return (java.sql.Timestamp)get_Value(COLUMNNAME_ValidFrom);
}
/** Set Gültig bis.
@param ValidTo
Gültig bis inklusiv (letzter Tag)
*/
@Override
public void setValidTo (java.sql.Timestamp ValidTo)
{
set_Value (COLUMNNAME_ValidTo, ValidTo);
}
/** Get Gültig bis.
@return Gültig bis inklusiv (letzter Tag)
*/
@Override
public java.sql.Timestamp getValidTo ()
{
return (java.sql.Timestamp)get_Value(COLUMNNAME_ValidTo);
}
|
/** Set VAT Code.
@param VATCode VAT Code */
@Override
public void setVATCode (java.lang.String VATCode)
{
set_Value (COLUMNNAME_VATCode, VATCode);
}
/** Get VAT Code.
@return VAT Code */
@Override
public java.lang.String getVATCode ()
{
return (java.lang.String)get_Value(COLUMNNAME_VATCode);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java-gen\de\metas\acct\model\X_C_VAT_Code.java
| 1
|
请完成以下Java代码
|
public List<String> getInstalledServices() {
return installedServices;
}
// builder /////////////////////////////
public static class DeploymentOperationBuilder {
protected PlatformServiceContainer container;
protected String name;
protected boolean isUndeploymentOperation = false;
protected List<DeploymentOperationStep> steps = new ArrayList<DeploymentOperationStep>();
protected Map<String, Object> initialAttachments = new HashMap<String, Object>();
public DeploymentOperationBuilder(PlatformServiceContainer container, String name) {
this.container = container;
this.name = name;
}
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
|
请完成以下Java代码
|
public class MustacheView extends AbstractTemplateView {
private @Nullable Compiler compiler;
private @Nullable Charset charset;
/**
* Set the Mustache compiler to be used by this view.
* <p>
* Typically this property is not set directly. Instead a single {@link Compiler} is
* expected in the Spring application context which is used to compile Mustache
* templates.
* @param compiler the Mustache compiler
*/
public void setCompiler(Compiler compiler) {
this.compiler = compiler;
}
/**
* Set the {@link Charset} used for reading Mustache template files.
* @param charset the charset
* @since 4.1.0
*/
public void setCharset(@Nullable Charset charset) {
this.charset = charset;
}
/**
* Set the name of the charset used for reading Mustache template files.
* @param charset the charset
* @deprecated since 4.1.0 for removal in 4.3.0 in favor of
* {@link #setCharset(Charset)}
*/
@Deprecated(since = "4.1.0", forRemoval = true)
public void setCharset(@Nullable String charset) {
setCharset((charset != null) ? Charset.forName(charset) : null);
}
@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-main\module\spring-boot-mustache\src\main\java\org\springframework\boot\mustache\servlet\view\MustacheView.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public EventDeploymentBuilder addEventDefinition(String resourceName, String eventDefinition) {
addString(resourceName, eventDefinition);
return this;
}
@Override
public EventDeploymentBuilder addChannelDefinitionBytes(String resourceName, byte[] channelDefinitionBytes) {
if (channelDefinitionBytes == null) {
throw new FlowableException("channel definition bytes is null");
}
EventResourceEntity resource = resourceEntityManager.create();
resource.setName(resourceName);
resource.setBytes(channelDefinitionBytes);
deployment.addResource(resource);
return this;
}
@Override
public EventDeploymentBuilder addChannelDefinition(String resourceName, String channelDefinition) {
addString(resourceName, channelDefinition);
return this;
}
@Override
public EventDeploymentBuilder name(String name) {
deployment.setName(name);
return this;
}
@Override
public EventDeploymentBuilder category(String category) {
deployment.setCategory(category);
return this;
}
@Override
public EventDeploymentBuilder tenantId(String tenantId) {
deployment.setTenantId(tenantId);
return this;
}
@Override
public EventDeploymentBuilder parentDeploymentId(String parentDeploymentId) {
deployment.setParentDeploymentId(parentDeploymentId);
return this;
}
|
@Override
public EventDeploymentBuilder enableDuplicateFiltering() {
this.isDuplicateFilterEnabled = true;
return this;
}
@Override
public EventDeployment deploy() {
return repositoryService.deploy(this);
}
// getters and setters
// //////////////////////////////////////////////////////
public EventDeploymentEntity getDeployment() {
return deployment;
}
public boolean isDuplicateFilterEnabled() {
return isDuplicateFilterEnabled;
}
}
|
repos\flowable-engine-main\modules\flowable-event-registry\src\main\java\org\flowable\eventregistry\impl\repository\EventDeploymentBuilderImpl.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class AcctSchemaGeneralLedger
{
boolean suspenseBalancing;
Account suspenseBalancingAcct;
boolean currencyBalancing;
Account currencyBalancingAcct;
@NonNull
Account intercompanyDueToAcct;
@NonNull
Account intercompanyDueFromAcct;
@NonNull
Account incomeSummaryAcct;
@NonNull
Account retainedEarningAcct;
|
@NonNull
Account purchasePriceVarianceOffsetAcct;
@NonNull
Account cashRoundingAcct;
@NonNull
public Account getDueToAcct(final AcctSchemaElementType segment)
{
return intercompanyDueToAcct;
}
@NonNull
public Account getDueFromAcct(final AcctSchemaElementType segment)
{
return intercompanyDueFromAcct;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\acct\api\AcctSchemaGeneralLedger.java
| 2
|
请完成以下Java代码
|
public String getType() {
return TYPE;
}
public void execute(EventSubscriptionJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) {
// lookup subscription:
String eventSubscriptionId = configuration.getEventSubscriptionId();
EventSubscriptionEntity eventSubscription = commandContext.getEventSubscriptionManager()
.findEventSubscriptionById(eventSubscriptionId);
// if event subscription is null, ignore
if(eventSubscription != null) {
eventSubscription.eventReceived(null, false);
}
}
@Override
public EventSubscriptionJobConfiguration newConfiguration(String canonicalString) {
return new EventSubscriptionJobConfiguration(canonicalString);
}
public static class EventSubscriptionJobConfiguration implements JobHandlerConfiguration {
protected String eventSubscriptionId;
|
public EventSubscriptionJobConfiguration(String eventSubscriptionId) {
this.eventSubscriptionId = eventSubscriptionId;
}
public String getEventSubscriptionId() {
return eventSubscriptionId;
}
@Override
public String toCanonicalString() {
return eventSubscriptionId;
}
}
public void onDelete(EventSubscriptionJobConfiguration configuration, JobEntity jobEntity) {
// do nothing
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\jobexecutor\ProcessEventJobHandler.java
| 1
|
请完成以下Java代码
|
public class PlainVendorReceipt implements IVendorReceipt<Object>
{
private I_M_Product product;
private BigDecimal qtyReceived;
private I_C_UOM qtyReceivedUOM;
private IHandlingUnitsInfo handlingUnitsInfo;
private I_M_PriceList_Version plv;
@Override
public String toString()
{
final StringBuilder sb = new StringBuilder();
sb.append("PlainVendorReceipt [");
sb.append("product=").append(product == null ? "-" : product.getValue());
sb.append(", qtyReceived=").append(qtyReceived).append(qtyReceivedUOM == null ? "" : qtyReceivedUOM.getUOMSymbol());
sb.append(", handlingUnitsInfo=").append(handlingUnitsInfo);
sb.append("]");
return sb.toString();
}
@Override
public I_M_Product getM_Product()
{
Check.assumeNotNull(product, "product not null");
return product;
}
public void setM_Product(final I_M_Product product)
{
this.product = product;
}
@Override
public BigDecimal getQtyReceived()
{
Check.assumeNotNull(qtyReceived, "qtyReceived not null");
return qtyReceived;
}
public void setQtyReceived(final BigDecimal qtyReceived)
{
this.qtyReceived = qtyReceived;
}
@Override
public I_C_UOM getQtyReceivedUOM()
{
Check.assumeNotNull(qtyReceivedUOM, "qtyReceivedUOM not null");
return qtyReceivedUOM;
}
public void setQtyReceivedUOM(final I_C_UOM qtyReceivedUOM)
{
|
this.qtyReceivedUOM = qtyReceivedUOM;
}
@Override
public IHandlingUnitsInfo getHandlingUnitsInfo()
{
return handlingUnitsInfo;
}
public void setHandlingUnitsInfo(final IHandlingUnitsInfo handlingUnitsInfo)
{
this.handlingUnitsInfo = handlingUnitsInfo;
}
/**
* This method does nothing!
*/
@Override
public void add(final Object IGNORED)
{
}
/**
* This method returns the empty list.
*/
@Override
public List<Object> getModels()
{
return Collections.emptyList();
}
@Override public I_M_PriceList_Version getPLV()
{
return plv;
}
public void setPlv(I_M_PriceList_Version plv)
{
this.plv = plv;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.materialtracking\src\main\java\de\metas\materialtracking\qualityBasedInvoicing\impl\PlainVendorReceipt.java
| 1
|
请完成以下Java代码
|
public <T extends PO> T getPO(final Object model, final boolean strict)
{
if (strict)
{
return null;
}
if (model instanceof GridTab)
{
final GridTab gridTab = (GridTab)model;
return GridTabWrapper.getPO(Env.getCtx(), gridTab);
}
final GridTabWrapper wrapper = GridTabWrapper.getWrapper(model);
if (wrapper == null)
{
throw new AdempiereException("Cannot extract " + GridTabWrapper.class + " from " + model);
}
return wrapper.getPO();
|
}
@Override
public Evaluatee getEvaluatee(final Object model)
{
return GridTabWrapper.getGridTab(model);
}
@Override
public boolean isCopy(final Object model)
{
return GridTabWrapper.getGridTab(model).getTableModel().isRecordCopyingMode();
}
@Override
public boolean isCopying(final Object model)
{
return isCopy(model);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\wrapper\GridTabInterfaceWrapperHelper.java
| 1
|
请完成以下Java代码
|
public void setConvertToUpperCase(boolean convertToUpperCase) {
this.convertToUpperCase = convertToUpperCase;
}
/**
* The name of the attribute which contains the user's password. Defaults to
* "userPassword".
* @param passwordAttributeName the name of the attribute
*/
public void setPasswordAttributeName(String passwordAttributeName) {
this.passwordAttributeName = passwordAttributeName;
}
/**
* The names of any attributes in the user's entry which represent application roles.
* These will be converted to <tt>GrantedAuthority</tt>s and added to the list in the
|
* returned LdapUserDetails object. The attribute values must be Strings by default.
* @param roleAttributes the names of the role attributes.
*/
public void setRoleAttributes(String[] roleAttributes) {
Assert.notNull(roleAttributes, "roleAttributes array cannot be null");
this.roleAttributes = roleAttributes;
}
/**
* The prefix that should be applied to the role names
* @param rolePrefix the prefix (defaults to "ROLE_").
*/
public void setRolePrefix(String rolePrefix) {
this.rolePrefix = rolePrefix;
}
}
|
repos\spring-security-main\ldap\src\main\java\org\springframework\security\ldap\userdetails\LdapUserDetailsMapper.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
DefaultMethodSecurityExpressionHandler getBean() {
this.handler.setDefaultRolePrefix(this.rolePrefix);
return this.handler;
}
}
abstract static class AbstractGrantedAuthorityDefaultsBeanFactory implements ApplicationContextAware {
protected String rolePrefix = "ROLE_";
@Override
public final void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
applicationContext.getBeanProvider(GrantedAuthorityDefaults.class)
.ifUnique((grantedAuthorityDefaults) -> this.rolePrefix = grantedAuthorityDefaults.getRolePrefix());
}
}
/**
* Delays setting a bean of a given name to be lazyily initialized until after all the
* beans are registered.
*
* @author Rob Winch
* @since 3.2
*/
private static final class LazyInitBeanDefinitionRegistryPostProcessor
implements BeanDefinitionRegistryPostProcessor {
private final String beanName;
private LazyInitBeanDefinitionRegistryPostProcessor(String beanName) {
this.beanName = beanName;
}
|
@Override
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
if (!registry.containsBeanDefinition(this.beanName)) {
return;
}
BeanDefinition beanDefinition = registry.getBeanDefinition(this.beanName);
beanDefinition.setLazyInit(true);
}
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
}
}
}
|
repos\spring-security-main\config\src\main\java\org\springframework\security\config\method\GlobalMethodSecurityBeanDefinitionParser.java
| 2
|
请完成以下Java代码
|
public class IntermediateCatchEventValidator extends ProcessLevelValidator {
@Override
protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) {
List<IntermediateCatchEvent> intermediateCatchEvents = process.findFlowElementsOfType(
IntermediateCatchEvent.class
);
for (IntermediateCatchEvent intermediateCatchEvent : intermediateCatchEvents) {
EventDefinition eventDefinition = null;
if (!intermediateCatchEvent.getEventDefinitions().isEmpty()) {
eventDefinition = intermediateCatchEvent.getEventDefinitions().get(0);
}
if (eventDefinition == null) {
addError(errors, Problems.INTERMEDIATE_CATCH_EVENT_NO_EVENTDEFINITION, process, intermediateCatchEvent);
} else {
|
if (
!(eventDefinition instanceof TimerEventDefinition) &&
!(eventDefinition instanceof SignalEventDefinition) &&
!(eventDefinition instanceof MessageEventDefinition) &&
!(eventDefinition instanceof LinkEventDefinition)
) {
addError(
errors,
Problems.INTERMEDIATE_CATCH_EVENT_INVALID_EVENTDEFINITION,
process,
intermediateCatchEvent
);
}
}
}
}
}
|
repos\Activiti-develop\activiti-core\activiti-process-validation\src\main\java\org\activiti\validation\validator\impl\IntermediateCatchEventValidator.java
| 1
|
请完成以下Java代码
|
public abstract class CmmnSentryPart implements Serializable {
private static final long serialVersionUID = 1L;
protected String type;
protected String sentryId;
protected String standardEvent;
protected String source;
protected String variableEvent;
protected String variableName;
protected boolean satisfied = false;
public abstract CmmnExecution getCaseInstance();
public abstract void setCaseInstance(CmmnExecution caseInstance);
public abstract CmmnExecution getCaseExecution();
public abstract void setCaseExecution(CmmnExecution caseExecution);
public String getSentryId() {
return sentryId;
}
public void setSentryId(String sentryId) {
this.sentryId = sentryId;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
/**
* @deprecated since 7.4 A new instance of a sentry
* does not reference the source case execution id anymore.
*/
public abstract String getSourceCaseExecutionId();
/**
* @deprecated since 7.4 A new instance of a sentry
* does not reference the source case execution id anymore.
*/
public abstract CmmnExecution getSourceCaseExecution();
/**
* @deprecated since 7.4 A new instance of a sentry
|
* does not reference the source case execution id anymore.
*/
public abstract void setSourceCaseExecution(CmmnExecution sourceCaseExecution);
public String getStandardEvent() {
return standardEvent;
}
public void setStandardEvent(String standardEvent) {
this.standardEvent = standardEvent;
}
public boolean isSatisfied() {
return satisfied;
}
public void setSatisfied(boolean satisfied) {
this.satisfied = satisfied;
}
public String getVariableEvent() {
return variableEvent;
}
public void setVariableEvent(String variableEvent) {
this.variableEvent = variableEvent;
}
public String getVariableName() {
return variableName;
}
public void setVariableName(String variableName) {
this.variableName = variableName;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmmn\execution\CmmnSentryPart.java
| 1
|
请完成以下Java代码
|
private void updateQtyOrderedAndBatches(@NonNull final I_PP_Order ppOrder)
{
final ProductId productId = ProductId.ofRepoIdOrNull(ppOrder.getM_Product_ID());
if (productId == null)
{
return;
}
final UomId uomToId = UomId.ofRepoIdOrNull(ppOrder.getC_UOM_ID());
if (uomToId == null)
{
return;
}
final I_C_UOM uom = uomDAO.getById(uomToId);
final Quantity qtyEntered = Quantity.of(ppOrder.getQtyEntered(), uom);
ppOrderBOMBL.changeQuantities(ppOrder, qtys -> qtys.withQtyRequiredToProduce(qtyEntered));
ppOrderBL.updateQtyBatchs(ppOrder, true); // override
}
/**
* Find Product Planning Data for given manufacturing order. If not planning found, a new one is created and filled with default values.
*/
@NonNull
private ProductPlanning findPP_Product_Planning(@NonNull final I_PP_Order ppOrderWithProductId)
{
final ProductPlanningQuery query = ProductPlanningQuery.builder()
.orgId(OrgId.ofRepoIdOrAny(ppOrderWithProductId.getAD_Org_ID()))
.warehouseId(WarehouseId.ofRepoIdOrNull(ppOrderWithProductId.getM_Warehouse_ID()))
.plantId(ResourceId.ofRepoIdOrNull(ppOrderWithProductId.getS_Resource_ID()))
.productId(ProductId.ofRepoId(ppOrderWithProductId.getM_Product_ID()))
.includeWithNullProductId(false)
.attributeSetInstanceId(AttributeSetInstanceId.ofRepoId(ppOrderWithProductId.getM_AttributeSetInstance_ID()))
.build();
|
final ProductPlanning productPlanningOrig = productPlanningDAO.find(query).orElse(null);
final ProductPlanning.ProductPlanningBuilder builder;
if (productPlanningOrig == null)
{
builder = ProductPlanning.builder()
.orgId(OrgId.ofRepoId(ppOrderWithProductId.getAD_Org_ID()))
.warehouseId(WarehouseId.ofRepoIdOrNull(ppOrderWithProductId.getM_Warehouse_ID()))
.plantId(ResourceId.ofRepoIdOrNull(ppOrderWithProductId.getS_Resource_ID()))
.productId(ProductId.ofRepoId(ppOrderWithProductId.getM_Product_ID()));
}
else
{
builder = productPlanningOrig.toBuilder();
}
builder.disallowSaving(true);
final ProductId productId = ProductId.ofRepoId(ppOrderWithProductId.getM_Product_ID()); // pp itself might not have M_Product_ID>0, so we use the PP_Order's one
if (productPlanningOrig == null || productPlanningOrig.getWorkflowId() == null)
{
final PPRoutingId routingId = routingRepo.getRoutingIdByProductId(productId);
builder.workflowId(routingId);
}
if (productPlanningOrig == null || productPlanningOrig.getBomVersionsId() == null)
{
bomVersionsRepo.retrieveBOMVersionsId(productId).ifPresent(builder::bomVersionsId);
}
return builder.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\org\eevolution\callout\PP_Order.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void saveData(RpAccountCheckMistakeScratchPool RpAccountCheckMistakeScratchPool) {
rpAccountCheckMistakeScratchPoolDao.insert(RpAccountCheckMistakeScratchPool);
}
/**
* 批量保存记录
*
* @param ScratchPoolList
*/
public void savaListDate(List<RpAccountCheckMistakeScratchPool> scratchPoolList) {
for (RpAccountCheckMistakeScratchPool record : scratchPoolList) {
rpAccountCheckMistakeScratchPoolDao.insert(record);
}
}
@Override
public void updateData(RpAccountCheckMistakeScratchPool RpAccountCheckMistakeScratchPool) {
rpAccountCheckMistakeScratchPoolDao.update(RpAccountCheckMistakeScratchPool);
}
@Override
public RpAccountCheckMistakeScratchPool getDataById(String id) {
return rpAccountCheckMistakeScratchPoolDao.getById(id);
}
/**
* 获取分页数据
*
* @param pageParam
* @return
*/
public PageBean listPage(PageParam pageParam, RpAccountCheckMistakeScratchPool rpAccountCheckMistakeScratchPool) {
Map<String, Object> paramMap = new HashMap<String, Object>();
return rpAccountCheckMistakeScratchPoolDao.listPage(pageParam, paramMap);
}
|
/**
* 从缓冲池中删除数据
*
* @param scratchPoolList
*/
public void deleteFromPool(List<RpAccountCheckMistakeScratchPool> scratchPoolList) {
for (RpAccountCheckMistakeScratchPool record : scratchPoolList) {
rpAccountCheckMistakeScratchPoolDao.delete(record.getId());
}
}
/**
* 查询出缓存池中所有的数据
*
* @return
*/
public List<RpAccountCheckMistakeScratchPool> listScratchPoolRecord(Map<String, Object> paramMap) {
if (paramMap == null) {
paramMap = new HashMap<String, Object>();
}
return rpAccountCheckMistakeScratchPoolDao.listByColumn(paramMap);
}
}
|
repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\reconciliation\service\impl\RpAccountCheckMistakeScratchPoolServiceImpl.java
| 2
|
请完成以下Java代码
|
protected void assertValid(final IPackingMaterialDocumentLineSource source)
{
Check.assumeInstanceOf(source, PlainPackingMaterialDocumentLineSource.class, "source");
}
@Override
protected IPackingMaterialDocumentLine createPackingMaterialDocumentLine(@NonNull final ProductId productId)
{
final I_M_InOut inout = getM_InOut();
final I_M_InOutLine inoutLine = inOutBL.newInOutLine(inout, I_M_InOutLine.class);
final UomId uomId = productBL.getStockUOMId(ProductId.toRepoId( productId));
inoutLine.setM_Product_ID(ProductId.toRepoId( productId));
inoutLine.setC_UOM_ID(uomId.getRepoId()); // prevent the system from picking its default-UOM; there might be no UOM-conversion to/from the product's UOM
// NOTE: don't save it
return new EmptiesInOutLinePackingMaterialDocumentLine(inoutLine);
}
private final EmptiesInOutLinePackingMaterialDocumentLine toImpl(final IPackingMaterialDocumentLine pmLine)
{
return (EmptiesInOutLinePackingMaterialDocumentLine)pmLine;
}
@Override
protected void removeDocumentLine(@NonNull final IPackingMaterialDocumentLine pmLine)
{
final EmptiesInOutLinePackingMaterialDocumentLine inoutLinePMLine = toImpl(pmLine);
final I_M_InOutLine inoutLine = inoutLinePMLine.getM_InOutLine();
if (!InterfaceWrapperHelper.isNew(inoutLine))
{
InterfaceWrapperHelper.delete(inoutLine);
}
|
}
@Override
protected void createDocumentLine(@NonNull final IPackingMaterialDocumentLine pmLine)
{
final EmptiesInOutLinePackingMaterialDocumentLine inoutLinePMLine = toImpl(pmLine);
final I_M_InOut inout = getM_InOut();
InterfaceWrapperHelper.save(inout); // make sure inout header is saved
final I_M_InOutLine inoutLine = inoutLinePMLine.getM_InOutLine();
inoutLine.setM_InOut(inout); // make sure inout line is linked to our M_InOut_ID (in case it was just saved)
inoutLine.setIsActive(true); // just to be sure
// task FRESH-273
inoutLine.setIsPackagingMaterial(true);
final boolean wasNew = InterfaceWrapperHelper.isNew(inoutLine);
InterfaceWrapperHelper.save(inoutLine);
if (wasNew)
{
affectedInOutLinesId.add(inoutLine.getM_InOutLine_ID());
}
}
@Override
protected void linkSourceToDocumentLine(final IPackingMaterialDocumentLineSource source, final IPackingMaterialDocumentLine pmLine)
{
// nothing
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\empties\EmptiesInOutLinesProducer.java
| 1
|
请完成以下Java代码
|
public boolean hasLocalNamespace() {
if (element != null) {
return element.getNamespaceURI().equals(namespaceUri);
}
else {
return false;
}
}
private String determinePrefixAndNamespaceUri() {
if (namespaceUri != null) {
if (rootElement != null && namespaceUri.equals(rootElement.getNamespaceURI())) {
// global namespaces do not have a prefix or namespace URI
return null;
}
else {
// lookup for prefix
String lookupPrefix = lookupPrefix();
if (lookupPrefix == null && rootElement != null) {
// if no prefix is found we generate a new one
// search for known prefixes
String knownPrefix = KNOWN_PREFIXES.get(namespaceUri);
if (knownPrefix == null) {
// generate namespace
return rootElement.registerNamespace(namespaceUri);
}
else if (knownPrefix.isEmpty()) {
// ignored namespace
return null;
}
else {
// register known prefix
rootElement.registerNamespace(knownPrefix, namespaceUri);
return knownPrefix;
}
}
else {
return lookupPrefix;
}
}
}
else {
// no namespace so no prefix
|
return null;
}
}
private String lookupPrefix() {
if (namespaceUri != null) {
String lookupPrefix = null;
if (element != null) {
lookupPrefix = element.lookupPrefix(namespaceUri);
}
else if (rootElement != null) {
lookupPrefix = rootElement.lookupPrefix(namespaceUri);
}
return lookupPrefix;
}
else {
return null;
}
}
}
|
repos\camunda-bpm-platform-master\model-api\xml-model\src\main\java\org\camunda\bpm\model\xml\impl\util\XmlQName.java
| 1
|
请完成以下Java代码
|
private UserIdWithGroupsCollection retrieveUserAssignments(@NonNull final UserId userId)
{
final ImmutableSet<UserGroupUserAssignment> assignments = queryBL
.createQueryBuilderOutOfTrx(I_AD_UserGroup_User_Assign.class)
.addEqualsFilter(I_AD_UserGroup_User_Assign.COLUMN_AD_User_ID, userId)
.addOnlyActiveRecordsFilter()
.create()
.stream()
.map(UserGroupRepository::toUserGroupUserAssignment)
.collect(ImmutableSet.toImmutableSet());
return UserIdWithGroupsCollection.of(assignments);
}
private static UserGroupUserAssignment toUserGroupUserAssignment(final I_AD_UserGroup_User_Assign record)
{
return UserGroupUserAssignment.builder()
.userId(UserId.ofRepoId(record.getAD_User_ID()))
.userGroupId(UserGroupId.ofRepoId(record.getAD_UserGroup_ID()))
.validDates(extractValidDates(record))
.build();
}
private static Range<Instant> extractValidDates(final I_AD_UserGroup_User_Assign record)
{
final Instant validFrom = TimeUtil.asInstant(record.getValidFrom());
final Instant validTo = TimeUtil.asInstant(record.getValidTo());
if (validFrom == null)
{
|
if (validTo == null)
{
return Range.all();
}
else
{
return Range.atMost(validTo);
}
}
else
{
if (validTo == null)
{
return Range.atLeast(validFrom);
}
else
{
return Range.closed(validFrom, validTo);
}
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\user\UserGroupRepository.java
| 1
|
请完成以下Java代码
|
public Pointcut getPointcut() {
return this.pointcut;
}
public void setPointcut(Pointcut pointcut) {
this.pointcut = pointcut;
}
@Override
public Advice getAdvice() {
return this;
}
@Override
public boolean isPerInstance() {
return true;
}
static final class MethodReturnTypePointcut extends StaticMethodMatcherPointcut {
|
private final Predicate<Class<?>> returnTypeMatches;
MethodReturnTypePointcut(Predicate<Class<?>> returnTypeMatches) {
this.returnTypeMatches = returnTypeMatches;
}
@Override
public boolean matches(Method method, Class<?> targetClass) {
return this.returnTypeMatches.test(method.getReturnType());
}
}
}
|
repos\spring-security-main\core\src\main\java\org\springframework\security\authorization\method\AuthorizeReturnObjectMethodInterceptor.java
| 1
|
请完成以下Java代码
|
public head addElement (String hashcode, String element)
{
addElementToRegistry (hashcode, element);
return (this);
}
/**
* Adds an Element to the element.
*
* @param element
* Adds an Element to the element.
*/
public head addElement (Element element)
{
addElementToRegistry (element);
return (this);
}
/**
* Adds an Element to the element.
*
* @param element
|
* Adds an Element to the element.
*/
public head addElement (String element)
{
addElementToRegistry (element);
return (this);
}
/**
* Removes an Element from the element.
*
* @param hashcode
* the name of the element to be removed.
*/
public head removeElement (String hashcode)
{
removeElementFromRegistry (hashcode);
return (this);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\tools\src\main\java-legacy\org\apache\ecs\xhtml\head.java
| 1
|
请完成以下Java代码
|
public Optional<JsonResponseCompositeList> retrieveBPartnersSince(@NonNull final RetrieveBPartnerSinceRequest retrieveBPartnerSinceRequest)
{
final SinceQuery sinceQuery;
final OrgId orgId;
if (Check.isBlank(retrieveBPartnerSinceRequest.getOrgCode()))
{
orgId = null;
}
else
{
orgId = RestUtils.retrieveOrgIdOrDefault(retrieveBPartnerSinceRequest.getOrgCode());
}
sinceQuery = SinceQuery.anyEntity(
extractInstant(retrieveBPartnerSinceRequest.getEpochMilli()),
getPageSize(),
orgId,
retrieveBPartnerSinceRequest.getExtSystem());
final NextPageQuery nextPageQuery = NextPageQuery.anyEntityOrNull(retrieveBPartnerSinceRequest.getNextPageId());
final QueryResultPage<JsonResponseComposite> page = jsonRetriever.getJsonBPartnerComposites(nextPageQuery, sinceQuery).orElse(null);
if (page == null)
{
return Optional.empty();
}
final ImmutableList<JsonResponseComposite> jsonItems = page.getItems();
final JsonPagingDescriptor jsonPagingDescriptor = JsonConverters.createJsonPagingDescriptor(page);
final JsonResponseCompositeList result = JsonResponseCompositeList.ok(jsonPagingDescriptor, jsonItems);
return Optional.of(result);
}
public Optional<JsonResponseContactList> retrieveContactsSince(
@Nullable final Long epochMilli,
@Nullable final String nextPageId)
{
final SinceQuery sinceQuery = SinceQuery.onlyContacts(
extractInstant(epochMilli),
getPageSize());
final NextPageQuery nextPageQuery = NextPageQuery.onlyContactsOrNull(nextPageId);
final Optional<QueryResultPage<JsonResponseComposite>> optionalPage = jsonRetriever.getJsonBPartnerComposites(nextPageQuery, sinceQuery);
|
if (!optionalPage.isPresent())
{
return Optional.empty();
}
final QueryResultPage<JsonResponseComposite> page = optionalPage.get();
final ImmutableList<JsonResponseContact> jsonContacts = page
.getItems()
.stream()
.flatMap(bpc -> bpc.getContacts().stream())
.collect(ImmutableList.toImmutableList());
final QueryResultPage<JsonResponseContact> sizeAdjustedPage = page.withItems(jsonContacts);
final JsonPagingDescriptor jsonPagingDescriptor = JsonConverters.createJsonPagingDescriptor(sizeAdjustedPage);
final JsonResponseContactList result = JsonResponseContactList.builder()
.contacts(jsonContacts)
.pagingDescriptor(jsonPagingDescriptor)
.build();
return Optional.of(result);
}
private static Instant extractInstant(@Nullable final Long epochMilli)
{
if (epochMilli == null || epochMilli <= 0)
{
return Instant.EPOCH;
}
return Instant.ofEpochMilli(epochMilli);
}
private int getPageSize()
{
return Services.get(ISysConfigBL.class).getIntValue(
SYSCFG_BPARTNER_PAGE_SIZE,
50,
Env.getAD_Client_ID(),
Env.getOrgId().getRepoId());
}
public Optional<JsonResponseContact> retrieveContact(@NonNull final ExternalIdentifier contactIdentifier)
{
return jsonRetriever.getContact(contactIdentifier);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business.rest-api-impl\src\main\java\de\metas\rest_api\v2\bpartner\BPartnerEndpointService.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class UserServiceImpl implements UserService {
private final UserDao userDao;
@Autowired
public UserServiceImpl(UserDao userDao) {
this.userDao = userDao;
}
/**
* 新增用户
*
* @param user 用户
*/
@Override
public User saveUser(User user) {
userDao.insert(user, true);
return user;
}
/**
* 批量插入用户
*
* @param users 用户列表
*/
@Override
public void saveUserList(List<User> users) {
userDao.insertBatch(users);
}
/**
* 根据主键删除用户
*
* @param id 主键
*/
@Override
public void deleteUser(Long id) {
userDao.deleteById(id);
}
/**
* 更新用户
*
* @param user 用户
* @return 更新后的用户
*/
@Override
public User updateUser(User user) {
if (ObjectUtil.isNull(user)) {
throw new RuntimeException("用户id不能为null");
}
userDao.updateTemplateById(user);
return userDao.single(user.getId());
}
/**
|
* 查询单个用户
*
* @param id 主键id
* @return 用户信息
*/
@Override
public User getUser(Long id) {
return userDao.single(id);
}
/**
* 查询用户列表
*
* @return 用户列表
*/
@Override
public List<User> getUserList() {
return userDao.all();
}
/**
* 分页查询
*
* @param currentPage 当前页
* @param pageSize 每页条数
* @return 分页用户列表
*/
@Override
public PageQuery<User> getUserByPage(Integer currentPage, Integer pageSize) {
return userDao.createLambdaQuery().page(currentPage, pageSize);
}
}
|
repos\spring-boot-demo-master\demo-orm-beetlsql\src\main\java\com\xkcoding\orm\beetlsql\service\impl\UserServiceImpl.java
| 2
|
请完成以下Java代码
|
public Map<Class<?>, Map<String, Object>> getCacheConfigurations() {
return cacheConfigurations;
}
public void setCacheConfigurations(Map<Class<?>, Map<String, Object>> cacheConfigurations) {
this.cacheConfigurations = cacheConfigurations;
}
public void addCacheConfiguration(Class<?> halResourceClass, Map<String, Object> cacheConfiguration) {
this.cacheConfigurations.put(halResourceClass, cacheConfiguration);
}
protected void parseConfiguration(String configuration) {
try {
JsonNode jsonConfiguration = objectMapper.readTree(configuration);
parseConfiguration(jsonConfiguration);
} catch (IOException e) {
throw new HalRelationCacheConfigurationException("Unable to parse cache configuration", e);
}
}
protected void parseConfiguration(JsonNode jsonConfiguration) {
parseCacheImplementationClass(jsonConfiguration);
parseCacheConfigurations(jsonConfiguration);
}
protected void parseCacheImplementationClass(JsonNode jsonConfiguration) {
JsonNode jsonNode = jsonConfiguration.get(CONFIG_CACHE_IMPLEMENTATION);
if (jsonNode != null) {
String cacheImplementationClassName = jsonNode.textValue();
Class<?> cacheImplementationClass = loadClass(cacheImplementationClassName);
setCacheImplementationClass(cacheImplementationClass);
}
else {
throw new HalRelationCacheConfigurationException("Unable to find the " + CONFIG_CACHE_IMPLEMENTATION + " parameter");
}
}
protected void parseCacheConfigurations(JsonNode jsonConfiguration) {
|
JsonNode jsonNode = jsonConfiguration.get(CONFIG_CACHES);
if (jsonNode != null) {
Iterator<Entry<String, JsonNode>> cacheConfigurations = jsonNode.fields();
while (cacheConfigurations.hasNext()) {
Entry<String, JsonNode> cacheConfiguration = cacheConfigurations.next();
parseCacheConfiguration(cacheConfiguration.getKey(), cacheConfiguration.getValue());
}
}
}
@SuppressWarnings("unchecked")
protected void parseCacheConfiguration(String halResourceClassName, JsonNode jsonConfiguration) {
try {
Class<?> halResourceClass = loadClass(halResourceClassName);
Map<String, Object> configuration = objectMapper.treeToValue(jsonConfiguration, Map.class);
addCacheConfiguration(halResourceClass, configuration);
} catch (IOException e) {
throw new HalRelationCacheConfigurationException("Unable to parse cache configuration for HAL resource " + halResourceClassName);
}
}
protected Class<?> loadClass(String className) {
try {
// use classloader which loaded the REST api classes
return Class.forName(className, true, HalRelationCacheConfiguration.class.getClassLoader());
}
catch (ClassNotFoundException e) {
throw new HalRelationCacheConfigurationException("Unable to load class of cache configuration " + className, e);
}
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\hal\cache\HalRelationCacheConfiguration.java
| 1
|
请完成以下Spring Boot application配置
|
spring:
application:
name: demo-provider
cloud:
# Nacos 作为注册中心的配置项
nacos:
discovery:
server-addr: 127.0.0.1:8848 # Nacos 服务器地址
# Zipkin 配置项,对应 ZipkinProperties 类
zipkin:
base-url: http://127.0.0.1:9411 # Zipkin 服务的地址
# Dubbo 配置项,对应 DubboConfigurationProperties 类
dubbo:
scan:
base-packages: cn.iocoder.springcloud.labx13.providerdemo.service # 指定 Dubbo 服务实现类的扫描基准包
# Dubbo 服务暴露的协议配置,对应 ProtocolConfig Map
protocols:
dubbo:
name: dubbo # 协议名称
port: -1 # 协议端口,-1 表示自增端口,从 20880 开始
# Dubbo 服务注册中心配置,对应 RegistryConfig 类
registry:
|
address: spring-cloud://127.0.0.1:8848 # 指定 Dubbo 服务注册中心的地址
# Dubbo 服务提供者的配置,对应 ProviderConfig 类
provider:
filter: tracing
# Spring Cloud Alibaba Dubbo 专属配置项,对应 DubboCloudProperties 类
cloud:
subscribed-services: '' # 设置订阅的应用列表,默认为 * 订阅所有应用。
|
repos\SpringBoot-Labs-master\labx-13\labx-13-sc-sleuth-dubbo\labx-13-sc-sleuth-dubbo-provider\src\main\resources\application.yaml
| 2
|
请完成以下Java代码
|
public void deleteHistoricTaskInstance(String taskId) {
commandExecutor.execute(new DeleteHistoricTaskInstanceCmd(taskId));
}
@Override
public void deleteHistoricProcessInstance(String processInstanceId) {
commandExecutor.execute(new DeleteHistoricProcessInstanceCmd(processInstanceId));
}
@Override
public NativeHistoricProcessInstanceQuery createNativeHistoricProcessInstanceQuery() {
return new NativeHistoricProcessInstanceQueryImpl(commandExecutor);
}
@Override
public NativeHistoricTaskInstanceQuery createNativeHistoricTaskInstanceQuery() {
return new NativeHistoricTaskInstanceQueryImpl(commandExecutor);
}
@Override
public NativeHistoricActivityInstanceQuery createNativeHistoricActivityInstanceQuery() {
|
return new NativeHistoricActivityInstanceQueryImpl(commandExecutor);
}
@Override
public List<HistoricIdentityLink> getHistoricIdentityLinksForProcessInstance(String processInstanceId) {
return commandExecutor.execute(new GetHistoricIdentityLinksForTaskCmd(null, processInstanceId));
}
@Override
public List<HistoricIdentityLink> getHistoricIdentityLinksForTask(String taskId) {
return commandExecutor.execute(new GetHistoricIdentityLinksForTaskCmd(taskId, null));
}
@Override
public ProcessInstanceHistoryLogQuery createProcessInstanceHistoryLogQuery(String processInstanceId) {
return new ProcessInstanceHistoryLogQueryImpl(commandExecutor, processInstanceId);
}
}
|
repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\HistoryServiceImpl.java
| 1
|
请完成以下Java代码
|
public PrintElement[] getElements()
{
if (m_pe == null)
{
m_pe = new PrintElement[m_elements.size()];
m_elements.toArray(m_pe);
}
return m_pe;
} // getElements
/**
* Paint Page Header/Footer on Graphics in Bounds
*
* @param g2D graphics
* @param bounds page bounds
* @param isView true if online view (IDs are links)
*/
public void paint (Graphics2D g2D, Rectangle bounds, boolean isView)
{
Point pageStart = new Point(bounds.getLocation());
getElements();
for (int i = 0; i < m_pe.length; i++)
m_pe[i].paint(g2D, 0, pageStart, m_ctx, isView);
} // paint
|
/**
* Get DrillDown value
* @param relativePoint relative Point
* @return if found NamePait or null
*/
public MQuery getDrillDown (Point relativePoint)
{
MQuery retValue = null;
for (int i = 0; i < m_elements.size() && retValue == null; i++)
{
PrintElement element = (PrintElement)m_elements.get(i);
retValue = element.getDrillDown (relativePoint, 1);
}
return retValue;
} // getDrillDown
} // HeaderFooter
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\print\layout\HeaderFooter.java
| 1
|
请完成以下Java代码
|
public void setFlatrateAmtPerUOM (final @Nullable BigDecimal FlatrateAmtPerUOM)
{
set_Value (COLUMNNAME_FlatrateAmtPerUOM, FlatrateAmtPerUOM);
}
@Override
public BigDecimal getFlatrateAmtPerUOM()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_FlatrateAmtPerUOM);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setIsSimulation (final boolean IsSimulation)
{
throw new IllegalArgumentException ("IsSimulation is virtual column"); }
@Override
public boolean isSimulation()
{
return get_ValueAsBoolean(COLUMNNAME_IsSimulation);
}
@Override
public void setM_Product_DataEntry_ID (final int M_Product_DataEntry_ID)
{
if (M_Product_DataEntry_ID < 1)
set_Value (COLUMNNAME_M_Product_DataEntry_ID, null);
else
set_Value (COLUMNNAME_M_Product_DataEntry_ID, M_Product_DataEntry_ID);
}
@Override
public int getM_Product_DataEntry_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_DataEntry_ID);
}
@Override
public void setNote (final @Nullable java.lang.String Note)
{
set_Value (COLUMNNAME_Note, Note);
}
@Override
public java.lang.String getNote()
{
return get_ValueAsString(COLUMNNAME_Note);
}
@Override
public void setProcessed (final boolean Processed)
{
set_Value (COLUMNNAME_Processed, Processed);
}
@Override
public boolean isProcessed()
{
return get_ValueAsBoolean(COLUMNNAME_Processed);
}
@Override
public void setProcessing (final boolean Processing)
{
set_Value (COLUMNNAME_Processing, Processing);
}
@Override
public boolean isProcessing()
{
return get_ValueAsBoolean(COLUMNNAME_Processing);
}
@Override
|
public void setQty_Planned (final @Nullable BigDecimal Qty_Planned)
{
set_Value (COLUMNNAME_Qty_Planned, Qty_Planned);
}
@Override
public BigDecimal getQty_Planned()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Qty_Planned);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setQty_Reported (final @Nullable BigDecimal Qty_Reported)
{
set_Value (COLUMNNAME_Qty_Reported, Qty_Reported);
}
@Override
public BigDecimal getQty_Reported()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Qty_Reported);
return bd != null ? bd : BigDecimal.ZERO;
}
/**
* Type AD_Reference_ID=540263
* Reference name: C_Flatrate_DataEntry Type
*/
public static final int TYPE_AD_Reference_ID=540263;
/** Invoicing_PeriodBased = IP */
public static final String TYPE_Invoicing_PeriodBased = "IP";
/** Correction_PeriodBased = CP */
public static final String TYPE_Correction_PeriodBased = "CP";
/** Procurement_PeriodBased = PC */
public static final String TYPE_Procurement_PeriodBased = "PC";
@Override
public void setType (final java.lang.String Type)
{
set_ValueNoCheck (COLUMNNAME_Type, Type);
}
@Override
public java.lang.String getType()
{
return get_ValueAsString(COLUMNNAME_Type);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java-gen\de\metas\contracts\model\X_C_Flatrate_DataEntry.java
| 1
|
请完成以下Java代码
|
public class ErrorType
extends NotificationType
{
@XmlAttribute(name = "error_value")
protected String errorValue;
@XmlAttribute(name = "valid_value")
protected String validValue;
@XmlAttribute(name = "record_id")
@XmlSchemaType(name = "positiveInteger")
protected BigInteger recordId;
/**
* Gets the value of the errorValue property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getErrorValue() {
return errorValue;
}
/**
* Sets the value of the errorValue property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setErrorValue(String value) {
this.errorValue = value;
}
/**
* Gets the value of the validValue property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getValidValue() {
return validValue;
}
/**
* Sets the value of the validValue property.
*
* @param value
* allowed object is
* {@link String }
*
|
*/
public void setValidValue(String value) {
this.validValue = value;
}
/**
* Gets the value of the recordId property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getRecordId() {
return recordId;
}
/**
* Sets the value of the recordId property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setRecordId(BigInteger value) {
this.recordId = value;
}
}
|
repos\metasfresh-new_dawn_uat\backend\vertical-healthcare_ch\forum_datenaustausch_ch.invoice_440_response\src\main\java-xjc\de\metas\vertical\healthcare_ch\forum_datenaustausch_ch\invoice_440\response\ErrorType.java
| 1
|
请完成以下Java代码
|
public String getClientRegistrationId() {
return this.clientRegistrationId;
}
/**
* Returns the name of the End-User {@code Principal} (Resource Owner).
* @return the name of the End-User
* @since 6.3
*/
public String getPrincipalName() {
return this.principalName;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
|
return true;
}
if (obj == null || this.getClass() != obj.getClass()) {
return false;
}
OAuth2AuthorizedClientId that = (OAuth2AuthorizedClientId) obj;
return Objects.equals(this.clientRegistrationId, that.clientRegistrationId)
&& Objects.equals(this.principalName, that.principalName);
}
@Override
public int hashCode() {
return Objects.hash(this.clientRegistrationId, this.principalName);
}
}
|
repos\spring-security-main\oauth2\oauth2-client\src\main\java\org\springframework\security\oauth2\client\OAuth2AuthorizedClientId.java
| 1
|
请完成以下Java代码
|
public void setAD_Printer_ID (int AD_Printer_ID)
{
if (AD_Printer_ID < 1)
set_Value (COLUMNNAME_AD_Printer_ID, null);
else
set_Value (COLUMNNAME_AD_Printer_ID, Integer.valueOf(AD_Printer_ID));
}
@Override
public int getAD_Printer_ID()
{
return get_ValueAsInt(COLUMNNAME_AD_Printer_ID);
}
@Override
public void setAD_Printer_Tray_ID (int AD_Printer_Tray_ID)
{
if (AD_Printer_Tray_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_Printer_Tray_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_Printer_Tray_ID, Integer.valueOf(AD_Printer_Tray_ID));
}
@Override
public int getAD_Printer_Tray_ID()
{
return get_ValueAsInt(COLUMNNAME_AD_Printer_Tray_ID);
}
@Override
public void setDescription (java.lang.String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
|
@Override
public java.lang.String getDescription()
{
return (java.lang.String)get_Value(COLUMNNAME_Description);
}
@Override
public void setName (java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
@Override
public java.lang.String getName()
{
return (java.lang.String)get_Value(COLUMNNAME_Name);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.printing\de.metas.printing.base\src\main\java-gen\de\metas\printing\model\X_AD_Printer_Tray.java
| 1
|
请完成以下Java代码
|
public String getTp() {
return tp;
}
/**
* Sets the value of the tp property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTp(String value) {
this.tp = value;
}
/**
* Gets the value of the dt property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getDt() {
return dt;
}
/**
* Sets the value of the dt property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setDt(XMLGregorianCalendar value) {
this.dt = value;
}
/**
* Gets the value of the ctry property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCtry() {
return ctry;
}
/**
* Sets the value of the ctry property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCtry(String value) {
this.ctry = value;
}
/**
* Gets the value of the cd property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCd() {
return cd;
}
/**
* Sets the value of the cd property.
*
* @param value
* allowed object is
* {@link String }
|
*
*/
public void setCd(String value) {
this.cd = value;
}
/**
* Gets the value of the amt property.
*
* @return
* possible object is
* {@link ActiveOrHistoricCurrencyAndAmount }
*
*/
public ActiveOrHistoricCurrencyAndAmount getAmt() {
return amt;
}
/**
* Sets the value of the amt property.
*
* @param value
* allowed object is
* {@link ActiveOrHistoricCurrencyAndAmount }
*
*/
public void setAmt(ActiveOrHistoricCurrencyAndAmount value) {
this.amt = value;
}
/**
* Gets the value of the inf 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 inf property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getInf().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link String }
*
*
*/
public List<String> getInf() {
if (inf == null) {
inf = new ArrayList<String>();
}
return this.inf;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.sepa\schema-pain_001_01_03_ch_02\src\main\java-xjc\de\metas\payment\sepa\jaxb\sct\pain_001_001_03_ch_02\StructuredRegulatoryReporting3.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public boolean existsByEmail(String email) {
return repository.existsByEmail(email);
}
@Override
public boolean existsByUsername(String username) {
return repository.existsByUsername(username);
}
@Override
public Optional<User> findById(long id) {
return repository.findById(id)
.map(e -> conversionService.convert(e, User.class));
}
@Override
public Optional<User> findByEmail(String email) {
return repository.findByEmail(email)
.map(e -> conversionService.convert(e, User.class));
}
@Override
public Optional<User> findByUsername(String username) {
return repository.findByUsername(username)
.map(e -> conversionService.convert(e, User.class));
}
@Override
public User save(User user) {
var entity = conversionService.convert(user, UserJdbcEntity.class);
var saved = repository.save(entity);
return conversionService.convert(saved, User.class);
}
|
@Mapper(config = MappingConfig.class)
interface ToDomainUserMapper extends Converter<UserJdbcEntity, User> {
@Override
User convert(UserJdbcEntity source);
}
@Mapper(config = MappingConfig.class)
interface FromDomainUserMapper extends Converter<User, UserJdbcEntity> {
@Override
UserJdbcEntity convert(User source);
}
}
|
repos\realworld-backend-spring-master\service\src\main\java\com\github\al\realworld\infrastructure\db\jdbc\UserJdbcRepositoryAdapter.java
| 2
|
请完成以下Java代码
|
private int getRelativeForegroundColor(final ITable table, final int rowIndexModel)
{
if (colorColumnIndex < 0)
{
return 0;
}
Object data = table.getModelValueAt(rowIndexModel, colorColumnIndex);
int cmp = 0;
// We need to have a Number
if (data == null)
{
return 0;
}
try
{
if (data instanceof Timestamp)
{
if (colorDataCompare == null || !(colorDataCompare instanceof Timestamp))
colorDataCompare = new Timestamp(System.currentTimeMillis());
cmp = ((Timestamp)colorDataCompare).compareTo((Timestamp)data);
}
else
{
if (colorDataCompare == null || !(colorDataCompare instanceof BigDecimal))
colorDataCompare = Env.ZERO;
if (!(data instanceof BigDecimal))
data = new BigDecimal(data.toString());
cmp = ((BigDecimal)colorDataCompare).compareTo((BigDecimal)data);
}
}
catch (Exception e)
{
return 0;
}
if (cmp > 0)
{
return -1;
}
if (cmp < 0)
{
|
return 1;
}
return 0;
}
public int getColorColumnIndex()
{
return colorColumnIndex;
}
public void setColorColumnIndex(int colorColumnIndexModel)
{
this.colorColumnIndex = colorColumnIndexModel;
}
public Object getColorDataCompare()
{
return colorDataCompare;
}
public void setColorDataCompare(Object colorDataCompare)
{
this.colorDataCompare = colorDataCompare;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\ui\DefaultTableColorProvider.java
| 1
|
请完成以下Java代码
|
public void setFind_ID (BigDecimal Find_ID)
{
set_Value (COLUMNNAME_Find_ID, Find_ID);
}
/** Get Find_ID.
@return Find_ID */
public BigDecimal getFind_ID ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Find_ID);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Operation AD_Reference_ID=205 */
public static final int OPERATION_AD_Reference_ID=205;
/** = = == */
public static final String OPERATION_Eq = "==";
/** >= = >= */
public static final String OPERATION_GtEq = ">=";
/** > = >> */
public static final String OPERATION_Gt = ">>";
/** < = << */
public static final String OPERATION_Le = "<<";
/** ~ = ~~ */
public static final String OPERATION_Like = "~~";
/** <= = <= */
public static final String OPERATION_LeEq = "<=";
/** |<x>| = AB */
public static final String OPERATION_X = "AB";
/** sql = SQ */
public static final String OPERATION_Sql = "SQ";
/** != = != */
public static final String OPERATION_NotEq = "!=";
/** Set Operation.
@param Operation
Compare Operation
*/
public void setOperation (String Operation)
{
set_Value (COLUMNNAME_Operation, Operation);
}
/** Get Operation.
@return Compare Operation
*/
public String getOperation ()
{
return (String)get_Value(COLUMNNAME_Operation);
}
/** Set Search Key.
|
@param Value
Search key for the record in the format required - must be unique
*/
public void setValue (String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
/** Get Search Key.
@return Search key for the record in the format required - must be unique
*/
public String getValue ()
{
return (String)get_Value(COLUMNNAME_Value);
}
/** Set Value To.
@param Value2
Value To
*/
public void setValue2 (String Value2)
{
set_Value (COLUMNNAME_Value2, Value2);
}
/** Get Value To.
@return Value To
*/
public String getValue2 ()
{
return (String)get_Value(COLUMNNAME_Value2);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Find.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public List<DecisionRequirementsDefinition> executeList(CommandContext commandContext, Page page) {
if (commandContext.getProcessEngineConfiguration().isDmnEnabled()) {
checkQueryOk();
return commandContext
.getDecisionRequirementsDefinitionManager()
.findDecisionRequirementsDefinitionsByQueryCriteria(this, page);
}
return Collections.emptyList();
}
@Override
public void checkQueryOk() {
super.checkQueryOk();
// latest() makes only sense when used with key() or keyLike()
if (latest && ( (id != null) || (name != null) || (nameLike != null) || (version != null) || (deploymentId != null) ) ){
throw new NotValidException("Calling latest() can only be used in combination with key(String) and keyLike(String)");
}
}
// getters ////////////////////////////////////////////
public String getId() {
return id;
}
public String[] getIds() {
return ids;
}
public String getCategory() {
return category;
}
public String getCategoryLike() {
return categoryLike;
}
public String getName() {
return name;
}
public String getNameLike() {
return nameLike;
}
|
public String getDeploymentId() {
return deploymentId;
}
public String getKey() {
return key;
}
public String getKeyLike() {
return keyLike;
}
public String getResourceName() {
return resourceName;
}
public String getResourceNameLike() {
return resourceNameLike;
}
public Integer getVersion() {
return version;
}
public boolean isLatest() {
return latest;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\dmn\entity\repository\DecisionRequirementsDefinitionQueryImpl.java
| 2
|
请完成以下Java代码
|
private static BooleanWithReason checkAllowReposting(final Document document)
{
if (!document.hasField(WindowConstants.FIELDNAME_Posted))
{
return BooleanWithReason.falseBecause("document has no Posted field");
}
final DocStatus docStatus = getDocStatusOrNull(document);
if (docStatus != null && !docStatus.isAccountable())
{
return BooleanWithReason.falseBecause("DocStatus is not accountable");
}
if (!isProcessed(document))
{
return BooleanWithReason.falseBecause("not processed");
}
return BooleanWithReason.TRUE;
}
private static DocStatus getDocStatusOrNull(final Document document)
{
final IDocumentFieldView docStatusField = document.getFieldViewOrNull(WindowConstants.FIELDNAME_DocStatus);
|
if (docStatusField == null)
{
return null;
}
final String docStatusStr = docStatusField.getValueAs(String.class);
return DocStatus.ofNullableCodeOrUnknown(docStatusStr);
}
private static boolean isProcessed(final Document document)
{
final IDocumentFieldView processedField = document.getFieldViewOrNull(WindowConstants.FIELDNAME_Processed);
if (processedField == null)
{
return false;
}
return processedField.getValueAsBoolean();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\accounting\process\WEBUI_Fact_Acct_Repost_SingleDocument.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String getNVE() {
return nve;
}
/**
* Sets the value of the nve property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNVE(String value) {
this.nve = value;
}
/**
* Gets the value of the grossVolume property.
*
* @return
* possible object is
* {@link UnitType }
*
*/
public UnitType getGrossVolume() {
return grossVolume;
}
/**
* Sets the value of the grossVolume property.
*
* @param value
* allowed object is
* {@link UnitType }
*
*/
public void setGrossVolume(UnitType value) {
this.grossVolume = value;
}
/**
|
* Gets the value of the grossWeight property.
*
* @return
* possible object is
* {@link UnitType }
*
*/
public UnitType getGrossWeight() {
return grossWeight;
}
/**
* Sets the value of the grossWeight property.
*
* @param value
* allowed object is
* {@link UnitType }
*
*/
public void setGrossWeight(UnitType value) {
this.grossWeight = value;
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\documents\extensions\edifact\PackagingInformationType.java
| 2
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.