/** * @inheritDoc */ public ResourceProperties getProperties(String key) { ResourceProperties rv = m_props.get(key); if (rv == null) { // new, throwaway empty one rv = new BaseResourceProperties(); } return rv; }
public BaseResourceProperties(Map<String, String> map) { this(); for (Map.Entry<String, String> entry : map.entrySet()) { if (entry.getKey() != null) { addProperty(entry.getKey(), entry.getValue()); } } }
return getUserProperty(name).getDisplayName(); // %%% no user? return getTimeProperty(name).toStringLocalFull(); long len = getLongProperty(name); String[] byteString = { "KB", "KB", "MB", "GB" }; int count = 0;
/** * Access a named property as a boolean. * * @param name * The property name. * @return the property value. * @exception EmptyException * if not found. * @exception TypeException * if the property is found but not a boolean. */ public boolean getBooleanProperty(String name) throws EntityPropertyNotDefinedException, EntityPropertyTypeException { String p = getProperty(name); if (p == null) throw new EntityPropertyNotDefinedException(); try { return Boolean.valueOf(p).booleanValue(); } catch (Exception any) { throw new EntityPropertyTypeException(name); } }
public Date getDateProperty(String name) throws EntityPropertyNotDefinedException, EntityPropertyTypeException { Time time = getTimeProperty(name); return new Date(time.getTime()); }
/** * Access a named property as a long. * * @param name * The property name. * @return the property value. * @exception EmptyException * if not found. * @exception TypeException * if the property is found but not a long. */ public long getLongProperty(String name) throws EntityPropertyNotDefinedException, EntityPropertyTypeException { String p = getProperty(name); if (p == null) throw new EntityPropertyNotDefinedException(); try { return Long.parseLong(p); } catch (Exception any) { throw new EntityPropertyTypeException(name); } }
public Instant getInstantProperty(String name) throws EntityPropertyNotDefinedException, EntityPropertyTypeException { Time time = getTimeProperty(name); return Instant.ofEpochMilli(time.getTime()); } /**
public ResourceProperties getProperties() { ResourceProperties rp = new BaseResourceProperties(); rp.addProperty("id", getId()); return rp; }
/** * Access a named property as a Time. * * @param name * The property name. * @return the property value * @exception EmptyException * if not found. * @exception TypeException * if the property is found but not a Time. */ public Time getTimeProperty(String name) throws EntityPropertyNotDefinedException, EntityPropertyTypeException { String p = getProperty(name); if (p == null) throw new EntityPropertyNotDefinedException(); try { return TimeService.newTimeGmt(p); } catch (Exception any) { throw new EntityPropertyTypeException(name); } } // getTimeProperty
/** * @see org.sakaiproject.entity.api.Entity#getProperties() */ public ResourceProperties getProperties() { ResourceProperties rp = new BaseResourceProperties(); rp.addProperty("id", getId()); return rp; }
/** * Access a named property as a User. * * @param name * The property name. * @return the property value * @exception EmptyException * if not found. * @exception TypeException * if the property is found but not a User. */ public User getUserProperty(String name) throws EntityPropertyNotDefinedException, EntityPropertyTypeException { String p = getProperty(name); if (p == null) throw new EntityPropertyNotDefinedException(); try { return UserDirectoryService.getUser(p); } catch (Exception any) { throw new EntityPropertyTypeException(name); } }
/** * Make the Sample Copyright Alert response. * * @param req * HttpServletRequest object with the client request. * @param res * HttpServletResponse object back to the client. */ protected void respondCopyrightAlertDemo(HttpServletRequest req, HttpServletResponse res) throws ServletException { // the context wraps our real vm attribute set ResourceProperties props = new BaseResourceProperties(); setVmReference("props", props, req); setVmReference("validator", new Validator(), req); setVmReference("sample", Boolean.TRUE.toString(), req); setVmReference("tlang", rb, req); res.setContentType("text/html; charset=UTF-8"); includeVm("vm/access/copyrightAlert.vm", req, res); }
ResourceProperties rp = new BaseResourceProperties(properties);
ResourceProperties rp = new BaseResourceProperties(); rp.addProperty(RWikiEntity.RP_REALM, reference.getContext() + reference.getContainer()); ResourceProperties rp = new BaseResourceProperties(); rp.addProperty("id", this.getId());