本文整理汇总了Java中org.apache.isis.applib.annotation.Programmatic类的典型用法代码示例。如果您正苦于以下问题:Java Programmatic类的具体用法?Java Programmatic怎么用?Java Programmatic使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Programmatic类属于org.apache.isis.applib.annotation包,在下文中一共展示了Programmatic类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: userProfileName
import org.apache.isis.applib.annotation.Programmatic; //导入依赖的package包/类
@Override
@Programmatic
public String userProfileName() {
final ApplicationUser applicationUser = meService.me();
final StringBuilder buf = new StringBuilder();
final String username = applicationUser.getName();
final ApplicationTenancy tenancy = applicationUser.getTenancy();
buf.append("Hi ");
buf.append(username);
if (tenancy.getName() != null) {
buf.append(" @").append(tenancy.getName());
}
return buf.toString();
}
示例2: userProfileName
import org.apache.isis.applib.annotation.Programmatic; //导入依赖的package包/类
@Override
@Programmatic
public String userProfileName() {
final ApplicationUser applicationUser = meService.me();
final StringBuilder buf = new StringBuilder();
final String username = applicationUser.getName();
final String atPath = applicationUser.getAtPath();
final ApplicationTenancy tenancy = applicationTenancyRepository.findByPath(atPath);
buf.append("Hi ");
buf.append(username);
if (tenancy.getName() != null) {
buf.append(" @").append(tenancy.getName());
}
return buf.toString();
}
示例3: newCardGame
import org.apache.isis.applib.annotation.Programmatic; //导入依赖的package包/类
@Programmatic
public CardGame newCardGame(
final Card card,
final LocalDate date,
final boolean outcome
) {
final CardGame cardGame = repositoryService.instantiate(CardGame.class);
cardGame.setCard(card);
cardGame.setDate(date);
cardGame.setOutcome(outcome);
card.getCardGames().add(cardGame);
repositoryService.persist(cardGame);
return cardGame;
}
示例4: newCardRequest
import org.apache.isis.applib.annotation.Programmatic; //导入依赖的package包/类
@Programmatic
private CardRequest newCardRequest(
User user,
CardRequestType type
) {
if(user == null) {
return null;
}
final CardRequest cardRequest = repositoryService.instantiate(CardRequest.class);
cardRequest.setRequestingUser(user);
cardRequest.setType(type);
cardRequest.setIssueDate(clockService.nowAsLocalDateTime());
repositoryService.persist(cardRequest);
return cardRequest;
}
示例5: newFakeCard
import org.apache.isis.applib.annotation.Programmatic; //导入依赖的package包/类
@Programmatic
public Card newFakeCard(final CardStatus status, final Center center) {
String number = nextCardNumber(center.getFakeNumerator());
final Card card = repositoryService.instantiate(Card.class);
card.setNumber(number);
card.setStatus(status);
card.setCenter(center);
card.setCreatedAt(clockService.nowAsLocalDateTime());
repositoryService.persist(card);
center.getFakeNumerator().setLastIncrement(Long.parseLong(number));
return card;
}
示例6: newBatch
import org.apache.isis.applib.annotation.Programmatic; //导入依赖的package包/类
@Programmatic
public List<Card> newBatch(
final String startNumber,
final int batchSize,
final CardStatus status,
final Center center
) {
String centerCode = center.getCode();
BigInteger start = new BigInteger(startNumber);
List<Card> results = new ArrayList<>();
/* Adds only valid numbers to results */
for(BigInteger i = start; results.size() < batchSize; i = i.add(BigInteger.ONE)) {
String cardNumber = i.toString();
if(cardNumberIsValid(cardNumber, centerCode)) {
results.add(findOrCreate(cardNumber, status, center));
}
}
return results;
}
示例7: nextCardNumber
import org.apache.isis.applib.annotation.Programmatic; //导入依赖的package包/类
@Programmatic
public String nextCardNumber(final Numerator numerator) {
long largestCardNumberSoFar = numerator.getLastIncrement();
//split off last digit i.e. remove checksum; then increment
long withoutChecksum, temp;
withoutChecksum = temp = (largestCardNumberSoFar / 10) + 1;
//Calculate the weighted sum of the first 12 digits of the card-number
int sum = 0;
//reversed order (%10 -> /10 method produces array of digits in reversed order)
int[] multipliers = {3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1};
for(int i = 0; i < 12; ++i) {
sum += multipliers[i] * (int)(temp % 10);
temp /= 10;
}
int checksum = (10 - sum % 10) % 10;
//attach checksum
return withoutChecksum + "" + checksum;
}
示例8: newAuthenticationDevice
import org.apache.isis.applib.annotation.Programmatic; //导入依赖的package包/类
@Programmatic
public AuthenticationDevice newAuthenticationDevice(
Center center,
AuthenticationDeviceType type,
String name,
String secret,
boolean active
) {
final AuthenticationDevice device = repositoryService.instantiate(AuthenticationDevice.class);
device.setCenter(center);
device.setType(type);
device.setName(name);
device.setSecret(secret);
device.setActive(active);
repositoryService.persist(device);
return device;
}
示例9: validateNewUser
import org.apache.isis.applib.annotation.Programmatic; //导入依赖的package包/类
@Programmatic
public String validateNewUser(
final boolean enabled,
final Title title,
final String firstName,
final String lastName,
final String email,
final String address,
final String zipcode,
final String city,
final String phoneNumber,
final Center center,
@Parameter(optionality = Optionality.OPTIONAL) final String cardNumber,
final boolean promotionalEmails,
final Boolean hasCar,
String reference
) {
if(findByExactEmailAndCenter(email, center) != null) {
return "User with email " + email + " already exists";
}
return validateFindOrCreate(enabled, title, firstName, lastName, email, address, zipcode, city, phoneNumber, center, cardNumber, promotionalEmails, hasCar, reference);
}
示例10: newChild
import org.apache.isis.applib.annotation.Programmatic; //导入依赖的package包/类
@Programmatic
private Child newChild(
final String name,
final Gender gender,
final LocalDate birthdate,
final User parent
) {
Child child = repositoryService.instantiate(Child.class);
child.setName(name);
child.setGender(gender);
child.setBirthdate(birthdate);
child.setParent(parent);
child.setNotes("");
parent.getChildren().add(child);
repositoryService.persist(child);
return child;
}
示例11: userProfileName
import org.apache.isis.applib.annotation.Programmatic; //导入依赖的package包/类
@Override
@Programmatic
public String userProfileName() {
final ApplicationUser applicationUser = meService.me();
final StringBuilder buf = new StringBuilder();
final String username = applicationUser.getName();
final ApplicationTenancy tenancy = applicationUser.getTenancy();
buf.append("Hi ");
buf.append(username);
if (!tenancy.getPath().equals(UsersTenancy.TENANCY_PATH + username)) {
buf.append(" @").append(tenancy.getName());
}
return buf.toString();
}
示例12: map
import org.apache.isis.applib.annotation.Programmatic; //导入依赖的package包/类
@Programmatic
@Override
public Object map(
final Object object,
final List<MediaType> acceptableMediaTypes,
final RepresentationType representationType) {
if(object instanceof QuickObject) {
final Bookmark bookmark = bookmarkService.bookmarkFor(object);
final QuickObjectDto dto = mapperFactory.getMapperFacade().map(object, QuickObjectDto.class);
final OidDto oidDto = mapperFactory.getMapperFacade().map(bookmark, OidDto.class);
// manually wire together
dto.setOid(oidDto);
return dto;
}
return null;
}
示例13: clonar
import org.apache.isis.applib.annotation.Programmatic; //导入依赖的package包/类
@Programmatic
public void clonar(Tarjeta a, Tarjeta b)
{
if (b==null || a!=null)
{
b = new Tarjeta();
b.setNumTarjetaTesco(a.getNumTarjetaTesco());
b.setClasifSug(a.getClasifSug());
b.setDecisionTomada(a.getDecisionTomada());
b.setEquipo(a.getEquipo());
b.setEstado(a.isEstado());
b.setEvento(a.getEvento());
b.setFechaCarga(a.getFechaCarga());
b.setFechaReporte(a.getFechaReporte());
b.setLineaNegocio(a.getLineaNegocio());
b.setLugarObs(a.getLugarObs());
b.setResuelto(b.isResuelto());
b.setReportado(a.isReportado());
}
}
示例14: map
import org.apache.isis.applib.annotation.Programmatic; //导入依赖的package包/类
@Programmatic
@Override
public Object map(
final Object object,
final List<MediaType> acceptableMediaTypes) {
if(object instanceof ToDoItem) {
for (MediaType acceptableMediaType : acceptableMediaTypes) {
final Map<String, String> parameters = acceptableMediaType.getParameters();
final String className = parameters.get("x-ro-domain-type");
if( matches(className, ToDoItemV1_1.class)) {
return newToDoItemV1_1((ToDoItem) object);
}
}
}
return null;
}
示例15: relativePriority
import org.apache.isis.applib.annotation.Programmatic; //导入依赖的package包/类
@Programmatic
public Integer relativePriority(final ToDoItem toDoItem) {
return queryResultsCache.execute(() -> {
if(toDoItem.isComplete()) {
return null;
}
// sort items, then locate this one
int i=1;
for (final ToDoItem each : sortedNotYetComplete()) {
if(each == toDoItem) {
return i;
}
i++;
}
return null;
}, RelativePriorityService.class, "relativePriority", toDoItem);
}