Java 类com.liferay.portal.kernel.util.HttpUtil 实例源码

项目:govapps    文件:OGPD_EntityLocalServiceImpl.java   
private JSONArray getExternImageURLs(Application application) {
    JSONArray result = JSONFactoryUtil.createJSONArray();       
    try {
        List<MultiMedia> allMultiMedias = applicationLocalService.getMultiMedias(application.getApplicationId());
        _log.debug("allMultiMedias.size(): " + allMultiMedias.size());
        for (MultiMedia multiMedia : allMultiMedias) {
            _log.debug("multiMedia.getImageId(): " + multiMedia.getImageId());
            if (multiMedia.getImageId() != 0) {
                DLFileEntry fe = DLFileEntryLocalServiceUtil.getDLFileEntry(multiMedia.getImageId());
                result.put("http://" +  AppConstants.COMPANY_VIRTUAL_HOST + "/documents/10180/0/" + HttpUtil.encodeURL(fe.getTitle(), true));
            }
        }
    } catch (SystemException se) {
        _log.error(se.getMessage());        
    } catch (PortalException pe) {
        _log.error(pe.getMessage());                
    }
    return result;      
}
项目:govapps    文件:OGPD_EntityLocalServiceImpl.java   
public JSONArray getOpenDataEntitiesForWidget() {
    JSONArray result = JSONFactoryUtil.createJSONArray();
    try {
        List<Application> apps = applicationPersistence.findByuseOpenData(Constants.USE_OPEN_DATA);
        for (Application app: apps) {

            JSONObject _ogpd_Entity = JSONFactoryUtil.createJSONObject();

            _ogpd_Entity.put("id", app.getApplicationId());
            _ogpd_Entity.put("name", app.getName());
            _ogpd_Entity.put("beschreibung", app.getDescription());

            if (app.getLogoImageId() != 0) {
                DLFileEntry fe = DLFileEntryLocalServiceUtil.getDLFileEntry(app.getLogoImageId());
                _ogpd_Entity.put("icon", "http://" +  AppConstants.COMPANY_VIRTUAL_HOST + "/documents/10180/0/" + HttpUtil.encodeURL(fe.getTitle(), true));
            }               
            _ogpd_Entity.put("plattform", app.getTargetOS());
            result.put(_ogpd_Entity);                               
        }

    } catch (Exception e) {
        e.printStackTrace();
    }
    return result;
}
项目:govapps    文件:ApplicationServiceImpl.java   
public String getIconURL(long applicationId) throws Exception {
        String result = "";     
        try {
//          _log.debug("getIconURL(applicationId " + applicationId + ")");  
            Application application = applicationLocalService.getApplication(applicationId);
            if (application.getLogoImageId() != 0) {
                DLFileEntry fe = DLFileEntryLocalServiceUtil.getDLFileEntry(application.getLogoImageId());
                result = "http://localhost/documents/10180/0/" + 
                        HttpUtil.encodeURL(HtmlUtil.unescape(fe.getTitle())) + 
                        StringPool.SLASH + 
                        fe.getUuid() +
                        "?version=" + fe.getVersion() +
                        "&t=" + fe.getModifiedDate().getTime() +
                        "&imageThumbnail=1";                
            }

        } catch (SystemException se) {
            _log.error("applicationId: " + applicationId);              
            _log.error(se.getMessage());        
        } catch (PortalException pe) {
            _log.error("applicationId: " + applicationId);              
            _log.error(pe.getMessage());                
        }
        return result;      
    }
