Example usage for com.liferay.portal.kernel.util StringPool SPACE

List of usage examples for com.liferay.portal.kernel.util StringPool SPACE

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util StringPool SPACE.

Prototype

String SPACE

To view the source code for com.liferay.portal.kernel.util StringPool SPACE.

Click Source Link

Usage

From source file:org.oep.cmon.user.portlet.business.EndorsementBs.java

License:Apache License

/**
 * This is function createCitizen/*from  ww  w  . j a  v  a2s . c o  m*/
 * Version: 1.0
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param yeuCau
 * @param userId
 * @param request
 * @throws SystemException
 * @throws NumberFormatException
 * @throws PortalException
 * @return long
 */
public long createCitizen(YeuCauDangKyCongDan yeuCau, long userId, String maCongDan)
        throws SystemException, NumberFormatException, PortalException {
    CongDan congDan = null;
    // Check if the citizen exists or not
    if (Validator.isNotNull(maCongDan)) {
        congDan = CongDanLocalServiceUtil.findByMa(maCongDan);

        if (congDan != null) {

            // update tai khoan nguoi dung id
            congDan.setTaiKhoanNguoiDungId(userId);

            //Update
            CongDanLocalServiceUtil.updateCongDan(congDan);

            return congDan.getId();

        }
    }

    congDan = new CongDanClp();

    long id = CounterLocalServiceUtil.increment(CITIZEN_SEQUENCE);

    congDan.setId(id);

    congDan.setMa(
            ElectricCodeGeneratorUtil.generateCode(yeuCau.getIDTinhThanhThuongTru(), yeuCau.getNgaySinh()));

    congDan.setHo(yeuCau.getHoCongDan());

    congDan.setDem(yeuCau.getTenDem());

    congDan.setTen(yeuCau.getTenCongDan());

    congDan.setTenDayDu(yeuCau.getHoCongDan() + StringPool.SPACE + yeuCau.getTenDem() + StringPool.SPACE
            + yeuCau.getTenCongDan());

    congDan.setNgaySinh(yeuCau.getNgaySinh());

    congDan.setSoCmnd(yeuCau.getSoCmnd());

    congDan.setNgayCapCmnd(yeuCau.getNgayCapCmnd());

    congDan.setGhiChuCmnd(yeuCau.getGhiChuCmnd());

    congDan.setSoHoChieu(yeuCau.getSoHoChieu());

    congDan.setNgayCapHoChieu(yeuCau.getNgayCapHoChieu());

    congDan.setNgayHetHanHoChieu(yeuCau.getNgayHetHanHoChieu());

    congDan.setGhiChuHoChieu(yeuCau.getGhiChuHoChieu());

    congDan.setSoBaoHiemYTe(yeuCau.getSoBaoHiemYte());

    congDan.setMaSoThueCaNhan(yeuCau.getMaSoThueCaNhan());

    congDan.setDiaChiThuongTru(yeuCau.getMoTaDiaChiThuongTru());

    congDan.setDiaChiHienNay(yeuCau.getMoTaDiaChiHienTai());

    congDan.setDienThoaiCoDinh(yeuCau.getDienThoaiCoDinh());

    congDan.setDienThoaiDiDong(yeuCau.getDienThoaiDiDong());

    //      congDan.setHoTenCha(yeuCau.getHoVaTenCha());
    //      
    //      congDan.setHoTenMe(yeuCau.getHoVaTenMe());
    //      
    //      congDan.setHoTenVoHoacChong(yeuCau.getHoVaTenVoChong());

    congDan.setSoHoKhau(yeuCau.getSoHoKhau());

    congDan.setLaChuHo(yeuCau.getChuHo());

    congDan.setEmail(yeuCau.getEmail());

    if (yeuCau.getIDDanToc() != null && yeuCau.getIDDanToc() > 0)
        congDan.setDanTocId(yeuCau.getIDDanToc());
    if (yeuCau.getIDPhuongXaHienTai() != null && yeuCau.getIDPhuongXaHienTai() > 0)
        congDan.setDiaChiHienNayXaId(yeuCau.getIDPhuongXaHienTai());
    if (yeuCau.getIDQuanHuyenHienTai() != null && yeuCau.getIDQuanHuyenHienTai() > 0)
        congDan.setDiaChiHienNayHuyenId(yeuCau.getIDQuanHuyenHienTai());
    if (yeuCau.getIDTinhThanhHienTai() != null && yeuCau.getIDTinhThanhHienTai() > 0)
        congDan.setDiaChiHienNayTinhId(yeuCau.getIDTinhThanhHienTai());
    if (yeuCau.getIDQuanHuyenThuongTru() != null && yeuCau.getIDQuanHuyenThuongTru() > 0)
        congDan.setDiaChiThuongTruHuyenId(yeuCau.getIDQuanHuyenThuongTru());
    if (yeuCau.getIDPhuongXaThuongTru() != null && yeuCau.getIDPhuongXaThuongTru() > 0)
        congDan.setDiaChiThuongTruXaId(yeuCau.getIDPhuongXaThuongTru());
    if (yeuCau.getIDTinhThanhThuongTru() != null && yeuCau.getIDTinhThanhThuongTru() > 0)
        congDan.setDiaChiThuongTruTinhId(yeuCau.getIDTinhThanhThuongTru());
    congDan.setGioiTinh(yeuCau.getGioiTinh());
    if (yeuCau.getIDNgheNghiep() != null && yeuCau.getIDNgheNghiep() > 0)
        congDan.setNgheNghiepId(yeuCau.getIDNgheNghiep());
    if (yeuCau.getIDNoiCapCmnd() != null && yeuCau.getIDNoiCapCmnd() > 0)
        congDan.setNoiCapCmndId(yeuCau.getIDNoiCapCmnd());
    if (yeuCau.getIDNoiCapHoChieu() != null && yeuCau.getIDNoiCapHoChieu() > 0)
        congDan.setNoiCapHoChieuId(yeuCau.getIDNoiCapHoChieu());
    if (yeuCau.getIDTinhThanhNoiSinh() != null && yeuCau.getIDTinhThanhNoiSinh() > 0)
        congDan.setNoiSinhTinhId(yeuCau.getIDTinhThanhNoiSinh());
    if (yeuCau.getIDPhuongXaNoiSinh() != null && yeuCau.getIDPhuongXaNoiSinh() > 0)
        congDan.setNoiSinhXaId(yeuCau.getIDPhuongXaNoiSinh());
    if (yeuCau.getIDQuanHuyenNoiSinh() != null && yeuCau.getIDQuanHuyenNoiSinh() > 0)
        congDan.setNoiSinhHuyenId(yeuCau.getIDQuanHuyenNoiSinh());

    congDan.setNoiSinhChiTiet(yeuCau.getMoTaDiaChiNoiSinh());
    if (yeuCau.getIDQuanHe() != null && yeuCau.getIDQuanHe() > 0)
        congDan.setQuanHeChuHoId(yeuCau.getIDQuanHe());
    if (yeuCau.getIDQuocTich() != null && yeuCau.getIDQuocTich() > 0) {
        congDan.setQuocTichId(yeuCau.getIDQuocTich());
    } else {
        String idStr = WebserviceFactory.getThamSoService().getValue("VIETNAM");

        if (Validator.isNotNull(idStr)) {
            try {
                congDan.setQuocTichId(Long.parseLong(idStr));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    congDan.setTaiKhoanNguoiDungId(userId);

    if (yeuCau.getTinhTrangHonNhan() != null && yeuCau.getTinhTrangHonNhan() > 0)
        congDan.setTinhTrangHonNhanId(yeuCau.getTinhTrangHonNhan());

    try {
        congDan.setTonGiaoId(yeuCau.getIDTonGiao());
    } catch (Exception e) {
        e.printStackTrace();
    }

    if (yeuCau.getIDTrinhDoChuyenMon() != null && yeuCau.getIDTrinhDoChuyenMon() > 0)
        congDan.setTrinhDoChuyenMonId(yeuCau.getIDTrinhDoChuyenMon());
    if (yeuCau.getIDTrinhDoHocVan() != null && yeuCau.getIDTrinhDoHocVan() > 0)
        congDan.setTrinhDoHocVanId(yeuCau.getIDTrinhDoHocVan());

    Date currentDate = new Date();

    congDan.setNgayTao(currentDate);

    congDan.setNgaySua(currentDate);

    User currentUser = PortalUtil.getUser(this.actionRequest);

    if (currentUser != null) {
        // Nguoi chung thuc
        congDan.setNguoiTao(currentUser.getEmailAddress());
        congDan.setNguoiSua(currentUser.getEmailAddress());
    } else {
        congDan.setNguoiTao("DUMMY");
        congDan.setNguoiSua("DUMMY");
    }

    congDan.setDaXoa(0);

    CongDanLocalServiceUtil.addCongDan(congDan);

    /*
    byte[] avatar = (byte[])this.actionRequest.getPortletSession().getAttribute("PROFILE_PIC");
            
    if ( avatar != null && avatar.length > 0 ){
       // Update avatar
       AnhCongDan anhChanDung = AnhCongDanLocalServiceUtil.getAnhCongDan(id);
               
       anhChanDung.setAnh(avatar);
               
       AnhCongDanLocalServiceUtil.updateAnhCongDan(anhChanDung);
    }
    */
    return congDan.getId();
}

From source file:org.oep.cmon.user.portlet.business.EndorsementBs.java

License:Apache License

/**
 * This is function create portal user/*from  w w  w  .  jav  a 2s.  c o  m*/
 * Version: 1.0
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param yeuCau
 * @param userId
 * @param password
 * @throws SystemException
 * @throws NumberFormatException
 * @throws PortalException
 * @return long
 */
public long createPortalCitizenUser(YeuCauDangKyCongDan yeuCau, String password)
        throws SystemException, PortalException, IOException {
    // Create portal user
    CitizenUserBs user = new CitizenUserBs();

    // Full name
    user.setFullName(yeuCau.getHoCongDan() + StringPool.SPACE + yeuCau.getTenDem() + StringPool.SPACE
            + yeuCau.getTenCongDan());

    // Email
    user.setEmail(yeuCau.getEmail());

    // Anh chan dung
    byte[] avatar = (byte[]) actionRequest.getPortletSession().getAttribute("PROFILE_PIC");

    if (avatar != null && avatar.length > 0) {
        user.setAvatar(avatar);
    }

    // Ngay sinh
    user.setBirthDate(yeuCau.getNgaySinh());

    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    // Create portal user
    return user.createCitizenUser(password, themeDisplay, yeuCau);
}

From source file:org.oep.cmon.userreg.portlet.action.UserRegActionPortlet.java

License:Apache License

/**
 * This is function create user request//  w  w w . j a va2 s . c  o  m
 * Version: 1.0
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param ho
 * @param dem
 * @param ten
 * @param url
 * @param email
 * @param uri
 * @throws IOException
 */
private void sendAccountConfirmationEmail(String ho, String dem, String ten, String url, String email,
        String uri) throws IOException {
    // Send email
    AccountCreationRequestMail mail = new AccountCreationRequestMail();

    mail.setEmail(email);

    mail.setUrl(url);

    mail.setUri(uri);

    mail.setFullName(ho + StringPool.SPACE + dem + StringPool.SPACE + ten);

    // Send the email
    mail.send();
}

From source file:org.oep.cmon.userreg.portlet.action.UserRegActionPortlet.java

License:Apache License

/**
 * This is function send citizen confirmation email
 * Version: 1.0//from   w ww .  ja v a 2 s.  c o m
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param ho
 * @param dem
 * @param ten
 * @param url
 * @param email
 * @param uri
 * @param request
 * @throws IOException
 */
private void sendCitizenConfirmationEmail(String ho, String dem, String ten, String url, String email,
        String uri, ActionRequest request) throws IOException {
    // Send email
    CitizenCreationRequestMail mail = new CitizenCreationRequestMail();

    mail.setEmail(email);

    mail.setUrl(url);
    mail.setUri(uri);

    mail.setFullName(ho + StringPool.SPACE + dem + StringPool.SPACE + ten);

    // Send the email
    mail.send(email, request);
}

From source file:org.oep.core.dossiermgt.service.persistence.DossierDoc2TemplatePK.java

License:Open Source License

@Override
public String toString() {
    StringBundler sb = new StringBundler(10);

    sb.append(StringPool.OPEN_CURLY_BRACE);

    sb.append("dossierDocId");
    sb.append(StringPool.EQUAL);/*from   ww w  .  ja v  a 2  s.c om*/
    sb.append(dossierDocId);

    sb.append(StringPool.COMMA);
    sb.append(StringPool.SPACE);
    sb.append("docTemplateId");
    sb.append(StringPool.EQUAL);
    sb.append(docTemplateId);

    sb.append(StringPool.CLOSE_CURLY_BRACE);

    return sb.toString();
}

From source file:org.oep.core.dossiermgt.service.persistence.DossierFolder2RolePK.java

License:Open Source License

@Override
public String toString() {
    StringBundler sb = new StringBundler(10);

    sb.append(StringPool.OPEN_CURLY_BRACE);

    sb.append("dossierFolderId");
    sb.append(StringPool.EQUAL);/*  w  w w  .ja  v a  2s  . co  m*/
    sb.append(dossierFolderId);

    sb.append(StringPool.COMMA);
    sb.append(StringPool.SPACE);
    sb.append("roleId");
    sb.append(StringPool.EQUAL);
    sb.append(roleId);

    sb.append(StringPool.CLOSE_CURLY_BRACE);

    return sb.toString();
}

From source file:org.oep.core.processmgt.service.persistence.DossierStep2RolePK.java

License:Open Source License

@Override
public String toString() {
    StringBundler sb = new StringBundler(10);

    sb.append(StringPool.OPEN_CURLY_BRACE);

    sb.append("dossierStepId");
    sb.append(StringPool.EQUAL);/* w w w .  j av a  2  s  .c  o  m*/
    sb.append(dossierStepId);

    sb.append(StringPool.COMMA);
    sb.append(StringPool.SPACE);
    sb.append("roleId");
    sb.append(StringPool.EQUAL);
    sb.append(roleId);

    sb.append(StringPool.CLOSE_CURLY_BRACE);

    return sb.toString();
}

From source file:org.oep.core.processmgt.service.persistence.ProcessOrder2UserPK.java

License:Open Source License

@Override
public String toString() {
    StringBundler sb = new StringBundler(10);

    sb.append(StringPool.OPEN_CURLY_BRACE);

    sb.append("processOrderId");
    sb.append(StringPool.EQUAL);//from  w  w w  .j a v a 2 s.c  om
    sb.append(processOrderId);

    sb.append(StringPool.COMMA);
    sb.append(StringPool.SPACE);
    sb.append("userId");
    sb.append(StringPool.EQUAL);
    sb.append(userId);

    sb.append(StringPool.CLOSE_CURLY_BRACE);

    return sb.toString();
}

From source file:org.oep.usermgt.service.persistence.JobPos2RolePK.java

License:Open Source License

@Override
public String toString() {
    StringBundler sb = new StringBundler(10);

    sb.append(StringPool.OPEN_CURLY_BRACE);

    sb.append("jobPosId");
    sb.append(StringPool.EQUAL);/* w w  w  . j  a va2s  .  c om*/
    sb.append(jobPosId);

    sb.append(StringPool.COMMA);
    sb.append(StringPool.SPACE);
    sb.append("roleId");
    sb.append(StringPool.EQUAL);
    sb.append(roleId);

    sb.append(StringPool.CLOSE_CURLY_BRACE);

    return sb.toString();
}

From source file:org.opencps.backend.util.BackendUtils.java

License:Open Source License

/**
 * @param pattern//from   ww w . java 2  s.com
 * @return
 */
public static boolean checkPreCondition(String pattern, long dossierId) {

    boolean validPreCondition = true;

    List<String> lsCondition = ListUtil.toList(StringUtil.split(pattern, StringPool.SPACE));

    boolean validPayok = true;
    boolean validCancel = true;
    boolean validTagLabel = true;
    boolean validService = true;
    boolean validOnline = true;
    boolean validOnegate = true;
    boolean validRepair = true;

    for (String condition : lsCondition) {
        if (StringUtil.equalsIgnoreCase(StringUtil.split(condition, StringPool.UNDERLINE)[0],
                PRE_CONDITION_PAYOK)) {

            validPayok = _checkPayOkCondition(dossierId);

            continue;
        }

        if (StringUtil.equalsIgnoreCase(StringUtil.split(condition, StringPool.UNDERLINE)[0],
                PRE_CONDITION_CANCEL)) {

            validCancel = _checkRequestCommandlCondition(dossierId, WebKeys.REQUEST_COMMAND_CANCEL);

            continue;
        }

        if (StringUtil.equalsIgnoreCase(StringUtil.split(condition, StringPool.UNDERLINE)[0],
                PRE_CONDITION_TAG_LABEL)) {

            validTagLabel = _checkTagLabelCondition();

            continue;
        }

        if (StringUtil.equalsIgnoreCase(StringUtil.split(condition, StringPool.UNDERLINE)[0],
                PRE_CONDITION_SERVICE_ID)) {

            validService = _checkServiceCondition();

            continue;
        }

        if (StringUtil.equalsIgnoreCase(StringUtil.split(condition, StringPool.UNDERLINE)[0],
                PRE_CONDITION_ONEGATE)) {

            validOnegate = _checkOnegateCondition();

            continue;
        }

        if (StringUtil.equalsIgnoreCase(StringUtil.split(condition, StringPool.UNDERLINE)[0],
                PRE_CONDITION_ONELINE)) {

            validOnline = _checkOnlineCondition();

            continue;
        }

        if (StringUtil.equalsIgnoreCase(StringUtil.split(condition, StringPool.UNDERLINE)[0],
                PRE_CONDITION_REPAIR)) {
            validRepair = _checkRequestCommandlCondition(dossierId, WebKeys.REQUEST_COMMAND_REPAIR);
        }

    }

    if (validPayok && validCancel && validOnline && validOnegate && validTagLabel && validService
            && validRepair) {
        validPreCondition = true;
    } else {
        validPreCondition = false;
    }

    return validPreCondition;
}