Search in sources :

Example 1 with Transient

use of java.beans.Transient in project MantaroBot by Mantaro.

the class PlayerData method anniversary.

@Transient
public String anniversary() {
    if (getMarriedSince() == null)
        return null;
    SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy", Locale.getDefault());
    Calendar cal = new GregorianCalendar();
    cal.setTime(new Date(getMarriedSince()));
    cal.add(Calendar.YEAR, 1);
    return sdf.format(cal.getTime());
}
Also used : Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) GregorianCalendar(java.util.GregorianCalendar) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) Transient(java.beans.Transient)

Example 2 with Transient

use of java.beans.Transient in project MantaroBot by Mantaro.

the class PlayerData method anniversary.

@Transient
public String anniversary() {
    if (getMarriedSince() == null || getMarriedSince() == 0)
        return null;
    SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy", Locale.getDefault());
    Calendar cal = new GregorianCalendar();
    cal.setTime(new Date(getMarriedSince()));
    cal.add(Calendar.YEAR, 1);
    return sdf.format(cal.getTime());
}
Also used : SimpleDateFormat(java.text.SimpleDateFormat) Transient(java.beans.Transient)

Example 3 with Transient

use of java.beans.Transient in project Workload by amoxu.

the class UserServiceImpl method updateUser.

@Transient
@Override
public void updateUser(User user) throws CustomException {
    user.setPassword(userMapper.selectByPrimaryKey(user.getId()).getPassword());
    user.setAnswer(userMapper.selectByPrimaryKey(user.getId()).getAnswer());
    Subject subject = SecurityUtils.getSubject();
    int ret;
    if (10000 == user.getId()) {
        if (subject.hasRole("超级管理员")) {
            ret = userMapper.updateByPrimaryKey(user);
        } else {
            throw new CustomException("权限不足");
        }
    } else {
        ret = userMapper.updateByPrimaryKey(user);
    }
    if (ret == 1) {
        return;
    } else {
        throw new CustomException("更新失败,请联系管理员。");
    }
}
Also used : CustomException(com.hfut.exception.CustomException) Subject(org.apache.shiro.subject.Subject) Transient(java.beans.Transient)

Example 4 with Transient

use of java.beans.Transient in project api-core by ca-cwds.

the class BaseAttorney method getPhones.

// =======================
// ApiMultiplePhonesAware:
// =======================
@JsonIgnore
@Override
@Transient
public ApiPhoneAware[] getPhones() {
    List<ApiPhoneAware> phones = new ArrayList<>();
    if (this.primaryPhoneNumber != null && this.messagePhoneNumber != 0) {
        phones.add(new ReadablePhone(null, String.valueOf(this.primaryPhoneNumber), this.primaryPhoneExtensionNumber != null ? this.primaryPhoneExtensionNumber.toString() : null, null));
    }
    if (this.messagePhoneNumber != null && this.messagePhoneNumber != 0) {
        LOGGER.debug("add message phone");
        phones.add(new ReadablePhone(null, String.valueOf(this.messagePhoneNumber), this.messagePhoneExtensionNumber != null ? this.messagePhoneExtensionNumber.toString() : null, ApiPhoneAware.PhoneType.Cell));
    }
    return phones.toArray(new ApiPhoneAware[0]);
}
Also used : ReadablePhone(gov.ca.cwds.data.ReadablePhone) ApiPhoneAware(gov.ca.cwds.data.std.ApiPhoneAware) ArrayList(java.util.ArrayList) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore) Transient(java.beans.Transient)

Example 5 with Transient

use of java.beans.Transient in project MantaroBot by Mantaro.

the class PlayerData method marryDate.

@Transient
public String marryDate() {
    if (getMarriedSince() == null || getMarriedSince() == 0)
        return null;
    SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy", Locale.getDefault());
    final Date date = new Date(getMarriedSince());
    return sdf.format(date);
}
Also used : SimpleDateFormat(java.text.SimpleDateFormat) Transient(java.beans.Transient)

Aggregations

Transient (java.beans.Transient)7 SimpleDateFormat (java.text.SimpleDateFormat)4 Date (java.util.Date)2 JsonIgnore (com.fasterxml.jackson.annotation.JsonIgnore)1 CustomException (com.hfut.exception.CustomException)1 ReadablePhone (gov.ca.cwds.data.ReadablePhone)1 ApiPhoneAware (gov.ca.cwds.data.std.ApiPhoneAware)1 Method (java.lang.reflect.Method)1 ArrayList (java.util.ArrayList)1 Calendar (java.util.Calendar)1 GregorianCalendar (java.util.GregorianCalendar)1 CtMethod (javassist.CtMethod)1 CtNewMethod (javassist.CtNewMethod)1 Subject (org.apache.shiro.subject.Subject)1