项目:govapps    文件:ApplicationServiceImpl.java   
private String getExternIconURL(Application application) throws Exception {
    String result = "";     
    try {
        if (application.getLogoImageId() != 0) {
            DLFileEntry fe = DLFileEntryLocalServiceUtil.getDLFileEntry(application.getLogoImageId());
            result = "http://" +  AppConstants.COMPANY_VIRTUAL_HOST + "/documents/10180/0/" + 
                    HttpUtil.encodeURL(HtmlUtil.unescape(fe.getTitle())) + 
                    StringPool.SLASH + 
                    fe.getUuid() +
                    "?version=" + fe.getVersion() +
                    "&t=" + fe.getModifiedDate().getTime() +
                    "&imageThumbnail=1";                
        }

    } catch (SystemException se) {
        _log.error(se.getMessage());                
    } catch (PortalException pe) {
        _log.error(pe.getMessage());                
    }
    return result;      
}
项目:govapps    文件:ApplicationServiceImpl.java   
public List<String> getImageURLs(long applicationId) {
    List<String> result = new ArrayList<String>();      
    try {
        List<MultiMedia> allMultiMedias = applicationLocalService.getMultiMedias(applicationId);

        for (MultiMedia multiMedia : allMultiMedias) {          
            DLFileEntry fe = DLFileEntryLocalServiceUtil.getDLFileEntry(multiMedia.getImageId());
            result.add("http://localhost/documents/10180/0/" + HttpUtil.encodeURL(fe.getTitle(), true));
        }
    } catch (SystemException se) {
        _log.error(se.getMessage());        
    } catch (PortalException pe) {
        _log.error(pe.getMessage());                
    }
    return result;      
}
项目:govapps    文件:ApplicationServiceImpl.java   
public List<String> getExternImageURLs(Application application) {
    List<String> result = new ArrayList<String>();      
    try {
        List<MultiMedia> allMultiMedias = applicationLocalService.getMultiMedias(application.getApplicationId());

        for (MultiMedia multiMedia : allMultiMedias) {          
            DLFileEntry fe = DLFileEntryLocalServiceUtil.getDLFileEntry(multiMedia.getImageId());
            result.add("http://" +  AppConstants.COMPANY_VIRTUAL_HOST + "/documents/10180/0/" + HttpUtil.encodeURL(fe.getTitle(), true));
        }
    } catch (SystemException se) {
        _log.error(se.getMessage());        
    } catch (PortalException pe) {
        _log.error(pe.getMessage());                
    }
    return result;      
}
项目:liferaylms-portlet    文件:LmsActivitiesList.java   
public void editactivity(ActionRequest actionRequest, ActionResponse actionResponse)
    throws PortalException, SystemException, Exception {
    long actId = ParamUtil.getInteger(actionRequest, "resId");

    // LearningActivity learnact =
    // com.liferay.lms.service.LearningActivityServiceUtil.getLearningActivity(actId);
    LearningActivityAssetRendererFactory laf = new LearningActivityAssetRendererFactory();
    if (laf != null) {
        AssetRenderer assetRenderer = laf.getAssetRenderer(actId, 0);
        String urlEdit = assetRenderer.getURLEdit((LiferayPortletRequest) actionRequest, (LiferayPortletResponse) actionResponse).toString();           
        Portlet urlEditPortlet =PortletLocalServiceUtil.getPortletById(HttpUtil.getParameter(urlEdit, "p_p_id",false));

        if(urlEditPortlet!=null) {
            PublicRenderParameter actIdPublicParameter = urlEditPortlet.getPublicRenderParameter("actId");
            if(actIdPublicParameter!=null) {
                urlEdit=HttpUtil.removeParameter(urlEdit,PortletQNameUtil.getPublicRenderParameterName(actIdPublicParameter.getQName()));
            }
            urlEdit=HttpUtil.addParameter(urlEdit, StringPool.UNDERLINE+urlEditPortlet.getPortletId()+StringPool.UNDERLINE+"resId", actId);
            urlEdit=HttpUtil.removeParameter(urlEdit, StringPool.UNDERLINE+urlEditPortlet.getPortletId()+StringPool.UNDERLINE+"actionEditingDetails");
            urlEdit=HttpUtil.addParameter(urlEdit, StringPool.UNDERLINE+urlEditPortlet.getPortletId()+StringPool.UNDERLINE+"actionEditingDetails", true);
        }

        actionResponse.sendRedirect(urlEdit);
    }
    SessionMessages.add(actionRequest, "asset-renderer-not-defined");
}
项目:edemocracia    文件:CDUpdatePasswordAction.java   
private String verificaRedirecionamentoParaHttp(HttpServletRequest request,
        HttpServletResponse response, String retorno) throws IOException {
    if ("portal.update_password".equals(retorno) && !Validator.isNull(ParamUtil.getString(request, Constants.CMD))) {
        String ticketKey = ParamUtil.getString(request, "ticketKey");
        String plid = ParamUtil.getString(request, "p_l_id");
        String doAsUserId = ParamUtil.getString(request, "doAsUserId");
        String urlHttp = PortalUtil.getPortalURL(request, false) + Portal.PATH_MAIN + "/portal/update_password";
        if (!Validator.isNull(ticketKey))
            urlHttp = HttpUtil.addParameter(urlHttp, "ticketKey", ticketKey);
        if (!Validator.isNull(plid))
            urlHttp = HttpUtil.addParameter(urlHttp, "p_l_id", plid);
        if (!Validator.isNull(doAsUserId))
            urlHttp = HttpUtil.addParameter(urlHttp, "doAsUserId", doAsUserId);
        response.sendRedirect(urlHttp);
        return null;
    } else {
        return retorno;
    }
}
项目:govapps    文件:OGPD_EntityLocalServiceImpl.java   
public JSONArray getRegionEntitiesForWidget(String regionID) {
    JSONArray result = JSONFactoryUtil.createJSONArray();
    try {
        long regionId = 1;
        if (regionID.trim().length() > 0) {
            regionId = Long.valueOf(regionID);
        }
        List<Application> apps = regionLocalService.getApplications(regionId);
        for (Application app: apps) {

            JSONObject _ogpd_Entity = JSONFactoryUtil.createJSONObject();

            _ogpd_Entity.put("id", app.getApplicationId());
            _ogpd_Entity.put("name", app.getName());
            _ogpd_Entity.put("beschreibung", app.getDescription());

            if (app.getLogoImageId() != 0) {
                DLFileEntry fe = DLFileEntryLocalServiceUtil.getDLFileEntry(app.getLogoImageId());
                _ogpd_Entity.put("icon", "http://" +  AppConstants.COMPANY_VIRTUAL_HOST + "/documents/10180/0/" + HttpUtil.encodeURL(fe.getTitle(), true));
            }               
            _ogpd_Entity.put("plattform", app.getTargetOS());
            result.put(_ogpd_Entity);
        }

    } catch (Exception e) {
        e.printStackTrace();
    }
    return result;
}
项目:edemocracia    文件:LoginPortlet.java   
private void redirecionaParaEscolhaUf(ActionResponse response, ThemeDisplay td, String currentUrl, Company company) throws PortalException,
        SystemException, IOException {
    Group guestGroup = GroupLocalServiceUtil.getGroup(company.getCompanyId(), GroupConstants.GUEST);
    Layout layout = LayoutLocalServiceUtil.getFriendlyURLLayout(guestGroup.getGroupId(), false, "/uf");
    String url = PortalUtil.getLayoutFriendlyURL(layout, td);
    url = HttpUtil.addParameter(url, "lp", currentUrl);
    response.sendRedirect(url);
}
项目:ch-inofix-timetracker    文件:TaskRecordActivityInterpreter.java   
@Override
protected String getPath(SocialActivity activity, ServiceContext serviceContext) throws Exception {

    _log.info("getPath");

    AssetRendererFactory<?> assetRendererFactory = AssetRendererFactoryRegistryUtil
            .getAssetRendererFactoryByClassName(TaskRecord.class.getName());

    AssetRenderer<?> assetRenderer = assetRendererFactory.getAssetRenderer(activity.getClassPK());

    _log.info(assetRenderer);

    String path = assetRenderer.getURLViewInContext(serviceContext.getLiferayPortletRequest(),
            serviceContext.getLiferayPortletResponse(), null);

    path = HttpUtil.addParameter(path, "redirect", serviceContext.getCurrentURL());

    return path;
}
项目:staging-checker    文件:RemoteConfigurationUtil.java   
@SuppressWarnings("unchecked")
private static Map<String, Object> readConfiguration(
        String configurationURL) {

    Map<String, Object> tempConfiguration;

    try {
        String configurationContent = HttpUtil.URLtoString(
            configurationURL);

        Yaml yaml = new Yaml();

        tempConfiguration = (Map<String, Object>)yaml.load(
            configurationContent);
    }
    catch (Exception e) {
        _log.error(e, e);

        tempConfiguration =
            (Map<String, Object>)ConfigurationUtil.getConfigurationEntry(
                "remoteConfigurationBackup");
    }

    if (Validator.isNull(tempConfiguration)) {
        return Collections.emptyMap();
    }

    int liferayBuildNumber = ReleaseInfo.getBuildNumber();

    if (tempConfiguration.containsKey(liferayBuildNumber)) {
        return (Map<String, Object>)tempConfiguration.get(
            liferayBuildNumber);
    }

    int liferayVersion = liferayBuildNumber / 100;

    if (tempConfiguration.containsKey(liferayVersion)) {
        return (Map<String, Object>)tempConfiguration.get(liferayVersion);
    }

    return Collections.emptyMap();
}
项目:index-checker    文件:RemoteConfigurationUtil.java   
@SuppressWarnings("unchecked")
private static Map<String, Object> readConfiguration(
        String configurationURL) {

    Map<String, Object> tempConfiguration;

    try {
        String configurationContent = HttpUtil.URLtoString(
            configurationURL);

        Yaml yaml = new Yaml();

        tempConfiguration = (Map<String, Object>)yaml.load(
            configurationContent);
    }
    catch (Exception e) {
        _log.error(e, e);

        tempConfiguration =
            (Map<String, Object>)ConfigurationUtil.getConfigurationEntry(
                "remoteConfigurationBackup");
    }

    if (Validator.isNull(tempConfiguration)) {
        return Collections.emptyMap();
    }

    int liferayBuildNumber = ReleaseInfo.getBuildNumber();

    if (tempConfiguration.containsKey(liferayBuildNumber)) {
        return (Map<String, Object>)tempConfiguration.get(
            liferayBuildNumber);
    }

    int liferayVersion = liferayBuildNumber / 100;

    if (tempConfiguration.containsKey(liferayVersion)) {
        return (Map<String, Object>)tempConfiguration.get(liferayVersion);
    }

    return Collections.emptyMap();
}
项目:govapps    文件:ApplicationLocalServiceImpl.java   
public List<List> getNewApplications(long companyId, int year, int month, int day, int count) throws SystemException {  

    List<List> result  = new ArrayList<List>();

    Date modifiedDate = PortalUtil.getDate(month, day, year);
    Date now = new Date();

    List<Application> applications = applicationPersistence.findAll();
    List<Application> applications2 = new ArrayList<Application>();
    for (Application app: applications) {
        applications2.add(app);
    }

    OrderByComparator orderByComparator = CustomComparatorUtil.getApplicationOrderByComparator("modifiedDate",  "desc");

       Collections.sort(applications2, orderByComparator);
       applications2 = applications2.subList(0, count);

    for (Application application: applications2) {
        if (application.getLifeCycleStatus() >= 4) {
            List toAdd = new ArrayList();
            toAdd.add(application);

            DLFileEntry fe;
            try {
                fe = DLFileEntryLocalServiceUtil.getDLFileEntry(application.getLogoImageId());
                String iconUrl = "http://localhost/documents/10180/0/" + 
                    HttpUtil.encodeURL(HtmlUtil.unescape(fe.getTitle())) + 
                    StringPool.SLASH + 
                    fe.getUuid() +
                    "?version=" + fe.getVersion() +
                    "&t=" + fe.getModifiedDate().getTime() +
                    "&imageThumbnail=1";

                toAdd.add(iconUrl);
            } catch (PortalException e) {
                _log.error(e.getMessage());
            }

            result.add(toAdd);              
        }
    }           
    return result;      
}
项目:govapps    文件:OGPD_EntityLocalServiceImpl.java   
public JSONArray getOGPD_Entities() {
//      JSONFactoryUtil _jsonFactoryUtil = new JSONFactoryUtil();
        JSONArray result = JSONFactoryUtil.createJSONArray();
        try {           

            List<Application> apps = applicationPersistence.findByuseOpenData(Constants.USE_OPEN_DATA);
            for (Application app: apps) {

                List<Link> links = applicationPersistence.getLinks(app.getApplicationId());
                String url = "";
                for (Link link: links) {
                    if (link.getType() == Constants.TARGET_LINK) {
                        url = link.getUrl();
                    }
                }
                _log.debug("url: " + url);

                JSONObject _ogpd_Entity = JSONFactoryUtil.createJSONObject();

                _ogpd_Entity.put("name", "govapps_" + String.valueOf(app.getApplicationId()));
                _ogpd_Entity.put("title", app.getName());
                _ogpd_Entity.put("author", app.getLegalDetails());
                _ogpd_Entity.put("notes", app.getDescription());

                String categoryString = app.getCategoryString();
                String[] categoryArray = categoryString.split(",");

                JSONArray groups = JSONFactoryUtil.createJSONArray();
                for (int i=0; i<categoryArray.length ; i++) {
                    groups.put(categoryArray[i].trim());
                }               
                _ogpd_Entity.put("groups", groups);
                _ogpd_Entity.put("type", "app");

                JSONArray resources = JSONFactoryUtil.createJSONArray();
                JSONObject resource = JSONFactoryUtil.createJSONObject();
                resource.put("url", url);
                resource.put("format", "application/octet-stream");
                resources.put(resource);
                _ogpd_Entity.put("resources", resources);

                _ogpd_Entity.put("license_id", app.getLicense());

                JSONObject extra = JSONFactoryUtil.createJSONObject();              

                JSONArray dates = JSONFactoryUtil.createJSONArray();
                JSONObject date = JSONFactoryUtil.createJSONObject();
                date.put("role", "erstellt");
                date.put("date", app.getCreateDate());              
                dates.put(date);
                extra.put("dates", dates);

                JSONObject terms_of_use = JSONFactoryUtil.createJSONObject();               
                extra.put("terms_of_use", terms_of_use);


                extra.put("used_datasets", getUsedDatasets(app));
                extra.put("sector", app.getSector());
                JSONArray images =  getExternImageURLs(app);
                if (app.getLogoImageId() != 0) {
                    DLFileEntry fe = DLFileEntryLocalServiceUtil.getDLFileEntry(app.getLogoImageId());
                    images.put("http://" +  AppConstants.COMPANY_VIRTUAL_HOST + "/documents/10180/0/" + HttpUtil.encodeURL(fe.getTitle(), true));
                }               
                extra.put("images", images);
                extra.put("ogd_version", "v1.0");


                _ogpd_Entity.put("extras", extra);
                result.put(_ogpd_Entity);                               
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
        return result;
    }
项目:govapps    文件:ApplicationServiceImpl.java   
public List<List> getNewApplications(long companyId, int year, int month, int day, int count) throws SystemException {  
    _log.debug("getNewApplications2: ");
    List<List> result  = new ArrayList<List>();
    try {
        Date modifiedDate = PortalUtil.getDate(month, day, year);
        Date now = new Date();

        DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Application.class);
        Criterion criterion = null;

        criterion = RestrictionsFactoryUtil.between("modifiedDate",modifiedDate,now);

        dynamicQuery.add(criterion);
        dynamicQuery.add(PropertyFactoryUtil.forName("lifeCycleStatus").eq(E_Stati.APPLICATION_STATUS_VERIFIED.getIntStatus()));

        Order defaultOrder = OrderFactoryUtil.desc("modifiedDate");
        dynamicQuery.addOrder(defaultOrder); 

        dynamicQuery.setLimit(0, count);

        List<Application> applications = ApplicationLocalServiceUtil.dynamicQuery(dynamicQuery);


        for (Application application: applications) {
            List toAdd = new ArrayList();
            toAdd.add(application);

            if (application.getLogoImageId() != 0) {
                DLFileEntry fe;
                fe = DLFileEntryLocalServiceUtil.getDLFileEntry(application.getLogoImageId());
                            //String iconUrl = "http://localhost/documents/10180/0/" + HttpUtil.encodeURL(fe.getTitle(), true);
                String iconUrl = "http://localhost/documents/10180/0/" + 
                    HttpUtil.encodeURL(HtmlUtil.unescape(fe.getTitle())) + 
                    StringPool.SLASH + 
                    fe.getUuid() +
                    "?version=" + fe.getVersion() +
                    "&t=" + fe.getModifiedDate().getTime() +
                    "&imageThumbnail=1";

                toAdd.add(iconUrl);
            }

            result.add(toAdd);              
        }
    } catch (Exception e) {
        _log.error(e.getMessage());
        e.printStackTrace();
    }
    return result;      
}
项目:edemocracia    文件:UFLandingPageAction.java   
protected void doRun(HttpServletRequest request, HttpServletResponse response) throws Exception {

    Company company = PortalUtil.getCompany(request);

    // Apenas para a comunidade default (e-democracia)
    String defaultWebId = PropsUtil.get(PropsKeys.COMPANY_DEFAULT_WEB_ID);
    if (!company.getWebId().equals(defaultWebId)) {
        return;
    }

    // Verifica se realmente está autenticado
    User user = PortalUtil.getUser(request);
    if (user.isDefaultUser())
        return;

    Country brazil = CountryServiceUtil.getCountryByA2("BR");

    // Verirfica se tem endereço no brasil
    for (Address address : user.getAddresses()) {
        if (address.getCountryId() == brazil.getCountryId()) {
        try {
            Region region = RegionServiceUtil.getRegion(address.getRegionId());
            if (region.getCountryId() == brazil.getCountryId())
            return;
        } catch (PortalException e) {
            // Ignore: Região não encontrada
        }
        }
    }

    HttpSession session = request.getSession();
    LastPath oldLastPath = (LastPath) session.getAttribute(WebKeys.LAST_PATH);

    // Vai para a página principal
    if (oldLastPath == null) {
        oldLastPath = new LastPath("", "/principal", new HashMap<String, String[]>());
    }

    HashMap<String, String[]> params = new HashMap<String, String[]>();
    params.put("lp", new String[] { oldLastPath.getContextPath() + oldLastPath.getPath() });
    LastPath newLastPath = new LastPath("", "/web/public/uf", params);
    session.setAttribute(WebKeys.LAST_PATH, newLastPath);
    _log.info("User logged in, redirect to page:" + newLastPath);
    if (session.getAttribute("FACEBOOK_USER_ID") != null && !"/login/login_redirect".equals(request.getParameter("_58_struts_action"))) {
        String lastPath = newLastPath.getPath();
        lastPath = HttpUtil.addParameter(lastPath, "lp", params.get("lp")[0]);
        response.sendRedirect(lastPath);
        _log.debug("Usuário do facebook redirecionado para cadastro de UF");
    }
    }
项目:edemocracia    文件:ImagemComunidadeAction.java   
@SuppressWarnings("unchecked")
    @Override
    public void run(HttpServletRequest request, HttpServletResponse response) throws ActionException {
    Map<String, Object> vmVariables = null;

    if (request.getAttribute(WebKeys.VM_VARIABLES) == null) {
        vmVariables = new HashMap<String, Object>();
        request.setAttribute(WebKeys.VM_VARIABLES, vmVariables);
    } else {
        vmVariables = (Map<String,Object>) request.getAttribute(WebKeys.VM_VARIABLES);
    }

    String urlImagem = "/e-democracia-theme/images/custom/simbol-edemocracia.png";
    String urlImagemThumb = urlImagem;

    try {
        ThemeDisplay td = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
        FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(td.getScopeGroupId(), 0, "icone");
        if (fileEntry != null) {
        FileVersion versaoAtual = fileEntry.getFileVersion();
        if (versaoAtual != null) {
            String nomeImage = HttpUtil.encodeURL(HtmlUtil.unescape(fileEntry.getTitle()), true);
            urlImagem = td.getPortalURL() + td.getPathContext() + "/documents/" + fileEntry.getRepositoryId() + "/" + fileEntry.getFolderId() + "/" + nomeImage + "?version=" + versaoAtual.getVersion() + "&t=" + versaoAtual.getModifiedDate().getTime();
            urlImagemThumb = urlImagem + "&imageThumbnail=1";
        }
        }
    } catch (Exception e) {
    }

/*  #set($caminhoImg = )
    #set($dlService = $serviceLocator.findService("com.liferay.portlet.documentlibrary.service.DLAppLocalService"))
    #set($imageEntry = $dlService.getFileEntry($themeDisplay.scopeGroupId, 0, "icone"))
    #if ($imageEntry)
     #set($fileVersion = $imageEntry.fileVersion)
     #if ($fileVersion)
      #set($imageName = $httpUtil.encodeURL($htmlUtil.unescape($imageEntry.title),true))
      #set($caminhoImg = $themeDisplay.portalURL + $themeDisplay.pathContext + "/documents/" + $imageEntry.repositoryId + "/" + $imageEntry.folderId + "/" + $imageName + "?version=" + $fileVersion.version + "&t=" + $fileVersion.modifiedDate.time + "&imageThumbnail=1")
     #end
    #end
*/

    vmVariables.put("caminho_img", urlImagemThumb);
    vmVariables.put("caminho_img_orig", urlImagem);
    }
项目:lims    文件:Buddy.java   
/**
 * Factory method which creates new Buddy object from BuddyDetails
 *
 * @param buddyDetails BuddyDetails
 * @return User
 */
public static Buddy fromBuddyDetails(BuddyDetails buddyDetails) {
    // Create new buddy
    Buddy buddy = new Buddy();
    // Map data to user details
    buddy.buddyId = buddyDetails.getBuddyId();
    buddy.companyId = buddyDetails.getCompanyId();
    buddy.fullName = buddyDetails.getFullName();
    buddy.screenName = buddyDetails.getScreenName();
    buddy.password = buddyDetails.getPassword();

    // Add additional info from local service util if it's not set in buddy details
    if (buddyDetails.getBuddyId() != null) {
        try {
            User user = UserLocalServiceUtil.getUserById(buddyDetails.getBuddyId());
            if (buddy.screenName == null) {
                buddy.screenName = user.getScreenName();
            }

            if (buddy.companyId == null) {
                buddy.companyId = user.getCompanyId();
            }

            if (buddy.fullName == null) {
                buddy.fullName = user.getFullName();
            }

            buddy.male = user.getMale();
            buddy.portraitId = user.getPortraitId();
            buddy.portraitImageToken = HttpUtil.encodeURL(DigesterUtil.digest(user.getUserUuid()));
            buddy.portraitToken = WebServerServletTokenUtil.getToken(user.getPortraitId());
            buddy.fullName = user.getFullName();

        } catch (Exception e) {
            // Just log
            if (log.isDebugEnabled()) {
                log.debug(e);
            }
        }
    }

    // Relations
    if (buddyDetails.getPresenceDetails() != null) {
        buddy.presence = Presence.fromPresenceDetails(buddyDetails.getPresenceDetails());
    }

    if (buddyDetails.getSettingsDetails() != null) {
        buddy.settings = Settings.fromSettingsDetails(buddyDetails.getSettingsDetails());
    }

    return buddy;
}
项目:ch-inofix-contact-manager    文件:ContactActivityInterpreter.java   
@Override
protected String getPath(SocialActivity activity, ServiceContext serviceContext) throws Exception {

    AssetRendererFactory<?> assetRendererFactory = AssetRendererFactoryRegistryUtil
            .getAssetRendererFactoryByClassName(Contact.class.getName());

    AssetRenderer<?> assetRenderer = assetRendererFactory.getAssetRenderer(activity.getClassPK());

    String path = assetRenderer.getURLViewInContext(serviceContext.getLiferayPortletRequest(),
            serviceContext.getLiferayPortletResponse(), null);

    path = HttpUtil.addParameter(path, "redirect", serviceContext.getCurrentURL());

    return path;
}