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

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

Introduction

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

Prototype

String UNDERLINE

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

Click Source Link

Usage

From source file:com.stoxx.service.business.registration.RegistrationServiceImpl.java

@Override
public User saveUserToLiferayDBForTranslator(UserProfileDetails userProfileDetails, ThemeDisplay themeDisplay,
        ServiceContext serviceContext, TranslatorAgency translatorAgency) throws STOXXException {
    try {/*from   w  ww.j  a  va  2 s  .  c o  m*/
        Group stoxxNetgroup = GroupLocalServiceUtil.getGroup(themeDisplay.getCompanyId(),
                STOXXConstants.STOXXNET_SITE_NAME);
        User adminDefaultUser = UserLocalServiceUtil.getDefaultUser(themeDisplay.getCompanyId());
        logger.info("the ****************************>default user id is " + adminDefaultUser.getUserId()
                + EMAIL_ADDRESS_IS + adminDefaultUser.getEmailAddresses());
        long[] groupIds = null;
        if (userProfileDetails.getUserType().equalsIgnoreCase(STOXXConstants.STOXX_VENDOR_USER)) {
            groupIds = new long[] { stoxxNetgroup.getGroupId() };
        }
        User user = null;
        if (userProfileDetails.getUserType().equalsIgnoreCase(STOXXConstants.STOXX_VENDOR_USER)) {
            StringBuilder userGroupNameTemp = new StringBuilder();
            String userGroupName = StringPool.BLANK;
            List<Long> translatorRoles = null;
            if (translatorAgency.getCompanyName().trim().contains(StringPool.SPACE)) {

                for (String word : translatorAgency.getCompanyName().trim().split(StringPool.SPACE)) {
                    userGroupNameTemp.append(word).append(StringPool.UNDERLINE);
                }
                userGroupName = userGroupNameTemp.substring(0, userGroupNameTemp.length() - 1);
                translatorRoles = assignTranslatorRole(userGroupName, translatorAgency, themeDisplay);
            } else {
                userGroupName = translatorAgency.getCompanyName().trim();
                translatorRoles = assignTranslatorRole(userGroupName, translatorAgency, themeDisplay);
            }
            UserGroup translatorGroup = UserGroupLocalServiceUtil.getUserGroup(themeDisplay.getCompanyId(),
                    userGroupName);
            long translatorGroupId[] = { translatorGroup.getUserGroupId() };
            long translatorRoleId[] = ArrayUtils
                    .toPrimitive(translatorRoles.toArray(new Long[translatorRoles.size()]));
            if (translatorAgency.getAgencyManagerEmailId()
                    .equalsIgnoreCase(userProfileDetails.getEmailAddress())) {
                user = UserLocalServiceUtil.addUser(adminDefaultUser.getUserId(), themeDisplay.getCompanyId(),
                        false, userProfileDetails.getPassword(), userProfileDetails.getPassword(), true,
                        StringPool.BLANK, userProfileDetails.getEmailAddress(), 0, StringPool.BLANK,
                        themeDisplay.getLocale(), userProfileDetails.getFirstName(), StringPool.BLANK,
                        userProfileDetails.getLastName(), userProfileDetails.getPrefixId(), 0,
                        userProfileDetails.isGender(), userProfileDetails.getBirthMonth(),
                        userProfileDetails.getBirthDay(), userProfileDetails.getBirthYear(),
                        userProfileDetails.getJobTitle(), groupIds, null, translatorRoleId, translatorGroupId,
                        false, serviceContext);
            } else {
                user = UserLocalServiceUtil.addUser(adminDefaultUser.getUserId(), themeDisplay.getCompanyId(),
                        false, userProfileDetails.getPassword(), userProfileDetails.getPassword(), true,
                        StringPool.BLANK, userProfileDetails.getEmailAddress(), 0, StringPool.BLANK,
                        themeDisplay.getLocale(), userProfileDetails.getFirstName(), StringPool.BLANK,
                        userProfileDetails.getLastName(), userProfileDetails.getPrefixId(), 0,
                        userProfileDetails.isGender(), userProfileDetails.getBirthMonth(),
                        userProfileDetails.getBirthDay(), userProfileDetails.getBirthYear(),
                        userProfileDetails.getJobTitle(), groupIds, null, null, translatorGroupId, false,
                        serviceContext);
            }
        }
        Role powerUserRole = RoleLocalServiceUtil.getRole(themeDisplay.getCompanyId(),
                RoleConstants.POWER_USER);
        if (Validator.isNotNull(powerUserRole)) {
            long rolePower[] = { powerUserRole.getRoleId() };
            if (Validator.isNotNull(user) && rolePower.length > 0) {
                RoleLocalServiceUtil.unsetUserRoles(user.getUserId(), rolePower);
            }
        }

        return user;
    } catch (PortalException e) {
        logger.error(e.getMessage(), e);
        throw new STOXXException(e.getMessage(), e);
    } catch (SystemException e) {
        logger.error(e.getMessage(), e);
        throw new STOXXException(e.getMessage(), e);
    }
}

