Quintiq file version 2.0 
 | 
#parent: #root 
 | 
StaticMethod CanCreate ( 
 | 
  String name, 
 | 
  ScenarioManager owner, 
 | 
  Bookmark bookmark, 
 | 
  String parentname, 
 | 
  Boolean isFolder, 
 | 
  output String feedback_o 
 | 
) declarative remote as Boolean 
 | 
{ 
 | 
  TextBody: 
 | 
  [* 
 | 
    // Precondition to validate if a bookmark can be created 
 | 
    feedback_o := ''; 
 | 
     
 | 
    maxnamelength := GlobalParameters_MP::GetLengthOfNames(); 
 | 
     
 | 
    // Check if a name is being provided or whether the length of the name is within the allowed range 
 | 
    if( name = '' or name.Length() > maxnamelength ) 
 | 
    { 
 | 
      feedback_o := Translations::ScenarioManager_Bookmark_ValidateInput_IsInvalidName( maxnamelength ); 
 | 
    } 
 | 
    // Check if the provided name is unique 
 | 
    else if( exists( owner, Bookmark, b, true , b.Name() = name and guard ( b <> bookmark, true ) ) ) 
 | 
    { 
 | 
      feedback_o := Translations::ScenarioManager_Bookmark_ValidateInput_IsIDExists(); 
 | 
    } 
 | 
    //Check if the new name is different from the parent name; this applies to both folders and bookmarks 
 | 
    else if( parentname = name ) 
 | 
    { 
 | 
      feedback_o := Translations::ScenarioManager_Bookmark_FolderAndBookmarkNameShouldBeDifferent();  
 | 
    } 
 | 
    // Check if bookmark folder is being created 
 | 
    else if( not isFolder  ) 
 | 
    { 
 | 
      // Check if the length of bookmark folder's name is within the allowed range 
 | 
       if ( parentname.Length() > maxnamelength ) 
 | 
      { 
 | 
        feedback_o := Translations::ScenarioManager_Bookmark_ValidateInput_IsInvalidName( maxnamelength ); 
 | 
      }   
 | 
    } 
 | 
     
 | 
    return feedback_o = ''; 
 | 
  *] 
 | 
} 
 |