/impl/conf/language/MessageResourcesProfile.properties |
---|
99,3 → 99,6 |
profile.RecordEventOrganizationImpl=Participação em Organizações de Eventos |
profile.RecordProjectImpl=Participações em Projectos |
profile.RecordOtherImpl=Outros |
profile.record.publisher.all=Instituição / Empresa / Conferência / Workshop / Revista |
profile.record.publisher.paper=Conferência / Workshop / Revista |
/impl/conf/app.properties |
---|
33,7 → 33,7 |
email.new.grades=true |
email.courseunit.announcements=true |
email.summaries=true |
email.summaries=false |
email.summary.subject.pt=Sumário lançado em {0} |
email.summary.subject.en=Sumário lançado em {0} |
/impl/src/java/jomm/dao/utils/HibernateUtils.java |
---|
14,17 → 14,16 |
public class HibernateUtils implements Runnable{ |
// private static Session session; |
// private static Session session; |
private static final Logger logger = Logger.getLogger(HibernateUtils.class); |
private static final SessionFactory sessionFactory; |
private static SessionFactory sessionFactory; |
static |
{ |
try |
{ |
Configuration config = new Configuration(); |
config.configure(Thread.currentThread().getContextClassLoader().getResource("pt/estgp/estgweb/hibernate.cfg.xml")); |
sessionFactory = config.buildSessionFactory(); |
createFactory(); |
// session = sessionFactory.openSession(); |
} |
catch (Throwable e) |
34,8 → 33,17 |
} |
} |
private static void createFactory() |
{ |
Configuration config = new Configuration(); |
config.configure(Thread.currentThread().getContextClassLoader().getResource("pt/estgp/estgweb/hibernate.cfg.xml")); |
sessionFactory = config.buildSessionFactory(); |
} |
public static SessionFactory getSessionFactory() |
{ |
if(sessionFactory.isClosed()) |
createFactory(); |
return sessionFactory; |
} |
51,7 → 59,7 |
// if(!examples.isOpen()) |
// examples = sessionFactory.openSession(); |
// return examples; |
return sessionFactory.getCurrentSession(); |
return getSessionFactory().getCurrentSession(); |
} |
public static void main(String [] args) throws SQLException |
/impl/src/java/jomm/dao/impl/AbstractDao.java |
---|
326,7 → 326,7 |
} |
/** |
* |
* |
* @param o |
* @return |
*/ |
698,7 → 698,7 |
/** |
* Refresh a collection of objects. |
* |
* @param objs Objects to delete |
* @param objs Objects to refreh |
*/ |
public final void refresh(Collection<CLAZZ> objs) |
{ |
715,7 → 715,26 |
throw new DaoException(e); |
} |
} |
/** |
* Refresh a collection of objects. |
* |
* @param obj Object to refreh |
*/ |
public final void refresh(CLAZZ obj) |
{ |
try |
{ |
Session session = getCurrentSession(); |
session.refresh(obj); |
} |
catch (HibernateException e) |
{ |
throw new DaoException(e); |
} |
} |
/** |
* Refresh a collection of objects. |
* |
/impl/src/java/pt/estgp/estgweb/services/urlstat/ResetRelativePathsService.java |
---|
New file |
0,0 → 1,84 |
package pt.estgp.estgweb.services.urlstat; |
import pt.utl.ist.berserk.logic.serviceManager.IService; |
import pt.estgp.estgweb.Globals; |
import pt.estgp.estgweb.domain.*; |
import pt.estgp.estgweb.domain.dao.DaoFactory; |
import pt.estgp.estgweb.services.expceptions.ServiceException; |
import org.apache.log4j.Logger; |
import org.apache.commons.httpclient.util.URIUtil; |
import org.apache.commons.httpclient.URIException; |
import org.jfree.data.time.TimeSeriesCollection; |
import org.jfree.data.time.TimeSeries; |
import org.jfree.data.time.Day; |
import org.jfree.data.time.Month; |
import org.jfree.chart.JFreeChart; |
import org.jfree.chart.ChartFactory; |
import org.jfree.chart.ChartUtilities; |
import org.jfree.chart.axis.DateAxis; |
import org.jfree.chart.plot.XYPlot; |
import javax.servlet.http.HttpServletRequest; |
import java.util.List; |
import java.util.Date; |
import java.util.ArrayList; |
import java.io.File; |
import java.io.IOException; |
import java.awt.*; |
import java.text.SimpleDateFormat; |
import java.sql.PreparedStatement; |
import java.sql.SQLException; |
import java.sql.ResultSet; |
import jomm.utils.MyCalendar; |
import jomm.utils.DatesUtils; |
import jomm.utils.MessageResources; |
import jomm.dao.impl.AbstractDao; |
import jomm.dao.utils.HibernateUtils; |
/** |
* @author Jorge Machado |
* @date 15/Mar/2008 |
* @time 6:55:38 |
* @see pt.estgp.estgweb.services.urlstat |
*/ |
public class ResetRelativePathsService implements IService |
{ |
private static final Logger logger = Logger.getLogger(ResetRelativePathsService.class); |
public static void main(String[] args) throws ServiceException, URIException, SQLException |
{ |
AbstractDao.getCurrentSession().beginTransaction(); |
PreparedStatement ps = AbstractDao.getCurrentSession().connection().prepareStatement("select relativePath from urlstat"); |
ResultSet rs = ps.executeQuery(); |
while(rs.next()) |
{ |
PreparedStatement ps1 = AbstractDao.getCurrentSession().connection().prepareStatement("update urlstat set relativePath = ? where relativePath=?"); |
String relativePath = rs.getString("relativePath"); |
String encoded=URIUtil.encodeWithinQuery(relativePath,"ISO-8859-1"); |
ps1.setString(1,encoded); |
ps1.setString(2,relativePath); |
ps1.executeUpdate(); |
ps1.close(); |
ps1 = AbstractDao.getCurrentSession().connection().prepareStatement("update urlstatday set relativePath = ? where relativePath=?"); |
ps1.setString(1,encoded); |
ps1.setString(2,relativePath); |
ps1.executeUpdate(); |
ps1.close(); |
ps1 = AbstractDao.getCurrentSession().connection().prepareStatement("update urlstatmonth set relativePath = ? where relativePath=?"); |
ps1.setString(1,encoded); |
ps1.setString(2,relativePath); |
ps1.executeUpdate(); |
ps1.close(); |
ps1 = AbstractDao.getCurrentSession().connection().prepareStatement("update urlstatyear set relativePath = ? where relativePath=?"); |
ps1.setString(1,encoded); |
ps1.setString(2,relativePath); |
ps1.executeUpdate(); |
ps1.close(); |
} |
AbstractDao.getCurrentSession().getTransaction().commit(); |
} |
} |
/impl/src/java/pt/estgp/estgweb/services/urlstat/ChartBuilderService.java |
---|
115,6 → 115,15 |
TimeSeriesCollection dataset = new TimeSeriesCollection(); |
for(String relativePath: relativePaths) |
{ |
try |
{ |
relativePath = URIUtil.encodeWithinQuery(relativePath,"ISO-8859-1"); |
} |
catch (URIException e) |
{ |
logger.error(e,e); |
return null; |
} |
UrlStat urlStat = DaoFactory.getUrlStatDaoImpl().loadOrNull(relativePath); |
if(urlStat != null) |
{ |
194,7 → 203,7 |
String dates = sp.format(startDate) + "_UNTIL_" + sp.format(endDate) + "_" + seriesScaleEnum.getType(); |
String path; |
if(encode) |
path = URIUtil.encodePath(relativePathName.replaceAll("/","_"),"ISO-8859-1"); |
path = URIUtil.encodeWithinQuery(relativePathName.replaceAll("/","_"),"ISO-8859-1"); |
else |
path = relativePathName.replaceAll("/","_"); |
return LINK_CHART_TMP_DIR + "/" + path + "_" + dates + ".png"; |
213,23 → 222,24 |
* @throws ServiceException |
*/ |
public static void main(String[] args) throws ServiceException |
public static void main(String[] args) throws ServiceException, URIException |
{ |
// UrlStatService.main(null); |
AbstractDao.getCurrentSession().beginTransaction(); |
List<String> relativePaths = new ArrayList<String>(); |
relativePaths.add("/public/announcements/getFlashNews.jsp?sid=0.9998549583612295"); |
// AbstractDao.getCurrentSession().beginTransaction(); |
// List<String> relativePaths = new ArrayList<String>(); |
// relativePaths.add("/public/announcements/getFlashNews.jsp?sid=0.9998549583612295"); |
System.out.println(URIUtil.decode(URIUtil.encodeWithinQuery("/public/announcements/getFlashNews.jsp?sid=0.9998549583612295&jorge=j","ISO-8859-1"))); |
// relativePaths.add("/teste2"); |
System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.weekDays)); |
System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.monthDays)); |
System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.trimestreDays)); |
System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.semestreDays)); |
System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.yearDays)); |
System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.trimestreMonths)); |
System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.semestreMonths)); |
System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.yearMonths)); |
System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.twoYearsMonths)); |
AbstractDao.getCurrentSession().getTransaction().commit(); |
// System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.weekDays)); |
// System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.monthDays)); |
// System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.trimestreDays)); |
// System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.semestreDays)); |
// System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.yearDays)); |
// System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.trimestreMonths)); |
// System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.semestreMonths)); |
// System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.yearMonths)); |
// System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.twoYearsMonths)); |
// AbstractDao.getCurrentSession().getTransaction().commit(); |
} |
} |
/impl/src/java/pt/estgp/estgweb/services/profile/CurriculumService.java |
---|
66,12 → 66,15 |
{ |
r = RecordEnum.parse(recordView.getType()).createInstance(); |
r.setOwner(userSession.getUser()); |
r.setCreators(new HashSet<User>()); |
r.getCreators().add(userSession.getUser()); |
// r.setCreators(new HashSet<User>()); |
// r.getCreators().add(userSession.getUser()); |
userSession.getUser().getCreatorRecords().add(r); |
if(userSession.getUser().getCreatorRecords() == null) |
userSession.getUser().setCreatorRecords(new HashSet<Record>()); |
userSession.getUser().getCreatorRecords().add(r); |
DaoFactory.getRecordDaoImpl().save(r); |
DaoFactory.getRecordDaoImpl().refresh(r); |
System.out.println(r.getCreators().size()); |
} |
else |
r = DaoFactory.getRecordDaoImpl().get(recordView.getId()); |
/impl/src/java/pt/estgp/estgweb/domain/views/RecordView.java |
---|
36,6 → 36,7 |
private String copyright; |
private String identifier; |
private String repositoryStream; |
private String creatorsStr; |
private List<UserView> creators = new ArrayList<UserView>(); |
private List<UserView> contributors = new ArrayList<UserView>(); |
private RepositoryFileImpl repositoryFile; |
91,6 → 92,8 |
this.copyright = record.getCopyright(); |
this.identifier = record.getIdentifier(); |
this.repositoryStream = record.getRepositoryStream(); |
this.creators = UserView.getViews(new ArrayList<User>(record.getCreators())); |
this.contributors = UserView.getViews(new ArrayList<User>(record.getContributors())); |
if(repositoryStream != null) |
120,7 → 123,8 |
r.setDescripion(description); |
r.setPublisher(publisher); |
r.setIdentifier(identifier); |
r.setCreators(UserView.loadUsers(creators)); |
if(creators != null && creators.size() > 0) |
r.setCreators(UserView.loadUsers(creators)); |
r.setContributors(UserView.loadUsers(contributors)); |
} |
/impl/src/java/pt/estgp/estgweb/domain/UrlStatImpl.java |
---|
1,5 → 1,9 |
package pt.estgp.estgweb.domain; |
import org.apache.commons.httpclient.util.URIUtil; |
import org.apache.commons.httpclient.URIException; |
import org.apache.log4j.Logger; |
import java.io.Serializable; |
import java.util.HashSet; |
import java.util.Date; |
12,6 → 16,7 |
*/ |
public class UrlStatImpl extends UrlStat |
{ |
private static final Logger logger = Logger.getLogger(UrlStatImpl.class); |
public UrlStatImpl() |
{ |
34,7 → 39,14 |
public String getName() |
{ |
if(super.getName() == null) |
return getRelativePath(); |
try |
{ |
return URIUtil.decode(getRelativePath()); |
} |
catch (URIException e) |
{ |
logger.error(e,e); |
} |
return super.getName(); |
} |
} |
/impl/src/java/pt/estgp/estgweb/web/tags/PageUrlStatTag.java |
---|
51,7 → 51,7 |
if(attributes == null) |
attributes = ""; |
String url = "<a " + attributes + " href=\"" + hrequest.getContextPath() + "/urlstat/startUrlStat.do?relativePaths[0].value=" + URIUtil.encodePath(relativePath,"ISO-8859-1") + "\">"; |
String url = "<a " + attributes + " href=\"" + hrequest.getContextPath() + "/urlstat/startUrlStat.do?relativePaths[0].value=" + URIUtil.encodeWithinQuery(relativePath,"ISO-8859-1") + "\">"; |
String endUrl = "</a>"; |
String toPage = bodyContent.getString().trim(); |
JspWriter writer = pageContext.getOut(); |
77,5 → 77,10 |
return EVAL_PAGE; |
} |
public static void main(String[] args) |
{ |
} |
} |
/impl/src/java/pt/estgp/estgweb/web/controllers/profile/ProfileController.java |
---|
433,13 → 433,19 |
else |
args = new Object[]{profileForm.getRecordView(), null, null, null, 0}; |
boolean newRecord = false; |
if(profileForm.getRecordView().getId() <= 0) |
newRecord = true; |
UserView userView; |
if (profileForm.getRecordView().getId() > 0) |
userView = (UserView) sm.execute(RequestUtils.getRequester(request, response), "EditUserProfileRecord", args, names); |
else |
userView = (UserView) sm.execute(RequestUtils.getRequester(request, response), "CreateUserProfileRecord", args, names); |
addMessage(request, "profile.record.add.sucess", profileForm.getRecordView().getTitle()); |
if(newRecord) |
addMessage(request, "profile.record.add.sucess", profileForm.getRecordView().getTitle()); |
else |
addMessage(request, "profile.record.updated.sucess", profileForm.getRecordView().getTitle()); |
profileForm.setUserView(userView); |
return mapping.findForward("home"); |
} |
500,7 → 506,7 |
RecordView recordView = (RecordView) sm.execute(RequestUtils.getRequester(request, response), "LoadEditUserProfileRecord", args, names); |
UserView uV = recordView.getOwnerUserView(); |
addMessage(request, "profile.record.deleted.sucess"); |
// addMessage(request, "profile.record.deleted.sucess"); |
profileForm.setUserView(uV); |
profileForm.setRecordView(recordView); |
return mapping.findForward("curriculum"); |
/impl/src/java/pt/estgp/estgweb/web/filters/UrlStatFilter.java |
---|
1,6 → 1,7 |
package pt.estgp.estgweb.web.filters; |
import org.apache.log4j.Logger; |
import org.apache.commons.httpclient.util.URIUtil; |
import javax.servlet.*; |
import javax.servlet.http.HttpServletRequest; |
140,6 → 141,9 |
} |
} |
logger.info("accessing " + relativePath); |
relativePath = URIUtil.encodeWithinQuery(relativePath,"ISO-8859-1"); |
logger.info("coded to " + relativePath); |
IntegerContainer count = urlStat.get(relativePath); |
if (count == null) |
/impl/src/web/admin/profile/profileCurriculum.jsp |
---|
33,15 → 33,20 |
<bean:message key="profile.record.type"/> |
</th> |
<td> |
<html:select property="recordView.type"> |
<html:option value="RecordThesisImpl" key="profile.RecordThesisImpl"/> |
<html:option value="RecordPaperImpl" key="profile.RecordPaperImpl"/> |
<%--todo Falta Artigo de Opinião e falta meter artigo cientifico, revista, conferencia, workshop--%> |
<html:option value="RecordJobImpl" key="profile.RecordJobImpl"/> |
<html:option value="RecordEventOrganizationImpl" key="profile.RecordEventOrganizationImpl"/> |
<html:option value="RecordProjectImpl" key="profile.RecordProjectImpl"/> |
<html:option value="RecordOtherImpl" key="profile.RecordOtherImpl"/> |
</html:select> |
<logic:greaterThan value="0" name="ProfileForm" property="recordView.id"> |
<bean:message key="profile.${ProfileForm.recordView.type}"/> |
</logic:greaterThan> |
<logic:lessEqual value="0" name="ProfileForm" property="recordView.id"> |
<html:select property="recordView.type"> |
<html:option value="RecordThesisImpl" key="profile.RecordThesisImpl"/> |
<html:option value="RecordPaperImpl" key="profile.RecordPaperImpl"/> |
<%--todo Falta Artigo de Opinião e falta meter artigo cientifico, revista, conferencia, workshop--%> |
<html:option value="RecordJobImpl" key="profile.RecordJobImpl"/> |
<html:option value="RecordEventOrganizationImpl" key="profile.RecordEventOrganizationImpl"/> |
<html:option value="RecordProjectImpl" key="profile.RecordProjectImpl"/> |
<html:option value="RecordOtherImpl" key="profile.RecordOtherImpl"/> |
</html:select> |
</logic:lessEqual> |
</td> |
</tr> |
<tr> |
98,7 → 103,12 |
</tr> |
<tr> |
<th> |
<bean:message key="profile.record.publisher"/> |
<logic:equal value="RecordPaperImpl" name="ProfileForm" property="recordView.type"> |
<bean:message key="profile.record.publisher.paper"/> |
</logic:equal> |
<logic:notEqual value="RecordPaperImpl" name="ProfileForm" property="recordView.type"> |
<bean:message key="profile.record.publisher.all"/> |
</logic:notEqual> |
</th> |
<td> |
<html:text styleClass="text" property="recordView.publisher"/> |
/impl/src/web/public/profile/recordViews.jsp |
---|
52,7 → 52,14 |
</logic:present> |
<logic:present name="recordView" property="publisher"> |
<tr> |
<th><bean:message key="profile.record.publisher"/></th> |
<th> |
<logic:equal value="RecordPaperImpl" name="recordView" property="type"> |
<bean:message key="profile.record.publisher.paper"/> |
</logic:equal> |
<logic:notEqual value="RecordPaperImpl" name="ProfileForm" property="recordView.type"> |
<bean:message key="profile.record.publisher"/> |
</logic:notEqual> |
</th> |
<td>${recordView.publisher}</td> |
</tr> |
</logic:present> |
/impl/build.xml |
---|
506,6 → 506,9 |
<target name="util.task.createRepositoryXML"> |
<java classname="pt.estgp.estgweb.services.data.CreateDescriptionsXML" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/> |
</target> |
<target name="util.task.reset.urlsstats"> |
<java classname="pt.estgp.estgweb.services.urlstat.ResetRelativePathsService" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/> |
</target> |
</project> |