From source file:com.stoxx.service.business.registration.RegistrationServiceImpl.java

private List<Long> assignTranslatorRole(String userGroupName, TranslatorAgency translatorAgency,
        ThemeDisplay themeDisplay) {/*from  w w  w  .j  a  v a2s.  c  o  m*/
    List<Long> roleList = new ArrayList<Long>();
    try {
        if (translatorAgency.getTranslatorLanguage().trim().contains(StringPool.COMMA)) {
            for (String language : translatorAgency.getTranslatorLanguage().trim().split(StringPool.COMMA)) {
                Role translatorRole = RoleLocalServiceUtil.getRole(themeDisplay.getCompanyId(),
                        userGroupName.concat(StringPool.UNDERLINE.concat(language)));
                long translatorRoleId = translatorRole.getRoleId();
                roleList.add(translatorRoleId);
            }
        } else {
            Role translatorRole = RoleLocalServiceUtil.getRole(themeDisplay.getCompanyId(), userGroupName
                    .concat(StringPool.UNDERLINE.concat(translatorAgency.getTranslatorLanguage().trim())));
            long translatorRoleId = translatorRole.getRoleId();
            roleList.add(translatorRoleId);
        }
    }

    catch (PortalException e) {
        logger.error(e.getMessage(), e);
    } catch (SystemException e) {
        logger.error(e.getMessage(), e);
    }
    return roleList;
}

From source file:com.vportal.portlet.vcms.util.VCMSFriendlyURLMapper.java

License:Open Source License

public void populateParams(String friendlyURLPath, Map<String, String[]> params, Map<String, Object> arg2) {
    // TODO Auto-generated method stub
    String[] arrURL = friendlyURLPath.split("/");

    String portletId = PortletKeysExt.VCMSVIEWCONTENT + "_INSTANCE_" + arrURL[2];

    String namespace = StringPool.UNDERLINE + portletId + StringPool.UNDERLINE;

    params.put("p_p_id", new String[] { portletId });
    params.put("p_p_state", new String[] { WindowState.NORMAL.toString() });
    params.put("p_p_lifecycle", new String[] { "0" });
    params.put("p_p_mode", new String[] { PortletMode.VIEW.toString() });

    for (int i = 3; i < arrURL.length; i++) {
        if (i == 3) {

            params.put(namespace + "categoryId", new String[] { arrURL[3] });
        } else if (i == 4) {
            if (Validator.isNumber(arrURL[4])) {
                params.put(namespace + "articleId", new String[] { arrURL[4] });
            }//from  w ww  .  ja  v  a2 s.  c om
        }
    }

}

From source file:it.smc.calendar.sync.caldav.util.CalDAVUtil.java

License:Open Source License

public static String getResourceETag(Resource resource) {
    StagedModel model = (StagedModel) resource.getModel();

    Date modifiedDate = model.getModifiedDate();

    if (model instanceof Calendar) {
        Calendar calendar = (Calendar) model;

        try {/*from   w  w  w.ja  v  a2s  .  c o  m*/
            modifiedDate = CalendarUtil.getLastCalendarModifiedDate(calendar.getCalendarId());
        } catch (Exception e) {
            _log.error(e);
        }
    }

    return String.valueOf(resource.getPrimaryKey()) + StringPool.UNDERLINE + modifiedDate.getTime();
}

From source file:jorgediazest.util.model.TableInfo.java

License:Open Source License

