@Override public LockInfo getLockInfo(Item item) { if (item.getState().isLocked()) { return new LockInfo( item.getState().getLocker().getLogin(), "studio", item.getState().getLockDate()); // $NON-NLS-1$ } return new LockInfo("", "", null); }
@Override public boolean isNameAvailable( Project project, Item item, String name, List<IRepositoryViewObject>... givenList) throws PersistenceException { if (name == null) { name = item.getProperty().getLabel(); } if (item instanceof FolderItem) { FolderHelper folderHelper = getFolderHelper(project.getEmfProject()); return !folderHelper.pathExists((FolderItem) item, name); } ERepositoryObjectType type = ERepositoryObjectType.getItemType(item); if (type == ERepositoryObjectType.METADATA_CON_TABLE) { return false; } boolean isAllowMultipleName = (type == ERepositoryObjectType.SQLPATTERNS || type == ERepositoryObjectType.METADATA_FILE_XML); String path = ""; if (item.getState() != null) { path = item.getState().getPath(); } List<IRepositoryViewObject> list; if (givenList.length == 0) { list = getAll(project, type, true, false); } else { list = givenList[0]; } for (IRepositoryViewObject current : list) { if (name.equalsIgnoreCase(current.getProperty().getLabel()) && item.getProperty().getId() != current.getProperty().getId()) { // To check SQLPattern in same path. see bug 0005038: unable to add a SQLPattern into // repository. if (!isAllowMultipleName || current.getProperty().getItem().getState().getPath().equals(path)) { return false; } } } return true; }
private boolean canDelete(IRepositoryViewObject viewObj) { Item item = viewObj.getProperty().getItem(); if (!(item instanceof ContainerItem)) { return true; } String path = item.getState().getPath(); List<String> paths = Arrays.asList( ITransformerV2NodeConsDef.PATH_BEFOREDEL, ITransformerV2NodeConsDef.PATH_BEFORESAVE, ITransformerV2NodeConsDef.PATH_ENTITYACTION, ITransformerV2NodeConsDef.PATH_WELCOMEACTION, ITransformerV2NodeConsDef.PATH_SMARTVIEW, ITransformerV2NodeConsDef.PATH_OTHER); if (path.startsWith("/")) { // $NON-NLS-1$ path = path.substring(1); } boolean canDel = !paths.contains(path); return canDel; }