public boolean itemExists(String s) throws RepositoryException { boolean itemEx = true; try { itemEx = userRegistry.resourceExists(s); } catch (RegistryException e) { e.printStackTrace(); } return itemEx; }
private void loadJCRSystemConfiguration(UserRegistry userReg,String workspaceRoot) throws RepositoryException{ try { RegistryJCRSpecificStandardLoderUtil.loadJCRSystemConfigs(userReg,workspaceRoot); } catch (RegistryException e) { e.printStackTrace(); // throw new RepositoryException("Registry Exception occurred while creating root node " + e.getMessage()); } }
/** * @param objectId * @return <code>true</code> iff <code>objectId</code> is the id of a private working copy. * @see RegistryPrivateWorkingCopy#PWC_NAME */ public static boolean isPwc(Registry registry, String objectId) { String property = null; try { property = registry.get(objectId).getProperty(CMISConstants.GREG_CREATED_AS_PWC); } catch (RegistryException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } boolean createdAsPwc = (property != null && property.equals("true")); return objectId.endsWith('_' + PWC_NAME) || createdAsPwc; }
public static Resource getResourceById(Registry repository, String resourceId){ Resource resource = null; try { resource = repository.get(getPathById(resourceId)); } catch (RegistryException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } return resource; }
public void save() throws AccessDeniedException, ItemExistsException, ConstraintViolationException, InvalidItemStateException, ReferentialIntegrityException, VersionException, LockException, NoSuchNodeTypeException, RepositoryException { try { if (!(registrySession.getUserRegistry().resourceExists(nodePath))) { throw new InvalidItemStateException("Unable to save the node at" + nodePath); } } catch (RegistryException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } }
public void initColl(String np) { try { resource = (CollectionImpl) registrySession.getUserRegistry().newCollection(); resource.setPath(np); } catch (RegistryException e) { e.printStackTrace(); } }
/** * @return <code>true</code> iff <code>versionName</code> is the name of private working copy. * @see RegistryPrivateWorkingCopy#PWC_NAME */ public static boolean denotesPwc(Registry registry, String versionName) { try { Resource resource = registry.get(versionName); String property = resource.getProperty(CMISConstants.GREG_CREATED_AS_PWC); String checkedOut = resource.getProperty(CMISConstants.GREG_IS_CHECKED_OUT); if(resource.getPath().endsWith(CMISConstants.PWC_SUFFIX) || ( property != null && property.equals("true") ) || ( checkedOut != null && checkedOut.equals("true") )){ return true; } } catch (RegistryException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } return false; }
public void removeItem(String s) throws VersionException, LockException, ConstraintViolationException, AccessDeniedException, RepositoryException { try { if (userRegistry.resourceExists(s)) { userRegistry.delete(s); } else { throw new PathNotFoundException("No such path exists" + s); } } catch (RegistryException e) { e.printStackTrace(); } }
public static void unregisterNodeTypeFromRegistry(RegistrySession registrySession, RegistryNodeTypeManager registryNodeTypeManager, String nodeType) { try { String[] paths = ((CollectionImpl) registrySession.getUserRegistry().get( RegistryJCRSpecificStandardLoderUtil. getSystemConfigNodeTypePath(registrySession))).getChildren(); for (String path : paths) { String name = path.split("/")[path.split("/").length - 1]; if (name.equals(nodeType)) { registrySession.getUserRegistry().delete(path); } } } catch (RegistryException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } }
private void addVersionToHistory(String nodePath, String nodeVersion) { try { String confPath = RegistryJCRSpecificStandardLoderUtil. getSystemConfigVersionPath((RegistrySession) session); Resource resource = ((RegistrySession) session).getUserRegistry().get(confPath); if (resource.getProperty(nodePath) != null) { resource.getPropertyValues(nodePath).add(nodeVersion); } else { List<String> list = new ArrayList<String>(); list.add(nodeVersion); resource.setProperty(nodePath, list); } ((RegistrySession) session).getUserRegistry().put(confPath, resource); } catch (RegistryException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } }
public boolean hasNode(String s) throws RepositoryException { //s-relative path String subnodepath = nodePath + s; boolean hasNode = false; if (nodePath.equals(registrySession.getWorkspaceRootPath())) { subnodepath = nodePath + s; } else { subnodepath = nodePath + "/" + s; } try { if (registrySession.getUserRegistry().resourceExists(subnodepath)) { if ((registrySession.getUserRegistry().get(subnodepath)) instanceof CollectionImpl) { hasNode = true; } } } catch (RegistryException e) { String msg = "failed to resolve the path of the given node or violation of repository syntax " + this; log.error(msg,e); e.printStackTrace(); throw new RepositoryException(msg, e); } return hasNode; }
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. return false;
public boolean hasNodes() throws RepositoryException { boolean hasNodes = true; CollectionImpl collec = null; try { if ((registrySession.getUserRegistry().resourceExists(nodePath)) && ((registrySession.getUserRegistry().get(nodePath) instanceof CollectionImpl))) { collec = (CollectionImpl) registrySession.getUserRegistry().get(nodePath); } if (collec != null) { String[] children = collec.getChildren(); if (children != null) { if (children.length == 0) hasNodes = false; } } } catch (RegistryException e) { e.printStackTrace(); } return hasNodes; }
public Node storeAsNode(String s) throws ItemExistsException, PathNotFoundException, VersionException, ConstraintViolationException, LockException, UnsupportedRepositoryOperationException, RepositoryException { RegistryNode node = new RegistryNode(s, session); CollectionImpl subCollection = null; try { subCollection = (CollectionImpl) session.getUserRegistry().newCollection(); subCollection.setDescription("nt:query"); session.getUserRegistry().put(s, subCollection); } catch (RegistryException e) { e.printStackTrace(); } node.nodeType = (RegistryNodeType) node.getParent().getPrimaryNodeType(); node.setPrimaryType("nt:query"); // node.nodeType.setNode(node); return node; }
e.printStackTrace(); throw new CmisRuntimeException(e.getMessage(), e);
public Node getParent() throws ItemNotFoundException, AccessDeniedException, RepositoryException { Node par = null; String parent = ""; try { if (isNodeRoot()) { throw new ItemNotFoundException("Node is already root: "+nodePath); } if (!registrySession.getUserRegistry().resourceExists(nodePath)) { throw new InvalidItemStateException(); } else { parent = ((CollectionImpl) registrySession.getUserRegistry().get(nodePath)).getParentPath(); par = (Node)registrySession.getItem(parent); } } catch (RegistryException e) { e.printStackTrace(); } catch (InvalidItemStateException e) { throw new InvalidItemStateException(); } return par; }
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } catch (ValueFormatException e) {