use of org.olat.properties.Property in project openolat by klemens.
the class RegistrationManager method setHasConfirmedDislaimer.
/**
* Marks the given identity to have confirmed the disclaimer. Note that this
* method does not check if the disclaimer does already exist, do this by
* calling needsToConfirmDisclaimer() first!
*
* @param identity
*/
public void setHasConfirmedDislaimer(Identity identity) {
Property disclaimerProperty = propertyManager.createUserPropertyInstance(identity, "user", "dislaimer_accepted", null, 1l, null, null);
propertyManager.saveProperty(disclaimerProperty);
}
use of org.olat.properties.Property in project openolat by klemens.
the class StatusWebservice method getSystemSummaryVO.
/**
* Return the statistics about runtime: uptime, classes loaded, memory
* summary, threads count...
*
* @response.representation.200.qname {http://www.example.com}runtimeVO
* @response.representation.200.mediaType application/xml, application/json
* @response.representation.200.doc The version of the instance
* @response.representation.200.example {@link org.olat.restapi.system.vo.Examples#SAMPLE_RUNTIMEVO}
* @response.representation.401.doc The roles of the authenticated user are not sufficient
* @param request The HTTP request
* @return The informations about runtime, uptime, classes loaded, memory summary...
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response getSystemSummaryVO() {
StatusVO stats = new StatusVO();
// File
try {
long startFile = System.nanoTime();
File infoFile = setInfoFiles("ping");
WorkThreadInformations.unset();
stats.setWriteFileInMilliseconds(CodeHelper.nanoToMilliTime(startFile));
stats.setWriteFile(infoFile.exists());
infoFile.delete();
} catch (Exception e) {
stats.setWriteFile(false);
stats.setWriteFileInMilliseconds(-1l);
log.error("", e);
}
// Datebase
try {
stats.setWriteDb(true);
PropertyManager propertyManager = CoreSpringFactory.getImpl(PropertyManager.class);
List<Property> props = propertyManager.findProperties((Identity) null, (BusinessGroup) null, PING_RESOURCE, PING_REF, PING_REF);
if (props != null && props.size() > 0) {
for (Property prop : props) {
propertyManager.deleteProperty(prop);
}
DBFactory.getInstance().commit();
}
long startDB = System.nanoTime();
Property prop = propertyManager.createPropertyInstance(null, null, PING_RESOURCE, PING_REF, PING_REF, 0f, 0l, "-", "-");
DBFactory.getInstance().commit();
stats.setWriteDbInMilliseconds(CodeHelper.nanoToMilliTime(startDB));
propertyManager.deleteProperty(prop);
DBFactory.getInstance().commit();
} catch (Exception e) {
stats.setWriteDb(false);
stats.setWriteDbInMilliseconds(-1l);
log.error("", e);
}
// Secure authenticated user
UserSessionManager sessionManager = CoreSpringFactory.getImpl(UserSessionManager.class);
Set<UserSession> userSessions = sessionManager.getAuthenticatedUserSessions();
int secureAuthenticatedCount = 0;
for (UserSession usess : userSessions) {
SessionInfo sessInfo = usess.getSessionInfo();
if (sessInfo.isWebDAV() || sessInfo.isREST()) {
//
} else if (sessInfo.isSecure()) {
secureAuthenticatedCount++;
}
}
stats.setSecureAuthenticatedCount(secureAuthenticatedCount);
// Concurrent dispatch threads
SessionStatsManager sessionStatsManager = CoreSpringFactory.getImpl(SessionStatsManager.class);
stats.setConcurrentDispatchThreads(sessionStatsManager.getConcurrentCounter());
return Response.ok(stats).build();
}
use of org.olat.properties.Property in project openolat by klemens.
the class FOCourseNodeIndexer method doIndexForum.
/**
* Index a forum in a course.
* @param parentResourceContext
* @param course
* @param courseNode
* @param indexWriter
* @throws IOException
*/
private void doIndexForum(SearchResourceContext parentResourceContext, ICourse course, CourseNode courseNode, OlatFullIndexer indexWriter) throws IOException, InterruptedException {
if (log.isDebug())
log.debug("Index Course Forum...");
ForumManager fom = ForumManager.getInstance();
CoursePropertyManager cpm = course.getCourseEnvironment().getCoursePropertyManager();
Property forumKeyProperty = cpm.findCourseNodeProperty(courseNode, null, null, FOCourseNode.FORUM_KEY);
// Check if forum-property exist
if (forumKeyProperty != null) {
Long forumKey = forumKeyProperty.getLongValue();
Forum forum = fom.loadForum(forumKey);
parentResourceContext.setDocumentType(TYPE);
doIndexAllMessages(parentResourceContext, forum, indexWriter);
}
}
use of org.olat.properties.Property in project openolat by klemens.
the class UserManagerImpl method getUserCharset.
@Override
public String getUserCharset(Identity identity) {
String charset;
charset = WebappHelper.getDefaultCharset();
PropertyManager pm = PropertyManager.getInstance();
Property p = pm.findProperty(identity, null, null, null, CHARSET);
if (p != null) {
charset = p.getStringValue();
// (a rather rare case)
if (!Charset.isSupported(charset)) {
charset = WebappHelper.getDefaultCharset();
}
} else {
charset = WebappHelper.getDefaultCharset();
}
return charset;
}
use of org.olat.properties.Property in project openolat by klemens.
the class UserManagerImpl method setUserCharset.
@Override
public void setUserCharset(Identity identity, String charset) {
PropertyManager pm = PropertyManager.getInstance();
Property p = pm.findProperty(identity, null, null, null, CHARSET);
if (p != null) {
p.setStringValue(charset);
pm.updateProperty(p);
} else {
Property newP = pm.createUserPropertyInstance(identity, null, CHARSET, null, null, charset, null);
pm.saveProperty(newP);
}
}
Aggregations