public int getAttributePos(String name) {
    if (mapAttributePosition.containsKey(name)) {
        return mapAttributePosition.get(name);
    }/* w  ww .  j  av  a  2 s  . co m*/

    Object[][] values = this.getAttributes();

    if (name.endsWith(StringPool.UNDERLINE)) {
        name = name.substring(0, name.length() - 1);
    }

    String nameWithUnderline = name + StringPool.UNDERLINE;

    int pos = -1;

    for (int i = 0; i < values.length; i++) {
        if (((String) values[i][0]).endsWith(StringPool.UNDERLINE)
                && ((String) values[i][0]).equals(nameWithUnderline)) {

            pos = i;
        } else if (((String) values[i][0]).equals(name)) {
            pos = i;
        }
    }

    mapAttributePosition.put(name, pos);

    return pos;
}

From source file:org.apache.jsp.html.taglib.ui.icon_005fdeactivate.page_jsp.java

License:Open Source License

public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;//from  w w w  . j a  v  a  2 s.  co  m
    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;

    try {
        _jspxFactory = JspFactory.getDefaultFactory();
        response.setContentType("text/html; charset=UTF-8");
        pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
        _jspx_page_context = pageContext;
        application = pageContext.getServletContext();
        config = pageContext.getServletConfig();
        session = pageContext.getSession();
        out = pageContext.getOut();
        _jspx_out = out;

        /**
         * Copyright (c) 2000-2007 Liferay, Inc. All rights reserved.
         *
         * Permission is hereby granted, free of charge, to any person obtaining a copy
         * of this software and associated documentation files (the "Software"), to deal
         * in the Software without restriction, including without limitation the rights
         * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         * copies of the Software, and to permit persons to whom the Software is
         * furnished to do so, subject to the following conditions:
         *
         * The above copyright notice and this permission notice shall be included in
         * all copies or substantial portions of the Software.
         *
         * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         * SOFTWARE.
         */

        out.write('\n');
        out.write('\n');

        /**
         * Copyright (c) 2000-2007 Liferay, Inc. All rights reserved.
         *
         * Permission is hereby granted, free of charge, to any person obtaining a copy
         * of this software and associated documentation files (the "Software"), to deal
         * in the Software without restriction, including without limitation the rights
         * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         * copies of the Software, and to permit persons to whom the Software is
         * furnished to do so, subject to the following conditions:
         *
         * The above copyright notice and this permission notice shall be included in
         * all copies or substantial portions of the Software.
         *
         * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         * SOFTWARE.
         */

        out.write('\n');
        out.write('\n');

        /**
         * Copyright (c) 2000-2007 Liferay, Inc. All rights reserved.
         *
         * Permission is hereby granted, free of charge, to any person obtaining a copy
         * of this software and associated documentation files (the "Software"), to deal
         * in the Software without restriction, including without limitation the rights
         * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         * copies of the Software, and to permit persons to whom the Software is
         * furnished to do so, subject to the following conditions:
         *
         * The above copyright notice and this permission notice shall be included in
         * all copies or substantial portions of the Software.
         *
         * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         * SOFTWARE.
         */

        out.write('\n');
        out.write('\n');

        /**
         * Copyright (c) 2000-2007 Liferay, Inc. All rights reserved.
         *
         * Permission is hereby granted, free of charge, to any person obtaining a copy
         * of this software and associated documentation files (the "Software"), to deal
         * in the Software without restriction, including without limitation the rights
         * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         * copies of the Software, and to permit persons to whom the Software is
         * furnished to do so, subject to the following conditions:
         *
         * The above copyright notice and this permission notice shall be included in
         * all copies or substantial portions of the Software.
         *
         * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         * SOFTWARE.
         */

        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        //  liferay-theme:defineObjects
        com.liferay.taglib.theme.DefineObjectsTag _jspx_th_liferay_002dtheme_005fdefineObjects_005f0 = (com.liferay.taglib.theme.DefineObjectsTag) _005fjspx_005ftagPool_005fliferay_002dtheme_005fdefineObjects_005fnobody
                .get(com.liferay.taglib.theme.DefineObjectsTag.class);
        _jspx_th_liferay_002dtheme_005fdefineObjects_005f0.setPageContext(_jspx_page_context);
        _jspx_th_liferay_002dtheme_005fdefineObjects_005f0.setParent(null);
        int _jspx_eval_liferay_002dtheme_005fdefineObjects_005f0 = _jspx_th_liferay_002dtheme_005fdefineObjects_005f0
                .doStartTag();
        if (_jspx_th_liferay_002dtheme_005fdefineObjects_005f0
                .doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
            _005fjspx_005ftagPool_005fliferay_002dtheme_005fdefineObjects_005fnobody
                    .reuse(_jspx_th_liferay_002dtheme_005fdefineObjects_005f0);
            return;
        }
        _005fjspx_005ftagPool_005fliferay_002dtheme_005fdefineObjects_005fnobody
                .reuse(_jspx_th_liferay_002dtheme_005fdefineObjects_005f0);
        com.liferay.portal.theme.ThemeDisplay themeDisplay = null;
        com.liferay.portal.model.Company company = null;
        com.liferay.portal.model.Account account = null;
        com.liferay.portal.model.User user = null;
        com.liferay.portal.model.User realUser = null;
        com.liferay.portal.model.Contact contact = null;
        com.liferay.portal.model.Layout layout = null;
        java.util.List layouts = null;
        java.lang.Long plid = null;
        com.liferay.portal.model.LayoutTypePortlet layoutTypePortlet = null;
        java.lang.Long portletGroupId = null;
        com.liferay.portal.kernel.security.permission.PermissionChecker permissionChecker = null;
        java.util.Locale locale = null;
        java.util.TimeZone timeZone = null;
        com.liferay.portal.model.Theme theme = null;
        com.liferay.portal.model.ColorScheme colorScheme = null;
        com.liferay.portal.theme.PortletDisplay portletDisplay = null;
        themeDisplay = (com.liferay.portal.theme.ThemeDisplay) _jspx_page_context.findAttribute("themeDisplay");
        company = (com.liferay.portal.model.Company) _jspx_page_context.findAttribute("company");
        account = (com.liferay.portal.model.Account) _jspx_page_context.findAttribute("account");
        user = (com.liferay.portal.model.User) _jspx_page_context.findAttribute("user");
        realUser = (com.liferay.portal.model.User) _jspx_page_context.findAttribute("realUser");
        contact = (com.liferay.portal.model.Contact) _jspx_page_context.findAttribute("contact");
        layout = (com.liferay.portal.model.Layout) _jspx_page_context.findAttribute("layout");
        layouts = (java.util.List) _jspx_page_context.findAttribute("layouts");
        plid = (java.lang.Long) _jspx_page_context.findAttribute("plid");
        layoutTypePortlet = (com.liferay.portal.model.LayoutTypePortlet) _jspx_page_context
                .findAttribute("layoutTypePortlet");
        portletGroupId = (java.lang.Long) _jspx_page_context.findAttribute("portletGroupId");
        permissionChecker = (com.liferay.portal.kernel.security.permission.PermissionChecker) _jspx_page_context
                .findAttribute("permissionChecker");
        locale = (java.util.Locale) _jspx_page_context.findAttribute("locale");
        timeZone = (java.util.TimeZone) _jspx_page_context.findAttribute("timeZone");
        theme = (com.liferay.portal.model.Theme) _jspx_page_context.findAttribute("theme");
        colorScheme = (com.liferay.portal.model.ColorScheme) _jspx_page_context.findAttribute("colorScheme");
        portletDisplay = (com.liferay.portal.theme.PortletDisplay) _jspx_page_context
                .findAttribute("portletDisplay");
        out.write("\r\n");
        out.write("\r\n");

        /**
         * Copyright (c) 2000-2006 Liferay, LLC. All rights reserved.
         *
         * Permission is hereby granted, free of charge, to any person obtaining a copy
         * of this software and associated documentation files (the "Software"), to deal
         * in the Software without restriction, including without limitation the rights
         * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         * copies of the Software, and to permit persons to whom the Software is
         * furnished to do so, subject to the following conditions:
         *
         * The above copyright notice and this permission notice shall be included in
         * all copies or substantial portions of the Software.
         *
         * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         * SOFTWARE.
         */

        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        //@ page import="com.liferay.portal.kernel.util.PortletExtKeys" 
        out.write("\r\n");
        out.write("\r\n");

        String contextPath = PropsUtil.get(PropsUtil.PORTAL_CTX);
        if (contextPath.equals("/")) {
            contextPath = "";
        }

        out.write('\r');
        out.write('\n');
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write('\n');
        out.write('\n');

        RenderRequest renderRequest = (RenderRequest) request.getAttribute(JavaConstants.JAVAX_PORTLET_REQUEST);

        RenderResponse renderResponse = (RenderResponse) request
                .getAttribute(JavaConstants.JAVAX_PORTLET_RESPONSE);

        String namespace = StringPool.BLANK;

        if (renderRequest != null) {
            namespace = renderResponse.getNamespace();
        }

        String currentURL = PortalUtil.getCurrentURL(request);

        out.write('\n');
        out.write('\n');

        /**
         * Copyright (c) 2000-2007 Liferay, Inc. All rights reserved.
         *
         * Permission is hereby granted, free of charge, to any person obtaining a copy
         * of this software and associated documentation files (the "Software"), to deal
         * in the Software without restriction, including without limitation the rights
         * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         * copies of the Software, and to permit persons to whom the Software is
         * furnished to do so, subject to the following conditions:
         *
         * The above copyright notice and this permission notice shall be included in
         * all copies or substantial portions of the Software.
         *
         * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         * SOFTWARE.
         */

        out.write('\n');
        out.write('\n');

        String image = (String) request.getAttribute("liferay-ui:icon:image");

        String message = (String) request.getAttribute("liferay-ui:icon:message");

        if (message == null) {
            message = StringUtil.replace(image, StringPool.UNDERLINE, StringPool.DASH);
        }

        String src = (String) request.getAttribute("liferay-ui:icon:src");

        if (Validator.isNull(src)) {
            src = themeDisplay.getPathThemeImages() + "/common/" + image + ".png";
        }

        String url = (String) request.getAttribute("liferay-ui:icon:url");
        String target = (String) request.getAttribute("liferay-ui:icon:target");
        boolean toolTip = GetterUtil.getBoolean((String) request.getAttribute("liferay-ui:icon:toolTip"));

        String details = null;

        if (toolTip) {
            details = "onmousemove=\"ToolTip.show(event, this, '"
                    + UnicodeLanguageUtil.get(pageContext, message) + "')\"";
        } else {
            details = "title=\"" + LanguageUtil.get(pageContext, message) + "\"";
        }

        out.write('\n');
        out.write('\n');

        String jsUrl = "javascript: if (confirm('"
                + UnicodeLanguageUtil.get(pageContext, "are-you-sure-you-want-to-deactivate-this")
                + "')) { self.location= '" + HttpUtil.encodeURL(url) + "'; } else { self.focus(); }";

        out.write('\n');
        out.write('\n');
        //  liferay-ui:icon
        com.liferay.taglib.ui.IconTag _jspx_th_liferay_002dui_005ficon_005f0 = (com.liferay.taglib.ui.IconTag) _005fjspx_005ftagPool_005fliferay_002dui_005ficon_005furl_005fimage_005fnobody
                .get(com.liferay.taglib.ui.IconTag.class);
        _jspx_th_liferay_002dui_005ficon_005f0.setPageContext(_jspx_page_context);
        _jspx_th_liferay_002dui_005ficon_005f0.setParent(null);
        _jspx_th_liferay_002dui_005ficon_005f0.setImage("deactivate");
        _jspx_th_liferay_002dui_005ficon_005f0.setUrl(jsUrl);
        int _jspx_eval_liferay_002dui_005ficon_005f0 = _jspx_th_liferay_002dui_005ficon_005f0.doStartTag();
        if (_jspx_th_liferay_002dui_005ficon_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
            _005fjspx_005ftagPool_005fliferay_002dui_005ficon_005furl_005fimage_005fnobody
                    .reuse(_jspx_th_liferay_002dui_005ficon_005f0);
            return;
        }
        _005fjspx_005ftagPool_005fliferay_002dui_005ficon_005furl_005fimage_005fnobody
                .reuse(_jspx_th_liferay_002dui_005ficon_005f0);
    } catch (Throwable t) {
        if (!(t instanceof SkipPageException)) {
            out = _jspx_out;
            if (out != null && out.getBufferSize() != 0)
                out.clearBuffer();
            if (_jspx_page_context != null)
                _jspx_page_context.handlePageException(t);
        }
    } finally {
        if (_jspxFactory != null)
            _jspxFactory.releasePageContext(_jspx_page_context);
    }
}

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

