public int compare(Resource r1, Resource r2) { return ((Long) Long.parseLong(r1.getProperty("expireTime"))) .compareTo((Long) Long.parseLong(r2.getProperty("expireTime"))); } });
public static String getLifeCycleName(Resource resource) { String lifeCycleName = ""; if (resource.getProperties() != null) { if (resource.getProperty("registry.LC.name") != null) { lifeCycleName = resource.getProperty("registry.LC.name"); } } return lifeCycleName; }
@Override protected boolean isMajorVersion() { String property = getNode().getProperty(CMISConstants.GREG_VERSION_STATE); return (property != null && property.equals(CMISConstants.GREG_MAJOR_VERSION)); }
protected static String getPropertyOrElse(Resource resource, String propertyName, String defaultValue) throws RegistryException { return hasProperty(resource, propertyName) ? resource.getProperty(propertyName) : defaultValue; }
/** * @return <code>true</code> if the document is checked out */ public boolean isDocumentCheckedOut() { String property = getNode().getProperty(CMISConstants.GREG_IS_CHECKED_OUT); return (property != null && !property.equals("false")); }
protected OpenIDUserDO resourceToObject(Resource resource) { OpenIDUserDO openIDUserDo = new OpenIDUserDO(); openIDUserDo.setUserName(resource .getProperty(IdentityRegistryResources.PROP_OPENID_SIGN_UP_USERID)); openIDUserDo.setOpenID(resource.getProperty(IdentityRegistryResources.PROP_OPENID)); return openIDUserDo; }
public static String getLifeCycleState(Resource resource) { String lifeCycleState = ""; if (resource.getProperties() != null) { if (!getLifeCycleName(resource).equals("")) { String LCStatePropertyName = "registry.lifecycle." + getLifeCycleName(resource) + ".state"; if (resource.getProperty(LCStatePropertyName) != null) { lifeCycleState = resource.getProperty(LCStatePropertyName); } } } return lifeCycleState; }
protected OpenIDUserDO resourceToObject(Resource resource) { OpenIDUserDO openIDUserDo = new OpenIDUserDO(); openIDUserDo.setUserName(resource .getProperty(IdentityRegistryResources.PROP_OPENID_SIGN_UP_USERID)); openIDUserDo.setOpenID(resource.getProperty(IdentityRegistryResources.PROP_OPENID)); return openIDUserDo; }
protected OpenIDUserDO resourceToObject(Resource resource) { OpenIDUserDO openIDUserDo = new OpenIDUserDO(); openIDUserDo.setUserName(resource .getProperty(IdentityRegistryResources.PROP_OPENID_SIGN_UP_USERID)); openIDUserDo.setOpenID(resource.getProperty(IdentityRegistryResources.PROP_OPENID)); return openIDUserDo; }
private boolean isPrivateWorkingCopy(RegistryObject node) { String checkedOutProperty = node.getNode().getProperty(CMISConstants.GREG_IS_CHECKED_OUT); String createdAsPwcProperty = node.getNode().getProperty(CMISConstants.GREG_CREATED_AS_PWC); boolean checkedOut = checkedOutProperty != null && checkedOutProperty.equals("true"); boolean createdAsPwc = createdAsPwcProperty != null && createdAsPwcProperty.equals("true"); boolean endsWithPwc = node.getNode().getPath().endsWith(CMISConstants.PWC_SUFFIX); return (checkedOut || createdAsPwc || endsWithPwc); }
private void encodeProperty(Resource resource, String propKey) { try { if (resource.getProperty(propKey) != null) { resource.setProperty(propKey, CryptoUtil.getDefaultCryptoUtil().encryptAndBase64Encode( resource.getProperty(propKey).getBytes())); } } catch (CryptoException e) { log.error("Unable to encrypt property key: " + propKey + " for resource " + "path: " + resource.getPath(), e); } }
public String[] getAvailableActions(RequestContext context) { String reviewer = context.getResource().getProperty(REVIEWER); if (CurrentSession.getUser().equals(reviewer)) { return new String [] { "approve", "reject" }; } return new String[0]; } }
private void decodeProperty(Resource resource, String propKey) { try { if(resource.getProperty(propKey)!=null){ resource.setProperty(propKey, new String(CryptoUtil.getDefaultCryptoUtil().base64DecodeAndDecrypt( resource.getProperty(propKey)))); } } catch (CryptoException e) { log.error("Unable to decrypt property key: " + propKey + " for resource " + "path: " + resource.getPath(), e); } } }
@Override protected String getCheckedOutBy() throws RegistryException { return isCheckedOut() ? getNode().getProperty(CMISConstants.GREG_CHECKED_OUT_BY) : null; }
@Override protected String getObjectId() throws RegistryException { String property = getNode().getProperty(CMISConstants.GREG_CREATED_AS_PWC); if(property != null && property.equals("true")){ return getVersionSeriesId(); } else{ return getVersionSeriesId() + '_' + PWC_NAME; } }
protected static GregorianCalendar getPropertyOrElse(Resource resource, String propertyName, GregorianCalendar defaultValue) throws RegistryException { if (hasProperty(resource, propertyName)) { Calendar date = toDate(resource.getProperty(propertyName)); return toCalendar(date); } else { return defaultValue; } }
@Override protected String getCheckedOutId() throws RegistryException { if (isCheckedOut()){ String property = getNode().getProperty(CMISConstants.GREG_CREATED_AS_PWC); if(property != null && property.equals("true")){ return getVersionSeriesId(); } else { return getVersionSeriesId() + CMISConstants.PWC_SUFFIX; } } return null; }
public String saveSchemasToRegistry(RequestContext requestContext, String commonSchemaLocation, String symlinkLocation, Resource metaResource,boolean disableSymlinkCreation) throws RegistryException { updateSchemaPaths(commonSchemaLocation,requestContext.getResource().getProperty("version"), requestContext); updateSchemaInternalsAndAssociations(); String path = saveSchemaToRegistry(requestContext, null, symlinkLocation, metaResource,disableSymlinkCreation); persistAssociations(path); return path; } public String saveSchemasToRegistry(RequestContext requestContext, String commonSchemaLocation,
public void restoreByLabel(String s, String s1, boolean b) throws VersionException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException { try { String verPath = ((RegistrySession) session).getUserRegistry().get( RegistryJCRSpecificStandardLoderUtil. getSystemConfigVersionLabelPath((RegistrySession) session)). getProperty(s1); ((RegistrySession) session).getUserRegistry().restoreVersion(verPath); } catch (RegistryException e) { throw new RepositoryException( "Excepion occurred in registry level while restoring by label on : " + s); } }
public static String getCurrentUserID() throws Exception { Registry registry = getRegistryService().getSystemRegistry(); Resource shutterbugCollection = registry.get(DEFAULT_SHUTTERBUG_HOME); UserRegistry userRegistry = CommonUtil.getUserRegistry(Utils.getRegistryService()); String tenantUser = TENANT_USER_PREFIX + userRegistry.getTenantId() + "." + userRegistry.getUserName(); return shutterbugCollection.getProperty(tenantUser); }