License:Open Source License

/**
 * @param pattern//w  ww.  ja  v a2  s  .  c o  m
 * @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;
}

From source file:org.opencps.usermgt.service.impl.JobPosLocalServiceImpl.java

License:Open Source License

public JobPos updateJobPos(long jobPosId, long userId, String title, String description, long workingUnitId,
        int leader, long[] rowIds, ServiceContext serviceContext) throws SystemException, PortalException {

    JobPos jobPos = jobPosPersistence.findByPrimaryKey(jobPosId);

    Role role = RoleServiceUtil.getRole(jobPos.getMappingRoleId());
    WorkingUnit workingUnit = workingUnitPersistence.findByPrimaryKey(workingUnitId);

    for (int jndex = 0; jndex < rowIds.length; jndex++) {

        if (rowIds[jndex] > 0) {

            ResourceAction resourceAction = ResourceActionLocalServiceUtil.fetchResourceAction(rowIds[jndex]);
            String className = resourceAction.getName();

            ResourcePermissionLocalServiceUtil.addResourcePermission(serviceContext.getCompanyId(), className,
                    ResourceConstants.SCOPE_GROUP, String.valueOf(serviceContext.getScopeGroupId()),
                    role.getRoleId(), resourceAction.getActionId());
        }//from ww  w . j a  v a  2s.c o m
    }

    long directWorkingUnitId = getDirectWorkingUnitId(workingUnitId).getWorkingunitId();
    Date currentDate = new Date();
    String roleName = StringPool.BLANK;

    roleName = title + StringPool.UNDERLINE + workingUnit.getName();

    jobPos.setUserId(userId);
    jobPos.setGroupId(serviceContext.getScopeGroupId());
    jobPos.setCompanyId(serviceContext.getCompanyId());
    jobPos.setCreateDate(currentDate);
    jobPos.setModifiedDate(currentDate);
    jobPos.setTitle(title);
    jobPos.setDescription(description);
    jobPos.setWorkingUnitId(workingUnitId);
    jobPos.setDirectWorkingUnitId(directWorkingUnitId);
    jobPos.setLeader(leader);

    role.setName(roleName);
    role.setTitle(roleName);
    RoleLocalServiceUtil.updateRole(role);

    return jobPosPersistence.update(jobPos);
}

From source file:org.rsc.liferay.solr.SolrIndexWriter.java

License:Open Source License

@Override
public void updateDocuments(SearchContext searchContext, Collection<Document> documents)
        throws SearchException {

    if (documents.isEmpty()) {
        return;//from w w  w  . ja  va2 s . c om
    }

    // LPS-41388

    Iterator<Document> itr = documents.iterator();

    Document firstDocument = itr.next();

    String uid = firstDocument.getUID();

    int pos = uid.indexOf(StringPool.UNDERLINE);

    String portletId = uid.substring(0, pos);

    deletePortletDocuments(searchContext, portletId);

    addDocuments(searchContext, documents);
}

From source file:vn.dtt.sol.ns.baocaodli.dao.service.impl.BaoCaoDLILocalServiceImpl.java

License:Open Source License

/**
 * //from   www . j av a 2  s.  c o m
 * @param namBaoCao
 * @param maTinh
 * @param baoCaoDLIId
 * @param suffix
 * @param fileExtension
 * @return
 */
private String getFileBaoCaoName(int namBaoCao, String maTinh, long baoCaoDLIId, String suffix,
        String fileExtension) {

    Date now = new Date();
    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");

    StringBuilder sb = new StringBuilder(10);

    sb.append(namBaoCao);
    sb.append(StringPool.UNDERLINE);
    sb.append(maTinh);
    sb.append(StringPool.UNDERLINE);
    sb.append(baoCaoDLIId);
    sb.append(StringPool.UNDERLINE);
    sb.append(suffix);
    sb.append(StringPool.UNDERLINE);
    sb.append(sdf.format(now));
    sb.append(fileExtension);

    return sb.toString();
}